:root {
  color-scheme: light;
  --canvas: #F4F0E8;
  --paper: #FFFFFF;
  --paper-strong: #FFFFFF;
  --ink: #111111;
  --ink-soft: #333333;
  --muted: #777777;
  --line: #C9C4CC;
  --line-strong: #111111;
  --dot: rgb(17 17 17 / 10%);
  --tile: #7654E8;
  --tile-ink: #FFFFFF;
  --tile-shadow: #4B32A7;
  --accent: #F2D34F;
  --accent-ink: #111111;
  --coral: #F05262;
  --success: #147D68;
  --success-bg: #DDF7EF;
  --error: #D12E43;
  --error-bg: #FFE6E9;
  --disabled: #D5D1DA;
  --violet: #7654E8;
  --tangerine: #FF9D42;
  --mint: #24BFA0;
  --violet-soft: #EEE9FF;
  --tangerine-soft: #FFF0E1;
  --mint-soft: #DDF7EF;
  --radius-card: 22px;
  --radius-control: 14px;
  --outline: 3px solid var(--line-strong);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #191722;
  --paper: #292633;
  --paper-strong: #332F40;
  --ink: #FBFAFF;
  --ink-soft: #E1DDEA;
  --muted: #B8B2C3;
  --line: #575064;
  --line-strong: #0C0A10;
  --dot: rgb(230 225 245 / 9%);
  --tile: #7654E8;
  --tile-ink: #FFFFFF;
  --tile-shadow: #39247F;
  --accent: #F2D34F;
  --accent-ink: #111111;
  --coral: #F05262;
  --success: #69E2C3;
  --success-bg: #263F3A;
  --error: #FF8794;
  --error-bg: #482C35;
  --disabled: #5B5662;
  --violet: #7654E8;
  --tangerine: #FF9D42;
  --mint: #24BFA0;
  --violet-soft: #352D4B;
  --tangerine-soft: #493629;
  --mint-soft: #263F3A;
}
* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--ink); transition: background-color 180ms ease, color 180ms ease; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
.game-page { position: relative; isolation: isolate; min-height: 100vh; min-height: 100svh; overflow: hidden; background-color: var(--canvas); }
.game-page::before { position: absolute; z-index: -1; inset: 0; background-image: radial-gradient(var(--dot) 1.35px, transparent 1.5px); background-size: 24px 24px; content: ""; pointer-events: none; }
.game-header { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 76px; padding: 12px clamp(18px, 5vw, 68px); gap: 18px; border-bottom: 3px solid var(--line-strong); background: var(--paper); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: var(--ink); font-size: 18px; font-weight: 950; letter-spacing: -.055em; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 19px; box-shadow: 3px 3px 0 var(--line-strong); }
.level-badge { display: inline-flex; align-items: center; margin-left: 7px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-strong); color: var(--ink); font-size: 9px; font-weight: 950; letter-spacing: .08em; line-height: 1.4; vertical-align: 1px; }
.header-right { display: flex; align-items: center; justify-self: end; gap: 12px; }
.header-count { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.score-pill, .moves-pill { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--paper-strong); }
.score-pill strong, .moves-pill strong { font-size: 16px; font-weight: 900; }
.score-pill strong { color: var(--success); }
.metric-label { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.theme-toggle { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--line-strong); border-radius: 13px; background: var(--paper-strong); color: var(--ink); cursor: pointer; box-shadow: 2px 2px 0 var(--line-strong); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .moon-icon, :root[data-theme="dark"] .sun-icon { display: none; }
.game-workspace { width: min(700px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 26px; }
.route-panel { display: grid; grid-template-columns: 1fr 62px 1fr; align-items: end; gap: 12px; padding: 0 0 24px; }
.route-end { display: flex; min-width: 0; flex-direction: column; gap: 9px; }
.route-end-target { align-items: flex-end; text-align: right; }
.route-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.route-dot { width: 9px; height: 9px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--tile); }
.target-dot { background: var(--accent); }
.route-connector { position: relative; display: flex; height: 48px; align-items: center; justify-content: center; margin-bottom: 5px; }
.route-connector i { position: absolute; right: 0; bottom: 2px; left: 0; height: 2px; background: var(--line); }
.route-connector i::after { position: absolute; top: -4px; right: 0; width: 8px; height: 8px; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted); content: ""; transform: rotate(45deg); }
.word-display { display: flex; gap: clamp(3px, .8vw, 7px); }
.word-display span { display: grid; width: clamp(35px, 6.5vw, 54px); height: clamp(43px, 7.8vw, 62px); place-items: center; border: 2px solid var(--line-strong); border-radius: 12px; background: var(--tile); color: var(--tile-ink); font-size: clamp(22px, 4vw, 31px); font-weight: 950; line-height: 1; box-shadow: 3px 4px 0 var(--tile-shadow); animation: letter-in 240ms ease both; }
.word-display-target span { background: var(--accent); color: var(--accent-ink); box-shadow: 3px 4px 0 color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }
.card-panel { padding: 21px; border: 3px solid var(--line-strong); border-radius: var(--radius-card); background: var(--paper); box-shadow: 5px 6px 0 var(--line-strong); }
.chain-panel { margin-top: 8px; }
.panel-heading, .entry-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.eyebrow { display: block; color: var(--muted); font-size: 9px; font-weight: 950; letter-spacing: .15em; }
.panel-heading h2, .entry-heading h2 { margin: 0; font-size: clamp(19px, 3vw, 23px); font-weight: 950; letter-spacing: -.045em; }
.chain-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.chain-list li { display: grid; grid-template-columns: 36px 1fr; align-items: center; min-height: 49px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-strong); animation: row-in 200ms ease both; }
.chain-list li > span { color: var(--muted); font-size: 10px; font-weight: 850; font-variant-numeric: tabular-nums; }
.chain-list li b { font-size: 18px; font-weight: 950; letter-spacing: .16em; }
.chain-list li.chain-final { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.chain-list li.chain-final b { color: var(--success); }
.entry-panel { margin-top: 20px; }
.entry-heading { margin-bottom: 16px; }
.entry-panel form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.entry-panel input { min-width: 0; height: 62px; padding: 0 17px; border: 3px solid var(--line-strong); border-radius: var(--radius-control); background: var(--paper-strong); color: var(--ink); font-size: 22px; font-weight: 950; letter-spacing: .24em; text-transform: uppercase; box-shadow: 3px 4px 0 var(--line); transition: box-shadow 140ms ease, border-color 140ms ease; }
.entry-panel input:focus { border-color: var(--tile); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tile) 22%, transparent); outline: none; }
.entry-panel input::placeholder { color: var(--muted); font-size: 11px; letter-spacing: .13em; }
.ink-button { display: inline-flex; min-height: 54px; align-items: center; justify-content: center; gap: 12px; padding: 0 20px; border: 3px solid var(--line-strong); border-radius: 14px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 11px; font-weight: 950; letter-spacing: .08em; box-shadow: 3px 4px 0 var(--line-strong); transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease; }
.ink-button:hover:not(:disabled) { filter: brightness(1.04); transform: translate(-1px, -1px); box-shadow: 4px 5px 0 var(--line-strong); }
.ink-button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 2px 0 var(--line-strong); }
.ink-button:disabled { border-color: var(--line); background: var(--disabled); color: color-mix(in srgb, var(--ink) 60%, transparent); box-shadow: none; cursor: not-allowed; }
.secondary-button { min-height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 11px; font-weight: 850; white-space: nowrap; }
.secondary-button:hover { background: var(--paper-strong); }
.game-message { margin: 13px 0 0; padding: 11px 13px; border: 2px solid var(--success); border-radius: 11px; background: var(--success-bg); color: var(--success); font-size: 12px; font-weight: 750; line-height: 1.5; }
.game-message.error { border-color: var(--error); background: var(--error-bg); color: var(--error); }
.finish-panel { margin-top: 20px; text-align: center; }
.finish-panel h2 { margin: 7px 0; font-size: 30px; font-weight: 950; letter-spacing: -.05em; }
.finish-panel p { max-width: 470px; margin: 0 auto 17px; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.finish-panel .ink-button { min-width: 180px; }
.completion-banner { margin: 0 0 17px; padding: 15px; border: 2px dashed var(--success); border-radius: 14px; background: var(--success-bg); text-align: center; animation: score-in 350ms ease both; }
.completion-banner strong { display: block; color: var(--success); font-size: 27px; font-weight: 950; }
.state-error { margin-top: 25px; color: var(--error); text-align: center; }
.state-error .ink-button { display: block; margin: 16px auto 0; }
.loading-progress { width: min(100%, 300px); margin: 18vh auto 0; text-align: center; }
.loading-track { height: 5px; margin-top: 16px; overflow: hidden; border-radius: 99px; background: var(--line); }
.loading-track span { display: block; width: 34%; height: 100%; border-radius: inherit; background: var(--accent); animation: loading-track 1.8s ease-in-out infinite; }
.loading-progress p { color: var(--muted); font-size: 12px; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
@keyframes letter-in { from { opacity: 0; transform: translateY(5px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes loading-track { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
@keyframes score-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (min-width: 900px) { .game-workspace { padding-top: 44px; } .route-panel { padding-bottom: 30px; } }
@media (max-width: 620px) {
  .game-header { min-height: 68px; padding: 10px 14px; gap: 8px; grid-template-columns: 1fr auto; }
  .wordmark { gap: 7px; font-size: 15px; }.brand-mark { width: 30px; height: 30px; font-size: 16px; }
  .header-right { gap: 7px; }.header-count { gap: 5px; }.score-pill, .moves-pill { min-height: 34px; gap: 5px; padding: 0 7px; border-radius: 9px; }.metric-label { font-size: 8px; }.score-pill strong, .moves-pill strong { font-size: 13px; }
  .theme-toggle { width: 36px; height: 36px; border-radius: 10px; }.theme-toggle svg { width: 17px; height: 17px; }
  .game-workspace { width: calc(100% - 28px); padding: 24px 0 20px; }
  .route-panel { grid-template-columns: 1fr 34px 1fr; gap: 5px; padding-bottom: 20px; }.route-label { font-size: 8px; gap: 5px; }.route-dot { width: 7px; height: 7px; }.route-connector { height: 43px; }
  .word-display { gap: 3px; }.word-display span { width: clamp(29px, 8.7vw, 44px); height: clamp(39px, 11vw, 51px); border-radius: 9px; font-size: clamp(20px, 6vw, 25px); box-shadow: 2px 3px 0 var(--tile-shadow); }
  .card-panel { padding: 16px; border-width: 2.5px; border-radius: 18px; box-shadow: 4px 5px 0 var(--line-strong); }
  .chain-panel { margin-top: 6px; }.chain-list { gap: 7px; margin-top: 14px; }.chain-list li { min-height: 44px; grid-template-columns: 29px 1fr; padding: 4px 9px; border-radius: 10px; }.chain-list li b { font-size: 16px; }
  .entry-panel { margin-top: 16px; }.entry-heading { margin-bottom: 13px; }.panel-heading h2, .entry-heading h2 { font-size: 19px; }.eyebrow { font-size: 8px; }
  .entry-panel form { grid-template-columns: 1fr; gap: 10px; }.entry-panel input { height: 57px; font-size: 21px; }.ink-button { min-height: 51px; }.secondary-button { min-height: 36px; font-size: 10px; }
}
@media (max-width: 370px) {
  .wordmark { font-size: 13px; }.brand-mark { width: 27px; height: 27px; }.header-count { gap: 4px; }.score-pill, .moves-pill { padding: 0 5px; }.metric-label { display: none; }
  .route-panel { grid-template-columns: 1fr 25px 1fr; }.word-display span { width: 27px; height: 37px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .word-display span, .ink-button, .card-panel, .theme-toggle { border: 2px solid ButtonText; } }


/* Keep long ladders usable while preserving the entry controls on screen. */
.chain-list {
  max-height: min(38vh, 320px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 5px 5px 2px;
  scroll-padding-block: 8px;
}
.chain-list li { scroll-margin-block: 8px; }

/* Comfortable minimum touch targets for secondary and theme controls. */
.theme-toggle { width: 44px; height: 44px; }
.secondary-button { min-height: 44px; }

@media (max-width: 620px) {
  .theme-toggle { width: 44px; height: 44px; }
}
@media (max-width: 370px) {
  .theme-toggle { width: 44px; height: 44px; }
}



/* Mobile play mode: the page is fixed to the visible viewport. The route and
   entry controls stay in place while only the word history scrolls. */
.share-status {
  min-height: 1.4em;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.finish-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.finish-actions .ink-button { flex: 1 1 180px; }

@media (max-width: 620px) {
  :root.keyboard-open,
  :root.keyboard-open body {
    height: var(--visual-viewport-height, 100dvh);
    min-height: 0;
    overflow: hidden;
  }
  :root.keyboard-open .game-page {
    display: flex;
    width: 100%;
    height: var(--visual-viewport-height, 100dvh);
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }
  :root.keyboard-open .game-header {
    display: grid;
    min-height: 54px;
    flex: 0 0 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-bottom-width: 2px;
  }
  :root.keyboard-open .wordmark { gap: 6px; font-size: 13px; }
  :root.keyboard-open .brand-mark {
    width: 25px;
    height: 25px;
    border-radius: 7px;
    font-size: 14px;
    box-shadow: 2px 2px 0 var(--line-strong);
  }
  :root.keyboard-open .header-right {
    min-width: 0;
    max-width: 100%;
    gap: 5px;
  }
  :root.keyboard-open .header-count {
    min-width: 0;
    gap: 4px;
  }
  :root.keyboard-open .score-pill,
  :root.keyboard-open .moves-pill {
    display: grid;
    width: 40px;
    min-width: 40px;
    min-height: 34px;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 2px;
    padding: 3px 3px;
    border-width: 1px;
    border-radius: 8px;
  }
  :root.keyboard-open .metric-label {
    display: block;
    font-size: 6px;
    line-height: 1;
    letter-spacing: .03em;
  }
  :root.keyboard-open .score-pill strong,
  :root.keyboard-open .moves-pill strong { font-size: 13px; line-height: 1; }
  :root.keyboard-open .header-hint-button {
    width: 48px;
    min-width: 48px;
    height: 36px;
    gap: 3px;
    padding: 0 4px;
    border-width: 1px;
    border-radius: 9px;
    box-shadow: 1px 2px 0 var(--line-strong);
  }
  :root.keyboard-open .header-hint-button svg { width: 17px; height: 17px; }
  :root.keyboard-open .header-hint-cost { font-size: 10px; line-height: 1; }
  :root.keyboard-open .theme-toggle {
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-width: 1px;
    border-radius: 9px;
    box-shadow: 1px 2px 0 var(--line-strong);
  }
  :root.keyboard-open .theme-toggle svg { width: 16px; height: 16px; }
  :root.keyboard-open .game-workspace {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 6px 10px max(6px, env(safe-area-inset-bottom));
  }
  :root.keyboard-open #game:not([hidden]) {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 7px;
    overflow: hidden;
  }
  :root.keyboard-open .route-panel {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 0 2px 5px;
  }
  :root.keyboard-open .route-end { gap: 4px; }
  :root.keyboard-open .route-end-target { align-items: flex-end; }
  :root.keyboard-open .route-label { gap: 5px; font-size: 7px; letter-spacing: .08em; }
  :root.keyboard-open .route-dot { width: 6px; height: 6px; }
  :root.keyboard-open .route-connector { display: none; }
  :root.keyboard-open .word-display { gap: 3px; }
  :root.keyboard-open .word-display span {
    width: clamp(27px, 7vw, 34px);
    height: 34px;
    border-radius: 7px;
    font-size: 19px;
    box-shadow: 1px 2px 0 var(--tile-shadow);
  }
  :root.keyboard-open .chain-panel {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 9px 11px;
    border-width: 2px;
    border-radius: 13px;
    box-shadow: 2px 3px 0 var(--line-strong);
  }
  :root.keyboard-open .panel-heading { flex: 0 0 auto; }
  :root.keyboard-open .panel-heading h2 { font-size: 14px; }
  :root.keyboard-open .chain-list {
    display: flex;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 6px 0 0;
    padding: 2px 5px 3px 2px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }
  :root.keyboard-open .chain-list li {
    min-height: 29px;
    flex: 0 0 auto;
    grid-template-columns: 25px 1fr;
    padding: 2px 7px;
    border-radius: 7px;
  }
  :root.keyboard-open .chain-list li > span { font-size: 9px; }
  :root.keyboard-open .chain-list li b { font-size: 14px; }
  :root.keyboard-open .entry-panel {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    margin: 0;
    padding: 9px 10px;
    border-width: 2px;
    border-radius: 13px;
    box-shadow: 2px 3px 0 var(--line-strong);
  }
  :root.keyboard-open .entry-heading { display: none; }
  :root.keyboard-open .entry-panel form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 7px;
  }
  :root.keyboard-open .entry-panel input {
    width: 100%;
    height: 46px;
    min-height: 46px;
    padding-inline: 10px;
    border-width: 2px;
    border-radius: 9px;
    font-size: 19px;
    letter-spacing: .18em;
    box-shadow: 1px 2px 0 var(--line);
  }
  :root.keyboard-open .entry-panel input::placeholder { font-size: 9px; }
  :root.keyboard-open .entry-panel .ink-button {
    min-height: 46px;
    padding-inline: 7px;
    border-width: 2px;
    border-radius: 9px;
    font-size: 9px;
    letter-spacing: .04em;
    box-shadow: 1px 2px 0 var(--line-strong);
  }
  :root.keyboard-open .entry-actions { display: none; }
  :root.keyboard-open .game-message {
    margin: 6px 0 0;
    padding: 6px 8px;
    border-width: 1px;
    font-size: 10px;
  }
}

/* Prevent the help text and action buttons from overflowing narrow screens. */
.entry-actions { display: flex; width: 100%; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.entry-actions .secondary-button {
  display: inline-flex;
  min-height: 44px;
  flex: 1 1 145px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px;
  border-width: 2px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 900;
  transition: transform 130ms ease, filter 130ms ease, box-shadow 130ms ease;
}
.entry-actions .secondary-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.entry-actions .secondary-button:hover { transform: translateY(-1px); filter: brightness(1.04); }
.entry-actions .secondary-button:active { transform: translateY(1px); }
.share-challenge-button {
  border-color: var(--tile-shadow);
  background: var(--tile);
  color: var(--tile-ink);
  box-shadow: 2px 3px 0 var(--tile-shadow);
}
.new-game-button {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line-strong));
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 2px 3px 0 color-mix(in srgb, var(--accent) 65%, var(--line-strong));
}
@media (max-width: 370px) {
  .entry-actions .secondary-button { flex: 1 1 100%; }
}


/* Focused mobile play: reserve the visible viewport for the route, history,
   and a compact one tap word control. */
.send-button {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  padding: 0;
}
.send-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.send-button:disabled svg { opacity: .65; }

@media (max-width: 620px) {
  .entry-panel form { grid-template-columns: minmax(0, 1fr) 54px; }
  .entry-panel .send-button { width: 54px; min-width: 54px; min-height: 54px; }
}
@media (max-width: 620px) {
  :root.keyboard-open .entry-panel form {
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 6px;
  }
  :root.keyboard-open .entry-panel .send-button {
    width: 48px;
    min-width: 48px;
    min-height: 44px;
  }
  :root.keyboard-open .send-button svg { width: 20px; height: 20px; }
}
@media (max-width: 420px) {
  .header-right { gap: 4px; }
  .header-help-button { width: 30px; min-width: 30px; height: 32px; }
  .theme-toggle { width: 32px; min-width: 32px; height: 32px; }
}

/* Paid BFS hint system */
.hint-tools { display: grid; gap: 8px; margin: 0 0 15px; }
.hint-button {
  display: grid; width: 100%; min-height: 66px;
  grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center;
  gap: 12px; padding: 10px 13px;
  border: 2px dashed var(--line-strong); border-radius: 14px;
  background: var(--paper-strong); color: var(--ink); text-align: left;
  cursor: pointer; transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.hint-button:hover:not(:disabled) { border-style: solid; border-color: var(--accent); background: var(--success-bg); transform: translateY(-1px); }
.hint-button:active:not(:disabled) { transform: translateY(1px); }
.hint-button:focus-visible { outline: 3px solid var(--tile); outline-offset: 3px; }
.hint-button:disabled { cursor: not-allowed; opacity: .7; }
.hint-icon { display: grid; width: 38px; height: 38px; place-items: center; border: 2px solid var(--line-strong); border-radius: 11px; background: var(--accent); color: var(--accent-ink); box-shadow: 2px 3px 0 var(--line-strong); }
.hint-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint-copy { display: grid; min-width: 0; gap: 3px; }
.hint-copy strong { font-size: 11px; font-weight: 950; letter-spacing: .08em; }
.hint-copy small { color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.35; }
.hint-cost-chip { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 950; white-space: nowrap; }
.hint-budget { margin: 0; color: var(--muted); font-size: 11px; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.hint-reveal { padding: 13px; border: 2px solid var(--success); border-radius: 14px; background: var(--success-bg); animation: hint-reveal-in 260ms cubic-bezier(.2,.8,.2,1) both; }
.hint-reveal[hidden] { display: none; }
.hint-reveal-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.hint-reveal-kicker { color: var(--success); font-size: 9px; font-weight: 950; letter-spacing: .13em; }
.hint-reveal-note { color: var(--muted); font-size: 10px; font-weight: 750; }
.hint-word { gap: 6px; justify-content: center; }
.hint-word span { animation: hint-tile-in 300ms cubic-bezier(.2,.8,.2,1) both; }
.hint-word span:nth-child(2) { animation-delay: 35ms; }
.hint-word span:nth-child(3) { animation-delay: 70ms; }
.hint-word span:nth-child(4) { animation-delay: 105ms; }
.hint-word span.hint-letter-changed { border-color: var(--success); background: var(--success); color: #fff; box-shadow: 3px 4px 0 color-mix(in srgb, var(--success) 55%, var(--line-strong)); }
.hint-reveal p { margin: 10px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.5; text-align: center; }
@keyframes hint-reveal-in { from { opacity: 0; transform: translateY(-5px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes hint-tile-in { from { opacity: 0; transform: translateY(8px) rotateX(35deg) scale(.9); } to { opacity: 1; transform: translateY(0) rotateX(0) scale(1); } }
@media (max-width: 620px) {
  .hint-tools { gap: 6px; margin-bottom: 10px; }
  .hint-button { min-height: 58px; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; padding: 8px 10px; }
  .hint-icon { width: 34px; height: 34px; }
  .hint-copy strong { font-size: 10px; }
  .hint-copy small { font-size: 10px; }
  .hint-budget { font-size: 10px; }
  .hint-reveal { padding: 10px; }
  .hint-word span { width: clamp(29px, 8.7vw, 44px); height: clamp(39px, 11vw, 51px); }
}
@media (prefers-reduced-motion: reduce) {
  .hint-button, .hint-reveal, .hint-word span { animation: none !important; transition: none !important; }
}


/* Compact paid hint action lives in the top bar, keeping the play area clear. */
.header-hint-button {
  display: inline-flex;
  min-width: 54px;
  height: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 2px solid var(--line-strong);
  border-radius: 13px;
  background: var(--paper-strong);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--line-strong);
  cursor: pointer;
}
.header-hint-button svg { width: 21px; height: 21px; fill: none; stroke: var(--accent-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.header-hint-cost { color: var(--accent-ink); font-size: 12px; font-weight: 950; font-variant-numeric: tabular-nums; }
.header-hint-button:disabled { opacity: .48; box-shadow: none; cursor: not-allowed; }
.hint-confirmation-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(5 12 11 / 72%);
  backdrop-filter: blur(5px);
}
.hint-confirmation {
  width: min(100%, 390px);
  padding: 24px;
  border: 3px solid var(--line-strong);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 7px 8px 0 rgb(0 0 0 / 28%);
}
.hint-confirm-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 25px;
  font-weight: 950;
}
.hint-confirmation h2 { margin: 15px 0 5px; font-size: 25px; font-weight: 950; letter-spacing: -.04em; }
.hint-confirmation > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.hint-confirm-cost, .hint-confirm-balance { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hint-confirm-cost strong { color: var(--error); font-size: 20px; }
.hint-confirm-balance strong { color: var(--success); font-size: 20px; }
.hint-confirmation .hint-confirm-warning { margin: 14px 0 18px; font-size: 12px; }
.hint-confirm-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.hint-confirm-actions button { min-width: 0; min-height: 48px; }
@media (max-width: 620px) {
  .header-hint-button { min-width: 48px; height: 40px; gap: 3px; padding-inline: 6px; border-radius: 10px; }
  .header-hint-button svg { width: 19px; height: 19px; }
  .header-hint-cost { font-size: 11px; }
  .hint-confirmation { padding: 20px; }
}
@media (max-width: 370px) {
  .header-hint-button { min-width: 43px; padding-inline: 5px; }
  .header-hint-button svg { width: 17px; height: 17px; }
}
@media (prefers-reduced-motion: reduce) { .hint-confirmation-backdrop { backdrop-filter: none; } }

@media (max-width: 620px) {
}

/* WRDLINK arcade palette details shared with the Reddit edition. */
.brand-mark { background: var(--violet); color: #FFFFFF; }
.level-badge { border: 1.5px dashed var(--violet); background: var(--violet-soft); }
.score-pill { border: 1.5px dashed var(--mint); background: var(--mint-soft); }
.moves-pill { border: 1.5px dashed var(--tangerine); background: var(--tangerine-soft); }
.word-display span { background: var(--violet); color: #FFFFFF; }
.word-display-target span { background: var(--accent); color: #111111; }
.ink-button { border-color: var(--line-strong); background: var(--mint); color: #111111; }
.ink-button:disabled { background: var(--disabled); color: var(--muted); }
.header-hint-button { background: var(--accent); color: var(--accent-ink); }
.entry-actions .new-game-button { background: var(--tangerine); color: #111111; }
.game-message.error { border-color: var(--coral); }
.loading-progress {
  width: min(100%, 410px);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 34px);
  border: 3px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 6px 7px 0 var(--line-strong);
  text-align: center;
}
.loading-progress p { color: var(--muted); font-size: 12px; font-weight: 800; }
.loading-track {
  height: 9px;
  overflow: hidden;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-strong);
  box-shadow: 2px 3px 0 var(--line-strong);
}
.loading-track span { background: var(--mint); }
.header-help-button {
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 11px;
  background: var(--violet);
  color: #FFFFFF;
  box-shadow: 2px 3px 0 var(--line-strong);
  font-size: 23px;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
}
.header-help-button:focus-visible, .help-close-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.help-backdrop { z-index: 30; }
.help-dialog {
  width: min(100%, 560px);
  max-height: min(88svh, 780px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(18px, 4vw, 28px);
}
.help-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.help-kicker {
  display: inline-flex;
  padding: 5px 9px;
  border: 1.5px dashed var(--violet);
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--ink);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .13em;
}
.help-close-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 9px;
  background: var(--paper-strong);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}
.help-section { margin-top: 19px; }
.help-section h3 { margin: 0 0 9px; font-size: 12px; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.help-rules { display: grid; gap: 8px; margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.help-example { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.help-example-step { display: inline-flex; align-items: center; gap: 6px; }
.help-example-step strong { padding: 7px 8px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--violet); color: white; font-size: 12px; box-shadow: 2px 3px 0 var(--line-strong); }
.help-example-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-done-button { width: 100%; margin-top: 20px; min-height: 48px; }
.finish-bonus { margin: 8px 0 14px; color: var(--success); font-size: 14px; font-weight: 950; }
.game-page.is-complete { min-height: 100svh; height: auto; overflow: visible; }
.game-page.is-complete .game-workspace { overflow: visible; }
.game-page.is-complete .chain-panel { overflow: hidden; }
.game-page.is-complete .chain-list {
  max-height: min(38vh, 340px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.finish-actions .finish-new-game-button { flex: 1 1 100%; }
@media (max-width: 620px) {
  .header-help-button { width: 32px; min-width: 32px; height: 34px; border-radius: 9px; }
  :root.keyboard-open .header-help-button { width: 30px; min-width: 30px; height: 32px; }
  :root.keyboard-open .game-header {
    min-height: 54px;
    height: 54px;
    flex-basis: 54px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    padding: 5px 9px;
  }
  :root.keyboard-open .header-right { min-width: 0; max-width: 100%; gap: 5px; }
  :root.keyboard-open .header-count { min-width: 0; gap: 4px; }
  :root.keyboard-open .score-pill, :root.keyboard-open .moves-pill {
    display: grid; width: 40px; min-width: 40px; min-height: 34px;
    grid-template-columns: 1fr; justify-items: center; align-content: center;
    gap: 2px; padding: 3px; border-width: 1px; border-radius: 8px;
  }
  :root.keyboard-open .metric-label { display: block; font-size: 6px; line-height: 1; letter-spacing: .03em; }
  :root.keyboard-open .score-pill strong, :root.keyboard-open .moves-pill strong { font-size: 13px; line-height: 1; }
  :root.keyboard-open .header-hint-button { width: 48px; min-width: 48px; height: 36px; gap: 3px; padding: 0 4px; border-width: 1px; border-radius: 9px; }
  :root.keyboard-open .theme-toggle { width: 32px; min-width: 32px; height: 32px; border-width: 1px; border-radius: 9px; }
  :root.keyboard-open .header-help-button { width: 30px; min-width: 30px; height: 32px; }
  .game-page.is-complete .game-workspace { overflow-y: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .header-help-button, .help-dialog, .help-example-step strong { transition: none !important; animation: none !important; }
}

.loading-heading { margin-bottom: 22px; }
.loading-kicker {
  display: inline-flex;
  padding: 5px 9px;
  border: 1.5px dashed var(--violet);
  border-radius: 999px;
  background: var(--violet-soft);
  color: var(--ink);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .14em;
}
.loading-heading h1 {
  margin: 13px 0 6px;
  color: var(--ink);
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 950;
  letter-spacing: -.045em;
}
.loading-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.loading-letters { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.loading-tile {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--line-strong);
  border-radius: 10px;
  background: var(--violet);
  color: #FFFFFF;
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 950;
  box-shadow: 3px 4px 0 var(--tile-shadow);
  animation: loading-tile 2.8s ease-in-out infinite;
  animation-delay: calc(var(--tile-index) * -.4s);
}
.loading-label { margin: 17px 0 0; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
@keyframes loading-tile {
  0%, 12% { background: var(--violet); color: #FFFFFF; }
  28%, 48% { background: var(--tangerine); color: #111111; }
  64%, 100% { background: var(--violet); color: #FFFFFF; }
}
@media (max-width: 420px) {
  .loading-progress { padding: 20px 15px; border-radius: 18px; }
  .loading-heading { margin-bottom: 18px; }
  .loading-tile { border-radius: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-tile { animation: none !important; }
}
