/* ============================================================================
   Shared stylesheet - originally built for read/, copied here (per the
   brief: koch/ works fully independently, sharing only the top-level
   audio_us/audio_uk folders) so koch/ matches read/'s style, logo
   treatment, and copyright footer exactly. Structural variables, fonts,
   colors and the card-based layout are lifted directly from
   read_guide.html's own premium dark-mode design. The word-stage / letter
   animation colors (amber/coral/connector-blue/silent-gray) are kept as
   their own separate palette - they're functional signal colors, not page
   chrome. The bottom of this file adds koch-only components (pattern
   picker pills, mode tabs, the audio-drill answer buttons) not used by read/.
   ============================================================================ */

:root {
  /* -- read_guide.html's own palette, verbatim -- */
  --bg-color: #232323;
  --card-color: #1d1d1d;
  --exception-bg: #161616;
  --electric-yellow: #e6c27a;
  --hot-pink: #FF2E88;
  --light-gray: #D8D8D8;
  --darker-gray: #888888;

  /* -- game-engine functional colors (typography apps' palette) -- */
  --stage-bg: #0A0A0A;
  --amber: #FFB74D;
  --coral: #FF6E4A;
  --silent-gray: #9E9E9E;
  --connector: #80D8FF;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The browser's own [hidden] { display: none } is a *user-agent* rule,
   which normal-importance author rules always beat regardless of
   selector specificity - so any element also matched by a rule that
   sets its own `display` (`#start-gate { display: flex }` etc.) stays
   visually present and still taking up layout space even once its
   `hidden` attribute is set. This one rule is what actually hides them. */
[hidden] { display: none !important; }

body {
  background-color: var(--bg-color);
  color: var(--light-gray);
  font-family: Verdana, Geneva, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 60px;
  overflow-x: hidden; /* safety net: no single overflowing child should force a horizontal scrollbar */
}

a { color: inherit; }

/* ---------------------------------------------------------------------------
   Header (shared: start screen, guide pages)
   ------------------------------------------------------------------------- */
header.app-header {
  position: sticky;
  top: 0;
  background-color: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(5px);
  border-bottom: 2px solid var(--card-color);
  padding: 15px 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

header.app-header h1 {
  color: var(--electric-yellow);
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--card-color);
  color: var(--light-gray);
  padding: 7px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid #333;
  transition: background 0.2s, color 0.2s;
}
.back-link:hover { background-color: var(--electric-yellow); color: #121212; }

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-link {
  display: inline-flex;
  border-radius: 50%;
  line-height: 0;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
}
.logo-link:hover { transform: scale(1.06); }

.logo-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

.site-footer {
  text-align: center;
  color: var(--darker-gray);
  font-size: 0.8rem;
  padding: 40px 20px 20px;
  letter-spacing: 0.02em;
}

main {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
}

.page-intro {
  color: var(--darker-gray);
  font-size: 0.95rem;
  margin-bottom: 24px;
  text-align: center;
}

.legend { margin-bottom: 24px; text-align: center; }
.legend-colors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--light-gray);
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-swatch.legend-alphabet { background: var(--coral); }
.legend-swatch.legend-lax { background: var(--amber); }
.legend-swatch.legend-silent { background: var(--silent-gray); }
.legend-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--darker-gray);
  text-align: center;
}

.duo-options { margin-bottom: 20px; text-align: center; }
.bin-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--light-gray);
  font-size: 0.9rem;
}
.bin-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--electric-yellow);
  cursor: pointer;
}

.resume-btn {
  margin: 22px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--electric-yellow);
  color: #121212;
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 14px 28px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: 0 0 0 rgba(247, 240, 0, 0);
}
.resume-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(247, 240, 0, 0.25);
}
.resume-btn:disabled {
  background-color: var(--card-color);
  color: var(--darker-gray);
  cursor: default;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 12px;
}

.group-card {
  background-color: var(--card-color);
  border: 1px solid #252525;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.group-card:hover { border-color: #3a3a3a; transform: translateY(-2px); }

.group-card .group-number {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--darker-gray);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.group-card .group-title {
  color: white;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.group-card .group-patterns {
  color: var(--darker-gray);
  font-size: 0.82rem;
  line-height: 1.5;
  flex-grow: 1;
}

.group-card .group-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.group-card .go-btn,
.group-card .help-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  padding: 9px 0;
  text-decoration: none;
  text-align: center;
  transition: transform 0.15s var(--ease), opacity 0.15s var(--ease);
}
.group-card .go-btn { flex: 1 1 auto; background-color: var(--electric-yellow); color: #121212; }
.group-card .help-btn { width: 44px; flex: 0 0 auto; background-color: #2a2a2a; color: var(--light-gray); border: 1px solid #3a3a3a; }
.group-card .go-btn:hover,
.group-card .help-btn:hover { transform: translateY(-1px); opacity: 0.92; }

/* ---------------------------------------------------------------------------
   Rule cards (guide/reference pages) - lifted straight from read_guide.html
   ------------------------------------------------------------------------- */
.section-title {
  color: white;
  font-size: 1.4rem;
  margin: 35px 0 15px 0;
  border-left: 4px solid var(--electric-yellow);
  padding-left: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.section-title:first-child { margin-top: 0; }

.rule-card {
  background-color: var(--card-color);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid #252525;
}

.card-header {
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background-color: #222222;
}

.pattern-visual {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--electric-yellow);
  letter-spacing: 0.05em;
}

.header-meta { display: flex; align-items: center; gap: 12px; }

.badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.badge-5 { background-color: #2b7a3e; color: #e2f7e6; }
.badge-4 { background-color: #3b6b8c; color: #e6f2fc; }
.badge-3 { background-color: #8c763b; color: #fcf6e6; }
.badge-2 { background-color: #8c4f3b; color: #fcebe6; }
.badge-1 { background-color: #7d2c2c; color: #fce8e8; }

.arrow { font-size: 0.8rem; transition: transform 0.3s; color: var(--darker-gray); }
.rule-card.active .arrow { transform: rotate(180deg); }

.card-body { padding: 20px; display: none; border-top: 1px solid #2a2a2a; }
.rule-card.active .card-body { display: block; }

.explanation { font-size: 0.95rem; margin-bottom: 15px; color: #c8c8c8; }

.chip-group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--darker-gray);
  margin-bottom: 6px;
  font-weight: 600;
}

.chips-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.word-chip {
  background-color: #2a2a2a;
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid #3a3a3a;
}

.exception-panel {
  background-color: var(--exception-bg);
  border-left: 4px solid var(--hot-pink);
  border-top: 1px solid #25121a;
  border-right: 1px solid #25121a;
  border-bottom: 1px solid #25121a;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

.exception-title {
  color: var(--hot-pink);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-style: normal;
}

.exception-words { color: #e0b3c5; }

.global-controls { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 10px; }

.control-btn {
  background: none;
  border: 1px solid #444;
  color: var(--darker-gray);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
}
.control-btn:hover { color: white; border-color: #666; }

/* ---------------------------------------------------------------------------
   Game page: viewer stage (letters), word picker, pattern library
   ------------------------------------------------------------------------- */
.game-body {
  padding-bottom: 0;
}

#viewer {
  position: relative;
  min-height: 38vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 20px;
  background: var(--stage-bg);
}

.word-stage {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: clamp(2px, 0.6vw, 8px);
}

.letter {
  font-family: Verdana, Geneva, sans-serif;
  font-size: clamp(80px, 11vw, 160px);
  font-weight: 800;
  line-height: 1;
  display: inline-block;
  color: #FFFFFF;
  transform-origin: bottom center;
  will-change: transform, opacity, color, text-shadow;
  position: relative;
  user-select: none;
}
.letter.consonant { color: #FFFFFF; }
.letter.short-vowel { color: var(--amber); }
.letter.silent { color: var(--silent-gray); opacity: 0; }

.connector-svg {
  position: absolute;
  left: 0;
  top: -70px;
  width: 100%;
  height: calc(100% + 70px);
  overflow: visible;
  pointer-events: none;
}
.connector-path {
  fill: none;
  stroke: var(--connector);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0;
}

.underline-bar {
  position: absolute;
  bottom: -16px;
  height: 3px;
  background: var(--connector);
  border-radius: 2px;
  opacity: 0;
  transform-origin: left center;
  pointer-events: none;
}

.pattern-label {
  /* Intentionally hidden: the pattern name (e.g. "PH", "-ED Suffix")
     shouldn't surface during the animation itself - the letters moving
     are the lesson, not a caption. engine.js still schedules its fade
     in/out timings; display:none just makes that invisible rather than
     touching that timing logic. */
  display: none;
}

.stub-stage {
  font-size: 16px;
  color: #555;
  letter-spacing: 0.03em;
  max-width: 560px;
  text-align: center;
  line-height: 1.6;
}

#word-meta {
  text-align: center;
  padding: 4px 16px 8px;
  color: var(--darker-gray);
  font-size: 0.85rem;
  min-height: 1.4em;
}

#word-picker {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 18px;
  max-width: 720px;
  margin: 0 auto 28px;
  padding: 0 24px;
}
#word-picker.visible { display: flex; }

.word-nav-btn {
  background: transparent;
  border: 1px solid #333;
  color: #ccc;
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.word-nav-btn:hover { border-color: white; color: white; }
.word-nav-btn:active { transform: scale(0.94); }

.word-nav-line {
  width: 72px;
  height: 0;
  border-top: 2px dotted #555;
  opacity: 0.7;
}

#pattern-library { max-width: 1000px; margin: 8px auto 0; padding: 8px 24px 48px; }
#pattern-library h2 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--darker-gray);
  text-align: center;
  margin: 0 0 20px;
  font-weight: 700;
}

.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }

.pattern-card {
  background: var(--card-color);
  border: 1px solid #252525;
  border-radius: 12px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
}
.pattern-card:hover { border-color: #3a3a3a; transform: translateY(-2px); }
.pattern-card.active { border-style: dotted; border-width: 2px; border-color: var(--electric-yellow); }
.pattern-card .p-name { font-size: 0.95rem; font-weight: 800; color: var(--electric-yellow); letter-spacing: 0.03em; }

/* ---------------------------------------------------------------------------
   In-game controls: pause/resume + save & exit - icon-only, visible during
   active play. Lives inside the sticky app-header (not its own fixed
   element) so it can't overlap the back link, and stays visible on
   scroll the same way the header itself does.
   ------------------------------------------------------------------------- */
.game-controls {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid #333;
  background-color: rgba(29, 29, 29, 0.9);
  backdrop-filter: blur(4px);
  color: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.icon-btn:hover { border-color: var(--electric-yellow); color: var(--electric-yellow); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.game-controls .icon-btn[data-action="exit"]:hover { border-color: var(--hot-pink); color: var(--hot-pink); }

/* Pause overlay */
#pause-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(6px);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
#pause-overlay.visible { display: flex; }
#pause-overlay .paused-label {
  color: var(--electric-yellow);
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#pause-overlay .paused-hint { color: var(--darker-gray); font-size: 0.9rem; }

.pause-logo-img {
  width: 64px;
  height: 64px;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease);
}
#pause-logo-link:hover .pause-logo-img { transform: scale(1.06); }

.resume-btn-overlay {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background-color: var(--electric-yellow);
  color: #121212;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.resume-btn-overlay:hover { transform: scale(1.05); }
.resume-btn-overlay:active { transform: scale(0.96); }
.resume-btn-overlay svg { width: 30px; height: 30px; fill: currentColor; margin-left: 4px; }

/* ---------------------------------------------------------------------------
   Debug panel (toggle with the ` key)
   ------------------------------------------------------------------------- */
#debug-panel {
  display: none;
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: rgba(8, 8, 8, 0.97);
  border-left: 1px solid #222;
  padding: 18px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 11px;
  color: #7CFFB2;
  overflow-y: auto;
  z-index: 999;
}
#debug-panel.visible { display: block; }
#debug-panel h3 { color: #fff; font-size: 12px; margin: 0 0 4px; letter-spacing: 0.05em; }
#debug-panel .hint { color: #555; font-size: 10px; margin-bottom: 14px; }
.debug-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid #1a1a1a; color: #4d4d4d; }
.debug-row.active { color: #7CFFB2; }
.debug-row span:last-child { flex-shrink: 0; color: #666; }

.no-results { display: none; text-align: center; padding: 40px; color: var(--darker-gray); }

@media (max-width: 640px) {
  .letter { font-size: clamp(56px, 16vw, 110px); }
  .group-grid { grid-template-columns: 1fr; }
}

/* ============================================================================
   koch/ only: mode tabs, pattern picker, and the audio-drill play screen.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   Mode tabs - 4 games in one app; only Sound Sprint (single pattern, audio)
   is built so far, the rest show as a roadmap rather than disappearing.
   ------------------------------------------------------------------------- */
.mode-tabs {
  /* grid, not flex - flex children refuse to shrink below their
     unwrapped text width (min-width:auto) unless told to, which is what
     let "Flash Sprint Duo/Tri" run off the edge of narrow screens.
     minmax() sidesteps that: each tile can't get narrower than 150px,
     but the track itself still reflows to fewer columns to fit. */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 auto 36px;
  max-width: 900px;
}

.mode-tab {
  min-width: 0;
  background-color: var(--card-color);
  border: 1px solid var(--electric-yellow);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}
.mode-tab.active {
  border-color: var(--connector);
  background-color: rgba(128, 216, 255, 0.08);
}
.mode-tab.selectable {
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.mode-tab.selectable:hover { border-color: var(--connector); transform: translateY(-2px); }
.mode-tab.soon { opacity: 0.45; }

.mode-tab .mode-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-top: 6px;
}

.mode-tab .mode-name {
  font-weight: 800;
  font-size: 1.15rem;
  color: white;
  letter-spacing: 0.02em;
}
.mode-tab.active .mode-name { color: var(--connector); }
.mode-tab .soon-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--darker-gray);
  border: 1px solid #333;
  border-radius: 20px;
  padding: 2px 10px;
}

/* ---------------------------------------------------------------------------
   Pattern picker - one card per read_guide.html group, each holding a row
   of selectable pattern pills. Single-select for mode 1 (Sound Sprint).
   Laid out as a centered card grid (auto-fit + justify-content:center),
   matching the learn/practice card-grid convention rather than the old
   full-width stacked rows.
   ------------------------------------------------------------------------- */
#picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 340px));
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
}

.picker-group {
  background-color: var(--card-color);
  border: 1px solid #252525;
  border-radius: 10px;
  padding: 20px;
}

.picker-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.picker-group-title {
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.picker-group-number {
  color: var(--darker-gray);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

.pattern-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pattern-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: var(--card-color);
  border: 1px solid #2e2e2e;
  border-radius: 22px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.pattern-pill:hover { border-color: #444; }
.pattern-pill.selected {
  border-color: var(--electric-yellow);
  background-color: #201f0a;
}

.pattern-pill-select {
  background: none;
  border: none;
  color: var(--light-gray);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 6px 4px;
}
.pattern-pill.selected .pattern-pill-select { color: var(--electric-yellow); }

.pattern-pill-help {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #333;
  background: #262626;
  color: var(--darker-gray);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.pattern-pill-help:hover { border-color: var(--electric-yellow); color: var(--electric-yellow); }

.go-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg-color) 60%, transparent);
  margin-top: 20px;
}

.go-btn-main {
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background-color: var(--electric-yellow);
  color: #121212;
  border: none;
  border-radius: 30px;
  padding: 14px 44px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.go-btn-main:disabled {
  background-color: var(--card-color);
  color: var(--darker-gray);
  cursor: default;
}
.go-btn-main:not(:disabled):hover { transform: translateY(-2px); }

/* ---------------------------------------------------------------------------
   Play screen (Sound Sprint - mode 1): audio-only trial loop. No word text
   is ever shown before the tap - only after, in the reveal.
   ------------------------------------------------------------------------- */
.drill-body { padding-bottom: 0; }

#trial-stage {
  min-height: 34vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 20px;
}

/* Shown once, before the first trial - a deliberate tap here is also
   what satisfies the browser's autoplay policy for every Audio.play()
   that follows (no prior user gesture on the page = silently blocked). */
#start-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.start-gate-label {
  color: var(--electric-yellow);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.start-gate-hint {
  color: var(--darker-gray);
  font-size: 0.85rem;
  text-align: center;
}

/* The orb is just an indicator that audio is playing - no functional
   purpose beyond that - so it's the pebble logo itself (bigger and far
   more recognizable than the old small header logo) inside the same
   neon "connector" frame/glow the rest of the app already uses, rather
   than a generic microphone icon. */
.listening-orb {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--connector);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: box-shadow 0.15s var(--ease);
}
.listening-orb.playing {
  box-shadow: 0 0 0 10px rgba(128, 216, 255, 0.08), 0 0 0 22px rgba(128, 216, 255, 0.04);
}
.orb-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.listening-orb.playing .orb-logo-img {
  animation: orb-pulsate 1s ease-in-out infinite;
}
@keyframes orb-pulsate {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* Mode 3's brief on-screen word - deliberately plain (no pattern
   coloring, unlike .reveal-word) since the whole point is recognizing
   the shape/spelling itself with no hint, not reading a hint. */
.flash-word {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: white;
}


.answer-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 10px 20px 30px;
  flex-wrap: wrap;
}

.answer-btn {
  width: 160px;
  min-height: 130px;
  border-radius: 16px;
  border: 2px solid #2e2e2e;
  background-color: var(--card-color);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  cursor: pointer;
  transition: transform 0.12s var(--ease), border-color 0.2s var(--ease);
}
.answer-btn:hover:not(:disabled) { transform: translateY(-3px); border-color: #555; }
.answer-btn:active:not(:disabled) { transform: scale(0.97); }
.answer-btn:disabled { opacity: 0.5; cursor: default; }

/* Base size fits short glyphs (AI, PH, +E...). Longer pattern labels
   (e.g. "Consonant + Y + Consonant", "Vowel + Double Consonant") get a
   smaller size via .medium/.long instead of overflowing the button -
   see glyphSizeClass() in play.html, which picks the class by length. */
.answer-btn .answer-glyph {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--electric-yellow);
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: break-word;
  max-width: 100%;
}
.answer-btn .answer-glyph.medium { font-size: 1.3rem; }
.answer-btn .answer-glyph.long { font-size: 1rem; letter-spacing: 0.01em; }
.answer-btn.bucket-btn .answer-glyph { color: var(--darker-gray); }

/* Dual-bucket mode (silent_e's alphabet/lax split) - colors inherited
   straight from the typography animation engine's own semantic palette
   (assets/engine.js's KF): coral is the "stretches to its alphabet
   sound" target color, amber is the resting/lax short-vowel color. */
.answer-btn.color-coral { border-color: rgba(255, 110, 74, 0.35); }
.answer-btn.color-coral .answer-glyph { color: var(--coral); }
.answer-btn.color-coral:hover:not(:disabled) { border-color: var(--coral); }
.answer-btn.color-amber { border-color: rgba(255, 183, 77, 0.35); }
.answer-btn.color-amber .answer-glyph { color: var(--amber); }
.answer-btn.color-amber:hover:not(:disabled) { border-color: var(--amber); }
.answer-btn .answer-caption {
  font-size: 0.7rem;
  color: var(--darker-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Mode 3's "ring" reveal mode - points at whichever tap zone the word
   actually belonged to, in the same neon connector-blue as the
   listening orb, so it reads as "here" rather than as a grade. Never
   applied to the zone that was actually tapped unless that's also the
   correct one - see handleAnswer() in flash.html.

   A subtle border/glow alone turned out to be easy to miss - the eye is
   still up near where the word just flashed, not on the tap row - so
   this pulses briefly (like the listening orb does) to actually pull
   attention down to it, on top of a much bolder glow than a resting
   hover state would ever use. */
.answer-btn.correct-ring {
  border-color: var(--connector);
  border-width: 3px;
  box-shadow: 0 0 0 6px rgba(128, 216, 255, 0.35), 0 0 24px 4px rgba(128, 216, 255, 0.5);
  animation: correct-ring-pulse 0.5s ease-in-out 2;
}
@keyframes correct-ring-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.recycle-icon { width: 40px; height: 40px; color: var(--darker-gray); }
.answer-btn.bucket-btn:hover:not(:disabled) .recycle-icon { color: var(--light-gray); }

/* Reveal: brief, neutral - shows the truth, never a verdict. */
#reveal-panel {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}
#reveal-panel.visible { opacity: 1; }

.reveal-word {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 800;
  letter-spacing: 0.02em;
}
/* Colors inherited from the typography animation engine's own palette
 * (assets/engine.js's KF) rather than invented fresh: coral is the
 * "stretches to its alphabet sound" target color, amber is the resting/
 * lax short-vowel color, silent-gray matches a faded silent letter, and
 * the plain connector blue is everything else the pattern touches that
 * the guide doesn't call lax or alphabet (digraphs, blends, suffixes...). */
.reveal-word .hl { color: var(--connector); }
.reveal-word .hl-alphabet { color: var(--coral); }
.reveal-word .hl-lax { color: var(--amber); }
.reveal-word .hl-silent { color: var(--silent-gray); }

@media (max-width: 640px) {
  .answer-btn { width: 130px; height: 110px; }
}
