:root {
  color-scheme: dark;
  --ink: #f0e5d3;
  --muted: #b0a28d;
  --quiet: #887b68;
  --line: #463a2d;
  --black: #1c1915;
  --surface: #29231d;
  --surface-raised: #342c24;
  --green: #687b5b;
  --green-bright: #e2eadb;
  --green-soft: #3a4634;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% -12%, rgba(127, 98, 62, .17), transparent 62%), var(--black);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
.page-shell { width: min(100%, 760px); margin: 0 auto; padding: 0 24px; }
.topbar { position: relative; height: 116px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; border-bottom: 1px solid #242622; }
.brand { grid-column: 2; justify-self: center; min-width: 0; max-width: 100%; display: inline-flex; align-items: center; gap: 15px; color: var(--ink); text-decoration: none; transition: filter .18s; }
.brand:hover { filter: brightness(1.12); }
.brand-word { display: inline-flex; align-items: baseline; font: 780 44px/1 ui-sans-serif, system-ui, sans-serif; letter-spacing: -1.8px; white-space: nowrap; }
.brand-before, .brand-or { color: inherit; }
.brand-after { color: inherit; font-weight: 700; }
.brand-mark { width: 68px; height: 68px; display: grid; place-items: center; }
.brand-mark svg { display: block; width: 64px; height: 64px; overflow: visible; }
.brand-mark path { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .mark-left { stroke: #e7e8e1; }
.brand-mark .mark-right { stroke: #aeb1a8; }
.settings-button { position: static; grid-column: 3; justify-self: end; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: #c3b297; background: transparent; cursor: pointer; transition: color .16s; }
.settings-button svg { display: block; width: 26px; height: 26px; }
.settings-button path, .settings-button circle { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.3; }
.settings-button:hover, .settings-button:focus-visible { color: var(--ink); background: transparent; }
.settings-button:focus-visible { outline: 2px solid #a38b66; outline-offset: 3px; }
main { padding-bottom: 30px; }
.game-card { display: flex; flex-direction: column; width: min(100%, 470px); margin-right: auto; margin-left: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.game-card { margin-top: 30px; padding: 20px 26px 18px; }
.card-topline { order: 0; }
.board { order: 1; }
.board-hint { order: 2; }
.message { order: 3; }
.new-puzzle-form { order: 4; display: flex; justify-content: center; margin-top: 14px; }
.new-puzzle-form[hidden] { display: none; }
.new-puzzle-button { min-height: 38px; padding: 0 16px; border: 1px solid #474b43; border-radius: 9px; color: var(--ink); background: #242622; cursor: pointer; font-size: 12px; font-weight: 600; transition: border-color .16s, background .16s, transform .16s; }
.new-puzzle-button:hover, .new-puzzle-button:focus-visible { border-color: #73796d; background: #2b2e29; }
.new-puzzle-button:hover { transform: translateY(-1px); }
.new-puzzle-button:focus-visible { outline: 2px solid #829b83; outline-offset: 3px; }
.hard-mode-prompt { order: 3; align-self: center; margin-top: 16px; padding: 3px 6px; border: 0; color: #9bc99a; background: transparent; font-size: 13px; font-weight: 650; text-decoration: underline; text-decoration-color: rgba(155, 201, 154, .55); text-underline-offset: 3px; cursor: pointer; }
.hard-mode-prompt:hover, .hard-mode-prompt:focus-visible { color: #c0e0b8; text-decoration-color: currentColor; }
.hard-mode-prompt:focus-visible { outline: 2px solid #829b83; outline-offset: 3px; }
.hard-mode-prompt[hidden] { display: none; }
body.light-mode .hard-mode-prompt { color: #477b50; text-decoration-color: rgba(71, 123, 80, .5); }
body.light-mode .hard-mode-prompt:hover, body.light-mode .hard-mode-prompt:focus-visible { color: #315f39; }
body.light-mode .hard-mode-prompt:focus-visible { outline-color: #477b50; }
.game-card.is-finished .message { order: 1; }
.game-card.is-finished .board { order: 2; margin-top: 16px; }
.game-card.is-finished .board-hint { order: 3; }
.card-topline { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid #292b27; }
.round-label { color: #858a82; font: 550 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1.3px; }
body[data-mode="daily"] .round-label { color: #8bbb91; }
body[data-mode="unlimited"] .round-label { color: #b6a0e3; }
.attempt-count { color: #a5a99f; font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.attempt-count #attempt-count { color: var(--ink); font-size: 15px; }
.count-divider { padding: 0 4px; color: #656961; }
.board { width: min(100%, 330px); margin: 22px auto 0; display: grid; gap: 7px; outline: none; }
.board-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.tile { position: relative; display: grid; aspect-ratio: 1 / 1; place-items: center; border: 1px solid #343731; border-radius: 9px; color: #e6e8e1; background: #20221f; font: 650 23px/1 ui-sans-serif, system-ui, sans-serif; transition: background .16s, border-color .16s; }
.tile.is-filled { border-color: #555a51; background: #242622; }
.board-row.is-active .tile { border-color: #50544d; background: #1d1f1c; }
.tile.is-green { border-color: var(--green) !important; color: #f1f7ef; background: var(--green) !important; }
.tile.is-hint { border-color: #343731; color: #c5c8c0; background: #282a27; }
.tile-letter { transform: translateY(-1px); }
.tile-arrow { position: absolute; right: 5px; bottom: 3px; color: #e1e4db; font: 500 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tile.has-possibilities { z-index: 2; }
.tile.has-possibilities.is-pinned { z-index: 12; }
.tile.has-possibilities:hover, .tile.has-possibilities:focus-visible { z-index: 12; outline: 2px solid #829b83; outline-offset: 2px; }
.possibility-popover { position: absolute; z-index: 20; bottom: calc(100% + 10px); left: 50%; width: min(300px, calc(100vw - 36px)); padding: 18px; transform: translateX(-50%); border: 1px solid #42463f; border-radius: 13px; background: #222420; box-shadow: 0 16px 36px rgba(0, 0, 0, .55); cursor: default; }
.possibility-popover.align-left { left: 0; transform: none; }
.possibility-popover.align-right { right: 0; left: auto; transform: none; }
.possibility-popover.is-below-tile { top: calc(100% + 10px); bottom: auto; }
.possibility-caption { display: block; margin: 0 0 13px; color: #969b91; font: 550 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; white-space: nowrap; }
.possibility-letters { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.possibility-letter { display: grid; height: 27px; place-items: center; border-radius: 6px; font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.possibility-letter.is-possible { color: #f1d36b; background: #39351f; }
.possibility-letter.is-impossible { color: #62665e; background: #1b1d1a; }
.board-row.shake { animation: shake .34s ease-in-out; }
.board.shake { animation: shake .38s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.board-hint { min-height: 16px; margin: 14px 0 0; color: #777c73; text-align: center; font-size: 10px; }
kbd { padding: 2px 5px; border: 1px solid #363933; border-radius: 4px; color: #b5b9af; background: #222420; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.message { min-height: 16px; margin: 4px 0 0; color: #d4b37f; text-align: center; font-size: 11px; font-weight: 550; }
.message.is-warning { color: #d88b80; }
.message.is-success { color: #a7c7a7; }
.message.is-result { display: block; width: 100%; min-height: 0; margin: 17px 0 0; padding: 2px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: clamp(23px, 5.5vw, 28px); font-weight: 650; line-height: 1.3; letter-spacing: -.45px; }
.message.is-result.is-win { color: #b8d4b5; }
.message.is-result.is-loss { color: #d8bf79; }
.help-actions { display: flex; justify-content: center; margin: 16px 0 0; }
.help-settings-button { display: none; }
.how-to-text { appearance: none; display: inline-flex; align-items: center; gap: 9px; min-height: 32px; padding: 3px 6px; border: 0; border-radius: 8px; color: #858a82; background: transparent; cursor: pointer; font: inherit; font-size: 13px; line-height: 1.5; }
.how-to-text:hover, .how-to-text:focus-visible { color: #b0b2a9; text-decoration: underline; }
.how-to-text:focus-visible, .dialog-close:focus-visible { outline: 2px solid #829b83; outline-offset: 3px; }
.how-mark { width: 23px; height: 23px; display: grid; flex: 0 0 23px; place-items: center; border: 1px solid #666b61; border-radius: 50%; color: #9a9e93; font: 600 13px/1 ui-sans-serif, system-ui, sans-serif; text-decoration: none; }
.how-to-text:hover .how-mark, .how-to-text:focus-visible .how-mark { border-color: #92978b; color: #c4c8bc; background: #292c26; }
.home-main { width: min(100%, 540px); margin: 52px auto 0; padding: 0 10px 36px; text-align: center; }
.home-main h1 { margin: 0; color: var(--ink); font-size: clamp(30px, 6vw, 38px); font-weight: 680; line-height: 1.12; letter-spacing: -1.4px; }
.mode-options { display: grid; gap: 12px; margin-top: 27px; text-align: left; }
.mode-option { position: relative; min-height: 104px; display: grid; grid-template-columns: 50px minmax(0, 1fr) 20px; align-items: center; gap: 15px; padding: 17px 18px; border: 1px solid #30332e; border-radius: 14px; color: var(--ink); background: #191a18; text-decoration: none; transition: border-color .16s, background .16s, transform .16s; }
.mode-option::before { position: absolute; top: 18px; bottom: 18px; left: 0; width: 3px; border-radius: 0 3px 3px 0; background: var(--mode-accent); content: ""; }
.mode-option-daily { --mode-accent: #83b991; }
.mode-option-unlimited { --mode-accent: #aa94dc; }
.mode-option-daily .mode-icon { border-color: #405444; color: #9bc9a3; background: #202b22; }
.mode-option-unlimited .mode-icon { border-color: #4c435f; color: #bba9e5; background: #282432; }
.mode-option-daily .mode-go { color: #91bd99; }
.mode-option-unlimited .mode-go { color: #b09bdd; }
.mode-option:hover, .mode-option:focus-visible { border-color: #55594f; background: #1e201d; transform: translateY(-2px); }
.mode-option-daily:hover, .mode-option-daily:focus-visible { border-color: #55745c; background: #1d211d; }
.mode-option-unlimited:hover, .mode-option-unlimited:focus-visible { border-color: #62567b; background: #211f24; }
.mode-option:focus-visible { outline: 2px solid #829b83; outline-offset: 3px; }
.mode-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #353832; border-radius: 12px; color: #d4d7ce; background: #222420; }
.mode-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.mode-icon-infinity { font: 400 34px/1 ui-sans-serif, system-ui, sans-serif; }
.mode-copy { display: grid; gap: 5px; }
.mode-title { color: var(--ink); font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.mode-description { color: var(--muted); font-size: 12px; line-height: 1.5; }
.mode-go { color: #9ca196; font-size: 20px; text-align: right; transition: transform .16s; }
.how-dialog, .settings-dialog { width: min(520px, calc(100vw - 32px)); max-width: none; max-height: min(720px, calc(100dvh - 32px)); padding: 0; overflow: hidden; border: 1px solid #3b3e38; border-radius: 16px; color: var(--ink); background: #191a18; box-shadow: 0 24px 80px rgba(0, 0, 0, .65); }
.settings-dialog { width: min(440px, calc(100vw - 32px)); }
.how-dialog::backdrop, .settings-dialog::backdrop { background: rgba(0, 0, 0, .76); backdrop-filter: blur(3px); }
.dialog-heading { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #2b2d29; background: #191a18; }
.how-heading { display: flex; align-items: center; gap: 10px; }
.how-heading h1 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 650; letter-spacing: -.15px; }
.dialog-close { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 1px solid #3b3e38; border-radius: 8px; color: #aeb2a9; background: #20221f; cursor: pointer; }
.dialog-close svg { display: block; width: 14px; height: 14px; }
.dialog-close path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.5; }
.dialog-close:hover { color: #fff; background: #2a2c28; }
.dialog-content { max-height: calc(min(720px, 100dvh - 32px) - 68px); padding: 18px 22px 22px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-content p { margin: 0; color: #aeb2a9; font-size: 12px; line-height: 1.7; }
.dialog-content .how-intro { margin-bottom: 20px; color: #d2d5cd; font-size: 13px; }
.dialog-content h2 { margin: 18px 0 7px; color: #e3e5df; font-size: 12px; font-weight: 650; letter-spacing: .1px; }
.dialog-content .clue-guide { margin-top: 9px; border-top: 1px solid #2b2d29; }
.dialog-content .hover-hint-note { margin-top: 5px; }
.mobile-hint-note { display: none; }
.dialog-content .how-last-note { margin-top: 12px; }
.clue-example { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #2b2d29; color: #c0c4ba; font-size: 11px; line-height: 1.55; }
.clue-example strong { color: #e3e5df; font-weight: 650; }
.example-tile { position: relative; flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; font-size: 14px; font-weight: 650; }
.example-tile.correct { color: #f1f7ef; background: var(--green); }
.example-tile.hint { color: #c5c8c0; background: #282a27; }
.example-tile small { position: absolute; right: 4px; bottom: 3px; color: #e1e4db; font: 500 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.settings-content { padding-top: 2px; padding-bottom: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px 0; }
.setting-row + .setting-row { border-top: 1px solid #2b2d29; }
.setting-copy { min-width: 0; flex: 1; }
.dialog-content .setting-copy h2 { margin: 0 0 4px; color: #e3e5df; font-size: 13px; font-weight: 650; }
.dialog-content .setting-copy p { color: #aeb2a9; font-size: 11px; line-height: 1.55; }
.settings-toggle { position: relative; display: inline-flex; flex: 0 0 42px; width: 42px; height: 24px; cursor: pointer; }
.settings-toggle input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.toggle-track { position: relative; display: block; width: 42px; height: 24px; border: 1px solid #42453e; border-radius: 99px; background: #2b2d29; transition: background .18s, border-color .18s; }
.toggle-track::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #aeb2a9; content: ""; transition: transform .18s, background .18s; }
.settings-toggle input:checked + .toggle-track { border-color: #527d5d; background: #3e6548; }
.settings-toggle input:checked + .toggle-track::after { transform: translateX(18px); background: #f1f7ef; }
.settings-toggle input:focus-visible + .toggle-track { outline: 2px solid #829b83; outline-offset: 3px; }
.settings-toggle input:disabled + .toggle-track { opacity: .6; }
.csrf-form { display: none; }

@media (max-width: 480px) {
  .page-shell { padding: 0 14px; }
  .topbar { height: 94px; }
  .brand { gap: 10px; }
  .brand-word { font-size: clamp(23px, 6.1vw, 29px); letter-spacing: -1.1px; }
  .brand-mark { width: 54px; height: 54px; }
  .brand-mark svg { width: 52px; height: 52px; }
  .home-main { margin-top: 36px; padding-right: 0; padding-left: 0; }
  .mode-option { grid-template-columns: 44px minmax(0, 1fr) 16px; gap: 12px; padding: 15px 13px; }
  .mode-icon { width: 42px; height: 42px; }
  .game-card { margin-top: 20px; padding: 17px 15px 15px; }
  .board { margin-top: 18px; gap: 6px; }
  .board-row { gap: 6px; }
  .tile { border-radius: 7px; font-size: 21px; }
  .tile-arrow { right: 4px; bottom: 2px; font-size: 17px; }
  .dialog-heading { padding: 16px 17px; }
  .dialog-content { padding: 16px 18px 19px; }
  .possibility-popover { padding: 15px; }
  .possibility-letters { gap: 4px; }
  .possibility-letter { height: 24px; font-size: 12px; }
}

@media (max-width: 380px) {
  .topbar { height: 82px; }
  .brand { gap: 6px; }
  .brand-word { font-size: clamp(18px, 5.7vw, 22px); letter-spacing: -.9px; }
  .brand-mark { width: clamp(36px, 13vw, 42px); height: clamp(36px, 13vw, 42px); }
  .brand-mark svg { width: 100%; height: 100%; }
}

body.light-mode {
  color-scheme: light;
  --ink: #352b20;
  --muted: #766957;
  --quiet: #8a7c68;
  --line: #d8cbb7;
  --black: #f2eadb;
  --surface: #fbf6eb;
  --surface-raised: #efe5d5;
}
body.light-mode .topbar { border-color: #dedfd7; }
body.light-mode .mode-option { border-color: #d9dad2; color: #272923; background: #fffefa; }
body.light-mode .mode-option:hover, body.light-mode .mode-option:focus-visible { border-color: #aeb4a7; background: #f3f2ec; }
body.light-mode .mode-icon { border-color: #d4d6cd; color: #4d5148; background: #f0efe8; }
body.light-mode .mode-go { color: #666a61; }
body.light-mode .mode-option-daily .mode-icon { border-color: #c4d8c5; color: #477b50; background: #edf5ec; }
body.light-mode .mode-option-unlimited .mode-icon { border-color: #d2c9e3; color: #65568f; background: #f1eef8; }
body.light-mode .mode-option-daily .mode-go { color: #477b50; }
body.light-mode .mode-option-unlimited .mode-go { color: #65568f; }
body.light-mode .mode-option-daily:hover, body.light-mode .mode-option-daily:focus-visible { border-color: #9ab99d; background: #f6faf4; }
body.light-mode .mode-option-unlimited:hover, body.light-mode .mode-option-unlimited:focus-visible { border-color: #b5a7d0; background: #f8f6fb; }
body.light-mode .new-puzzle-button { border-color: #c9ccc2; color: #272923; background: #f0efe8; }
body.light-mode .new-puzzle-button:hover, body.light-mode .new-puzzle-button:focus-visible { border-color: #aeb4a7; background: #e8e7df; }
body.light-mode .brand-mark .mark-left { stroke: #353730; }
body.light-mode .brand-mark .mark-right { stroke: #777a72; }
body.light-mode .settings-button { color: #76644a; background: transparent; }
body.light-mode .settings-button:hover, body.light-mode .settings-button:focus-visible { color: #352b20; background: transparent; }
body.light-mode .card-topline { border-color: #e5e5de; }
body.light-mode .round-label { color: #6e726a; }
body.light-mode[data-mode="daily"] .round-label { color: #477b50; }
body.light-mode[data-mode="unlimited"] .round-label { color: #65568f; }
body.light-mode .attempt-count { color: #656960; }
body.light-mode .count-divider { color: #9b9e96; }
body.light-mode .tile { border-color: #d1d3cb; color: #292b25; background: #f0efe9; }
body.light-mode .tile.is-filled { border-color: #aeb2a7; background: #e7e7df; }
body.light-mode .board-row.is-active .tile { border-color: #b7bab0; background: #f2f1eb; }
body.light-mode .tile.is-green { border-color: #527d5d !important; color: #f7faf5; background: #527d5d !important; }
body.light-mode .tile.is-hint { border-color: #d1d3cb; color: #3e413a; background: #e6e6df; }
body.light-mode .tile-arrow { color: #41443d; }
body.light-mode .tile.has-possibilities:hover, body.light-mode .tile.has-possibilities:focus-visible { outline-color: #71866e; }
body.light-mode .possibility-popover { border-color: #d4d5cc; background: #fffefa; box-shadow: 0 14px 32px rgba(35, 37, 30, .18); }
body.light-mode .possibility-caption { color: #676b62; }
body.light-mode .possibility-letter.is-possible { color: #765b00; background: #f3e8b8; }
body.light-mode .possibility-letter.is-impossible { color: #a1a39b; background: #efeee8; }
body.light-mode .board-hint { color: #73776e; }
body.light-mode kbd { border-color: #d2d3cb; color: #464940; background: #f2f1eb; }
body.light-mode .message { color: #795c22; }
body.light-mode .message.is-warning { color: #a4483c; }
body.light-mode .message.is-result.is-win { color: #426c46; }
body.light-mode .message.is-result.is-loss { color: #806000; }
body.light-mode .how-dialog, body.light-mode .settings-dialog { border-color: #d4d5cc; color: #272923; background: #fffefa; box-shadow: 0 24px 80px rgba(35, 37, 30, .25); }
body.light-mode .how-dialog::backdrop, body.light-mode .settings-dialog::backdrop { background: rgba(38, 40, 34, .42); }
body.light-mode .dialog-heading { border-color: #e1e1da; background: #fffefa; }
body.light-mode .how-heading h1 { color: #272923; }
body.light-mode .dialog-close { border-color: #d5d6ce; color: #62665e; background: #f1f0ea; }
body.light-mode .dialog-close:hover { color: #272923; background: #e8e7df; }
body.light-mode .dialog-content p { color: #5f635b; }
body.light-mode .dialog-content .how-intro { color: #383b34; }
body.light-mode .dialog-content h2, body.light-mode .clue-example strong { color: #343730; }
body.light-mode .dialog-content .clue-guide, body.light-mode .clue-example { border-color: #e2e2db; }
body.light-mode .clue-example { color: #53574f; }
body.light-mode .example-tile.hint { color: #41443d; background: #e6e6df; }
body.light-mode .example-tile small { color: #41443d; }
body.light-mode .dialog-content .how-last-note { border-color: #e2e2db; color: #6e726a; }
body.light-mode .setting-row + .setting-row { border-color: #e2e2db; }
body.light-mode .dialog-content .setting-copy h2 { color: #343730; }
body.light-mode .dialog-content .setting-copy p { color: #5f635b; }
body.light-mode .toggle-track { border-color: #c4c6bc; background: #dedfd7; }
body.light-mode .toggle-track::after { background: #fffefa; }
body.light-mode .settings-toggle input:checked + .toggle-track { border-color: #527d5d; background: #628a68; }
body.light-mode .settings-toggle input:checked + .toggle-track::after { background: #fffefa; }

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

/* Warm, lived-in colors and softer surfaces across both theme settings. */
body { background: radial-gradient(ellipse at 50% -12%, rgba(127, 98, 62, .17), transparent 62%), var(--black); }
.topbar { border-color: #382f25; }
.brand-word { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: -1px; }
.brand-mark .mark-left { stroke: #eee1cc; }
.brand-mark .mark-right { stroke: #c2af92; }
.settings-button { color: #c3b297; background: transparent; }
.settings-button:hover, .settings-button:focus-visible { color: var(--ink); background: transparent; }
.game-card { border-color: #493d30; border-radius: 20px; background: linear-gradient(145deg, #2d261f, #26211b 72%); box-shadow: 0 16px 38px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 241, 218, .035); }
.card-topline { border-color: #45392d; }
.round-label, body[data-mode="daily"] .round-label, body[data-mode="unlimited"] .round-label { color: #c0a982; font: 600 12px Georgia, "Times New Roman", serif; letter-spacing: .15px; }
.attempt-count { color: #b1a38e; }
.count-divider { color: #807361; }
.tile { border-color: #514435; border-radius: 11px; color: #f0e5d3; background: #302920; box-shadow: none; }
.tile.is-filled { border-color: #756247; background: #382f24; }
.board-row.is-active .tile { border-color: #62533e; background: #2c261f; }
.tile.is-green { border-color: var(--green) !important; color: #f7f4e9; background: var(--green) !important; }
.tile.is-hint { border-color: #554737; color: #d6cab7; background: #383026; }
.tile-arrow { color: #efe4d2; }
.tile.has-possibilities:hover, .tile.has-possibilities:focus-visible { outline-color: #a38b66; }
.possibility-popover { border-color: #5a4a37; border-radius: 15px; background: #30281f; box-shadow: 0 16px 36px rgba(0, 0, 0, .48); }
.possibility-caption { color: #b9a98e; }
.possibility-letter { border-radius: 8px; }
.possibility-letter.is-possible { color: #e5cf83; background: #49402b; }
.possibility-letter.is-impossible { color: #817666; background: #28231d; }
.board-hint { color: #a99b85; }
kbd { border-color: #514536; color: #d1c2aa; background: #342c24; }
.message { color: #d1b67e; }
.message.is-success, .message.is-result.is-win { color: #c4d0ae; }
.message.is-result.is-loss { color: #dfc488; }
.new-puzzle-button { border-color: #66563f; background: #393025; }
.new-puzzle-button:hover, .new-puzzle-button:focus-visible { border-color: #9c835b; background: #443828; }
.dialog-close:focus-visible, .settings-toggle input:focus-visible + .toggle-track { outline-color: #a38b66; }
.home-main h1 { font: 600 clamp(32px, 6vw, 40px)/1.12 Georgia, "Times New Roman", serif; letter-spacing: -.55px; }
.mode-option { border-color: #493d30; border-radius: 17px; background: linear-gradient(145deg, #2c261f, #26211b 78%); box-shadow: 0 8px 22px rgba(0, 0, 0, .11); }
.mode-option::before { border-radius: 0 4px 4px 0; }
.mode-option-daily, .mode-option-unlimited { --mode-accent: #a9916c; }
.mode-option-daily .mode-icon, .mode-option-unlimited .mode-icon { border-color: #574937; color: #d3bd94; background: #393025; }
.mode-option-daily .mode-go, .mode-option-unlimited .mode-go { color: #c3ab83; }
.mode-option:hover, .mode-option:focus-visible { border-color: #756247; background: linear-gradient(145deg, #352c22, #2b241d 78%); }
.mode-option-daily:hover, .mode-option-daily:focus-visible, .mode-option-unlimited:hover, .mode-option-unlimited:focus-visible { border-color: #8b7552; background: linear-gradient(145deg, #352c22, #2b241d 78%); }
.how-dialog, .settings-dialog { border-color: #524331; border-radius: 19px; background: #29231d; box-shadow: 0 24px 70px rgba(0, 0, 0, .48); }
.how-dialog::backdrop, .settings-dialog::backdrop { background: rgba(19, 16, 13, .72); }
.dialog-heading { border-color: #45392d; background: #29231d; }
.how-heading h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; }
.dialog-close { border-color: #554735; color: #c6b69b; background: #342c24; }
.dialog-close:hover { color: var(--ink); background: #403528; }
.dialog-content p { color: #b8aa94; }
.dialog-content .how-intro { color: #e2d5c0; }
.dialog-content h2, .clue-example strong, .dialog-content .setting-copy h2 { color: #e8dbc5; }
.dialog-content .clue-guide, .clue-example, .setting-row + .setting-row { border-color: #45392d; }
.clue-example { color: #cbbda7; }
.example-tile.hint { color: #d6cab7; background: #383026; }
.example-tile small { color: #efe4d2; }
.dialog-content .how-last-note, .dialog-content .setting-copy p { color: #b2a38d; }
.toggle-track { border-color: #5a4a37; background: #3b3228; }
.toggle-track::after { background: #d5c5a9; }
.settings-toggle input:checked + .toggle-track { border-color: #738362; background: #657452; }
.settings-toggle input:checked + .toggle-track::after { background: #f5eddf; }

body.light-mode { background: radial-gradient(ellipse at 50% -10%, rgba(189, 162, 119, .2), transparent 62%), var(--black); }
body.light-mode .topbar { border-color: #dfd1bc; }
body.light-mode .brand-mark .mark-left { stroke: #4a3b2a; }
body.light-mode .brand-mark .mark-right { stroke: #8b7758; }
body.light-mode .settings-button { color: #76644a; background: transparent; }
body.light-mode .settings-button:hover, body.light-mode .settings-button:focus-visible { color: #352b20; background: transparent; }
body.light-mode .game-card { border-color: #d6c7b0; background: linear-gradient(145deg, #fffaf0, #f8f0e2 85%); box-shadow: 0 14px 34px rgba(85, 64, 36, .12), inset 0 1px #fffdf8; }
body.light-mode .card-topline { border-color: #e4d8c6; }
body.light-mode .round-label, body.light-mode[data-mode="daily"] .round-label, body.light-mode[data-mode="unlimited"] .round-label { color: #806c4c; }
body.light-mode .attempt-count { color: #766957; }
body.light-mode .count-divider { color: #aa9a81; }
body.light-mode .tile { border-color: #d6c7b0; color: #3c3023; background: #f2e8d8; box-shadow: inset 0 1px #fffaf0; }
body.light-mode .tile.is-filled { border-color: #bdaa8d; background: #eee1cc; }
body.light-mode .board-row.is-active .tile { border-color: #c9b798; background: #f5ecde; }
body.light-mode .tile.is-green { border-color: #687b5b !important; color: #fffaf0; background: #687b5b !important; }
body.light-mode .tile.is-hint { border-color: #d8cbb7; color: #514332; background: #e9decd; }
body.light-mode .tile-arrow { color: #514332; }
body.light-mode .tile.has-possibilities:hover, body.light-mode .tile.has-possibilities:focus-visible { outline-color: #95815f; }
body.light-mode .possibility-popover { border-color: #d3c1a7; background: #fbf6eb; box-shadow: 0 14px 32px rgba(85, 64, 36, .18); }
body.light-mode .possibility-caption { color: #76664f; }
body.light-mode .possibility-letter.is-possible { color: #735d24; background: #eee2b9; }
body.light-mode .possibility-letter.is-impossible { color: #a99d8b; background: #f0e9dd; }
body.light-mode .board-hint { color: #85755f; }
body.light-mode kbd { border-color: #d7c8b2; color: #594a35; background: #f4ecde; }
body.light-mode .message { color: #816638; }
body.light-mode .message.is-success, body.light-mode .message.is-result.is-win { color: #596c4c; }
body.light-mode .message.is-result.is-loss { color: #84682f; }
body.light-mode .new-puzzle-button { border-color: #c8b493; color: #403322; background: #f0e6d4; }
body.light-mode .new-puzzle-button:hover, body.light-mode .new-puzzle-button:focus-visible { border-color: #ad9367; background: #eadcc5; }
body.light-mode .mode-option { border-color: #d8c9b3; background: linear-gradient(145deg, #fffaf0, #f7efe1 85%); box-shadow: 0 8px 20px rgba(85, 64, 36, .08); }
body.light-mode .mode-option:hover, body.light-mode .mode-option:focus-visible, body.light-mode .mode-option-daily:hover, body.light-mode .mode-option-daily:focus-visible, body.light-mode .mode-option-unlimited:hover, body.light-mode .mode-option-unlimited:focus-visible { border-color: #b9a27e; background: linear-gradient(145deg, #fffdf7, #f4ead8 85%); }
body.light-mode .mode-option-daily .mode-icon, body.light-mode .mode-option-unlimited .mode-icon { border-color: #d5c3a5; color: #806c4c; background: #f2e8d8; }
body.light-mode .mode-option-daily .mode-go, body.light-mode .mode-option-unlimited .mode-go { color: #806c4c; }
body.light-mode .how-dialog, body.light-mode .settings-dialog { border-color: #d6c7b0; background: #fbf6eb; box-shadow: 0 24px 70px rgba(85, 64, 36, .22); }
body.light-mode .how-dialog::backdrop, body.light-mode .settings-dialog::backdrop { background: rgba(65, 48, 27, .36); }
body.light-mode .dialog-heading { border-color: #e4d8c6; background: #fbf6eb; }
body.light-mode .how-heading h1 { color: #352b20; }
body.light-mode .dialog-close { border-color: #d7c8b2; color: #76644a; background: #f2e8d8; }
body.light-mode .dialog-close:hover { color: #352b20; background: #eadcc5; }
body.light-mode .dialog-content p { color: #6c5d48; }
body.light-mode .dialog-content .how-intro { color: #443727; }
body.light-mode .dialog-content h2, body.light-mode .clue-example strong, body.light-mode .dialog-content .setting-copy h2 { color: #493a28; }
body.light-mode .dialog-content .clue-guide, body.light-mode .clue-example, body.light-mode .setting-row + .setting-row { border-color: #e4d8c6; }
body.light-mode .clue-example { color: #65563f; }
body.light-mode .example-tile.hint { color: #514332; background: #e9decd; }
body.light-mode .example-tile small { color: #514332; }
body.light-mode .dialog-content .how-last-note, body.light-mode .dialog-content .setting-copy p { color: #766957; }
body.light-mode .toggle-track { border-color: #cdbc9f; background: #e7dac5; }
body.light-mode .toggle-track::after { background: #fbf6eb; }
body.light-mode .settings-toggle input:checked + .toggle-track { border-color: #687b5b; background: #748565; }
body.light-mode .settings-toggle input:checked + .toggle-track::after { background: #fffaf0; }

/* Home page choices styled like softly worn paper game cards. */
.mode-options { gap: 17px; }
.mode-option {
  min-height: 112px;
  padding: 18px 20px;
  border: 1px solid #b39a75;
  border-radius: 6px 16px 7px 14px;
  color: #403322;
  background: linear-gradient(118deg, rgba(255, 252, 243, .42), transparent 58%), #e9ddc8;
  box-shadow: 0 4px 0 #a48b68, 0 12px 24px rgba(0, 0, 0, .16);
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
}
.mode-option::before {
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: 0;
  border-left: 1px dashed rgba(111, 87, 55, .38);
  border-radius: 0;
  background: none;
}
.mode-option-daily, .mode-option-unlimited { --mode-accent: #806c4c; }
.mode-option-daily .mode-icon, .mode-option-unlimited .mode-icon {
  border-color: #c7b392;
  border-radius: 12px 10px 13px 9px;
  color: #705a39;
  background: #ded0b7;
}
.mode-option-daily .mode-go, .mode-option-unlimited .mode-go { color: #806c4c; }
.mode-title { color: #3d3021; font: 600 19px/1.2 Georgia, "Times New Roman", serif; letter-spacing: -.2px; }
.mode-description { color: #6c5b43; }
.mode-icon-infinity { font-family: Georgia, "Times New Roman", serif; }
.mode-option:hover, .mode-option:focus-visible,
.mode-option-daily:hover, .mode-option-daily:focus-visible,
.mode-option-unlimited:hover, .mode-option-unlimited:focus-visible {
  border-color: #927b57;
  background: linear-gradient(118deg, rgba(255, 252, 243, .62), transparent 58%), #f0e5d2;
  box-shadow: 0 5px 0 #a48b68, 0 16px 28px rgba(0, 0, 0, .2);
  transform: translateY(-2px) rotate(-.2deg);
}
.mode-option-unlimited:hover, .mode-option-unlimited:focus-visible { transform: translateY(-2px) rotate(.2deg); }
.mode-option:focus-visible { outline: 2px solid #b79c70; outline-offset: 4px; }
body.light-mode .mode-option {
  border-color: #c9b798;
  color: #403322;
  background: linear-gradient(118deg, rgba(255, 255, 255, .55), transparent 58%), #f1e6d3;
  box-shadow: 0 4px 0 #b59d78, 0 10px 20px rgba(85, 64, 36, .12);
}
body.light-mode .mode-option-daily .mode-icon, body.light-mode .mode-option-unlimited .mode-icon {
  border-color: #d0bd9d;
  color: #705a39;
  background: #e6d8bf;
}
body.light-mode .mode-option-daily .mode-go, body.light-mode .mode-option-unlimited .mode-go { color: #806c4c; }
body.light-mode .mode-title { color: #3d3021; }
body.light-mode .mode-description { color: #6c5b43; }
body.light-mode .mode-option:hover, body.light-mode .mode-option:focus-visible,
body.light-mode .mode-option-daily:hover, body.light-mode .mode-option-daily:focus-visible,
body.light-mode .mode-option-unlimited:hover, body.light-mode .mode-option-unlimited:focus-visible {
  border-color: #aa9169;
  background: linear-gradient(118deg, rgba(255, 255, 255, .72), transparent 58%), #f7eddb;
  box-shadow: 0 5px 0 #b59d78, 0 14px 24px rgba(85, 64, 36, .16);
}

/* The mode chooser is a calm, warm menu panel rather than decorative cards. */
.home-main h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.55px; }
.mode-options {
  gap: 0;
  margin: 30px auto 0;
  padding: 8px 18px;
  border: 1px solid #514333;
  border-radius: 14px;
  background: #29231d;
  box-shadow: inset 0 1px rgba(255, 241, 218, .035);
}
.mode-options::before { display: none; }
.mode-option, .mode-option-daily, .mode-option-unlimited {
  isolation: isolate;
  min-height: 100px;
  padding: 15px 8px;
  border: 1px solid transparent;
  border-bottom-color: #45392d;
  border-radius: 0;
  color: #f0e5d3;
  background: transparent;
  box-shadow: none;
  transform: none;
  transition: none;
}
.mode-option:last-child { border-bottom: 0; }
.mode-option::before { display: none; }
.mode-option-daily .mode-icon, .mode-option-unlimited .mode-icon {
  width: 44px;
  height: 44px;
  border: 1px solid #5a4a37;
  border-radius: 11px;
  color: #c0a982;
  background: #342c24;
}
.mode-option-daily .mode-icon svg { transform: none; }
.mode-option-unlimited .mode-icon { font: 400 34px/1 Georgia, "Times New Roman", serif; }
.mode-title { color: #f0e5d3; font: 600 19px/1.2 Georgia, "Times New Roman", serif; letter-spacing: 0; }
.mode-description { color: #b0a28d; font-size: 12px; line-height: 1.55; }
.mode-option-daily .mode-go, .mode-option-unlimited .mode-go { color: #c0a982; font: 400 21px/1 Georgia, "Times New Roman", serif; }
.mode-option:hover, .mode-option-daily:hover, .mode-option-unlimited:hover {
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transform: none;
}
/* The separator belongs to the row above; hide it while the next row is hovered. */
.mode-option:has(+ .mode-option:hover) { border-bottom-color: transparent; }
.mode-option:hover::after {
  position: absolute;
  z-index: -1;
  inset: -1px -18px 0;
  border-radius: 8px;
  background: #30281f;
  content: "";
  pointer-events: none;
}
.mode-option:first-child:hover::after { top: -8px; border-radius: 14px 14px 8px 8px; }
.mode-option:last-child:hover::after { bottom: -8px; border-radius: 8px 8px 14px 14px; }
.mode-option:focus-visible, .mode-option-daily:focus-visible, .mode-option-unlimited:focus-visible {
  border-color: #806c4c;
  border-radius: 8px;
  background: #30281f;
  box-shadow: none;
  transform: none;
}
.mode-option:focus-visible { outline: 2px solid #a38b66; outline-offset: 2px; }

body.light-mode .mode-options { border-color: #d2c2aa; background: #f8f1e5; box-shadow: inset 0 1px #fffaf1; }
body.light-mode .mode-option, body.light-mode .mode-option-daily, body.light-mode .mode-option-unlimited {
  border-bottom-color: #e4d8c6;
  color: #352b20;
  background: transparent;
  box-shadow: none;
}
body.light-mode .mode-option-daily .mode-icon, body.light-mode .mode-option-unlimited .mode-icon { border-color: #d3c2a8; color: #806c4c; background: #efe5d5; }
body.light-mode .mode-title { color: #352b20; }
body.light-mode .mode-description { color: #766957; }
body.light-mode .mode-option-daily .mode-go, body.light-mode .mode-option-unlimited .mode-go { color: #806c4c; }
body.light-mode .mode-option:hover, body.light-mode .mode-option-daily:hover, body.light-mode .mode-option-unlimited:hover {
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transform: none;
}
body.light-mode .mode-option:hover::after { background: #f0e7d9; }
body.light-mode .mode-option:focus-visible, body.light-mode .mode-option-daily:focus-visible, body.light-mode .mode-option-unlimited:focus-visible {
  border-color: #aa9169;
  border-radius: 8px;
  background: #f0e7d9;
  box-shadow: none;
}
/* Remove the light tile's inset highlight, which reads as a pale gap inside its border. */
body.light-mode .tile { box-shadow: none; }

.archive-main { width: min(100%, 540px); margin: 38px auto 0; padding: 0 10px 36px; }
.archive-main h1 { margin: 22px 0 6px; color: var(--ink); font: 600 clamp(28px, 6vw, 36px)/1.15 Georgia, "Times New Roman", serif; letter-spacing: -.5px; }
.archive-intro { margin: 0; color: #b0a28d; font-size: 12px; line-height: 1.6; }
.archive-list { display: grid; gap: 7px; margin-top: 20px; }
.archive-item { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto 20px; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid #514333; border-radius: 8px; color: #f0e5d3; background: #29231d; text-decoration: none; }
.archive-item:hover { border-color: #806c4c; background: #30281f; }
.archive-item.is-complete { border-color: #526d50; color: #d9ead2; background: #263126; }
.archive-item.is-complete:hover { border-color: #789675; background: #2d3a2d; }
.archive-item.is-complete .archive-item-date { color: #a9c2a4; }
.archive-item.is-complete .archive-item-arrow { color: #a9c99f; }
.archive-item-number { font: 600 13px Georgia, "Times New Roman", serif; }
.archive-item-date { color: #b0a28d; font-size: 11px; }
.archive-item-arrow { color: #c0a982; font-size: 17px; text-align: right; }
.archive-empty { margin: 0; padding: 20px; border: 1px solid #514333; border-radius: 8px; color: #b0a28d; background: #29231d; font-size: 12px; text-align: center; }
.archive-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 17px; color: #b0a28d; font-size: 11px; }
.archive-pagination a { color: #d8c7aa; text-decoration: none; }
.archive-pagination a:hover { color: #f0e5d3; }
.archive-pagination span:last-child { text-align: right; }
body.light-mode .archive-main h1 { color: #352b20; }
body.light-mode .archive-intro, body.light-mode .archive-pagination { color: #766957; }
body.light-mode .archive-item, body.light-mode .archive-empty { border-color: #d2c2aa; color: #352b20; background: #f8f1e5; }
body.light-mode .archive-item:hover { border-color: #aa9169; background: #f0e7d9; }
body.light-mode .archive-item.is-complete { border-color: #a8c3a3; color: #29452d; background: #eaf3e7; }
body.light-mode .archive-item.is-complete:hover { border-color: #82a77d; background: #dfeedd; }
body.light-mode .archive-item.is-complete .archive-item-date { color: #527a56; }
body.light-mode .archive-item.is-complete .archive-item-arrow { color: #477b50; }
body.light-mode .archive-item-date { color: #766957; }
body.light-mode .archive-item-arrow, body.light-mode .archive-pagination a { color: #806c4c; }
body.light-mode .archive-pagination a:hover { color: #352b20; }
body.light-mode .archive-empty { color: #766957; }

@media (max-width: 480px) {
  .archive-item { grid-template-columns: minmax(0, 1fr) 20px; }
  .archive-item-date { grid-column: 1; grid-row: 2; }
  .archive-item-arrow { grid-column: 2; grid-row: 1 / span 2; }
}

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

.mobile-keyboard { display: none; }
.mobile-keyboard[hidden] { display: none; }

.share-result-button[hidden] { display: none; }
.play-unlimited-link[hidden] { display: none; }
.play-unlimited-link {
  order: 4;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 9px;
  text-decoration: none;
}
.play-unlimited-icon { color: #c0a982; font: 400 25px/.8 Georgia, "Times New Roman", serif; }
body.light-mode .play-unlimited-icon { color: #806c4c; }
.play-unlimited-link { border-color: #90764f; color: #f4ead7; background: #51432f; }
.play-unlimited-link, .share-result-button { transition: none; }
.play-unlimited-link:hover, .play-unlimited-link:focus-visible { border-color: #b09463; color: #fff8e9; background: #5c4b34; }
.play-unlimited-link:hover { transform: none; }
.play-unlimited-link:focus-visible { outline: 2px solid #b79b6b; outline-offset: 2px; }
.play-unlimited-link .play-unlimited-icon { color: #dfc28b; }
body.light-mode .play-unlimited-link { border-color: #c8b28d; color: #443724; background: #eee4d2; }
body.light-mode .play-unlimited-link:hover, body.light-mode .play-unlimited-link:focus-visible { border-color: #ac9163; color: #382d1f; background: #e5d7be; }
body.light-mode .play-unlimited-link:focus-visible { outline-color: #a58a5c; }
body.light-mode .play-unlimited-link .play-unlimited-icon { color: #846b42; }
.share-result-button {
  order: 5;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 14px;
  padding: 0 18px;
  border: 1px solid #66563f;
  border-radius: 9px;
  color: #f0e5d3;
  background: #393025;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.share-result-button svg { display: block; width: 16px; height: 16px; flex: 0 0 auto; }
.share-result-button svg path, .share-result-button svg circle { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.share-result-button:hover, .share-result-button:focus-visible { border-color: #9c835b; background: #443828; }
.share-result-button:focus-visible { outline: 2px solid #a38b66; outline-offset: 2px; }
body.light-mode .share-result-button { border-color: #c4c7ca; color: #383c40; background: #e8e9eb; }
body.light-mode .share-result-button:hover, body.light-mode .share-result-button:focus-visible { border-color: #a3a7ab; background: #dcdfe1; }
body.light-mode .share-result-button:focus-visible { outline-color: #858a8f; }
.share-result-button { border-color: #55595e; color: #e3e5e7; background: #383b3f; }
.share-result-button:hover, .share-result-button:focus-visible { border-color: #74797f; background: #44484d; }
.share-result-button:focus-visible { outline-color: #8c9299; }

@media (max-width: 600px) {
  .desktop-hint-note { display: none; }
  .mobile-hint-note { display: block; }
  .game-card { padding-right: 12px; padding-left: 12px; }
  .board { width: min(100%, 280px); }
  .mobile-keyboard:not([hidden]) { order: 3; display: grid; gap: 9px; margin-top: 12px; touch-action: manipulation; user-select: none; }
  .mobile-keyboard-row { display: flex; justify-content: center; gap: 4px; }
  .mobile-keyboard-row.middle-row { width: 92%; margin: 0 auto; }
  .mobile-key { min-width: 0; height: 58px; flex: 1 1 0; padding: 0; border: 1px solid #554735; border-radius: 8px; color: #f0e5d3; background: #40362a; font: 600 19px/1 ui-sans-serif, system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mobile-key:active { border-color: #9c835b; background: #574833; }
  .mobile-key:focus-visible { outline: 2px solid #a38b66; outline-offset: 2px; }
  .mobile-key-action { flex: 1.55 1 0; font-size: 13px; }
  .mobile-key.backspace-key { font-size: 25px; }
  body.light-mode .mobile-key { border-color: #d3c2a8; color: #352b20; background: #efe5d5; }
  body.light-mode .mobile-key:active { border-color: #aa9169; background: #e5d8c5; }
  body.light-mode .mobile-key:focus-visible { outline-color: #aa9169; }
  .board-hint { order: 2; }
  .message { order: 4; }
  .hard-mode-prompt { order: 4; }
  .share-result-button { order: 6; }
  .play-unlimited-link { order: 5; }
  .new-puzzle-form { order: 7; }
}
.leaderboard-button[hidden] { display: none; }
.game-stage { position: relative; padding-top: 30px; }
.game-stage > .game-card { margin-top: 0; }
.game-stage-actions { position: absolute; top: 30px; left: 50%; width: min(100%, 470px); height: 0; transform: translateX(-50%); }
.game-stage-actions .settings-button { position: absolute; z-index: 30; top: 0; left: calc(-36px - 30px); grid-column: auto; justify-self: auto; }
.leaderboard-button {
  position: absolute;
  z-index: 30;
  top: 0;
  left: calc(100% + 30px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid #e6cb8f;
  border-radius: 9px;
  color: #342715;
  background: linear-gradient(180deg, #f0d99f, #d8b96f);
  box-shadow: 0 2px 0 #937447;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  transition: border-color .16s, background .16s, transform .16s;
}
.leaderboard-button:hover, .leaderboard-button:focus-visible { border-color: #f4dda7; background: linear-gradient(180deg, #f6e4b8, #e1c27a); transform: translateY(-1px); }
.leaderboard-button:focus-visible { outline: 2px solid #e4c579; outline-offset: 3px; }
body.light-mode .leaderboard-button { border-color: #b8985b; color: #342715; background: linear-gradient(180deg, #ead29a, #d0ae65); }
body.light-mode .leaderboard-button:hover, body.light-mode .leaderboard-button:focus-visible { border-color: #a9874d; background: linear-gradient(180deg, #f0dda9, #d9b96e); }
body.light-mode .leaderboard-button:focus-visible { outline-color: #a9874d; }

@media (max-width: 750px) {
  .game-stage-actions { top: 0; left: 50%; width: min(100%, 470px); height: 30px; transform: translateX(-50%); }
  .game-stage-actions .settings-button, .home-header-settings { display: none; }
  .help-actions { align-items: center; gap: 8px; }
  .help-actions .help-settings-button { display: grid; grid-column: auto; justify-self: auto; width: 32px; height: 32px; }
  .help-settings-button svg { width: 21px; height: 21px; }
  .leaderboard-button { left: auto; right: 0; }
}

@media (max-width: 600px) {
  .game-stage { padding-top: 24px; }
  .game-stage-actions { height: 24px; }
  .leaderboard-button { min-height: 22px; padding: 0 9px; font-size: 10px; }
}

.leaderboard-dialog { width: min(400px, calc(100vw - 32px)); }
.leaderboard-content { text-align: center; }
.leaderboard-content .leaderboard-intro { color: #e2d5c0; }
.leaderboard-content .leaderboard-percentage { margin: 18px 0 8px; color: #d5c7ad; font-size: clamp(48px, 14vw, 66px); font-weight: 650; line-height: 1; letter-spacing: -2px; }
.leaderboard-content .leaderboard-average-section { margin-top: 19px; padding-top: 15px; border-top: 1px solid #45392d; }
.leaderboard-content .leaderboard-average-title { margin: 0 0 6px; color: #b8aa94; font-size: 11px; font-weight: 600; }
.leaderboard-content .leaderboard-average-value { color: #e2d5c0; font-size: 21px; font-weight: 650; line-height: 1.2; }
.leaderboard-content .leaderboard-note { margin-top: 13px; font-size: 11px; }
body.light-mode .leaderboard-content .leaderboard-intro { color: #443727; }
body.light-mode .leaderboard-content .leaderboard-percentage { color: #687b5b; }
body.light-mode .leaderboard-content .leaderboard-average-section { border-color: #e4d8c6; }
body.light-mode .leaderboard-content .leaderboard-average-title { color: #766957; }
body.light-mode .leaderboard-content .leaderboard-average-value { color: #443727; }
body.light-mode .leaderboard-content .leaderboard-note { color: #766957; }
body.light-mode .how-to-text { color: #77776e; }
body.light-mode .how-to-text:hover, body.light-mode .how-to-text:focus-visible { color: #56594f; }
body.light-mode .how-mark { border-color: #aaa99e; color: #77776e; }
body.light-mode .how-to-text:hover .how-mark, body.light-mode .how-to-text:focus-visible .how-mark { border-color: #77776e; color: #4e5249; background: #f0efe8; }

/* Keep the close controls in How to Play and Settings visually unboxed. */
.how-dialog .dialog-close, .settings-dialog .dialog-close { border: 0; color: #c6b69b; background: transparent; }
.how-dialog .dialog-close:hover, .settings-dialog .dialog-close:hover { color: var(--ink); background: transparent; }
.how-dialog .dialog-close:focus, .settings-dialog .dialog-close:focus { outline: 0; box-shadow: none; }
body.light-mode .how-dialog .dialog-close, body.light-mode .settings-dialog .dialog-close { color: #76644a; background: transparent; }
body.light-mode .how-dialog .dialog-close:hover, body.light-mode .settings-dialog .dialog-close:hover { color: #352b20; background: transparent; }

@media (max-width: 600px) and (max-height: 820px) {
  .topbar { height: clamp(68px, calc(20dvh - 70px), 94px); }
  .game-stage { padding-top: clamp(20px, calc(5dvh - 17px), 24px); }
  .game-stage-actions { height: clamp(20px, calc(5dvh - 17px), 24px); }
  .leaderboard-button { min-height: 20px; padding: 0 8px; font-size: 9px; }
  .game-card { padding: clamp(8px, calc(4.5dvh - 20px), 15px) 12px; }
  .card-topline { padding-bottom: clamp(8px, calc(5dvh - 26px), 15px); }
  .board { width: min(100%, clamp(220px, calc(27dvh + 50px), 280px)); margin-top: clamp(8px, calc(5dvh - 23px), 18px); gap: 4px; }
  .board-row { gap: 4px; }
  .tile { border-radius: 6px; font-size: clamp(16px, 5.2vw, 20px); }
  .tile-arrow { right: 3px; bottom: 2px; font-size: 14px; }
  .mobile-keyboard:not([hidden]) { gap: clamp(4px, calc(1.5dvh - 4px), 8px); margin-top: clamp(6px, calc(2.2dvh - 7px), 11px); }
  .mobile-keyboard-row { gap: clamp(2px, calc(1.67dvh - 9.7px), 4px); }
  .mobile-key { height: clamp(42px, calc(6.4dvh + 3px), 56px); border-radius: 7px; font-size: clamp(15px, calc(5dvh - 20px), 19px); }
  .mobile-key-action { font-size: clamp(11px, calc(2.5dvh - 8px), 13px); }
  .mobile-key.backspace-key { font-size: clamp(20px, calc(4.8dvh - 14px), 25px); }
  .board-hint { min-height: 14px; margin-top: clamp(7px, calc(3.33dvh - 13.3px), 14px); font-size: 9px; }
  .message { min-height: 14px; margin-top: 2px; }
  .message.is-result { margin-top: 5px; font-size: clamp(19px, 5vw, 23px); }
  .game-card.is-finished .board { margin-top: clamp(8px, calc(3.33dvh - 14.7px), 12px); }
  .share-result-button { min-height: 34px; margin-top: 6px; padding: 0 14px; }
  .play-unlimited-link { min-height: 34px; margin-top: 5px; }
  .new-puzzle-form { margin-top: 6px; }
  .new-puzzle-button { min-height: 34px; }
  .hard-mode-prompt { margin-top: 5px; font-size: 12px; }
  .help-actions { margin-top: 10px; }
  main { padding-bottom: clamp(4px, calc(5dvh - 26px), 14px); }
}

@media (max-width: 600px) and (max-height: 600px) {
  .topbar { height: clamp(52px, calc(20dvh - 56px), 64px); }
  .game-stage { padding-top: 18px; }
  .game-stage-actions { height: 18px; }
  .leaderboard-button { min-height: 18px; }
  .game-card { padding: clamp(6px, calc(2dvh + 2px), 14px) 10px; }
  .card-topline { padding-bottom: clamp(4px, calc(2dvh - 7px), 5px); }
  .board { width: min(100%, clamp(185px, 37dvh, 225px)); margin-top: clamp(4px, 1dvh, 6px); gap: 3px; }
  .board-row { gap: 3px; }
  .tile { border-radius: 5px; font-size: clamp(13px, 2.3dvh, 15px); }
  .mobile-keyboard:not([hidden]) { gap: clamp(3px, .8dvh, 5px); margin-top: clamp(4px, 1dvh, 5px); }
  .mobile-keyboard-row { gap: clamp(2px, .5dvh, 3px); }
  .mobile-key { height: clamp(32px, 6.5dvh, 40px); border-radius: 5px; font-size: clamp(13px, 2.5dvh, 15px); }
  .mobile-key-action { font-size: clamp(9px, 1.7dvh, 10px); }
  .mobile-key.backspace-key { font-size: clamp(19px, 3.5dvh, 21px); }
  .board-hint { min-height: 12px; margin-top: clamp(3px, .8dvh, 5px); font-size: 8px; }
  .message { min-height: 12px; margin-top: 0; }
  .message.is-result { margin-top: 4px; font-size: 19px; }
  .game-card.is-finished .board { margin-top: 5px; }
  .share-result-button { min-height: 30px; margin-top: 4px; }
  .play-unlimited-link { min-height: 30px; margin-top: 4px; }
  .new-puzzle-form { margin-top: 4px; }
  .new-puzzle-button { min-height: 30px; }
  .hard-mode-prompt { min-height: 22px; margin-top: 3px; font-size: 11px; }
  .help-actions { margin-top: 6px; }
  main { padding-bottom: 0; }
}

@media (min-width: 751px) and (max-height: 900px) {
  body[data-mode] .topbar { height: clamp(88px, calc(20dvh - 60px), 116px); }
  body[data-mode] .game-stage {
    --compact-game-stage-top: clamp(18px, calc(4dvh - 10px), 26px);
    padding-top: var(--compact-game-stage-top);
  }
  body[data-mode] .game-stage-actions { top: var(--compact-game-stage-top); }
  body[data-mode] .game-card { padding: clamp(12px, 2dvh, 18px) 24px; }
  body[data-mode] .card-topline { padding-bottom: 12px; }
  body[data-mode] .board { width: min(100%, clamp(300px, calc(30dvh + 75px), 330px)); margin-top: 18px; gap: 6px; }
  body[data-mode] .board-row { gap: 6px; }
  body[data-mode] .tile { font-size: clamp(21px, 2.8vw, 23px); }
  body[data-mode] .game-card.is-finished .board { margin-top: 12px; }
  body[data-mode] .board-hint { min-height: 14px; margin-top: 10px; }
  body[data-mode] .message { min-height: 14px; margin-top: 2px; }
  body[data-mode] .message.is-result { margin-top: 12px; font-size: clamp(22px, 4vw, 27px); }
  body[data-mode] .share-result-button { min-height: 36px; margin-top: 10px; padding: 0 16px; }
  body[data-mode] .play-unlimited-link { min-height: 34px; margin-top: 7px; }
  body[data-mode] .new-puzzle-form { margin-top: 10px; }
  body[data-mode] .new-puzzle-button { min-height: 34px; }
  body[data-mode] .hard-mode-prompt { margin-top: 10px; }
  body[data-mode] .help-actions { margin-top: 12px; }
  body[data-mode] .how-to-text { min-height: 28px; }
  body[data-mode] main { padding-bottom: clamp(8px, 2dvh, 18px); }
}
