/* 15-u-overlay.css — Phase 3: U (UnChew) overlay.
 *
 * A single full-screen sheet on mobile / centered modal on desktop.
 * All selectors are .v2-u-* scoped so nothing leaks into the host page.
 */

body.v2-u-locked { overflow: hidden; }

.v2-u-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.v2-u-overlay.is-open { pointer-events: auto; opacity: 1; }

.v2-u-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 32, 0.55);
  backdrop-filter: blur(2px);
}

.v2-u-sheet {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: 100vh;
  background: var(--surface, #fff);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  align-self: flex-end;
  overflow: hidden;
}
@media (min-width: 720px) {
  .v2-u-overlay { align-items: center; }
  .v2-u-sheet {
    align-self: center;
    border-radius: 14px;
    max-height: 86vh;
  }
}

.v2-u-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--v2-border, #ece8da);
  flex-shrink: 0;
  position: relative;
  min-height: 30px;
}
.v2-u-title {
  font: 600 1.05rem/1.2 Inter, system-ui, sans-serif;
  color: var(--v2-ink, #2d4e6a);
  margin: 0;
  flex: 1;
}
.v2-u-close {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--v2-muted, #777);
  padding: 4px 8px;
  border-radius: 6px;
}
.v2-u-close:hover { background: rgba(0, 0, 0, 0.05); }
.v2-u-close:focus-visible { outline: 2px solid #ff4700; outline-offset: 2px; }

.v2-u-sentence {
  padding: 10px 16px;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text, #2a2a2a);
  border-bottom: 1px solid var(--v2-border, #ece8da);
  font-style: italic;
  flex-shrink: 0;
}
.v2-u-sentence:empty { display: none; }

.v2-u-steps {
  display: inline-flex; gap: 6px; align-items: center;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.v2-u-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  font: 700 0.85rem/1 ui-monospace, SF Mono, Menlo, monospace;
  background: transparent;
  border: 2px solid var(--v2-border, #d8d3c4);
  color: var(--v2-muted, #777);
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.v2-u-step:hover:not(.is-on) { color: var(--v2-ink, #2d4e6a); border-color: var(--v2-ink, #2d4e6a); }
.v2-u-step.is-on {
  background: #ff4700;
  border-color: #ff4700;
  color: #fff;
}

.v2-u-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px 18px;
}

.v2-u-stage { display: block; }

.v2-u-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 12px;
}

.v2-u-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--v2-surface-2, #faf7ee);
  border: 1px solid var(--v2-border, #d8d3c4);
  color: var(--v2-ink, #2d4e6a);
  padding: 8px 14px;
  border-radius: 8px;
  font: 500 0.92rem/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.v2-u-btn:hover { background: var(--v2-surface-3, #f3ebd4); }
.v2-u-btn:focus-visible { outline: 2px solid #ff4700; outline-offset: 2px; }

.v2-u-rec {
  width: 60px;
  height: 48px;
  border-radius: 10px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  border: 1.5px solid var(--danger, #dc2626);
  background: #fff;
  color: var(--danger, #dc2626);
  font: 700 0.82rem/1 Inter, system-ui, sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.v2-u-rec.is-recording {
  background: var(--danger, #dc2626);
  color: #fff;
  animation: v2-u-pulse 1.1s ease-in-out infinite;
}
@keyframes v2-u-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 106, 74, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(196, 106, 74, 0.05); }
}
.v2-u-rec-label {
  font-size: 0.92rem;
  color: var(--v2-ink, #2d4e6a);
  font-weight: 500;
}
/* Live progress bar while recording (fills as the student speaks). */
.v2-u-rec-progress {
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 0 12px;
}
.v2-u-rec-progress-fill {
  height: 100%;
  width: 0;
  background: #ff4700;
  border-radius: 4px;
  transition: width 0.2s linear;
}

.v2-u-speed-group { display: inline-flex; gap: 4px; margin-left: auto; }
.v2-u-speed {
  background: transparent;
  border: 1px solid var(--v2-border, #d8d3c4);
  color: var(--v2-muted, #777);
  padding: 4px 8px;
  border-radius: 6px;
  font: 500 0.78rem/1 ui-monospace, SF Mono, Menlo, monospace;
  cursor: pointer;
}
.v2-u-speed.is-on {
  background: rgba(255, 71, 0, 0.12);
  border-color: #ff4700;
  color: #ff4700;
}

/* U1 — colour fill that creeps with playback at the chosen speed. */
.v2-u-fill-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin: 2px 0 12px;
}
.v2-u-fill {
  height: 100%;
  width: 0;
  background: #ff4700;
  border-radius: 4px;
  transition: width 0.12s linear;
}

/* U2 — the line that shrinks as the streak grows; empty = mastered from memory. */
.v2-u-s2-text {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text, #2a2a2a);
  min-height: 1.5em;
  margin: 0 0 12px;
}
.v2-u-s2-text:empty::before {
  content: "✓ з пам'яті";
  color: var(--v2-moss, #7a8d6a);
  font-weight: 600;
}

/* Stage 2 — bar stack */
.v2-u-bar-stack {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}
.v2-u-bar {
  flex: 1;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--v2-border, #d8d3c4);
  background: transparent;
  transition: background 0.25s ease, opacity 0.25s ease;
}
.v2-u-bar.is-on {
  background: var(--v2-moss, #7a8d6a);
  border-color: var(--v2-moss, #7a8d6a);
}

/* Stage 3 — dial */
.v2-u-dial {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
}
.v2-u-dial-num {
  font: 600 2.2rem/1 ui-monospace, SF Mono, Menlo, monospace;
  color: var(--v2-ink, #2d4e6a);
  font-variant-numeric: tabular-nums;
}
.v2-u-dial-unit {
  font-size: 0.8rem;
  color: var(--v2-muted, #777);
}
.v2-u-dial-arrow {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--v2-muted, #777);
  min-width: 60px;
  text-align: right;
}
.v2-u-dial-track {
  position: relative;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  margin: 0 0 8px;
  overflow: hidden;
}
.v2-u-dial-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background: #ff4700;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.v2-u-nudge {
  margin: 6px 0;
  font-size: 0.9rem;
  min-height: 1.2em;
  color: var(--v2-ink, #2d4e6a);
}
.v2-u-shake { animation: v2-u-shake 0.4s ease; }
@keyframes v2-u-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Stage 4 — pillows */
.v2-u-pillows {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}
.v2-u-pillow {
  background: var(--v2-surface-2, #faf7ee);
  border: 1px solid var(--v2-border, #d8d3c4);
  color: var(--v2-ink, #2d4e6a);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font: 600 1.05rem/1 Inter, system-ui, sans-serif;
  cursor: pointer;
}
.v2-u-pillow.is-on {
  background: #ff4700;
  color: #fff;
  border-color: #ff4700;
}
.v2-u-pillow:focus-visible { outline: 2px solid #ff4700; outline-offset: 2px; }

.v2-u-tiny {
  font-size: 0.78rem;
  line-height: 1.4;
}
.v2-u-muted { color: var(--v2-muted, #777); }

/* [U] trigger button on the practice page (sentence control row) */
.v2-u-btn-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 0.78rem/1 ui-monospace, SF Mono, Menlo, monospace;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  padding: 0 10px;
  height: 32px;
  min-width: 32px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.v2-u-btn-trigger:hover { background: #f5f5f5; }
.v2-u-btn-trigger:focus-visible { outline: 2px solid #ff4700; outline-offset: 2px; }
.v2-u-btn-trigger:disabled { opacity: 0.45; cursor: not-allowed; }
