:root {
  color-scheme: light;
  --ink: #1d1635;
  --paper: #f5f0ff;
  --paper-dark: #e7dcfa;
  --white: #fffcff;
  --board: #211735;
  --board-deep: #171026;
  --board-border: #514261;
  --board-muted: #d0c1e4;
  --lime: #d9fa73;
  --purple: #bca9ff;
  --pink: #fac1df;
  --cream: #ffe6a1;
  --mint: #c2f2da;
  --display: 'Arial Rounded MT Bold', 'Arial Black', 'Segoe UI', sans-serif;
  --body: 'Segoe UI', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Cascadia Mono', 'SFMono-Regular', Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #6244b4; outline-offset: 4px; }
.stage :focus-visible, .embed-page :focus-visible { outline-color: var(--lime); }
.site-page { color: var(--ink); background: var(--paper) radial-gradient(#d9c9f2 1px, transparent 1px) 0 0 / 20px 20px; }
.page-width { width: min(1072px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 10; top: 10px; left: 10px; transform: translateY(-150%); background: var(--lime); color: var(--ink); padding: 10px 16px; }
.skip-link:focus { transform: translateY(0); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar { background: #fbf8ff; border-bottom: 1px solid #e1d4f3; }
.topbar-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 66px; }
.wordmark { display: inline-flex; align-items: center; gap: 7px; font-family: var(--display); font-weight: 950; font-size: 21px; letter-spacing: -.65px; text-decoration: none; white-space: nowrap; }
.logo-chip { display: grid; place-items: center; width: 37px; height: 33px; margin-right: 3px; background: var(--lime); border: 2px solid var(--ink); border-radius: 8px; box-shadow: 0 3px var(--ink); font: 900 16px var(--mono); letter-spacing: -1px; transform: rotate(-6deg); }
.wordmark-accent { color: #59429a; }
.topbar nav { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 720; }
.topbar nav a { text-decoration: none; white-space: nowrap; }
.topbar nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.topbar .nav-play { background: var(--paper-dark); border-radius: 8px; padding: 8px 13px; }

.hero { position: relative; display: flex; align-items: center; min-height: 226px; margin-top: 30px; padding: 28px 250px 31px 41px; isolation: isolate; overflow: hidden; color: var(--white); background: #382361; border: 2px solid var(--ink); border-radius: 23px; box-shadow: 0 6px var(--ink); }
.hero::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(110deg, #382361 40%, transparent 80%), repeating-linear-gradient(0deg, transparent 0 25px, #f4dbff1d 25px 26px), repeating-linear-gradient(90deg, transparent 0 25px, #f4dbff1d 25px 26px); }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(3rem, 7.4vw, 6.2rem); line-height: .94; letter-spacing: -.085em; font-weight: 1000; text-wrap: balance; }
.hero h1 span { color: var(--lime); }
.hero p { margin: 18px 0 0; color: #eee4ff; font-size: clamp(.99rem, 2vw, 1.32rem); font-weight: 650; }
.cabinet { position: absolute; z-index: -1; right: 4.3%; bottom: 0; width: clamp(145px, 24vw, 235px); height: auto; transform: rotate(4deg); filter: drop-shadow(0 7px 0 #140b2c62); }

.play-section { margin-top: 25px; scroll-margin-top: 13px; }
.stage { position: relative; isolation: isolate; height: 409px; overflow: hidden; border: 2px solid #1a1029; border-radius: 21px; background: var(--board); color: var(--white); box-shadow: 0 5px #1a1029; }
.stage iframe { display: block; position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--board); }
.cover { height: 100%; display: flex; flex-direction: column; padding: 18px 23px; }
.cover-info, .board-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mode-chip, .game-goal, .game-score { display: inline-flex; align-items: center; gap: 7px; font: 750 12px var(--mono); }
.mode-chip { padding: 7px 10px; border: 1px solid var(--board-border); border-radius: 8px; color: #eee1ff; }
.mode-chip > span { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.game-goal { color: var(--board-muted); }
.game-goal b { padding: 4px 8px; border: 1px solid #777c48; border-radius: 6px; background: #303524; color: var(--lime); }
.cover-body { width: min(100%, 490px); display: grid; justify-items: center; align-content: center; flex: 1; margin-inline: auto; padding-bottom: 13px; }
.cover-body p { margin: 25px 0 16px; text-align: center; color: var(--board-muted); font-size: 15px; }
.tile-grid { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2vw, 14px); }
.number-tile { display: grid; place-items: center; min-width: 0; height: clamp(62px, 13vw, 91px); border: 2px solid #10091b; border-radius: 12px; box-shadow: 0 5px 0 #0e081a; color: var(--ink); font-family: var(--display); font-size: clamp(1.75rem, 6vw, 3.3rem); font-weight: 950; line-height: 1; letter-spacing: -.07em; transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), background-color 170ms var(--ease); }
.tile-mint { background: var(--mint); }
.tile-pink { background: var(--pink); }
.tile-cream { background: var(--cream); }
.tile-lilac { background: var(--purple); }
.cover-tiles .number-tile:nth-child(1) { transform: rotate(-6deg) translateY(3px); }
.cover-tiles .number-tile:nth-child(2) { transform: rotate(-2deg) translateY(-4px); }
.cover-tiles .number-tile:nth-child(3) { transform: rotate(3deg) translateY(-4px); }
.cover-tiles .number-tile:nth-child(4) { transform: rotate(6deg) translateY(3px); }
.game-primary { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 44px; padding: 8px 17px; border: 2px solid #10091b; border-radius: 10px; box-shadow: 0 3px #10091b; color: #201933; background: var(--lime); font-weight: 900; text-decoration: none; transition: transform 140ms var(--ease), box-shadow 140ms var(--ease), background-color 140ms var(--ease); }
.game-primary:hover { background: #e5ff9d; transform: translateY(-2px); box-shadow: 0 5px #10091b; }
.game-primary:active { transform: translateY(2px); box-shadow: 0 1px #10091b; }
.play-button { min-width: 199px; min-height: 52px; font-size: 18px; }
.play-triangle { width: 0; height: 0; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid currentColor; }
.stage-loader { position: absolute; inset: 0; display: none; place-content: center; place-items: center; background: var(--board); text-align: center; }
.stage[data-gf-state="loading"] .stage-loader { display: grid !important; }
.stage[data-gf-state="playing"] .stage-loader { display: none !important; }
.stage-loader > span { color: var(--lime); font: 900 40px var(--mono); animation: loader-tilt .8s var(--ease) infinite alternate; }
.stage-loader p { color: var(--board-muted); }
@keyframes loader-tilt { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.stage:fullscreen { width: 100%; height: 100%; border: 0; border-radius: 0; }

.below-stage { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-top: 14px; }
.below-stage > p { margin: 8px 0 0; color: #5b438a; font-size: 13px; font-weight: 750; }
.caption-divider { margin: 0 3px; }
.stage-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 6px; }
.quiet-button { min-height: 34px; padding: 5px 10px; border: 1px solid #d9c9ed; border-radius: 8px; background: #fffcff; color: #3f2d62; font-size: 13px; font-weight: 750; transition: background-color 140ms var(--ease); }
.quiet-button:hover:not(:disabled) { background: #e9ddf9; }
.quiet-button:disabled { opacity: .6; }
.quiet-button[aria-pressed="true"] { color: #702350; background: var(--pink); }
.share-status:empty { display: none; }
.share-status { font-size: .8rem; }
.rules, .info-grid > div, .comments { background: #fdfaff; border: 1px solid #dfd1f0; border-radius: 18px; padding: clamp(18px, 3vw, 31px); }
.rules { margin-top: 27px; scroll-margin-top: 12px; }
.rules h2, .info-grid h2, .comments h2 { margin: 0 0 8px; font-family: var(--display); font-size: clamp(1.6rem, 3.4vw, 2rem); letter-spacing: -.065em; }
.rules h3 { margin: 0 0 3px; font-size: 16px; }
.rules p, .info-grid p { color: #514367; line-height: 1.5; margin: 0; }
.rule-list { padding: 0; margin: 22px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; list-style: none; }
.rule-list li { display: flex; align-items: flex-start; gap: 10px; min-width: 0; background: #eee7fc; border-radius: 11px; padding: 13px; }
.rule-list li > span { flex: 0 0 28px; height: 28px; display: grid; place-items: center; border: 1px solid #3d2a5b; border-radius: 7px; background: var(--cream); font: 800 14px var(--mono); }
.rule-list li p { font-size: 14px; }
.example { border-top: 1px dashed #dfcfef; padding-top: 16px; }
.example p { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; margin-top: 7px; font: 800 .95rem var(--mono); }
.example strong { background: #efe8fc; border-radius: 6px; padding: 6px 9px; }
.example strong:last-child { background: var(--lime); color: var(--ink); }
.info-grid { margin-block: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-grid p + p { margin-top: 10px; }
.info-grid .keyboard-note { margin-top: 17px; }
kbd { padding: 1px 4px; border: 1px solid #decfee; border-radius: 4px; background: #f5efff; white-space: nowrap; }
.faq details { border-bottom: 1px solid #e9def4; padding-block: 11px; }
.faq details:last-child { border: 0; }
.faq summary { cursor: pointer; font-weight: 750; }
.faq details p { margin: 7px 0 0 15px; }
.comments { margin-block: 14px; }
.comments form { display: grid; gap: 8px; max-width: 480px; }
.comments form > button { justify-self: start; }
.comments :is(input, textarea) { width: 100%; padding: 8px; border: 1px solid #c9b5e0; border-radius: 6px; }
.footer { margin-top: 25px; background: #eee5fb; border-top: 1px solid #e0d1f3; color: #584371; }
.footer-inner { min-height: 57px; font-size: 13px; font-weight: 750; }

.embed-page { min-height: 100dvh; color: var(--white); background: var(--board); }
.arcade-board { display: flex; flex-direction: column; width: 100%; min-height: 100dvh; }
.board-top { padding: 13px 21px; min-height: 62px; border-bottom: 1px solid #3d2e51; }
.modes { display: flex; padding: 3px; gap: 3px; background: var(--board-deep); border: 1px solid #58466e; border-radius: 10px; }
.modes button, .operator-grid button, .board-button { border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--white); font-weight: 750; transition: transform 140ms var(--ease), border-color 140ms var(--ease), background-color 140ms var(--ease); }
.modes button { padding: 6px 11px; min-height: 33px; font-size: 14px; color: var(--board-muted); white-space: nowrap; }
.modes button[aria-pressed="true"] { color: var(--board-deep); background: var(--purple); }
.modes button:hover:not([aria-pressed="true"]) { background: #3d2d53; }
.audio-controls { display: flex; flex-shrink: 0; gap: 5px; }
.audio-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 4px 9px; border: 1px solid #624e76; border-radius: 8px; background: var(--board-deep); color: var(--board-muted); font-size: 12px; font-weight: 750; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.audio-button::before { content: ''; width: 6px; height: 6px; flex: 0 0 6px; border: 1px solid currentColor; border-radius: 50%; }
.audio-button[aria-pressed="true"] { color: var(--lime); border-color: #697747; }
.audio-button[aria-pressed="true"]::before { background: var(--lime); }
.audio-button:disabled { opacity: .5; }
.audio-button:hover:not(:disabled) { background: #413053; }
.game-score { white-space: nowrap; color: var(--board-muted); }
.game-score strong { color: var(--lime); }
.board-center { position: relative; display: grid; align-content: center; flex: 1; width: min(515px, 100%); padding: 13px 15px 8px; margin: auto; }
.board-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; color: var(--board-muted); font: 700 12px var(--mono); }
.board-meta .game-score { margin-left: auto; }
.progress-pips { display: flex; gap: 3px; }
.progress-pips i { width: 10px; height: 5px; background: #655576; border-radius: 2px; }
.progress-pips i.filled { background: var(--lime); }
.arcade-board .number-tile:hover:not(:disabled) { transform: translateY(-3px); }
.arcade-board .number-tile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px #0e081a; }
.arcade-board .number-tile[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--white), 0 5px #0e081a; transform: translateY(-3px); }
.arcade-board .number-tile.hint-tile { outline: 2px dashed var(--lime); outline-offset: 4px; }
.arcade-board .number-tile.long-value { font-size: clamp(1rem, 4vw, 2rem); }
.arcade-board .number-tile.consumed { border: 1px dashed #5c4b71; background: #191127; color: transparent; box-shadow: none; }
.arcade-board .number-tile.merged { animation: tile-merge .38s var(--ease); }
.arcade-board[data-outcome="win"] .number-tile:not(.consumed) { background: var(--lime); box-shadow: 0 4px #0e081a, 0 0 0 2px #aec765, 0 0 29px #d9fa7352; }
@keyframes tile-merge { from { transform: scale(.88) translateY(4px); } 55% { transform: scale(1.06) translateY(-4px); } to { transform: none; } }
.operator-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: min(100%, 306px); margin: 17px auto 0; }
.operator-grid button { min-height: 42px; background: var(--board-deep); border: 1px solid #624e76; font: 800 22px var(--mono); }
.operator-grid button:hover:not(:disabled) { background: #473363; transform: translateY(-2px); }
.operator-grid button[aria-pressed="true"] { background: var(--purple); color: var(--board-deep); }
.operator-grid button:disabled { opacity: .5; }
.board-message { display: grid; place-items: center; min-height: 42px; margin: 7px 0 0; color: var(--board-muted); font-size: 14px; font-weight: 650; line-height: 1.3; text-align: center; overflow-wrap: anywhere; }
.board-message[data-feedback="hint"], .board-message[data-feedback="win"] { color: var(--lime); animation: message-in .33s var(--ease); }
.board-message[data-feedback="error"] { color: #ffc6d5; animation: message-in .33s var(--ease); }
.board-message[data-feedback="win"] { font-weight: 850; }
@keyframes message-in { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.board-controls { display: flex; align-items: center; justify-content: space-between; padding: 12px 21px 15px; gap: 8px; background: #1c142c; border-top: 1px solid #3d2e51; }
.move-tools { display: flex; align-items: center; gap: 6px; }
.board-button { min-height: 36px; padding: 5px 8px; font-size: 13px; white-space: nowrap; }
.board-button:not(:disabled):hover { background: #413053; }
.board-button:disabled { opacity: .47; }
.hint-button { color: var(--lime); }
.hint-button:disabled { color: var(--board-muted); }
.next-button { min-height: 40px; min-width: 125px; font-size: 13px; }
.win-sparks { pointer-events: none; position: absolute; inset: 0; overflow: hidden; }
.win-sparks i { position: absolute; top: 43%; left: 50%; font-size: 18px; font-style: normal; color: var(--lime); opacity: 0; }
.win-sparks i:nth-child(1) { --spark-x: -140px; --spark-y: -70px; }
.win-sparks i:nth-child(2) { --spark-x: -100px; --spark-y: 33px; color: var(--pink); }
.win-sparks i:nth-child(3) { --spark-x: -48px; --spark-y: -94px; color: var(--purple); }
.win-sparks i:nth-child(4) { --spark-x: 49px; --spark-y: -88px; color: var(--cream); }
.win-sparks i:nth-child(5) { --spark-x: 104px; --spark-y: 39px; color: var(--mint); }
.win-sparks i:nth-child(6) { --spark-x: 136px; --spark-y: -46px; }
.win-sparks.celebrate i { animation: win-spark .82s var(--ease) both; }
@keyframes win-spark { 0% { opacity: 0; transform: scale(.3); } 23% { opacity: 1; } 74% { opacity: .95; } 100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) rotate(39deg) scale(1.3); } }

@media (max-width: 720px) {
  .hero { min-height: 190px; padding: 24px 165px 28px 25px; }
  .hero h1 { font-size: clamp(2.7rem, 9vw, 4.8rem); }
  .cabinet { right: 2%; width: clamp(130px, 25vw, 201px); }
  .rule-list { grid-template-columns: 1fr; gap: 8px; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .page-width { width: calc(100% - 26px); }
  .topbar-inner { min-height: 57px; gap: 10px; }
  .wordmark { gap: 4px; font-size: 17px; }
  .logo-chip { width: 30px; height: 27px; margin-right: 2px; font-size: 13px; }
  .topbar nav { gap: 12px; font-size: 12px; }
  .topbar .nav-play { display: none; }
  .hero { margin-top: 17px; min-height: 151px; padding: 16px 102px 21px 17px; border-radius: 16px; }
  .hero h1 { font-size: clamp(2.38rem, 10vw, 3.15rem); line-height: .99; text-wrap: initial; }
  .hero p { margin-top: 10px; font-size: .87rem; line-height: 1.35; }
  .cabinet { right: -7px; bottom: 3px; width: clamp(118px, 32vw, 157px); }
  .play-section { margin-top: 18px; }
  .stage { height: 366px; border-radius: 15px; }
  .cover { padding: 14px; }
  .cover-body p { margin-top: 21px; font-size: 14px; }
  .number-tile { border-radius: 9px; }
  .below-stage { gap: 5px; }
  .below-stage > p { font-size: 11px; }
  .quiet-button { padding-inline: 6px; font-size: 11px; }
  .stage-actions { gap: 4px; }
  .board-top { padding-inline: 11px; }
  .audio-button { gap: 4px; min-height: 36px; padding-inline: 6px; font-size: 11px; }
  .board-center { padding-inline: 12px; }
  .board-controls { padding-inline: 9px; }
  .modes button { padding-inline: 8px; font-size: 12px; }
  .move-tools { gap: 1px; }
  .board-button { padding-inline: 5px; font-size: 12px; }
  .next-button { min-width: 99px; padding-inline: 7px; font-size: 12px; }
}

@media (max-width: 350px) {
  .hero { padding-right: 94px; }
  .cabinet { right: -12px; width: 108px; }
  .stage { height: 394px; }
  .board-top { gap: 5px; padding-inline: 9px; }
  .modes { gap: 2px; }
  .modes button { padding-inline: 4px; font-size: 11px; }
  .audio-button { padding-inline: 5px; }
  .board-meta { gap: 6px; }
  .below-stage > p .caption-divider, .below-stage > p span:last-child { display: none; }
}

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

.policy-page { padding-block: 40px; max-width: 760px; }
