/* Game-only styles. Shared error-page styles remain in main.css. */
.game-page {
  display: block;
  background: radial-gradient(ellipse at 50% 25%, #152333 0, #090e14 45%, #050505 85%);
  color: #e5ecf4;
  padding: 0 1rem env(safe-area-inset-bottom);
}
.game-page * { box-sizing: border-box; }
[hidden] { display: none !important; }
.masthead {
  width: 100%; max-width: 42rem; margin: 1rem auto 1.25rem;
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  gap: 1rem; align-items: center;
}
.masthead h1 { margin: 0; line-height: 0; }
.masthead img { width: 104px; height: 104px; }
.masthead-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 1rem; }
.hub-link { font-size: .75rem; color: #b1c3d6; text-decoration: none; white-space: nowrap; }
.mode-label { text-align: right; font-size: .64rem; letter-spacing: .12em; color: #c4d5e9; }
.mode-label span { display: block; font-size: .58rem; margin-top: .35rem; color: #9eafc2; }
.game-shell { width: 100%; max-width: 42rem; padding: 0; margin: 0 auto; text-align: center; }
.intro { margin: 0; text-align: left; }
.intro p { margin: .5rem 0; color: #aebed0; font-size: .85rem; }
.intro strong { color: #e5ecf4; font-weight: 500; }
.intro .eyebrow { color: #c5d9ed; font-size: .66rem; letter-spacing: .13em; }
.play-panel { border: 1px solid #3a4c61; background: linear-gradient(155deg, #172231, #0d151f 65%); border-radius: 1.35rem; padding: 1.35rem 1.7rem 1.2rem; box-shadow: 0 24px 70px #0006, inset 0 1px 0 #ffffff0c; }
.chain-heading { padding-bottom: 1rem; border-bottom: 1px solid #ffffff0b; display: flex; justify-content: space-between; color: #aabed2; font-size: .7rem; letter-spacing: .12em; }
.chain-heading b { color: #f1f6fc; }
.machine { position: relative; min-height: 15rem; padding: 3rem 0 3.5rem; display: flex; flex-direction: column; justify-content: center; isolation: isolate; }
.machine-mark { position: absolute; width: 14.75rem; height: 14.75rem; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: -1; pointer-events: none; }
.machine[data-state="complete"] .machine-mark { filter: brightness(1.35); }
#latch-plus { fill: #829bb5; transform-box: fill-box; transform-origin: center; }
#latch-plus.latch-flash { fill: #e1f1ff; filter: drop-shadow(0 0 8px #a1d1ff); animation: plus-lock .8s cubic-bezier(.4,0,.2,1); }
@keyframes plus-lock {
  0% { transform: scale(1) rotate(0); opacity: .75; }
  35% { transform: scale(1.14) rotate(90deg); opacity: 1; }
  60% { transform: scale(.97) rotate(90deg); opacity: 1; }
  100% { transform: scale(1) rotate(90deg); opacity: .75; }
}
.word-label { position: relative; top: -.55rem; font-size: .62rem; letter-spacing: .17em; color: #a8bdd3; margin: 0 0 1.1rem; }
.tiles { position: relative; top: -.55rem; display: flex; flex-wrap: wrap; justify-content: center; gap: .38rem; }
.tile { position: relative; display: grid; place-items: center; width: clamp(1.85rem, 7vw, 3.35rem); height: clamp(2.55rem, 9.5vw, 4.3rem); border: 1px solid #627992; border-bottom: 3px solid #142235; border-radius: .38rem; color: #eaf2fb; background: linear-gradient(165deg, #405570, #25364b 68%); box-shadow: 0 5px 9px #0006, inset 0 1px 0 #ffffff1c; transform-origin: center; }
.plate-glyph { font: 600 clamp(1.3rem, 5vw, 2rem)/1 system-ui, sans-serif; text-shadow: 0 2px 2px #0005; }
.tile.added { animation: plate-flip .48s cubic-bezier(.4,0,.2,1) both; }
.tile.locked { background: linear-gradient(160deg, #597da0, #365572); border: 1px solid #aacde9; border-bottom: 3px solid #739bbc; box-shadow: 0 5px 9px #0006, inset 0 0 0 1px #c5e0f329; }
.tile.locked + .tile.added, .tile.added + .tile.locked { margin-left: .35rem; }
.tile.added[data-order="0"] { animation-delay: 0.00s; }
.tile.added[data-order="1"] { animation-delay: 0.07s; }
.tile.added[data-order="2"] { animation-delay: 0.14s; }
.tile.added[data-order="3"] { animation-delay: 0.21s; }
.tile.added[data-order="4"] { animation-delay: 0.28s; }
.tile.added[data-order="5"] { animation-delay: 0.35s; }
.tile.added[data-order="6"] { animation-delay: 0.42s; }
.tile.added[data-order="7"] { animation-delay: 0.49s; }
.tile.added[data-order="8"] { animation-delay: 0.56s; }
.tile.added[data-order="9"] { animation-delay: 0.63s; }
.tile.added[data-order="10"] { animation-delay: 0.70s; }
.tile.added[data-order="11"] { animation-delay: 0.77s; }
.tile.added[data-order="12"] { animation-delay: 0.84s; }
.direction-guides { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: .3rem 0 1.1rem; text-align: left; }
.direction-guides > div { border: 1px solid #40556d; border-radius: .65rem; background: #0a121d7a; padding: .8rem .9rem; box-shadow: inset 0 1px 0 #ffffff05; }
.direction-guides strong { display: block; font-size: .65rem; letter-spacing: .12em; color: #93bde2; }
.direction-guides span { display: block; font-size: .85rem; line-height: 1.5; color: #d1deec; margin-top: .35rem; }
.hint-preview { margin: 0 0 1.1rem; padding: .8rem; border: 1px solid #4c6580; border-radius: .7rem; background: #102033; }
.hint-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .8rem; }
.hint-heading strong { text-align: left; color: #bed8ef; font-size: .66rem; letter-spacing: .08em; }
.hint-heading button { padding: .3rem .6rem; font-size: .7rem; }
.hint-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; }
.hint-tiles .tile { width: clamp(1.6rem, 6vw, 2.6rem); height: clamp(2.2rem, 8vw, 3.2rem); }
.hint-tiles .plate-glyph { font-size: clamp(1.15rem, 4vw, 1.65rem); }
.hint-blank { background: #0c1725; border: 1px dashed #7f9db9; box-shadow: inset 0 2px 5px #0003; }
#hint-caption { font-size: .77rem; color: #afc6db; margin: .8rem 0 0; }
.intro .connection-example { font-size: .7rem; font-family: ui-monospace, Consolas, monospace; letter-spacing: .07em; }
.connection-example strong { color: #c0dcf4; }
.help li { line-height: 1.65; margin-bottom: .5rem; }
.loading-word { font-size: 2rem; letter-spacing: .3em; color: #9eb4cc; }
.feedback { min-height: 3.2rem; padding: .7rem 0 .6rem; }
.feedback strong { font-size: .8rem; letter-spacing: .12em; color: #bed6ed; }
.feedback p { margin: .35rem auto 0; max-width: 30rem; color: #aebdd0; font-size: .85rem; line-height: 1.45; }
.feedback p:empty { display: none; }
.feedback[data-kind="invalid"] strong { color: #ffc49e; }
.feedback[data-kind="complete"] strong, .feedback[data-kind="success"] strong { color: #c0dcf4; }
fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
fieldset > label { display: block; text-align: left; color: #c3d0df; font-size: .8rem; margin: .6rem 0; }
.entry-row { display: flex; gap: .6rem; }
#word-input { width: 100%; min-width: 0; border: 1px solid #647f9e; border-radius: .45rem; padding: .65rem .8rem; color: #eef6ff; background: #050b12; font: 600 1.2rem ui-monospace, Consolas, monospace; text-transform: uppercase; letter-spacing: .09em; }
#word-input[aria-invalid="true"] { border-color: #e7ae86; }
button { min-height: 44px; border: 1px solid #526a84; border-radius: .45rem; padding: .65rem 1rem; font: 600 .8rem system-ui, sans-serif; cursor: pointer; color: #e5effb; background: #1b2b3e; }
button:hover:not(:disabled) { background: #2c4159; }
button.primary { color: #142638; background: linear-gradient(#e0edf9, #acc9e2); border-color: #d1e2f2; box-shadow: 0 2px 4px #0004; white-space: nowrap; }
button.primary:hover:not(:disabled) { background: #e0effe; }
button:disabled, fieldset:disabled { opacity: .45; cursor: default; }
:is(button, input, summary, a):focus-visible { outline: 2px solid #b3dcff; outline-offset: 4px; }
.input-help { margin: .55rem 0; text-align: left; color: #9bacc0; font-size: .73rem; }
.word-actions { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .4rem 0 1rem; }
.word-actions .hint-action { padding-inline: 1.3rem; background: #263e57; border-color: #6d8eae; }
.word-actions .quiet { border-color: transparent; }
.word-actions .quiet:hover { border-color: #526a84; }
.keyboard-settings { display: flex; justify-content: flex-end; padding-top: .4rem; }
.keyboard-option { display: flex; align-items: center; gap: .35rem; min-height: 44px; color: #aabbd0; font-size: .75rem; cursor: pointer; text-align: left; }
.keyboard-option input { accent-color: #a7caeb; width: 17px; height: 17px; }
button.quiet { background: transparent; color: #c1cddd; border-color: #34485f; }
.keyboard { margin-top: 1.1rem; }
.key-row { display: flex; justify-content: center; gap: .25rem; margin-top: .3rem; }
.key-row button { padding: .25rem 0; flex: 1; max-width: 3rem; min-width: 0; min-height: 46px; font-size: .95rem; touch-action: manipulation; }
.route-panel { text-align: left; padding: 1.3rem .3rem 0; }
.route-panel h2 { color: #a6b9ce; font-size: .65rem; font-weight: 500; letter-spacing: .16em; margin: 0 0 .85rem; }
.route { list-style: none; display: flex; flex-wrap: wrap; gap: .7rem 1.3rem; padding: 0; margin: 0; min-height: 2rem; }
.route li { position: relative; font: 600 .9rem ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.route li:not(:last-child)::after { content: '›'; position: absolute; right: -.9rem; color: #7189a4; }
.route small { display: block; color: #a7b9cc; margin-top: .3rem; font: .62rem system-ui, sans-serif; }
.session-stats { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; border-top: 1px solid #263343; padding-top: 1rem; margin-top: 1rem; color: #a4b6ca; font-size: .75rem; }
.session-stats b { color: #dfeafa; }
.help { text-align: left; font-size: .83rem; color: #b3c3d5; border-top: 1px solid #263343; margin: 1.1rem 0 0; padding: 1rem .3rem; }
summary { cursor: pointer; min-height: 30px; }
.help p, .credits p { line-height: 1.65; }
.site-footer { max-width: 42rem; margin: 1rem auto 2rem; text-align: center; font-size: .7rem; color: #91a4ba; }
.credits { max-width: 35rem; margin: auto; }
.credits summary { display: list-item; list-style-position: inside; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 1rem; left: 1rem; z-index: 5; background: #101d2c; padding: 1rem; }
.noscript { color: #ffc49e; }
/* Preserve the logo's sideways flip; game plates have their own softer finish. */
@keyframes plate-flip {
  0%, 100% { transform: scaleX(1) skewY(0deg); opacity: 1; }
  50% { transform: scaleX(.12) skewY(-9deg); opacity: .8; }
  85% { transform: scaleX(1) skewY(0deg); opacity: 1; }
}
@media (max-width: 480px) {
  .game-page { padding-left: .65rem; padding-right: .65rem; }
  .masthead { grid-template-columns: 4.5rem minmax(0, 1fr); gap: .2rem .8rem; margin: .5rem auto 1rem; }
  .masthead h1 { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .masthead-tools { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; justify-content: space-between; gap: .5rem; }
  .mode-label span { display: inline; margin-left: .4rem; font-size: .53rem; }
  .mode-label { font-size: .55rem; }
  .masthead .intro { grid-column: 2; grid-row: 2; margin: 0; }
  .intro .eyebrow { font-size: .56rem; letter-spacing: .05em; }
  .intro .connection-example { font-size: .57rem; letter-spacing: 0; }

  .masthead img { width: 76px; height: 76px; }

  .intro p { font-size: .72rem; margin: .4rem 0; }
  .play-panel { padding: 1rem .8rem; }
  .machine { min-height: 13.5rem; padding: 3rem 0; }
  .machine-mark { width: 13rem; height: 13rem; }
  .feedback { min-height: 3.2rem; }
  .entry-row { gap: .4rem; }
  .entry-row button { padding: .6rem .75rem; }
  .key-row { gap: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
