/* Four Lights progression and refreshed lamps. Loaded after explore.css. */

/* Stage stepper */
.stage-steps { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px auto 4px; }
.stage-step { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 6px 14px 6px 7px; border: 1px solid #5f757f; border-radius: 999px; background: transparent; color: #f7e5ae; font-size: .875rem; font-weight: 600; }
.stage-step span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #7d919b; font-family: var(--serif); font-weight: 400; }
.stage-step:hover { background: #2c3f49; border-color: #899faa; }
.stage-step.is-past span { background: #526d7b; border-color: #97aab3; }
.stage-step[aria-current="step"] { background: #f6e09f; color: #2f414a; border-color: #f6e09f; }
.stage-step[aria-current="step"] span { border-color: #2f414a; }

.stage-text { color: #4b5b63; font-size: .9375rem; line-height: 1.7; margin: 0 0 14px; }
.stage-text strong { color: #22313a; }
.stage-feedback { min-height: 1.7em; color: #22313a; margin: 14px 0 6px; line-height: 1.65; }
.stage-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.stage-actions .check-button { width: auto; flex: 1 1 220px; }

/* Refreshed lamps: dark glass when off, a warm glowing bulb when on. */
.light-board { width: min(100%, 292px); }
.lamp-disc { position: relative; width: 66px; height: 66px; border: 1px solid #506873; color: #7e919b; background: radial-gradient(circle at 40% 32%, #354b56, #202f37 72%); box-shadow: inset 0 3px 8px #00000060, inset 0 -2px 4px #ffffff0a; transition: background .35s ease, border-color .35s ease, box-shadow .35s ease, color .35s ease, transform .2s ease; }
.lamp-glow { position: absolute; inset: -22px; border-radius: 50%; background: radial-gradient(circle, #ffe9a766 0, #ffda6a26 42%, #ffda6a00 70%); opacity: 0; transform: scale(.55); transition: opacity .4s ease, transform .4s ease; pointer-events: none; }
.lamp-disc svg { position: relative; z-index: 1; width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.lamp-disc::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 42% 34%, #fffbf0, #fbe6a6 42%, #ebca66 78%); opacity: 0; transform: scale(.82); transition: opacity .42s ease, transform .42s cubic-bezier(.3, 1.4, .5, 1); }
.lamp.is-on .lamp-disc::before { opacity: 1; transform: scale(1); }
.lamp.is-on .lamp-disc { color: #8a6c12; border-color: #fff0c4; box-shadow: 0 0 28px 4px #f3d16b4d, inset 0 -4px 8px #c9a53a55; }
.lamp.is-on .lamp-glow { opacity: 1; transform: scale(1); }
.lamp.is-on .lamp-disc .coil { stroke: #c0620a; stroke-width: 1.8; }
.lamp.was-toggled .lamp-disc { outline: 2px solid #f3d98b99; outline-offset: 6px; animation: lamp-pop .45s ease-out; }
.lamp-disc { will-change: transform; }
.lamp.is-candidate .lamp-disc { border-color: #f3d783; box-shadow: 0 0 0 5px #f3d78340, 0 0 18px #f3d78333; }
.lamp.is-picked .lamp-disc { border-color: #f0d78c; box-shadow: 0 0 0 6px #f0d78c55, 0 0 26px #f0d78c44; transform: scale(1.06); }
.lamp .lamp-state { transition: color .35s ease; }

/* Smoother command building and replays */
.command-button { transition: background .18s, border-color .18s, transform .14s ease, box-shadow .25s; }
.command-button:active:not(:disabled) { transform: translateY(1px) scale(.97); }
.sequence-item { transition: background .3s ease, border-color .3s ease, outline-color .3s ease, transform .3s ease; outline: 2px solid transparent; outline-offset: 2px; }
.sequence-item.is-new { animation: seq-in .32s cubic-bezier(.2, .9, .3, 1.2); }
.sequence-item.is-current { transform: translateY(-2px); }
.light-board { transition: border-color .4s ease, box-shadow .4s ease; }
.replay-area { animation: fade-up .3s ease-out; }
.feedback:not([hidden]) { animation: fade-up .3s ease-out; }
@keyframes seq-in { from { opacity: 0; transform: translateY(6px) scale(.85); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
.lamp-state { font-size: .8125rem; }
@keyframes lamp-pop { 40% { transform: scale(1.1); } }

/* "The game chooses" move log */
.move-log { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; }
.move-log:empty { display: none; }
.move-log li { padding: 3px 10px; border: 1px solid #d6cfbf; border-radius: 999px; font-size: .8125rem; color: #4b5b63; background: #fffdf8; }
.move-log li:last-child { border-color: #f0d78c; color: #7d5a10; }

/* "Always works" live progress */
.coverage { max-width: 640px; margin: 16px auto 18px; padding: 16px 18px; border: 1px solid #d6cfbf; border-radius: 12px; background: #fffdf8; box-shadow: 0 7px 22px #00000008; }
/* Stage 2 (founders, 1 Dec): the 14 patterns sit at the top, larger; the big board appears only for a replay. */
.game-shell[data-stage="3"] #run-board:not(.is-replaying) { display: none; }
.coverage-family { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #4b5b63; }
.coverage-family:first-child { margin-top: 0; }
.coverage-grid.is-grouped { grid-template-columns: repeat(8, minmax(0, 64px)); }
.hint-list .hint-note { list-style: none; margin-top: 6px; font-style: italic; color: #4b5b63; }
.coverage-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .875rem; color: #4b5b63; margin-bottom: 10px; }
.coverage-watch-button { font-size: .875rem; }
.coverage-buttons { display: inline-flex; gap: 16px; }
.coverage-size-button { display: none; font-size: .875rem; }
.coverage-watch { margin: -2px 0 10px; font-size: .875rem; color: #22313a; min-height: 1.5em; }
/* All 14 at once: each board shows its run; matched boards glow gold, escaped ones get an orange outline. */
.coverage-grid.is-watching .coverage-item { border-color: #455a64; background: #213139; }
.coverage-item.is-caught, .coverage-grid.is-watching .coverage-item.is-caught { border-color: #f0d78c; background: #3a4a33; box-shadow: 0 0 0 2px #f0d78c55, 0 0 14px #f0d78c66; }
.coverage-item.is-caught .mini-lamp.is-on { background: #ffe9a6; }
.coverage-item.is-escaped { border-color: #e0906a; box-shadow: 0 0 0 2px #e0906a; }
/* Clearer gold mark (testers, 1 Dec): a stronger gold edge and a tick in the corner. */
.coverage-item { position: relative; cursor: pointer; }
.coverage-item.is-caught, .coverage-item.is-done, .coverage-grid.is-watching .coverage-item.is-caught { border-color: #f0d78c; box-shadow: 0 0 0 2px #f0d78c, 0 0 16px #f0d78c88; }
.coverage-item.is-caught::after, .coverage-item.is-done::after {
  content: '✓'; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%;
  background: #f0d78c; color: #22313a; font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px #fffdf8;
}
.coverage-grid.is-watching .coverage-item.is-done:not(.is-caught) { box-shadow: none; }
.coverage-grid.is-watching .coverage-item.is-done:not(.is-caught)::after { display: none; }
.coverage-item:focus-visible { outline: 3px solid #2d424d; outline-offset: 3px; }
.coverage-item:hover { filter: brightness(1.12); }
.watch-controls { display: flex; gap: 16px; margin: -4px 0 10px; }
.watch-controls[hidden] { display: none; }
.coverage-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 14px 0 0; font-size: .8125rem; color: #4b5b63; }
.key-swatch { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: #213139; font-size: .625rem; font-weight: 700; }
.key-swatch.is-gold { box-shadow: 0 0 0 2px #f0d78c; color: #f0d78c; }
.key-swatch.is-orange { box-shadow: 0 0 0 2px #e0906a; margin-left: 8px; }
.key-tap { flex-basis: 100%; }
.mini-lamp { transition: background .25s; }
.mini-lamp.was-flipped { animation: mini-flip .45s ease-out; }
@keyframes mini-flip { 0% { transform: scale(.55); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.coverage-head strong { color: #7d5a10; font-variant-numeric: tabular-nums; }
.coverage-grid { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 72px)); justify-content: center; gap: 10px; padding: 0; margin: 0; }
.coverage-item { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; aspect-ratio: 1; padding: 10px; border: 1px solid #455a64; border-radius: 10px; background: #213139; transition: border-color .3s, background .3s; }
.coverage-item .mini-lamp:nth-child(3) { grid-area: 2 / 2; }
.coverage-item .mini-lamp:nth-child(4) { grid-area: 2 / 1; }
.mini-lamp { border-radius: 50%; background: #394e58; }
.mini-lamp.is-on { background: #e8d7a3; }
.coverage-item.is-done { border-color: #c9b26a; background: #2f3f47; }
.coverage-item.just-done { animation: lamp-pop .5s ease-out; }

@media (max-width: 480px) {
  .stage-step { font-size: .8125rem; padding-right: 11px; }
  .coverage { padding: 14px 12px; }
  .coverage-size-button { display: inline-block; }
  /* Compact while building the list: 7 small boards a row (8 when grouped). */
  .coverage.is-compact .coverage-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
  .coverage.is-compact .coverage-grid.is-grouped { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .coverage.is-compact .coverage-item { padding: 4px; gap: 3px; border-radius: 7px; }
  .coverage.is-compact .coverage-family { margin: 2px 0 -3px; font-size: .6875rem; }
  .coverage.is-compact .coverage-watch { font-size: .8125rem; }
  .coverage.is-compact .coverage-item.is-caught::after, .coverage.is-compact .coverage-item.is-done::after { width: 15px; height: 15px; line-height: 15px; font-size: .625rem; top: -6px; right: -6px; }
  .coverage.is-compact .coverage-key { font-size: .75rem; }
  .coverage-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .coverage-grid.is-grouped { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .coverage-item { padding: 8px; gap: 5px; }
  .lamp-disc { width: 60px; height: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .lamp-disc, .lamp-disc::before, .lamp-glow, .coverage-item, .command-button, .sequence-item { transition: none; }
  .sequence-item.is-new, .replay-area, .feedback:not([hidden]) { animation: none; }
  .lamp.is-picked .lamp-disc { transform: none; }
  .lamp.was-toggled .lamp-disc, .coverage-item.just-done, .mini-lamp.was-flipped { animation: none; }
}
