:root {
  color-scheme: dark;
  font-family: "Geist", "Inter", system-ui, sans-serif;
  background: #121715;
  color: #f1f5ee;
  --muted: #a4b2a9;
  --line: #344039;
  --mint: #bdffa3;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
.privacy-page { width: min(100%, 46rem); margin: 0 auto; padding: clamp(1.5rem, 6vw, 4rem) 1.25rem; line-height: 1.65; }
.privacy-page h1 { margin: 1.5rem 0 .5rem; font-size: clamp(2.4rem, 6vw, 3.5rem); letter-spacing: -.045em; }
.privacy-page h2 { margin: 2rem 0 .5rem; font-size: 1.35rem; line-height: 1.25; }
.privacy-page p { margin: .65rem 0; }
.privacy-page a, .account-page a { color: var(--mint); text-underline-offset: .18em; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:focus-visible, canvas:focus-visible, textarea:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
[hidden] { display: none !important; }
.privacy-footer { margin-top: 20px; text-align: center; }
.privacy-actions { display: grid; gap: 9px; }
#privacy-dialog h2 { font-size: 2rem; }
#privacy-dialog p { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.cube-preview .privacy-footer { display: none; }
.masthead {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); max-width: 1100px;
  margin: auto; padding: 20px 0;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; font-weight: 740; letter-spacing: -.035em; }
.mark { display: grid; grid-template-columns: repeat(2, 7px); gap: 2px; transform: rotate(-9deg); }
.mark i { height: 7px; background: var(--mint); border-radius: 1.5px; }
.mark i:last-child { opacity: .45; }
.game-categories { display: flex; flex-wrap: wrap; gap: 6px; }
.game-categories a { display: grid; place-items: center; min-width: 44px; text-decoration: none; }
.game-categories button { display: flex; align-items: center; gap: 6px; }
.game-categories button[aria-haspopup] { background: transparent; }
#puzzle-preview { text-align: center; }
#puzzle-preview .label { margin-top: 0; }
#puzzle-preview h2 { margin: 0; }
#preview-image { display: block; width: min(100%, 300px, 44svh); height: auto; margin: auto; }
#preview-access { color: var(--muted); font-size: .9rem; }
.game-categories small { font: 500 .64rem var(--mono); }
.game-categories [aria-current="page"] { color: var(--mint); border-color: #6a896c; }
.game-categories a:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.label, .format { font: 600 .7rem var(--mono); letter-spacing: .115em; color: var(--muted); }
main { max-width: 1040px; margin: auto; padding: 44px 0 40px; }
.intro { margin-bottom: 25px; }
h1 { margin: 0; font-size: clamp(2.45rem, 6.6vw, 4.65rem); line-height: 1; letter-spacing: -.08em; }
h1 span { color: var(--mint); }
.intro p { margin: 13px 0 0; color: var(--muted); }
.cube-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 24px; margin: 0 0 18px; }
.cube-picker .setting-control { gap: 12px; }
.cube-picker .setting-control select { min-width: 170px; }
#cube-access { flex: 1; min-width: 230px; margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.board { display: grid; grid-template-columns: minmax(0, 1.57fr) minmax(0, 1fr); gap: 14px; }
.viewer, .panel { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.viewer {
  position: relative; min-height: 420px;
  background: radial-gradient(ellipse at 50% 45%, #2a3a30 0%, #1b2520 55%, #171f1b 100%);
}
.viewer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(#a4b9a32d 1px, transparent 1px) center / 20px 20px;
  mask-image: radial-gradient(ellipse, #000, transparent 90%);
}
.viewer-top { position: absolute; top: 13px; left: 14px; right: 14px; z-index: 1; display: flex; justify-content: space-between; gap: 6px; }
.view-actions { display: flex; gap: 6px; margin-left: auto; }
.quiet { color: var(--muted); background: #1b2520; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-height: 40px; font-size: .8rem; }
.quiet:hover { color: #fff; border-color: #708477; }
#cube { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; outline-offset: -4px; }
#cube:active { cursor: grabbing; }
.viewer-bottom { position: absolute; inset: auto 0 17px; text-align: center; pointer-events: none; font-size: .8rem; color: #c0ccc3; }
.viewer-bottom [aria-hidden] { color: var(--mint); margin-right: 5px; }
.panel { background: #1a211d; }
.clock, .turns { padding: 22px; }
.clock { position: relative; border-bottom: 1px solid var(--line); }
#get-hint, #view-result { position: absolute; right: 14px; top: 14px; }
#phase { color: var(--mint); }
#timer { font: 600 clamp(2.8rem, 5.8vw, 4.5rem)/1 var(--mono); letter-spacing: -.085em; margin-top: 10px; white-space: nowrap; }
#timer span { color: var(--muted); font-size: .4em; margin-left: 8px; }
#hint { color: var(--muted); font-size: .83rem; margin: 12px 0; min-height: 2.35em; }
#next-release { color: var(--muted); font-size: .78rem; margin: 8px 0 0; }
#next-release-time { color: var(--mint); font-family: var(--mono); }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 9px 13px; background: var(--mint); border: 0; border-radius: 8px; color: #172414; font-weight: 750; font-size: .9rem; }
.primary:hover { background: #d7ffc6; }
.turn-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.turn-head h2 { margin: 0; }
#move-count { color: var(--mint); font: .72rem var(--mono); }
.turn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pyraminx-preview .turn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#reverse, #wide { min-height: 44px; }
#wide { touch-action: none; user-select: none; }
.reverse-control { display: grid; justify-items: center; gap: 4px; }
.shift-hint { color: var(--muted); font: .66rem var(--mono); }
#reverse[aria-pressed="true"], #reverse:active:enabled, #reverse.key-held, #wide[aria-pressed="true"] { color: var(--mint); border-color: var(--mint); background: #293c2e; }
#reverse:disabled, #wide:disabled { opacity: .55; cursor: default; }
.turn {
  position: relative; background: #252f29; color: #f1f5ee; min-height: 43px;
  border: 1px solid #3b4a40; border-radius: 7px; padding: 4px 0 7px; font: 600 .99rem var(--mono);
}
.turn::after { content: ""; position: absolute; bottom: 4px; left: 50%; translate: -50% 0; width: 13px; height: 2px; background: var(--face-color); border-radius: 2px; }
.turn kbd { display: block; color: var(--muted); font: .66rem var(--mono); }
.turn:hover:enabled { background: #313e35; border-color: var(--face-color); }
.turn:active:enabled, .turn.key-held, .turn.touch-held { background: #3b4a40; border-color: var(--face-color); }
.turn:disabled { opacity: .55; cursor: default; }
#undo { min-height: 40px; }
#undo:disabled { opacity: .45; cursor: default; }
.game-settings { display: grid; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.setting-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .78rem; }
.setting-control select { min-width: 130px; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: #252f29; color: #f1f5ee; font: inherit; }
.setting-control select:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.setting-control select:disabled { opacity: .65; cursor: default; }
.memory-solving .turn { --face-color: #9ba89f !important; }
.turn.hint-target { outline: 2px solid var(--mint); outline-offset: -2px; }
#move-hint { margin: 10px 0 0; color: var(--mint); font-size: .8rem; }
#move-hint:empty { margin: 0; }
#hint-offer { line-height: 1.5; color: var(--muted); }
.hint-actions { display: grid; gap: 8px; margin-top: 20px; }
.hint-actions button { min-height: 44px; justify-content: center; }
#hint-playback { padding: 14px; background: #121b16; border: 1px solid var(--line); border-radius: 8px; }
#hint-playback::after { content: ""; display: block; height: 3px; border-radius: 3px; margin-top: 10px; background: var(--mint); transform-origin: left; animation: hint-progress 3s linear; }
@keyframes hint-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { #hint-playback::after { display: none; } }
.results {
  width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  margin: auto; padding: 28px 24px 22px; background: radial-gradient(ellipse at 50% 0%, #2b4430 0%, #1a211d 58%); color: inherit;
  border: 1px solid #506156; border-radius: 16px; box-shadow: 0 24px 85px #080c09b3;
}
.results[open] { animation: fade-in 220ms ease-out both; }
.results::backdrop { background: #0a0e0bc4; animation: fade-in 220ms ease-out both; }
.result-content { position: relative; text-align: center; }
.solved-mark {
  display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 12px;
  border-radius: 16px; background: var(--mint); color: #172414;
  font-size: 2rem; font-weight: 750; box-shadow: 0 0 36px #bdffa343;
}
.celebrate .solved-mark { animation: stamp-result 420ms 70ms both; }
.celebrate .stats { animation: reveal-result 350ms 220ms ease-out both; }
.confetti { position: fixed; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; left: 50%; top: 36%; width: 8px; height: 13px; border-radius: 2px; background: var(--color); opacity: 0; }
.confetti i:nth-child(3n) { width: 7px; height: 7px; border-radius: 50%; }
.celebrate .confetti i { animation: scatter-result 1300ms 125ms both; }
@keyframes reveal-result {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes stamp-result {
  0% { transform: scale(.64) rotate(-12deg); opacity: 0; }
  65% { transform: scale(1.12) rotate(5deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes scatter-result {
  0% { transform: translate(0, 0) scale(.35); opacity: 0; animation-timing-function: cubic-bezier(.12, .65, .25, 1); }
  12% { opacity: 1; }
  40% { transform: translate(var(--x), var(--y)) rotate(var(--spin)); opacity: 1; }
  72% { opacity: .85; }
  100% { transform: translate(var(--x), calc(var(--y) + 14dvh)) rotate(calc(var(--spin) + 80deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .results[open], .results::backdrop, .celebrate .solved-mark, .celebrate .stats, .celebrate .confetti i { animation: none; }
}
.close-result { position: absolute; z-index: 1; top: 12px; right: 12px; min-width: 44px; font-size: 1.2rem; }
.results h2 { font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -.06em; margin: 0 0 18px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats div { display: grid; gap: 4px; }
.stats div { min-width: 0; padding: 13px 5px; border: 1px solid #3d5544; border-radius: 10px; background: #121b16; }
.stats strong { font: 600 clamp(1.08rem, 5.3vw, 1.7rem) var(--mono); color: var(--mint); }
.stats span { font: .7rem var(--mono); color: var(--muted); }
.result-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
.result-actions .primary { justify-content: center; }
#share-status:empty { display: none; }
#share-fallback { width: 100%; min-height: 65px; }
.result-banner { margin-top: 24px; min-height: 50px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; }
#result-break { inset: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; padding: 20px; border: 0; background: #121715; color: inherit; }
#result-break[open] { display: grid; place-items: center; }
.break-card { width: min(100%, 24rem); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #1a211d; }
.break-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.05em; }
.break-card p { margin: 12px 0 24px; color: var(--muted); line-height: 1.5; }
.break-card button { justify-content: center; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 1150px) {
  .masthead { margin-inline: 24px; }
  main { margin-inline: 24px; }
}
@media (max-width: 700px) {
  .masthead { padding: 13px 0; margin-inline: 14px; }
  main { margin-inline: 14px; padding-top: 21px; }
  .intro { margin-bottom: 14px; }
  .intro p { margin-top: 7px; font-size: .86rem; }
  .cube-picker { margin-bottom: 12px; gap: 7px; }
  .cube-picker .setting-control { width: 100%; }
  #cube-access { font-size: .71rem; }
  .board { grid-template-columns: 1fr; gap: 8px; }
  .viewer { min-height: 0; height: clamp(220px, 32svh, 310px); }
  .viewer-top { top: 7px; left: 8px; right: 8px; }
  .viewer-bottom { bottom: 9px; font-size: .7rem; }
  .clock, .turns { padding: 11px 12px; }
  #timer { font-size: 2.65rem; margin-top: 4px; }
  #hint { min-height: 0; margin: 6px 0 8px; font-size: .75rem; }
  #get-hint, #view-result { right: 10px; top: 10px; }
  .turn-head { margin-bottom: 7px; }
  .turn { min-height: 44px; }
}
@media (hover: none) and (pointer: coarse) {
  .turn kbd, .shift-hint { display: none; }
}
@media (max-width: 600px) {
  .masthead { flex-wrap: wrap; gap: 10px; }
  .game-categories { width: 100%; }
  .game-categories a { padding-inline: 8px; }
}
.cube-preview .masthead, .cube-preview .intro, .cube-preview .cube-picker, .cube-preview .panel { display: none; }
.cube-preview #undo { display: none; }
.cube-preview main { margin: 0; padding: 0; }
.cube-preview .board { display: block; }
.cube-preview .viewer { height: 100svh; min-height: 0; border: 0; border-radius: 0; }

/* Public game navigation */
.player-header { display: block; }
.player-brand-row, .account-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.player-brand-row { margin-bottom: .5rem; }
.player-account-link, .privacy-footer a, .player-links a, .privacy-nav a, .account-header a {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--mint); text-underline-offset: .22em;
}
.player-account-link, .privacy-footer a, .player-links a, .account-header a { font-size: .9rem; }
.player-header .game-categories { align-items: start; }
.player-header .game-categories :is(a, summary, button) { min-height: 44px; }
.other-cubes { min-width: 0; }
.other-cubes summary { display: list-item; padding-block: .75rem; cursor: pointer; }
.cube-options { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.other-cubes[open] { flex-basis: 100%; }
.other-cubes[open] summary { width: fit-content; }
.play-skip { position: absolute; left: 1rem; top: 0; z-index: 3; translate: 0 -150%; background: var(--mint); color: #172414; border: 0; border-radius: .4rem; padding: .8rem 1rem; }
.play-skip:focus { translate: 0 0; }
.cube-preview .play-skip { display: none; }
.privacy-footer, .player-links, .privacy-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.25rem; }
.privacy-footer { padding-top: .8rem; border-top: 1px solid var(--line); }
.player-header :focus-visible, .board:focus-visible, .privacy-footer :focus-visible,
.account-page :focus-visible, .privacy-page :focus-visible, #privacy-dialog a:focus-visible {
  outline: 2px solid var(--mint); outline-offset: 3px;
}
.privacy-nav { justify-content: space-between; }
@media (min-width: 740px) {
  .player-header { display: flex; gap: 1.5rem; align-items: start; }
  .player-brand-row { gap: 1.5rem; min-height: 44px; margin: 0; }
  .player-header .game-categories { justify-content: flex-end; }
}
@media (max-width: 400px) {
  .player-header .game-categories { gap: 5px; }
  .player-header .quiet { padding-inline: 9px; }
}

/* Player account */
.account-page { width: min(100%, 42rem); margin: auto; padding: 0 clamp(1rem, 4vw, 2rem) 2.5rem; line-height: 1.55; }
.account-header { min-height: 4.25rem; border-bottom: 1px solid var(--line); }
.account-page h1 { font-size: clamp(2.5rem, 7vw, 3.8rem); letter-spacing: -.055em; margin: clamp(1.6rem, 5vw, 3rem) 0 1.25rem; }
.session-panel { padding: clamp(1.1rem, 4vw, 2rem); background: #1a211d; border: 1px solid var(--line); border-radius: 1rem; }
.session-panel h2 { margin: 0; font-size: 1.35rem; line-height: 1.3; letter-spacing: -.025em; }
.session-panel p { margin: .5rem 0; color: #c2cdc5; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.2rem; margin-top: 1rem; }
.account-actions a, .account-details summary, .account-actions button { min-height: 44px; }
.account-actions a, .account-page a.account-primary { display: inline-flex; align-items: center; }
.account-page a.account-primary { padding: .7rem 1.1rem; background: var(--mint); color: #172414; border-radius: .55rem; font-weight: 700; text-decoration: none; }
.account-actions .quiet { font-size: .9rem; }
.account-page a.account-primary:hover { background: #d7ffc6; }
.browser-progress { margin-top: 1.4rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.browser-progress h2 { font-size: 1.05rem; }
.account-details { margin-top: .6rem; }
.account-details summary { width: fit-content; padding-block: .6rem; cursor: pointer; color: var(--mint); }
.account-details code { overflow-wrap: anywhere; }
.player-links { margin-top: .5rem; }

/* The studio and owner tools use their own palettes. */
:root:has(body > .player-header, body > .account-page, body > .privacy-page) {
  --cube-blue: #618eff;
  --cube-white: #fff;
  --cube-red: #ff5966;
  --mint: #a8c3ff;
  --muted: #b8c3d6;
  --line: #435067;
  background: #141820;
  color: #f2f5ff;

  .brand { font-family: "Instrument Sans", "Helvetica Neue", Arial, sans-serif; }
  .brand .mark { display: flex; gap: 2px; transform: skew(-19deg); }
  .brand .mark i { width: 4px; height: 17px; border-radius: 1px; background: var(--cube-blue); }
  .brand .mark i:nth-child(2) { background: var(--cube-white); }
  .brand .mark i:nth-child(3) { background: var(--cube-red); }
  .brand .mark i:last-child { display: none; }

  .viewer { background: radial-gradient(ellipse at 50% 45%, #2b3951, #192230 72%, #171e29); }
  .panel, .session-panel, .break-card { background: #1b202a; }
  .quiet, .setting-control select { background: #202838; }
  .turn { background: #283142; border-color: var(--line); }
  .turn:hover:enabled { background: #323f55; }
  .turn:active:enabled, .turn.key-held, .turn.touch-held { background: #3a4961; }
  .game-categories [aria-current="page"] { border-color: var(--cube-blue); }
  #category-memory[aria-current="page"] { color: var(--cube-red); border-color: currentColor; }
  .primary, .account-primary { background: var(--cube-blue); color: #0b1731; }
  .primary:hover, .account-primary:hover { background: #a8c3ff; }
  .session-panel p, .viewer-bottom { color: #cad4e7; }
  .results { background: radial-gradient(ellipse at top, #2b3951, #1b202a 60%); border-color: var(--line); }
  .results .stats div, #hint-playback, #result-break { background: #141820; border-color: var(--line); }
  .solved-mark { background: var(--cube-blue); color: #0b1731; box-shadow: none; }
}
:root:has(body > .player-header #category-memory[aria-current="page"]) .intro h1 span { color: var(--cube-red); }
