/**
 * SpeechAce Pronunciation Modal Stylesheet
 * 100% Visual, Architectural, and Behavioral Parity with Open English Production
 */

/* Modal Backdrop Overlay */
.oe-speechace-overlay,
.speechace-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200000;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.oe-speechace-overlay.active,
.speechace-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal Window Container: 733px x 541px */
.oe-speechace-modal,
.speechace-modal-card {
  width: 733px;
  height: 541px;
  max-width: 95vw;
  max-height: 95vh;
  background: #FFFFFF;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: oeModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes oeModalPop {
  0% { transform: scale(0.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Header */
.oe-speechace-header {
  padding: 18px 24px 8px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFFFF;
  flex-shrink: 0;
}

.oe-speechace-title {
  font-size: 19px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
}

.oe-speechace-close-btn,
.oe-btn-close-box {
  width: 28px;
  height: 28px;
  background: #f1f5f9;
  border-radius: 4px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
  outline: none;
}

.oe-speechace-close-btn:hover,
.oe-btn-close-box:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Modal Body / Stage Content */
.oe-speechace-body,
.oe-stage-content {
  padding: 0 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
}

/* Step Counter: "1 of 15" */
.oe-speechace-counter,
.oe-step-counter {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13.5px;
  color: #94a3b8;
  margin-top: 10px;
  text-align: center;
  letter-spacing: 0.2px;
}

/* Target Sentence Row */
.oe-speechace-sentence-wrap,
.oe-target-sentence-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
  min-height: 44px;
}

/* Audio Play Button (Olive/Teal Green Circle) */
.oe-speechace-play-audio,
.oe-btn-audio-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.8px solid #16a34a;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: background 0.15s, transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.oe-speechace-play-audio:hover,
.oe-btn-audio-circle:hover {
  background: rgba(22, 163, 74, 0.08);
  transform: scale(1.05);
}

.oe-speechace-play-audio.playing,
.oe-btn-audio-circle.playing {
  background: #16a34a;
}

.oe-speechace-play-triangle {
  width: 0;
  height: 0;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
  border-left: 8px solid #16a34a;
  margin-left: 2px;
  transition: border-color 0.15s;
}

.oe-speechace-play-audio.playing .oe-speechace-play-triangle,
.oe-btn-audio-circle.playing .oe-speechace-play-triangle {
  border-left-color: #FFFFFF;
}

/* Sentence Words & Text Layout */
.oe-speechace-sentence,
.oe-sentence-words {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  user-select: none;
  color: #1e293b;
  line-height: 1.25;
}

.oe-word-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding: 2px 2px 0 2px;
  border-radius: 3px;
  transition: background 0.15s;
}

.oe-word-unit:hover {
  background: rgba(0, 0, 0, 0.03);
}

.oe-word-text {
  line-height: 1.15;
  transition: color 0.2s;
}

/* Accurate Word: Spruce Green / Teal */
.oe-word-correct,
.oe-word-good {
  color: #2b5a5b;
}

/* Problematic Word: Coral Brick Red */
.oe-word-error,
.oe-word-bad {
  color: #c43c2c;
}

/* Neutral Word (before scoring) */
.oe-word-neutral {
  color: #1e293b;
}

.oe-punctuation {
  color: #2b3034;
  margin-left: -6px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 23px;
  line-height: 1.15;
}

/* Underline Dots */
.oe-word-dots-single,
.oe-dots-good {
  width: 100%;
  height: 3px;
  margin-top: 3px;
  background-image: radial-gradient(circle, #2b5a5b 0.9px, transparent 0.9px);
  background-size: 3.5px 3px;
  background-repeat: repeat-x;
}

.oe-word-dots-matrix,
.oe-dots-bad {
  width: 100%;
  height: 9px;
  margin-top: 2px;
  background-image: radial-gradient(circle, #c43c2c 0.95px, transparent 0.95px);
  background-size: 3.5px 3px;
  background-repeat: repeat;
}

.oe-word-dots-none {
  width: 100%;
  height: 3px;
  margin-top: 3px;
}

/* Interactive Phoneme Popover (Positioned below word for 100% visibility and zero header clipping) */
.oe-phoneme-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #FFFFFF;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s, visibility 0.18s, transform 0.18s;
  z-index: 1000;
  min-width: 190px;
  max-width: 280px;
  text-align: left;
}

.oe-phoneme-popover::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1e293b;
}

.oe-word-unit:hover .oe-phoneme-popover,
.oe-word-unit.popover-open .oe-phoneme-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(2px);
}

.oe-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}

.oe-popover-word-title {
  font-weight: 700;
  color: #f8fafc;
  font-size: 13px;
}

.oe-popover-ipa {
  color: #38bdf8;
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  font-weight: 600;
}

.oe-popover-score-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
}

.oe-popover-score-pill.good {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.oe-popover-score-pill.bad {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.oe-popover-focus-row {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.oe-popover-focus-sound {
  color: #38bdf8;
  font-weight: 700;
  font-family: 'Times New Roman', serif;
}

.oe-popover-tip {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.4;
  margin-bottom: 8px;
}

.oe-popover-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  outline: none;
}

.oe-popover-audio-btn:hover {
  background: rgba(56, 189, 248, 0.28);
  transform: scale(1.02);
}

/* Recording Controls Area */
.oe-speechace-controls,
.oe-recording-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  position: relative;
}

/* Replay User Recording (Small circular button on the left) */
.oe-speechace-btn-replay,
.oe-btn-replay-user {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.6px solid #00819c;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, opacity 0.2s, transform 0.1s;
  padding: 0;
}

.oe-speechace-btn-replay:hover:not(.disabled),
.oe-btn-replay-user:hover:not(.disabled) {
  background: rgba(0, 129, 156, 0.12);
  transform: scale(1.06);
}

.oe-speechace-btn-replay.disabled,
.oe-btn-replay-user.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.oe-speechace-btn-replay.playing,
.oe-btn-replay-user.playing {
  background: #00819c;
}

.oe-speechace-replay-triangle {
  width: 0;
  height: 0;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  border-left: 6.5px solid #00819c;
  margin-left: 1.5px;
  transition: border-color 0.15s;
}

.oe-speechace-btn-replay.playing .oe-speechace-replay-triangle,
.oe-btn-replay-user.playing .oe-speechace-replay-triangle {
  border-left-color: #FFFFFF;
}

/* Microphone Ring Container & Arc */
.oe-mic-ring-wrap {
  position: relative;
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Animated Arc matching live_pron_open.png */
.oe-mic-arc {
  position: absolute;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-left-color: #38bdf8;
  border-top-color: #38bdf8;
  transform: rotate(-30deg);
  pointer-events: none;
  transition: border-color 0.3s;
}

.oe-mic-ring-wrap.recording .oe-mic-arc {
  border: 2.5px solid transparent;
  border-left-color: #0ea5e9;
  border-right-color: #0ea5e9;
  animation: oeArcSpin 1.1s linear infinite;
}

@keyframes oeArcSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Big Mic Button */
.oe-speechace-btn-mic,
.oe-btn-mic-large {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid #00819c;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
  z-index: 2;
  padding: 0;
}

.oe-speechace-btn-mic:hover,
.oe-btn-mic-large:hover {
  box-shadow: 0 0 14px rgba(0, 129, 156, 0.3);
  transform: scale(1.02);
}

.oe-speechace-btn-mic.recording,
.oe-btn-mic-large.recording {
  border-color: #ef4444;
  animation: oeMicPulse 1.2s infinite;
}

.oe-speechace-btn-mic.recording svg path,
.oe-speechace-btn-mic.recording svg rect,
.oe-btn-mic-large.recording svg path,
.oe-btn-mic-large.recording svg rect {
  fill: #ef4444 !important;
  stroke: #ef4444 !important;
}

@keyframes oeMicPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Historical Progressive Bar Chart */
.oe-speechace-chart-card,
.oe-chart-container {
  width: 630px;
  margin-top: 34px;
  position: relative;
}

.oe-chart-rows-container {
  display: flex;
  flex-direction: column;
}

.oe-chart-row,
.oe-bar-row {
  display: flex;
  align-items: center;
  height: 20px;
  margin-bottom: 4px;
  position: relative;
}

.oe-chart-label {
  width: 82px;
  text-align: right;
  padding-right: 12px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: -0.1px;
}

.oe-chart-label.last-label {
  font-weight: 700;
  color: #0079ff;
}

.oe-chart-track {
  flex: 1;
  height: 16px;
  position: relative;
}

/* Vertical Grid Lines: 0%, 25%, 50%, 75%, 100% (Accurate Parity) */
.oe-chart-grid-overlay,
.oe-chart-gridlines {
  position: absolute;
  top: -8px;
  bottom: -6px;
  left: 82px;
  right: 0;
  pointer-events: none;
}

.oe-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: #EAEAEA;
}

/* Progressive Attempt Bars */
.oe-bar,
.oe-bar-fill {
  height: 16px;
  border-radius: 4px;
  position: relative;
  z-index: 2;
  transition: width 0.4s ease;
}

/* LAST: Solid Vibrant Blue */
.oe-bar-solid-blue,
.oe-bar-last {
  background-color: #3097f8;
  border: none;
}

/* 1ST, 2ND, 3RD: Crosshatched / Striped Bars */
.oe-bar-hatched {
  background-color: #FFFFFF;
  background-image: 
    repeating-linear-gradient(45deg, #cbd5e1 0px, #cbd5e1 1.2px, transparent 1.2px, transparent 4.5px),
    repeating-linear-gradient(-45deg, #cbd5e1 0px, #cbd5e1 1.2px, transparent 1.2px, transparent 4.5px);
  border: 1px solid #cbd5e1;
}

/* Bottom Feedback Drawer / Footer */
.oe-speechace-drawer,
.oe-feedback-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 91px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

/* State A: Idle / Before Evaluation -> Clean White / Light Footer with Skip */
.oe-speechace-drawer.idle-state {
  background: #FFFFFF;
  border-top: 1px solid #f1f5f9;
}

/* State B: Evaluated -> Soft Warm Peach (#FFEAD1 / #FFF4E6) */
.oe-speechace-drawer.evaluated-state {
  background: #FFEAD1;
  border-top: none;
}

.oe-drawer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Circular Score Badge */
.oe-score-circle,
.oe-score-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 30px;
  font-weight: 400;
  color: #4a3810;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  transition: transform 0.2s, color 0.2s;
}

.oe-score-circle.good,
.oe-score-badge.good {
  color: #2e5b15;
}

.oe-score-circle.need-practice,
.oe-score-badge.need-practice {
  color: #c2410c;
}

.oe-drawer-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.oe-drawer-headline {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: bold;
  color: #59421f;
}

.oe-drawer-subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 13px;
  color: #7c5c2a;
}

.oe-drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Skip Button (Shown in Idle State before user evaluates) */
.oe-btn-skip {
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 6px 22px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.oe-btn-skip:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #94a3b8;
}

/* Continue Button (Shown in Evaluated State) */
.oe-btn-continue {
  background: #45611a;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  font-family: Arial, sans-serif;
  border: none;
  border-radius: 9999px;
  padding: 7px 22px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, transform 0.1s;
}

.oe-btn-continue:hover {
  background: #364d14;
  transform: scale(1.02);
}

/* Practice Completed Celebration Screen */
.oe-completed-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.oe-completed-trophy {
  font-size: 52px;
  margin-bottom: 12px;
  animation: oeTrophyBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes oeTrophyBounce {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.oe-completed-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.oe-completed-subtitle {
  font-size: 14.5px;
  color: #64748b;
  max-width: 460px;
  line-height: 1.5;
  margin-bottom: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.oe-completed-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.oe-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 18px;
  min-width: 100px;
}

.oe-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.oe-stat-val.xp {
  color: #16a34a;
}

.oe-stat-lbl {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.oe-btn-finish {
  background: #00819c;
  color: #FFFFFF;
  border: none;
  border-radius: 9999px;
  padding: 10px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.oe-btn-finish:hover {
  background: #00667c;
  transform: scale(1.02);
}

/* Authentic SpeechAce Warning Toast (Silence / Low Volume) */
.oe-speechace-toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff1f2;
  border: 1.5px solid #f87171;
  border-radius: 6px;
  padding: 8px 18px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
  z-index: 9999;
  animation: oeToastSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes oeToastSlideDown {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

.oe-toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

