/*Dialogue Practice UI*/
.mon-dialogue {
  list-style: none;
  padding: 0;
  margin: 2rem auto;      /* auto = canh giữa */
  max-width: 800px;       /* giới hạn chiều rộng */
}

.mon-dialogue li {
  position: relative;
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-size: 1rem;
  list-style: none;
}

/* Nam (Lucas) bên trái */
.mon-dialogue .voice-guy {
  margin-right: auto;        /* đẩy sang trái */
  background: #e6f4ff;
  text-align: left;
  border: 1px solid #ddd;
}

/* Nữ (Jenny) bên phải */
.mon-dialogue .voice-jenny {
  margin-left: auto;         /* đẩy sang phải */
  background: #f9f9f9;
  border: 1px solid #ddd;
  text-align: right;
}

/* Avatar nam (Lucas) */
.mon-dialogue .voice-guy::before {
  content: "";
  position: absolute;
  left: -50px;   /* đẩy ra ngoài bubble */
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: url('https://smartspeaknwrite.com/wp-content/uploads/male.png') no-repeat center/cover;
}

/* Avatar nữ (Jenny) */
.mon-dialogue .voice-jenny::before {
  content: "";
  position: absolute;
  right: -50px;  /* nằm bên phải */
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: url('https://smartspeaknwrite.com/wp-content/uploads/female.png') no-repeat center/cover;
}

/* Nút luyện tập – block để xuống dòng */
.mon-dialogue .voice-guy .mon-pro-btn.practice,
.mon-dialogue .voice-jenny .mon-pro-btn.practice {
  display: inline-block; /* sẽ ăn theo text-align */
}
.mon-dialogue .mon-pro-btn.practice {
  margin-top: 12px;         /* tạo khoảng cách với text */
  padding: 6px 14px;
  background: #ff7a2f;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.mon-dialogue .mon-pro-btn.practice:hover {
  background: #e96a1f;
}

/* Mobile fix Dialogue Practice UI */
@media (max-width: 768px) {
  .mon-dialogue li {
    max-width: 100%;          /* full width bubble */
    margin: 0 auto 1rem;      /* canh giữa */
    padding-left: 50px;       /* chừa chỗ avatar */
    padding-right: 50px;      /* chừa chỗ avatar */
  }

  .mon-dialogue .voice-guy::before,
  .mon-dialogue .voice-jenny::before {
    position: absolute;
    top: 10px;
    left: 10px;    /* ép avatar về trong bubble */
    right: auto;
  }

  .mon-dialogue .voice-jenny::before {
    left: auto;
    right: 10px;  /* Jenny bên phải */
  }
}

/* ==== LIST HIỂN THỊ TỪ / CÂU ==== */
.mon-pro-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* ép thành 4 cột */
  gap: 1.2rem;
}

.mon-pro-list li {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: flex-start;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: transform .2s ease, box-shadow .2s ease;
}
.mon-pro-list li:hover {
  box-shadow:0 4px 12px rgba(0,0,0,.12);
  transform:translateY(-2px);
}

/* ==== NÚT LUYỆN TẬP ==== */
.mon-pro-btn.practice {
  background:#ff6b35;
  border:none;
  color:#fff;
  font-weight:600;
  font-size:.85rem;
  padding:.4rem .9rem;
  border-radius:6px;
  cursor:pointer;
  transition: background .2s;
  margin: 5px 5px;
  align-self:flex-end;        /* đẩy nút sang phải */
}
.mon-pro-btn.practice:hover { background:#e95b28;color: yellow; }

/* ==== POPUP ==== */
#mon-pro-popup {
  display:none; position:fixed; inset:0; z-index:9999; font-family:Arial, sans-serif;
}
#mon-pro-popup .en-text {
  font-weight: 600;
  color: #222;
  margin-bottom: 4px;
  font-size: 17px;
}
#mon-pro-popup .vi-text {
  color: #666;
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
}
#mon-pro-popup.show { display:block; }
#mon-pro-popup .mon-pro-overlay {
  position:absolute; inset:0; background:rgba(0,0,0,.7);z-index:100;
}
#mon-pro-popup .mon-pro-dialog {
  position:relative; z-index:200; display:flex; align-items:center; justify-content:center; height:100%;pointer-events: none;
}
#mon-pro-popup .mon-pro-content {
  background:#fff;
  padding:2rem;
  border-radius:16px;
  max-width:600px;
  width:90%;
  box-shadow:0 12px 40px rgba(0,0,0,.25);
  text-align:center;
  animation: popupFade .3s ease;
  position: relative;
  pointer-events: auto;
}
@keyframes popupFade {
  from {transform:scale(.9); opacity:0;}
  to {transform:scale(1); opacity:1;}
}
#mon-pro-popup .mon-pro-close {
  position:absolute; top:10px; right:10px;
  border:none; background:none;
  font-size:20px; cursor:pointer; color:#555;
}
#mon-pro-popup .mon-pro-close:hover { color:#000; }

/* ==== CÂU HỎI ==== */
.mon-pro-question {
  font-size:1.5rem;
  font-weight:700;
  margin-bottom:1.2rem;
  color:#333;
}

/* ==== NÚT TRONG POPUP ==== */
.mon-pro-actions {
  display:flex;
  justify-content:center;
  gap:1rem;
  margin-bottom:1.5rem;
}
.mon-pro-actions .mon-pro-btn {
  padding:.7rem 1.4rem;
  border-radius:8px;
  background:#f5f5f5;
  border:1px solid #ddd;
  font-weight:600;
  font-size:.95rem;
  cursor:pointer;
  transition: all .2s ease;
}
.mon-pro-actions .mon-pro-btn.play {
  background:#007bff; color:#fff; border:none;
}
.mon-pro-actions .mon-pro-btn.play:hover { background:#0066d3; }
.mon-pro-actions .mon-pro-btn.record {
  background:#28a745; color:#fff; border:none;
}
.mon-pro-actions .mon-pro-btn.record:hover { background:#218838; }

/* ==== HIỂN THỊ ĐIỂM ==== */
.mon-pro-scores {
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:2rem;
  margin-bottom:1rem;
}
.mon-pro-score-item {
  text-align:center;
  font-family:Arial, sans-serif;
}

/* ==== RING scores (conic-gradient, donut) ==== */
.mon-pro-ring {
  --val:0; --fg:#2e7d32; --bg:#e6e6e6;
  width:90px; aspect-ratio:1;
  border-radius:50%;
  background: conic-gradient(var(--fg) calc(var(--val)*1%), var(--bg) 0);
  position:relative;
  display:grid; place-items:center;
  transition: background .6s ease;
}

/* tạo lỗ trắng giữa để thành donut */
.mon-pro-ring::after {
  content:""; position:absolute; inset:10px;
  background:#fff; border-radius:50%;
}

/* số % nằm trên cùng */
.mon-pro-ring__value {
  position:relative; z-index:2;
  font-weight:700; font-size:1rem; color:#222;
}

/* fix 100% kín vòng */
.mon-pro-ring[data-full="1"] {
  background: conic-gradient(var(--fg) 100%, var(--fg) 0);
}

.mon-pro-score-item .label {
  margin-top:.5rem;
  font-size:.9rem;
  font-weight:600;
  color:#333;
}

/* ==== TIPS & MISTAKES ==== */
.mon-pro-feedback .tips {
  margin:.8rem 0;
  color:#666;
  font-style:italic;
  font-size:.9rem;
}
.mon-pro-feedback .mistakes {
  margin:.5rem 0;
  padding-left:1.2rem;
  text-align:left;
}
.mon-pro-feedback .mistakes li {
  color:#444;
  font-size:.9rem;
  margin-bottom:.3rem;
}

.mon-pro-btn.recording {
  background: #c62828;
  color: #fff;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(198,40,40, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(198,40,40, 0); }
  100% { box-shadow: 0 0 0 0 rgba(198,40,40, 0); }
}

.mon-pro-loading {
  margin-left:8px;
  font-style: italic;
  color: #555;
}

.mon-pro-recwrap {
  display: inline-flex;   /* để nó nằm ngang cạnh nút */
  align-items: center;
  margin-left: 12px;
  padding: 4px 10px;
  background: #fff5f5;
  border: 1px solid #f5c2c2;
  border-radius: 8px;
}

.mon-pro-timer {
  font-weight: bold;
  font-family: monospace;
  font-size: 18px;
  color: #c62828;
  min-width: 36px;
  text-align: right;
}

.mon-pro-wave {
  width: auto;
  height: 50px;
  margin-right: 8px;
}

.wrong-word { color:#e53935; font-weight:600; text-decoration: line-through; }
.correct-word { color:#2e7d32; font-weight:600; }
.ipa { color:#1565c0; margin-left:5px; font-family:'Courier New', monospace; }
.play-ipa { margin-left:6px; border:none; background:transparent; cursor:pointer; }
.comment { font-size:0.9em; color:#555; margin-top:2px; }

/* Mobile tối ưu */
@media (max-width: 480px) {
  .mon-pro-list {
    grid-template-columns: 1fr;
  }
  .mon-pro-actions {
    flex-direction: column; /* xếp dọc */
    align-items: stretch;   /* full width */
    gap: .6rem;
  }
  .mon-pro-actions .mon-pro-btn {
    width: 100%;
    font-size: 10px;
    padding: .9rem;
  }
  .mon-pro-recwrap {
    margin-left: 0;
    margin-top: .6rem;
    justify-content: center;
    width: 100%;
  }
  .mon-pro-wave {
    margin-right: 12px;
  }
  .mon-pro-timer {
    font-size: 20px;
  }
  #mon-pro-popup .en-text {
    font-weight: 600;
    color: #222;
    margin-bottom: 1px;
    font-size: 15px;
  }
  #mon-pro-popup .vi-text {
    color: #666;
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
  }  
}

/* Mobile: 2 cột */
@media (max-width: 768px) {
  .mon-pro-list {
    grid-template-columns: repeat(2, 1fr);
  }
  #mon-pro-popup .en-text {
    font-weight: 600;
    color: #222;
    margin-bottom: 1px;
    font-size: 15px;
  }
  #mon-pro-popup .vi-text {
    color: #666;
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
  }   
}
