:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090c11;
  color: #f7f4eb;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: #090c11;
}

button, input, select { font: inherit; }

.game-shell {
  position: relative;
  isolation: isolate;
  width: min(100vw, 30rem);
  min-height: 100dvh;
  overflow: hidden;
  background: #11151c;
  display: grid;
  grid-template-rows: max(3.8rem, calc(env(safe-area-inset-top) + 3rem)) minmax(10rem, 1fr) auto auto auto;
  height: 100dvh;
  min-height: 32rem;
  --tray-stone-width: 44px;
  --tray-stone-height: 44px;
}

.world-art,
.atmosphere,
.playfield-layer,
.feedback-layer,
.tray-layer,
.hud { position: absolute; inset-inline: 0; }

.world-art {
  inset-block: 0;
  z-index: -3;
}

.world-art img { width: 100%; height: 100%; object-fit: cover; object-position: center; }

.atmosphere {
  inset-block: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 8, 12, .38), transparent 22%, transparent 68%, rgba(5, 8, 12, .78));
}

.hud { top: 0; z-index: 10; padding: max(.4rem, env(safe-area-inset-top)) .7rem .2rem; }

.hud-primary {
  position: relative;
  height: 3rem;
}

.controls-heading { grid-column: 1 / -1; }

.eyebrow { color: #ddc98b; font-size: .63rem; font-weight: 800; letter-spacing: .22em; }
.world-name { font-family: Georgia, serif; font-size: 1.2rem; }
.score-block { position: absolute; left: 50%; top: 0; transform: translateX(-50%); min-width: 4rem; padding: .15rem .65rem; text-align: center; border-radius: .75rem; background: rgba(9,12,17,.72); }
.score-block span { display: block; color: #c7c9cc; font-size: .55rem; text-transform: uppercase; letter-spacing: .12em; }
.score-block strong { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score-rolling { animation: score-dial .13s linear infinite; }
.move-score { position: absolute; right: 100%; top: .2rem; white-space: nowrap; font-size: 1.45rem; color: #f4dfa3; text-shadow: 0 0 10px #090c11; pointer-events: none; }
.undo-button { min-width: 2.75rem; min-height: 2.75rem; border: 1px solid rgba(255,255,255,.2); border-radius: .65rem; background: #1b222d; color: #f4dfa3; font-size: 1rem; cursor: pointer; }
.undo-button:disabled { opacity: .35; cursor: default; }
.undo-button span:not(.sr-only) { font-size: .75rem; }

.icon-button, .controls button {
  border: 1px solid rgba(255,255,255,.18);
  border-radius: .7rem;
  background: rgba(255,255,255,.08);
  color: inherit;
  min-height: 2.6rem;
}

.icon-button { position: absolute; top: 0; right: 0; width: 2.75rem; min-height: 2.75rem; }

.controls {
  margin-top: .45rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
  padding: .75rem;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 1rem;
  background: rgba(9, 12, 17, .92);
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.controls[hidden] { display: none; }
.controls label { color: #c7c9cc; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.effects-settings { display:flex; gap:1rem; margin:0; padding:.55rem .7rem; border:1px solid #ffffff24; border-radius:.6rem; }
.effects-settings legend { color:#aeb6c1; font-size:.68rem; letter-spacing:.08em; text-transform:uppercase; }
.effects-settings label { display:flex; align-items:center; gap:.4rem; }
.effects-settings input { width:auto; }
.controls input, .controls select, .controls button {
  width: 100%;
  margin-top: .25rem;
  padding: .55rem .6rem;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: .55rem;
  background: #151a22;
  color: #fff;
}
.controls button { align-self: end; }
.control-note, .control-actions { grid-column: 1 / -1; }
.control-note { margin: .2rem 0; font-size: .75rem; line-height: 1.5; color: #c7c9cc; }
.settings-grid, .control-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.control-actions button:only-child { grid-column: 1 / -1; }
.account-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
  padding: .65rem;
  border: 1px solid rgba(221,201,139,.35);
  border-radius: .7rem;
  background: rgba(221,201,139,.08);
}
.account-panel div { min-width: 0; }
.account-panel strong, .account-panel span { display: block; }
.account-panel strong { font-size: .82rem; }
.account-panel span { margin-top: .15rem; color: #c7c9cc; font-size: .7rem; line-height: 1.35; overflow-wrap: anywhere; }
.account-panel button { width: auto; min-width: 7.5rem; margin: 0; }
.settings-grid { margin-top: .4rem; }
.mulligan-setting { grid-column: 1 / -1; }
.controls input[type="range"] { accent-color: #ddc98b; min-height: 2.75rem; padding: 0; }
.instructions-dialog { width: min(94vw, 32rem); height: min(88dvh, 48rem); padding: .75rem; border: 1px solid #62616b; border-radius: 1rem; background: #11151c; color: #f7f4eb; }
.instructions-dialog::backdrop { background: rgba(0,0,0,.8); }
.instructions-dialog[open] { display: flex; flex-direction: column; gap: .75rem; }
.instructions-dialog button { padding: .7rem; background: #242b36; color: inherit; border: 1px solid #62616b; border-radius: .6rem; }
.instructions-dialog iframe { width: 100%; flex: 1; min-height: 0; border: 0; }

.playfield-layer { position: relative; grid-row: 2; min-height: 0; z-index: 1; padding: .2rem .4rem; }
.board { display: block; width: 100%; height: 100%; overflow: visible; touch-action: none; }

.game-shell[data-playfield="portrait"] .playfield-layer {
  padding: .2rem .4rem;
}

.cell {
  fill: rgba(11, 15, 20, .32);
  stroke: rgba(240, 237, 222, .22);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  transition: fill .16s ease, stroke .16s ease, filter .16s ease;
}

.cell.legal {
  fill: rgba(221, 201, 139, .14);
  stroke: rgba(238, 218, 153, .72);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(238, 218, 153, .38));
}

.cell.fizzle { animation: fizzle .32s ease-out; }
#board .cell:focus { outline:none; }
#board .cell:focus-visible { outline:none; stroke:#f4dfa3; stroke-width:3px; filter:drop-shadow(0 0 5px #e6c676); }

.stone-shape {
  stroke: rgba(255,255,255,.34);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.42));
}

.stone-sigil {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.essence-aura { pointer-events: none; }

.feedback-layer {
  position: relative;
  grid-row: 3;
  z-index: 4;
  min-height: 1.5rem;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.feedback-layer p {
  margin: 0;
  max-width: 88%;
  padding: .15rem .6rem;
  border-radius: 99px;
  background: rgba(8, 11, 16, .65);
  color: #e7e4db;
  font-size: .8rem;
  font-weight: 500;
  text-align: center;
}

.feedback-emote { position: absolute; bottom: 100%; font-size: clamp(2.8rem, 13vw, 4.5rem); line-height: 1.2; filter: drop-shadow(0 0 12px rgba(239,218,151,.5)); }
.feedback-emote:empty { display: none; }

.game-result {
  position: absolute;
  z-index: 9;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(88%, 25rem);
  max-height: 65dvh;
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid #ddc98b;
  border-radius: 1rem;
  background: rgba(9, 12, 17, .97);
  box-shadow: 0 .75rem 3rem #000;
  text-align: center;
}
.game-result[hidden] { display: none; }
.game-result h1 { margin: 0; font-size: 1.75rem; }
.game-result p { margin: .6rem 0; }
.result-score strong { display: block; font-size: 2.6rem; color: #f4dfa3; font-variant-numeric: tabular-nums; }
.result-score span, #resultDetails { color: #c7c9cc; font-size: .85rem; }
.result-actions { display: grid; gap: .6rem; margin-top: 1rem; }
.result-actions button { min-height: 2.75rem; padding: .6rem; color: #f7f4eb; background: #242b36; border: 1px solid #62616b; border-radius: .6rem; cursor: pointer; }
.result-actions button[hidden] { display: none; }
.result-account-reminder { display: grid; gap: .45rem; margin: 1rem 0 0; padding: .8rem; border: 1px solid rgba(221,201,139,.4); border-radius: .7rem; background: rgba(221,201,139,.08); }
.result-account-reminder[hidden] { display: none; }
.result-account-reminder>p { margin:0; color:#f3eee3; font-size:.82rem; font-weight:400; text-align:left; }
.result-account-reminder button { min-height:2.6rem; border:1px solid #ddc98b; border-radius:.55rem; background:#ddc98b; color:#17130b; font-weight:800; }
.tray-stone:disabled { cursor: default; opacity: .65; transform: none; filter: none; }

.account-dialog { width:min(92vw,26rem); padding:1.15rem; border:1px solid #ddc98b; border-radius:1rem; background:#11151c; color:#f7f4eb; box-shadow:0 1rem 4rem #000; }
.account-dialog::backdrop { background:rgba(0,0,0,.82); }
.account-dialog h1 { margin:.2rem 0 .6rem; font:1.8rem/1.08 Georgia,serif; }
.account-dialog p:not(.eyebrow) { color:#c7c9cc; line-height:1.5; }
.account-dialog-actions { display:grid; gap:.6rem; margin-top:1rem; }
.account-dialog-actions a, .account-dialog-actions button { min-height:2.8rem; display:grid; place-items:center; padding:.65rem; border:1px solid #62616b; border-radius:.6rem; background:#242b36; color:#f7f4eb; text-decoration:none; font-weight:700; }
.account-dialog-actions .account-primary { border-color:#ddc98b; background:#ddc98b; color:#17130b; }

.tray-layer {
  position: relative;
  grid-row: 5;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.75rem;
  column-gap: .35rem;
  row-gap: .1rem;
  align-items: end;
  padding: .1rem .5rem max(.1rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(7, 9, 13, .98), rgba(7, 9, 13, .84), transparent);
}

.tray-row { grid-row: 2; grid-column: 1; display: flex; justify-content: center; align-items: center; gap: .35rem; }
.tray-row .undo-button { flex: 0 0 2.75rem; }
.tray { display: flex; gap: 4px; align-items: center; }

.tray-stone {
  position: relative;
  display: grid;
  place-items: center;
  width: max(2.75rem, var(--tray-stone-width));
  height: max(2.75rem, var(--tray-stone-height));
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  transition: transform .16s ease, filter .16s ease;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
  padding-bottom: 8px;
  box-sizing: content-box;
}

.tray-stone svg { width: var(--tray-stone-width); height: var(--tray-stone-height); overflow: visible; transform-box: fill-box; transform-origin: center; }
.tray-slot-empty { visibility: hidden; }
.tray-stone { min-width: 0; padding: 0 0 8px; }
.tray-stone.selected { transform: translateY(-.15rem); }
.tray-stone::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  border-radius: 2px;
  background: #f4dfa3;
  opacity: 0;
}
.tray-stone.selected::after { opacity: 1; }
.tray-stone:focus-visible { outline: 2px solid #f4dfa3; outline-offset: 2px; border-radius: .3rem; }
.tray-stone[data-resonance="2"] { filter: drop-shadow(0 0 5px var(--stone-glow, #f4e6a7)); }
.tray-stone[data-resonance="3"] { filter: drop-shadow(0 0 8px var(--stone-glow, #f4e6a7)); }
.tray-meta { grid-row: 1; grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; color: #a8abb1; font-size: .625rem; line-height: 1.2; }
.help-button { grid-row: 2; grid-column: 2; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: rgba(27,34,45,.9); color: #f4dfa3; font-size: 1.2rem; text-decoration: none; }
.help-button:hover { background: #303b4a; }

#singularityNote[hidden] { display: none; }
.game-shell[data-world="singularity"] { min-height: calc(min(100vw, 30rem) + 14rem); }
.game-shell[data-world="singularity"] .playfield-layer { padding: .2rem .4rem; }
.game-shell[data-world="singularity"] .board { overflow: hidden; cursor: grab; }
.game-shell[data-world="singularity"] .board:active { cursor: grabbing; }
.tray-stone .stone-sigil { stroke-width: 1.5; }
.game-shell[data-world="singularity"] .game-result { top: 34%; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes fizzle {
  0% { fill: rgba(200, 80, 62, .75); filter: drop-shadow(0 0 10px #c8503e); }
  100% { fill: rgba(11, 15, 20, .32); filter: none; }
}

@keyframes score-dial {
  from { transform: translateY(.08em); opacity: .72; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 31rem) {
  .game-shell { height: min(56rem, 96dvh); border-radius: 1.5rem; box-shadow: 0 1.5rem 5rem #000; }
}

@media (max-width: 369px) {
  .game-shell[data-tray-slots="5"] .tray-row { grid-column: 1 / -1; }
  .game-shell[data-tray-slots="5"] .tray-meta { grid-column: 1; align-self: center; }
  .game-shell[data-tray-slots="5"] .help-button { grid-row: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* A compact goal during play; the full path and calibration stay in dialogs/menu. */
.game-shell[data-mode="progression"] { grid-template-rows: max(6.6rem, calc(env(safe-area-inset-top) + 6rem)) minmax(10rem, 1fr) auto auto auto; }
.journey-button { position: absolute; left: 0; top: 0; min-height: 44px; padding: .25rem .55rem; color: #f4dfa3; background: #0e151dcc; border: 1px solid #b6a06850; border-radius: .65rem; cursor: pointer; font-size: .7rem; }
.journey-button span { display: block; color: #b6beca; font-size: .65rem; }
.journey-strip { margin: .55rem .2rem .2rem; font-size: .72rem; color: #d5d9df; }
.journey-strip[hidden] { display: none; }
.journey-strip > div { display: flex; justify-content: space-between; align-items: center; gap: .5rem; min-height: 1.5rem; }
.journey-strip button { border: 0; background: transparent; color: #f4dfa3; cursor: pointer; font-size: .75rem; padding: .25rem; min-height: 32px; }
.journey-strip progress { display: block; appearance: none; width: 100%; height: 3px; border: 0; border-radius: 4px; overflow: hidden; background: #343d49; }
.journey-strip progress::-webkit-progress-bar { background: #343d49; }
.journey-strip progress::-webkit-progress-value { background: #ead39a; }
.journey-strip progress::-moz-progress-bar { background: #ead39a; }
.journey-dialog { width: min(94vw, 30rem); max-height: 90dvh; padding: 1.1rem; color: #f7f4eb; background: #101720; border: 1px solid #b6a06866; border-radius: 1.2rem; overflow-y: auto; }
.journey-dialog::backdrop { background: #03070be6; backdrop-filter: blur(8px); }
.journey-dialog header { display: flex; justify-content: space-between; gap: .6rem; }
.journey-dialog header button { flex-shrink: 0; align-self: start; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #ffffff30; color: inherit; background: #1d2734; font-size: 1.3rem; cursor: pointer; }
.journey-dialog h1 { font-family: Georgia, serif; font-weight: 400; font-size: 1.65rem; line-height: 1.15; margin: .5rem 0; }
.journey-intro, .journey-note { color: #aeb8c4; font-size: .78rem; line-height: 1.55; }
.journey-cards { display: grid; gap: .6rem; margin: 1rem 0; }
.journey-card { display: flex; gap: .9rem; padding: .9rem; background: linear-gradient(120deg,#242b3b,#151e28); border: 1px solid #ffffff1e; border-radius: .8rem; }
.journey-card.current { border-color: #ead39a; }
.journey-card.locked { background: #151b24; }
.journey-card.beaten { border-color: #79a99580; }
.journey-symbol { align-self: center; width: 2rem; text-align: center; color: #dac28a; font-size: 2.4rem; }
.journey-card.locked .journey-symbol { color: #687282; }
.journey-card-body { flex: 1; min-width: 0; }
.journey-state { color: #acb4c0; font-size: .6rem; text-transform: uppercase; letter-spacing: .12em; }
.journey-card h2 { margin: .25rem 0; font-family: Georgia, serif; font-weight: 400; font-size: 1.35rem; }
.journey-card p { margin: .2rem 0; color: #aeb8c4; line-height: 1.45; font-size: .75rem; }
.journey-card .journey-card-target { color: #e8d7ac; margin: .5rem 0; }
.journey-card button { width: 100%; min-height: 44px; padding: .45rem .6rem; text-align: left; background: #d8c492; color: #11151c; border: 0; border-radius: .45rem; cursor: pointer; font-size: .75rem; }
.journey-card button:disabled { color: #8e98a6; background: #252d39; cursor: default; }
.score-curve { display: block; width: 100%; height: auto; margin: .65rem 0; cursor: crosshair; }
.progression-admin summary { color: #dbc28d; cursor: pointer; }
.progression-admin output { color: #f4dfa3; }
.controls details[hidden], #nextWorld[hidden], #resultNextWorld[hidden] { display: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #f4dfa3; outline-offset: 3px; }

.game-shell[data-mode] .move-score { font-size: 1.15rem; }
.records-nav { display:flex; gap:.55rem; grid-column:1/-1; }
.records-nav a, .result-leaderboard { flex:1; text-align:center; color:#f4dfa3; border:1px solid #ffffff24; border-radius:.55rem; padding:.55rem; text-decoration:none; background:#0b121bcf; }
.result-rank-status { color:#f4dfa3; font-size:.82rem; min-height:1.1rem; }
.result-actions .result-leaderboard { display:inline-flex; align-items:center; justify-content:center; }
.competition-strip{display:grid;gap:.35rem;padding:.5rem .7rem;border:1px solid #ddc98b66;border-radius:.6rem;background:#11151ce8;font-size:.8rem;line-height:1.35}
.competition-strip .competition-actions{display:flex;align-items:center;justify-content:space-between;gap:.5rem}
.competition-strip a{color:#f4dfa3}.competition-strip button{padding:.35rem .65rem;min-height:36px;font-size:.8rem}
.competition-strip p{margin:0}.competition-strip [role=status]{color:#e6d9b4}
.game-shell[data-mode="competition"]{grid-template-rows:max(11.8rem,calc(env(safe-area-inset-top) + 11.4rem)) minmax(10rem,1fr) auto auto auto}
.game-shell[data-mode="competition"] .journey-button{display:none}
.competition-strip{max-height:8rem;overflow:auto}.competition-strip [role="status"]:empty{display:none}

/* World browsing lives over the live playfield; it never changes board geometry. */
.world-swipe-picker {position:absolute;z-index:3;right:.25rem;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:stretch;gap:.4rem;width:4.2rem;color:#fae5ac;text-align:center;}
.world-swipe-picker[hidden] {display:none;}
.world-swipe-picker button {display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"arrow symbol" "name name";place-items:center;min-width:4.2rem;min-height:3.7rem;padding:.28rem .25rem;border:1px solid #e6ce8c88;border-radius:.72rem;background:#0b111cdd;box-shadow:0 .25rem 1rem #0008;color:#fff1c2;cursor:pointer;touch-action:manipulation;backdrop-filter:blur(5px);}
.world-swipe-picker button[hidden] {display:none;}
.world-switch-arrow {grid-area:arrow;font-size:1.45rem;line-height:1;}
.world-switch-symbol {grid-area:symbol;font-size:1.35rem;line-height:1;}
.world-switch[data-world="square"] .world-switch-symbol {
  box-sizing: border-box;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  font-size: 0;
}
.world-switch-name {grid-area:name;max-width:100%;overflow:hidden;text-overflow:ellipsis;color:#d3d3d2;font-size:.55rem;line-height:1.15;white-space:nowrap;}
.world-switch-up .world-switch-arrow {animation:world-nudge-up 1.8s ease-in-out infinite;}
.world-switch-down .world-switch-arrow {animation:world-nudge-down 1.8s ease-in-out infinite;}
@keyframes world-nudge-up {0%,70%,100%{transform:translateY(0)}82%{transform:translateY(-3px)}}
@keyframes world-nudge-down {0%,70%,100%{transform:translateY(0)}82%{transform:translateY(3px)}}
@media(max-width:360px){.world-swipe-picker{right:.1rem;width:3.8rem}.world-swipe-picker button{min-width:3.8rem}}
@media(prefers-reduced-motion:reduce){.world-swipe-picker{transition:none}.world-switch-arrow{animation:none}}

/* v1.1.0: Make the primary play action reachable before advanced menus. */
.primary-play-action { margin: .3rem 0 .15rem; }
.controls .primary-play-action button { width:100%; min-height:3rem; margin:0; border-color:#e0c882; background:#ddc98b; color:#191b21; font-size:1rem; font-weight:800; letter-spacing:.012em; }
.controls .primary-play-action button:focus-visible { outline:3px solid #fff6d8; outline-offset:2px; }
.progression-admin > label {display:block; margin:.65rem 0;}
.resume-dialog { width:min(92vw,27rem); max-height:85dvh; overflow-y:auto; padding:1.3rem; border:1px solid #ddc98b; border-radius:1rem; background:#11151c; color:#f7f4eb; box-shadow:0 1rem 4rem #000d; }
.resume-dialog::backdrop { background:rgba(0,0,0,.84); }
.resume-dialog h2 { font:normal 1.8rem Georgia,serif; margin:.3rem 0 .8rem; }
.resume-dialog p { line-height:1.5; color:#c7c9cc; }
.resume-actions {display:grid;gap:.65rem;margin-top:1.15rem;}
.resume-actions button {min-height:3.1rem;border-radius:.6rem;border:1px solid #70737a;background:#242b36;color:#fff;font-size:1rem;font-weight:700;}
.resume-actions .resume-primary {background:#ddc98b;border-color:#ddc98b;color:#17130b;}
.resume-dialog .resume-note {font-size:.76rem;}

/* Prevent the long account/gallery labels from collapsing into a single-character column. */
.account-panel .story-menu-action { grid-column:1 / -1; width:100%; text-align:left; overflow-wrap:normal; white-space:normal; }
@media (max-width:430px) {
  .account-panel {grid-template-columns:minmax(0,1fr);}
  .account-panel > button {grid-column:1;width:100%;}
}

/* v1.1.0 — uncompromised mobile playfield and restrained chrome */
.score-block {min-width: 7.6rem; min-height: 3.55rem; padding: .25rem .75rem; border: 1px solid #e2c98653;}
.score-block span {font-size:.64rem; letter-spacing:.15em;}
.score-block strong {font-size:clamp(1.75rem, 7.8vw, 2.85rem); line-height:1.06;}
.hud-primary {height:3.65rem;}
.game-shell[data-mode="progression"] {grid-template-rows:max(4.2rem,calc(env(safe-area-inset-top) + 3.85rem)) minmax(10rem,1fr) auto auto auto;}
.journey-strip {display:none!important;}
.journey-button {min-width:3.8rem; height:3.45rem; border-color:#75674666; isolation:isolate; --path-progress:0;}
.journey-perimeter {position:absolute;inset:-2px;width:calc(100% + 4px);height:calc(100% + 4px);overflow:visible;pointer-events:none;}
.journey-perimeter rect {fill:none;stroke:#edd28c;stroke-width:3.2;stroke-dasharray:var(--path-progress,0) 100;transition:stroke-dasharray .4s ease,filter .3s;}
.journey-button[data-near-goal="true"] .journey-perimeter rect {stroke:#fff1b2;filter:drop-shadow(0 0 4px #e6c676);}
.tray-layer::after {content:none!important;}
.tray-meta {padding:0 .2rem;}
.tray-row {justify-content:flex-start;}
.bag-widget {flex:0 0 3.4rem;display:grid;place-items:center;position:relative;min-width:3.2rem;height:3.4rem;color:#f4dfa3;}
.bag-widget svg {width:100%;height:100%;filter:drop-shadow(0 0 5px #d6b57245);}
.bag-widget strong {position:absolute;top:49%;transform:translateY(-40%);font-size:.91rem;line-height:1;color:#ffe7a3;font-variant-numeric:tabular-nums;}
.tray-stone {height:3.35rem; padding:0;box-sizing:border-box;}
.tray-stone::after {content:none!important;}
.tray-stone .tray-socket {position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:37px;height:37px;pointer-events:none;opacity:.85;}
.tray-stone .tray-socket path {stroke:#dbc785;stroke-width:1.35;fill:none;stroke-linejoin:round;}
.tray-stone.selected .tray-socket path {stroke:#ffe7a5;stroke-width:2;filter:drop-shadow(0 0 3px #ebd18c);}
.tray-stone > svg:not(.tray-socket) {z-index:1;position:relative;transform:translateY(-4px);}
.tray-stone.selected > svg:not(.tray-socket) {transform:translateY(-8px);}
.tray-stone.tray-slot-empty {visibility:visible;opacity:.5;}
.tray-stone.tray-slot-empty .tray-socket {opacity:1;}
.undo-button[hidden] {display:none!important;}
.admin-mulligan-toggle {grid-column:1/-1;display:flex;align-items:center;gap:.4rem;}
.admin-mulligan-toggle input {width:auto!important;}
/* Opening reveals are sequenced by opening-deal.js; rerenders never restart a CSS delay. */
.opening-anchor {pointer-events:none;}
.motif-outline {stroke-dasharray:15 85;stroke-dashoffset:0;animation:motif-one-lap .8s linear 1 forwards;filter:drop-shadow(0 0 3px currentColor);}
@keyframes motif-one-lap {from{stroke-dashoffset:0;opacity:.95;}to{stroke-dashoffset:-100;opacity:.9;}}
.game-result[hidden]{display:none!important;}
.game-shell[data-end-emote="active"] .game-result{display:none!important;}
.end-game-emote {position:absolute;inset:26% 4% auto;z-index:12;text-align:center;pointer-events:none;padding:1.1rem;border-radius:1rem;background:#070e18e8;border:1px solid #e6c78299;box-shadow:0 0 36px #d8ae5970;animation:bag-finale 1.45s ease-out both;}
.end-game-emote strong{display:block;color:#fae0a0;font:700 clamp(1.6rem,7vw,2.5rem)/1.1 Georgia,serif;}
.end-game-emote span{display:block;color:#e6e5e1;font-size:.9rem;margin-top:.45rem;}
@keyframes bag-finale{0%{opacity:0;transform:scale(.74);}25%,75%{opacity:1;transform:scale(1);}100%{opacity:0;transform:scale(1.06);}}
@media (prefers-reduced-motion:reduce){.opening-anchor,.motif-outline,.end-game-emote{animation:none;opacity:1;}}

/* Round 2: keep result headings clear of the persistent HUD, including Circle. */
.game-result,.game-shell[data-world="singularity"] .game-result {top:90px;bottom:100px;transform:translateX(-50%);max-height:none;z-index:30;padding-top:3rem;}
.modal-close {position:absolute;top:.5rem;right:.5rem;z-index:10;width:44px;height:44px;border:1px solid #d8c28a70;border-radius:50%;background:#111b28;color:#fff;font-size:1.6rem;cursor:pointer;}
dialog {padding-top:3.5rem;}
.show-results {pointer-events:auto;cursor:pointer;}
.show-results[hidden]{display:none;}
.result-account-reminder {order:2;}
.game-result {display:flex;flex-direction:column;}
.result-actions {order:1;}
#resultNewGame {background:#e4c984;color:#131820;font-weight:bold;}
#resultCoaching {font-size:.85rem;line-height:1.4;}

.emote-points {display:block;color:#ffe5a3;font-size:clamp(1.4rem,5vw,2.3rem);font-weight:800;font-variant-numeric:tabular-nums;text-shadow:0 2px 12px #000;}

/* Board faces never cast onto adjacent faces. The shared underlay supplies exposed-edge depth. */
#board .stone-shape {filter:none;}
#board .occupied-shadow {filter:drop-shadow(0 4px 5px rgba(0,0,0,.42));}

/* Round 5: compact HUD and bounded, consistent control panels. */
.score-block {min-width:4rem;min-height:0;padding:.15rem .65rem;border:0;border-radius:.75rem;}
.score-block span {font-size:.55rem;letter-spacing:.12em;}
.score-block strong {font-size:2rem;line-height:1.1;}
.controls {position:absolute;top:4rem;left:.7rem;right:.7rem;max-height:calc(100dvh - 6rem);overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box;}
.controls-heading {grid-column:1/-1;position:relative;min-height:3rem;padding-right:5rem;}
.menu-login {position:absolute;right:0;top:0;width:auto!important;min-width:4rem;}
.share-game {width:44px!important;min-width:44px;flex:0 0 44px;padding:.5rem;}
.primary-play-action {display:flex;align-items:center;gap:.5rem;}
.primary-play-action #newGame {flex:1;}
#challengeBoard {color:#f4dfa3;padding:.5rem 0;align-self:center;}
.tray-row {position:relative;justify-content:center;min-height:3.8rem;width:100%;}
.tray {position:absolute;left:50%;transform:translateX(-50%);display:flex;justify-content:center;}
.tray-socket {display:none!important;}
.tray-stone {height:44px;border:0;background:none;}
.tray-stone > svg:not(.tray-socket) {transform:none;}
.tray-stone.selected > svg:not(.tray-socket) {transform:translateY(-4px);}
.bag-widget {position:absolute;left:0;top:0;display:flex;flex-direction:column;gap:.2rem;align-items:center;min-width:44px;height:auto;}
.bag-widget span {font-size:.6rem;color:#c7c9cc;}
.bag-widget strong {position:static;transform:none;display:grid;place-items:center;width:44px;height:44px;border:1px solid #ffffff35;border-radius:50%;font-size:.95rem;background:#111b28;color:#f4dfa3;}
.tray-row #undoMove {position:absolute;left:3.2rem;}
.journey-dialog {box-sizing:border-box;width:min(calc(100vw - 3rem),calc(30rem - 1.4rem));height:auto;max-height:calc(100dvh - 6rem);overflow-y:auto;padding:1.15rem;margin:auto;}
.journey-dialog .journey-card {padding:.75rem;}
.journey-dialog h1 {font-size:1.35rem;}
dialog {box-sizing:border-box;max-height:calc(100dvh - 2rem);overflow-y:auto;}
@media(min-width:650px){.controls {max-height:min(calc(100dvh - 7rem),calc(56rem - 7rem));}.journey-dialog {max-height:min(calc(100dvh - 7rem),calc(56rem - 7rem));}}

.controls [hidden],.tray-layer [hidden]{display:none!important;}
.tray-row{grid-column:1/-1;}
.help-button{z-index:2;}

.journey-card {align-items:center;gap:.7rem;}
.journey-card h2 {display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;}
.journey-lock-label {font:600 .6rem system-ui,sans-serif;letter-spacing:.1em;color:#aeb8c4;}
.journey-card .journey-play {position:relative;flex:0 0 80px;width:80px;height:80px;min-height:80px;padding:0;background:transparent;border:0;border-radius:0;text-align:center;}
.journey-card .journey-play:disabled {background:transparent;}
.journey-play svg {position:absolute;inset:0;width:80px;height:80px;overflow:visible;}
.journey-play path {fill:#d8c492;stroke:#f0dba5;stroke-width:1.5;stroke-linejoin:round;}
.journey-play:disabled path {fill:#252d39;stroke:#5f6d7d;}
.journey-play-label {position:relative;z-index:1;display:block;font-size:.7rem;color:#11151c;font-weight:650;}
.journey-play[data-world="triangle"] .journey-play-label {transform:translateY(13px);}
.journey-play:disabled .journey-play-label {color:#b8c1cc;}

.tray-meta{justify-content:flex-end;}

/* Formation celebrations live exclusively on the actual tile boundary. */
.formation-board-points{fill:#ffe7a3;stroke:#08101a;stroke-width:5px;paint-order:stroke fill;stroke-linejoin:round;font-weight:800;pointer-events:none;}
@media(prefers-reduced-motion:reduce){.motif-outline{stroke-dasharray:none;animation:none;}}

/* v1.1.2: stable selection cue, separate from legal-move glow. */
.tray-stone::after{content:""!important;position:absolute;left:20%;right:20%;bottom:0;height:3px;border-radius:2px;background:#f4dfa3;opacity:0;pointer-events:none;}
.tray-stone.selected{transform:none;}
.tray-stone.selected::after{opacity:1;}
.tray-stone[data-playable="false"]{filter:none;}
.tray-stone[data-playable="false"]::before{opacity:0!important;animation:none!important;}
.tray-stone[data-playable="false"]>svg{opacity:.65;filter:none!important;animation:none!important;}
.feedback-layer p:empty{display:none;}

/* v1.4.0 shared menus and compact footer labels. Cinematic stories keep their full-screen layout. */
.menu-dialog,.controls.menu-dialog,.journey-dialog.menu-dialog {position:fixed;inset:0;box-sizing:border-box;width:min(420px,calc(100vw - 2rem));height:auto;max-height:calc(100dvh - 4rem);margin:auto;padding:20px;border:1px solid #75684880;border-radius:20px;background:#101923;color:#f4eee3;overflow-y:auto;overscroll-behavior:contain;box-shadow:0 12px 40px #0008;}
.menu-dialog::backdrop {background:#03070bba;backdrop-filter:blur(5px);}
.menu-dialog[hidden] {display:none!important;}
.controls.menu-dialog {display:block;left:0;right:0;top:0;}
.controls.menu-dialog[data-live="true"] {top:auto;bottom:max(1rem,calc((100dvh - 56rem)/2 + 1rem));border-radius:20px 20px 16px 16px;}
.menu-header {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;}
.menu-header>div {display:flex;align-items:center;gap:6px;}
.menu-header h2 {margin:0;font:normal 1.3rem Georgia,serif;}
.menu-header button,#closeJourney {flex:0 0 auto;width:44px;min-width:44px;height:44px;padding:0;border:1px solid #ffffff28;border-radius:50%;background:#172331;color:inherit;}
.menu-header .menu-login {position:static;min-width:0;width:auto!important;border:0;background:transparent;color:#e4cc8f;padding:8px;text-decoration:none;}
.controls .menu-settings {margin:0 0 16px;border:0;border-bottom:1px solid #33404d;padding-bottom:8px;}
.controls summary {list-style:none;min-height:48px;padding:12px 0;display:flex;justify-content:space-between;align-items:center;gap:8px;color:#f4eee3;cursor:pointer;}
.controls summary::-webkit-details-marker {display:none;}
.controls summary::after {content:'⌄';color:#e4cc8f;}
.controls details[open]>summary::after {transform:rotate(180deg);}
.controls .quick-settings {display:grid;grid-template-columns:1.25fr 1fr 1fr;gap:10px;}
.controls .quick-settings label {font-size:12px;display:grid;grid-template-rows:32px 44px;gap:4px;color:#b1bccb;margin:0;}
.controls .quick-settings select {min-height:44px;width:100%;font-size:16px;padding:7px;border:1px solid #33404d;background:#1b2733;color:#f4eee3;border-radius:8px;}
.controls .menu-primary {display:block;width:100%;min-height:46px;margin:8px 0;background:#e4cc8f;color:#15191e;border:0;border-radius:9px;font-weight:700;padding:10px;}
.controls .menu-text-action,.menu-text-action {display:inline-flex;align-items:center;min-height:40px;padding:8px 0;border:0;background:transparent;color:#e4cc8f;font-size:13px;text-decoration:none;}
.controls .menu-context {display:flex;align-items:center;justify-content:space-between;gap:12px;margin:14px 0;}
.menu-context strong {font:normal 1.4rem Georgia,serif;}
.menu-record {font-size:12px;color:#e4cc8f;}
.controls .menu-tabs {display:flex;border-bottom:1px solid #33404d;margin:18px 0 8px;gap:6px;padding-bottom:8px;}
.controls .menu-tabs button {flex:1;padding:10px;min-height:44px;background:transparent;border:0;border-radius:8px;color:#b1bccb;}
.controls .menu-tabs button[aria-pressed="true"] {background:#1b2733;color:#e4cc8f;}
.controls[data-live="false"] .menu-section>summary {display:none;}
.controls .menu-section {border:0;}
.controls .menu-subsection {border-bottom:1px solid #33404d;}
.menu-score-list {list-style:none;padding:0;margin:0 0 10px;font-size:13px;}
.menu-score-list li {display:flex;justify-content:space-between;align-items:center;gap:12px;padding:9px 0;font-variant-numeric:tabular-nums;}
.menu-score-list strong {font-weight:500;}
.menu-caption {color:#b1bccb;font-size:12px;line-height:1.5;}
.controls .menu-row,.menu-row {display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;border:0;border-bottom:1px solid #33404d;background:transparent;color:#f4eee3;text-align:left;padding:12px 0;text-decoration:none;font-size:14px;}
.controls .menu-account {display:flex;flex-direction:row;align-items:center;gap:10px;color:#b1bccb;font-size:12px;margin:18px 0 0;}
.menu-account strong {font-weight:500;color:#f4eee3;}
.menu-account-copy{display:flex;flex-direction:column;gap:3px;min-width:0}.menu-account-tile{flex:0 0 42px;width:42px;height:42px}.menu-profile-tile{display:block;width:42px;height:42px}
#adminMenuTools {margin-top:16px;border-top:1px solid #33404d;padding-top:14px;}
.tray-layer {display:block;padding:26px 8px max(8px,env(safe-area-inset-bottom));min-height:86px;}
.tray-meta {display:none;}
.tray-row {min-height:52px;width:100%;}
.bag-widget {top:0;gap:0;}
.bag-widget>span {position:absolute;bottom:calc(100% + 9px);left:50%;transform:translateX(-50%);font-size:10px;white-space:nowrap;color:#c7c9cc;}
.help-widget {position:absolute;right:8px;bottom:max(8px,env(safe-area-inset-bottom));display:flex;flex-direction:row;align-items:center;gap:6px;}
.help-widget .build-version {position:absolute;bottom:calc(100% + 9px);left:50%;transform:translateX(-50%);font-size:10px;white-space:nowrap;color:#c7c9cc;}
.help-widget .help-button,.help-widget .pause-game {position:static;display:grid;place-items:center;width:44px;height:44px;}
.tray {max-width:calc(100% - 162px);gap:2px;}
.journey-dialog .journey-cards {display:flex;flex-direction:column;gap:0;}
.journey-dialog .journey-card {display:grid;grid-template-columns:minmax(0,1fr) 62px;gap:8px 14px;border:0;border-radius:0;border-bottom:1px solid #33404d;padding:18px 0;background:transparent;}
.journey-card-body h2 {font:normal 1.35rem Georgia,serif;margin:0 0 5px;}
.journey-card-body>p {margin:5px 0;font-size:12px;color:#b1bccb;}
.journey-card-body .journey-card-target {color:#e4cc8f;font-size:11px;}
.journey-dialog .journey-play {width:62px;height:62px;min-height:62px;flex-basis:62px;}
.journey-play>svg {width:62px;height:62px;}
.journey-play-label {position:absolute;inset:0;display:grid;place-items:center;}
.journey-play[data-world="triangle"]:not(:disabled) .journey-play-label {transform:translateY(10px);}
.journey-play:disabled .journey-play-label {transform:none!important;}
.journey-play .journey-lock-icon {position:static;display:block;width:18px;height:18px;}
.journey-lock-icon path {fill:none!important;stroke:#b1bccb!important;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.journey-stats {grid-column:1/-1;white-space:nowrap;font-size:12px;color:#b1bccb;margin:4px 0;font-variant-numeric:tabular-nums;}
.journey-actions {grid-column:1/-1;display:flex;flex-direction:column;align-items:flex-start;}
.journey-actions button,.journey-actions a {display:flex;align-items:center;min-height:38px;padding:6px 0;border:0;background:transparent;color:#e4cc8f;text-decoration:none;font-size:13px;}
.player-dialog label {display:flex;flex-direction:column;gap:6px;margin:14px 0;font-size:13px;color:#b1bccb;}
.player-dialog input,.player-dialog select {width:100%;min-height:44px;background:#1b2733;color:#f4eee3;border:1px solid #33404d;border-radius:8px;padding:8px;font-size:16px;}
.player-dialog .player-action {min-height:44px;border:1px solid #33404d;border-radius:8px;background:#1b2733;color:#e4cc8f;padding:8px 12px;margin:6px 6px 6px 0;}
.player-tile {width:96px;height:96px;display:block;margin:14px auto;touch-action:none;}
@media(max-width:350px){.menu-dialog,.controls.menu-dialog,.journey-dialog.menu-dialog{padding:16px;}.journey-stats{font-size:11px}.controls .quick-settings{gap:6px;}.tray{gap:0;}}

/* Feedback is centered on the tray boundary without consuming board space. */
.feedback-layer {position:absolute;grid-row:auto;left:12px;right:12px;top:0;bottom:auto;min-height:0;height:0;margin:0;padding:0;z-index:32;pointer-events:none;display:block;}
.feedback-layer .tray-notice {position:absolute;top:0;bottom:auto;left:50%;transform:translate(-50%,-50%);width:max-content;max-width:min(100%,360px);min-height:44px;margin:0;padding:9px 14px;border:1px solid #e4cc8f3d;border-radius:12px;background:#101923d9;color:#f4eee3;font-size:13px;font-weight:400;line-height:1.45;text-align:center;backdrop-filter:blur(6px);opacity:1;transition:opacity 220ms ease;}
.feedback-layer .tray-notice[data-fading="true"] {opacity:0;}
.feedback-layer .show-results:focus-visible {outline:2px solid #e4cc8f;outline-offset:3px;}
@media(prefers-reduced-motion:reduce){.feedback-layer .tray-notice{transition:none;}}
.feedback-layer .feedback-emote {bottom:14px;}
.feedback-layer:has(p:not(:empty)) .feedback-emote {bottom:76px;}
.menu-dialog>header {position:sticky;top:0;z-index:3;background:#101923;padding:6px 0;}
.tray-layer {padding-top:34px;}
.tray-row {min-height:44px;}
.motif-glows .motif-outline {stroke-dasharray:15 85;stroke-dashoffset:0;animation:motif-one-lap .8s linear 1 forwards;}
@media(prefers-reduced-motion:reduce){.motif-glows .motif-outline{animation:none;stroke-dasharray:none;}}
.feedback-layer .tray-notice {display:flex;align-items:center;justify-content:center;gap:8px;}
.feedback-layer p:empty {display:none;}
.feedback-layer:has(.show-results:not([hidden])) #status {display:none;}
.status-reaction {width:48px;height:48px;flex-shrink:0;animation:reaction-pop .7s ease-out both;}
@keyframes reaction-pop{0%{transform:scale(.6) rotate(-8deg)}55%{transform:scale(1.12) rotate(5deg)}100%{transform:scale(1) rotate(0)}}
@media(prefers-reduced-motion:reduce){.status-reaction{animation:none;}}
.player-dialog .player-action {display:inline-flex;align-items:center;justify-content:center;text-decoration:none;}
.menu-dialog>.menu-header {position:sticky;top:0;z-index:3;background:#101923;padding:6px 0;}
.controls .quick-settings label {letter-spacing:normal;text-transform:none;}
.admin-feature-flags {display:grid;gap:9px;margin:14px 0;padding:12px;border:1px solid #33404d;border-radius:10px;}
.admin-feature-flags legend {padding:0 5px;color:#e4cc8f;font-size:11px;letter-spacing:.08em;text-transform:uppercase;}
.admin-feature-flags label {display:flex;align-items:center;gap:9px;margin:0;}
.admin-feature-flags input {width:auto;min-height:auto;}
.player-danger {border-color:#dc6554!important;background:#431f22!important;color:#ffd9d2!important;}
.player-danger-copy {padding:10px 12px;border-left:3px solid #dc6554;background:#dc65541f;color:#ffd9d2;line-height:1.5;}
.connection-banner {position:fixed;z-index:120;left:50%;bottom:max(102px,calc(env(safe-area-inset-bottom) + 88px));transform:translateX(-50%);width:max-content;max-width:min(92vw,28rem);margin:0;padding:8px 12px;border:1px solid #e4cc8f66;border-radius:10px;background:#101923ee;color:#f4eee3;font-size:12px;line-height:1.35;text-align:center;box-shadow:0 8px 26px #0009;pointer-events:none;}
.connection-banner[hidden] {display:none;}

/* v1.4.0: eligibility is a quiet score-frame state, not another HUD badge. */
.score-block[data-leaderboard-eligible="true"] {border-color:#e4cc8f;box-shadow:0 0 0 1px #e4cc8f55,0 0 11px #e4cc8f45,0 3px 16px #0008;}
.game-shell[data-mode="competition"] .score-block,.game-shell[data-mode="tutorial"] .score-block {border-color:#ffffff26;box-shadow:0 3px 16px #0008;}
.journey-button[data-target-met="true"] .journey-perimeter rect {stroke:#ffe39a;filter:drop-shadow(0 0 6px #e6c676);}

.menu-dialog,.controls.menu-dialog,.journey-dialog.menu-dialog {width:min(420px,calc(min(100vw,30rem) - 1.5rem));max-height:min(calc(100dvh - 2rem),calc(56rem - 2rem));}
.menu-user {display:flex!important;align-items:center;gap:7px;width:auto!important;max-width:180px;min-height:44px!important;margin:0!important;padding:4px 8px!important;border:0!important;background:transparent!important;color:#f4eee3!important;cursor:pointer;}
.menu-user>span:last-child {max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;}
.menu-account-tile,.menu-profile-tile {display:block;width:34px;height:34px;flex:0 0 34px;border-radius:50%;overflow:hidden;}
.menu-profile-tile {width:34px;height:34px;}
.player-tile,.registration-tile {border-radius:50%;}
.controls .menu-settings {margin:4px 0 14px;padding:12px;border:1px solid #33404d;border-radius:12px;background:#131e29;}
.menu-section-title {margin:0 0 9px;color:#e4cc8f;font:600 11px/1.2 system-ui,sans-serif;letter-spacing:.14em;text-transform:uppercase;}
.menu-context {display:grid!important;grid-template-columns:34px minmax(0,1fr) auto;min-height:54px;padding:9px 10px;border:1px solid var(--level-accent,#e4cc8f66);border-radius:12px;background:linear-gradient(100deg,var(--level-wash,#e4cc8f18),transparent);}
.menu-context[data-world="triangle"] {--level-accent:#e0bd65;--level-wash:#e0bd6524;}
.menu-context[data-world="square"] {--level-accent:#79a995;--level-wash:#79a99524;}
.menu-context[data-world="hexagon"] {--level-accent:#72a8d8;--level-wash:#72a8d824;}
.menu-context[data-world="singularity"] {--level-accent:#b28ad7;--level-wash:#b28ad724;}
.menu-world-icon {display:grid;place-items:center;width:30px;height:30px;border:1px solid var(--level-accent);border-radius:50%;color:var(--level-accent);font-size:20px;}
.menu-eligibility {margin:5px 2px 11px;color:#b9c2ce;font-size:11px;line-height:1.4;}
.menu-eligibility[data-eligible="true"] {color:#ffe7a3;}
.controls .menu-section {padding:4px 0;}
.menu-summary-card {margin:8px 0;padding:11px 12px;border:1px solid #33404d;border-radius:12px;background:#131e29;}
.menu-summary-card h4 {display:flex;justify-content:space-between;gap:12px;margin:0;color:#f4eee3;font-size:13px;}
.menu-summary-card .menu-score-list {margin-bottom:4px;}
.journey-card[data-world="triangle"] {--level-accent:#e0bd65;}.journey-card[data-world="square"] {--level-accent:#79a995;}.journey-card[data-world="hexagon"] {--level-accent:#72a8d8;}.journey-card[data-world="singularity"] {--level-accent:#b28ad7;}
.journey-dialog .journey-card {border-left:3px solid var(--level-accent,#33404d);padding-left:12px;}
.journey-card .journey-play path {stroke:var(--level-accent,#f0dba5);}
.world-art img:not([src]) {visibility:hidden;}
.icon-button.competition-react {left:0;right:auto;font-size:11px;}

/* Signed-in identity remains the game-menu trigger, within the original HUD. */
.game-shell{--hud-side-width:3.8rem;--hud-side-height:3.45rem}
.journey-button{width:var(--hud-side-width);min-width:var(--hud-side-width);height:var(--hud-side-height)}
#controlsToggle{width:var(--hud-side-width);height:var(--hud-side-height);min-height:var(--hud-side-height);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:4px;border-color:#75674666;border-radius:.65rem;background:#0e151dcc}
#controlsToggle [hidden]{display:none!important}
.controls-avatar{display:block;width:28px;height:28px;flex:0 0 28px;border-radius:50%;overflow:hidden}
.controls-profile-tile{display:block;width:100%;height:100%}
.controls-username{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.65rem;line-height:12px;color:#b6beca}
/* Center the glyph itself and reserve a separate corner for the close control. */
.modal-close,.instructions-dialog .modal-close{display:grid;place-items:center;padding:0;line-height:1}
.modal-close svg{display:block;width:18px;height:18px;pointer-events:none}

.controls-login-label{display:flex;align-items:center;justify-content:center;font-size:.7rem;font-weight:400;line-height:1.2}

.menu-header>div{min-width:0;flex:1;justify-content:flex-end}
#menuProfile{min-width:0;flex:0 1 auto}
#menuProfile>span:last-child{min-width:0;flex:1 1 auto}
@media(max-width:350px){.menu-context strong{font-size:20px}.menu-context .menu-record{max-width:94px;white-space:normal;text-align:right;line-height:1.3}}

/* v1.4.0 completed-game summary and on-playfield replay. */
.game-result,.game-shell[data-world="singularity"] .game-result{top:84px;bottom:96px;width:min(92%,27rem);padding:2.7rem 1rem 1rem;display:block;text-align:left;scrollbar-width:thin}
.game-result h1,.game-result>p{text-align:center}
.game-result h1{font-size:1.45rem}
.game-result #resultReason{margin:.25rem 0 .7rem;color:#c7c9cc;font-size:.76rem}
.result-summary{display:grid;grid-template-columns:minmax(0,1fr) 7.2rem;gap:.55rem;align-items:stretch}
.result-score,.result-small-tiles>div,.result-records a,.result-stat-grid>div,.result-stat-grid>button{border:1px solid #ffffff20;border-radius:.65rem;background:#111a25;text-align:center}
.result-score{display:grid;place-content:center;min-height:5.35rem;padding:.45rem}
.result-score strong{display:block;color:#f4dfa3;font-size:2.35rem;line-height:1;font-variant-numeric:tabular-nums}
.result-score span,.result-small-tiles span,.result-records span,.result-stat-grid span{display:block;margin-top:.22rem;color:#aeb8c4;font-size:.63rem;line-height:1.2}
.result-small-tiles{display:grid;grid-template-rows:repeat(2,minmax(0,1fr));gap:.4rem}
.result-small-tiles>div{display:grid;place-content:center;min-height:2.45rem;padding:.2rem .35rem}
.result-small-tiles strong{font-size:.82rem;font-variant-numeric:tabular-nums}
.result-records{display:grid;grid-template-columns:1fr 1fr;gap:.55rem;margin:1.05rem auto .65rem;max-width:21rem}
.result-records a{display:grid;place-content:center;min-height:3rem;padding:.4rem;color:#f7f4eb;text-decoration:none}
.result-records strong{color:#f4dfa3;font-size:.9rem}
.result-records a.earned{border-color:#d8b95f;background:#d8b95f18;box-shadow:inset 0 0 0 1px #d8b95f44}
.game-result #resultDetails,.game-result #resultCoaching,.result-rank-status{margin:.35rem auto;max-width:24rem;text-align:center;font-size:.72rem;line-height:1.35}
.result-rank-status{min-height:0;color:#d8c48d}
.result-actions{order:initial;display:grid;gap:.55rem;margin:1rem 0 0}
.result-actions button{min-height:2.7rem}
.result-action-row,.result-social-row{display:grid;grid-template-columns:1fr 1fr;gap:.55rem}
#resultNextWorld,#resultNewGame{display:flex;align-items:center;justify-content:center;gap:.5rem}
#resultNextWorld{border-color:#d8c48d;background:#d8c48d;color:#111821;font-weight:800}
#resultNewGame{background:#242b36;color:#f7f4eb;font-weight:700}
.level-button-geometry{display:block;width:1.25rem;height:1.25rem;flex:0 0 auto;overflow:visible;fill:none;stroke:currentColor;stroke-width:7;stroke-linecap:round;stroke-linejoin:round}
#resultNextWorld .level-button-geometry{width:1.7rem;height:1.7rem;stroke-width:6}
#resultNewGame .level-button-geometry{width:1.35rem;height:1.35rem}
.level-button-arrow{font-size:1.05em}
.result-stats{margin:1.15rem 0 0;padding-top:.9rem;border-top:1px solid #ffffff1f}
.result-stats h2{margin:0 0 .55rem;color:#c9d0da;font-size:.68rem;letter-spacing:.13em;text-transform:uppercase;text-align:center}
.result-stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.45rem}
.result-stat-grid>div,.result-stat-grid>button{display:grid;place-content:center;min-width:0;min-height:3.45rem;padding:.38rem .25rem;color:#f7f4eb}
.result-stat-grid strong{font-size:1rem;font-variant-numeric:tabular-nums}
.result-stat-grid>button{border-color:#d8c48d;background:#111a25;cursor:pointer;font:inherit}
.result-stat-grid>button:disabled{border-color:#ffffff20;cursor:default;opacity:.6}
.result-social{margin:1.15rem 0 0;padding-top:1rem;border-top:1px solid #ffffff1f}
.result-social>p{margin:0 0 .55rem!important;padding-left:.65rem;border-left:4px solid #ddc98b;color:#c7c9cc;font-size:.75rem;line-height:1.4;text-align:left!important}
.result-social-row button{display:flex;align-items:center;justify-content:center;gap:.5rem;min-height:2.75rem;padding:.55rem;border:1px solid #62616b;border-radius:.6rem;background:#242b36;color:#f7f4eb;font-weight:700;cursor:pointer}
.result-social-row svg{order:2;width:18px;height:18px;fill:currentColor;flex:0 0 18px}
.result-social-row .challenge-icon{fill:none}
.result-account-reminder{order:initial}

.result-replay[hidden],.result-replay-controls[hidden]{display:none!important}
.result-replay{position:absolute;inset:0;z-index:7;display:block;background:transparent}
.result-replay-board{position:absolute;inset:0;width:100%;height:100%}
.result-replay-controls{display:grid;width:100%;gap:.28rem}
.result-replay-status{color:#d8c48d;font-size:.66rem;font-weight:700;letter-spacing:.08em;text-align:center;text-transform:uppercase}
.result-replay-buttons{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.35rem;width:100%}
.result-replay-buttons button{min-width:0;min-height:2.75rem;padding:.35rem .25rem;border:1px solid #62616b;border-radius:.6rem;background:#242b36;color:#f7f4eb;font-size:.72rem;font-weight:700}
.result-replay-buttons #resultReplayExit{border-color:#d8c48d;color:#f4dfa3;background:#111a25}
.game-shell[data-replay-active="true"] #board,.game-shell[data-replay-active="true"] .game-result,.game-shell[data-replay-active="true"] .show-results,.game-shell[data-replay-active="true"] .world-swipe-picker{display:none!important}
.game-shell[data-replay-active="true"] .tray-meta,.game-shell[data-replay-active="true"] #bagWidget,.game-shell[data-replay-active="true"] #undoMove,.game-shell[data-replay-active="true"] #tray,.game-shell[data-replay-active="true"] .help-widget{display:none!important}
.game-shell[data-replay-active="true"] .tray-layer{display:block!important;padding-top:.45rem}
.game-shell[data-replay-active="true"] .tray-row{min-height:3.8rem}
.game-shell[data-replay-active="true"] .result-replay-controls{display:grid!important}
@media(max-width:350px){.game-result,.game-shell[data-world="singularity"] .game-result{width:94%;padding-inline:.75rem}.result-summary{grid-template-columns:minmax(0,1fr) 6.3rem}.result-stat-grid{grid-template-columns:repeat(2,1fr)}.result-social>p{font-size:.7rem}}
.competition-winner{margin:.35rem 0;padding:.55rem .65rem;border:2px solid #d8b95f;border-radius:.55rem;background:#d8b95f18;color:#ffe8a4;font-weight:800}
.pause-game{display:grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid rgba(255,255,255,.28);border-radius:50%;background:rgba(27,34,45,.9);color:#d8c48d;cursor:pointer}
.pause-game:hover{background:#303b4a}
.pause-game svg{display:block;width:18px;height:18px;fill:currentColor}
.pause-game[hidden]{display:none}
.pause-overlay{position:absolute;z-index:44;inset:0;display:grid;place-content:center;gap:.65rem;padding:2rem;background:#070b11ed;text-align:center}
.pause-overlay[hidden]{display:none}
.pause-overlay p{margin:0;color:#d8c48d;font-size:.68rem;font-weight:800;letter-spacing:.22em}
.pause-overlay h2{margin:0;font:2rem/1.1 Georgia,serif}
.pause-overlay span{color:#b7c0cc;font-size:.82rem}
.pause-overlay button{min-height:2.8rem;margin-top:.6rem;border:1px solid #d8c48d;border-radius:.6rem;background:#d8c48d;color:#111821;font-weight:800}
.controls .menu-row[hidden]{display:none!important}

.solo-connection{position:absolute;z-index:80;top:80px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 2rem);display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:.5rem;padding:.6rem .8rem;border:1px solid #bba46d;border-radius:8px;background:#101923ed;color:#f3e7c6;font-size:.8rem;box-shadow:0 3px 15px #0008}.solo-connection[hidden],.solo-connection [hidden]{display:none}.solo-connection button{padding:.35rem .6rem;font:inherit}
