@import url('https://fonts.googleapis.com/css2?family=League+Gothic&family=Montserrat:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg: #121213;
    --fg: #ffffff;
    --muted: rgba(255,255,255,.75);
    --border: #3a3a3c;
    --border-filled: #565758;
  
    --tile-absent: #3a3a3c;
    --tile-present: #F5A623;
    --tile-correct: #005CB9;
  
    --key-bg: #818384;
    --key-fg: #ffffff;
    --key-bg-weak: #565758;
  
    --focus: rgba(255,255,255,.25);
  }
  
  html[data-theme="light"] {
    --bg: #f5f6f7;
    --fg: #101114;
    --muted: rgba(16,17,20,.7);
    --border: #d0d3d6;
    --border-filled: #a7abb0;
  
    --tile-absent: #a7abb0;
    --tile-present: #F5A623;
    --tile-correct: #0066CC;
  
    --key-bg: #d0d3d6;
    --key-fg: #101114;
    --key-bg-weak: #a7abb0;
  
    --focus: rgba(16,17,20,.15);
  }
  
  * {
    box-sizing: border-box;
  }
  
  html, body {
    margin: 0;
    min-height: 100%;
  }
  
  body {
    min-height: 100vh;
    font-family: "Gotham", "Montserrat", system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
  }
  
  a {
    color: inherit;
    text-decoration: none;
  }
  
  .page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 18px 48px;
  }
  
  /* Shared buttons match Verdle */
  .btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--tile-correct);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
  }
  
  .btn:disabled {
    opacity: .55;
    cursor: not-allowed;
  }
  
  .btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--fg);
  }
  
  .btn:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
  
  /* header rules */

  .site-header {
    border-bottom: 1px solid rgba(158,220,245,.24);
    background: rgba(6,28,52,.97);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    transition: transform 260ms cubic-bezier(.22,.75,.24,1), box-shadow 220ms ease;
    will-change: transform;
  }

  .site-header.header-hidden {
    transform: translateY(calc(-100% - 2px));
    box-shadow: none;
  }
  
  .site-header__inner {
    max-width: 1240px;
    min-height: 82px;
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
  
  .signal-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #fff;
  }

  .signal-brand-logo {
    width: 100px;
    height: 45px;
    object-fit: contain;
    flex: 0 0 auto;
  }

  .signal-brand-word {
    color: #fff;
    font: 400 36px/.85 "Gotham Condensed", "League Gothic", "Arial Narrow", sans-serif;
    letter-spacing: .025em;
    text-transform: uppercase;
  }
  
  .site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .site-nav a {
    padding: 10px 14px;
    border-radius: 999px;
    background: transparent;
    color: #c9d9e6;
    font-weight: 700;
    font-size: 14px;
    transition:
      color 180ms ease,
      background-color 180ms ease,
      transform 180ms ease;
  }
  
  .site-nav a:hover {
    color: #fff;
    background: rgba(158,220,245,.15);
    transform: translateY(-1px);
  }
  
  .site-nav a:active {
    transform: translateY(0);
  }
  
  .site-nav a.active,
  .site-nav a[aria-current="page"] {
    color: #fff;
    background: #287fba;
  }

  .game-title-line {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .game-title-line h1,
  .game-back {
    font-family: "Gotham Condensed", "League Gothic", "Arial Narrow", sans-serif;
    font-weight: 400;
  }

  .game-back {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    color: var(--fg);
    font-size: 30px;
    line-height: 1;
    transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
  }

  .game-back:hover {
    transform: translateX(-3px);
    border-color: var(--tile-correct);
    background: color-mix(in srgb, var(--bg) 86%, var(--tile-correct) 14%);
  }

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

  @media (max-width: 720px) {
    .site-header__inner {
      min-height: 70px;
      padding: 0 18px;
      gap: 12px;
    }

    .signal-brand-logo { width:74px; height:34px; }
    .signal-brand-word { font-size:29px; }
    .site-nav a { display:none; }
    .site-nav a[aria-current="page"] { display:block; padding:9px 12px; font-size:12px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .site-header { transition:none; }
    .game-back { transition:none; }
  }

  @media (max-width: 430px) {
    .signal-brand-word {
      font-size: 24px;
    }
  }

  /* ---------- Page wipe transition ---------- */
.page-transition {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    overflow: hidden;
  }
  
  .page-transition::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--border);
    will-change: width, transform;
    transform: translateX(0);
  }
  
  /* Initial page load: wipe exits to the right */
  body.is-loading {
    overflow: hidden;
  }
  
  body.is-loading .page-transition::before {
    width: 100%;
    animation: wipeOut 320ms cubic-bezier(.65,0,.35,1) forwards;
  }
  
  /* Navigation away: wipe enters from the left */
  body.is-transitioning {
    overflow: hidden;
  }
  
  body.is-transitioning .page-transition::before {
    animation: wipeIn 320ms cubic-bezier(.65,0,.35,1) forwards;
  }
  
  @keyframes wipeIn {
    0% {
      width: 0%;
      transform: translateX(0);
    }
    100% {
      width: 100%;
      transform: translateX(0);
    }
  }
  
  @keyframes wipeOut {
    0% {
      width: 100%;
      transform: translateX(0);
    }
    100% {
      width: 100%;
      transform: translateX(100%);
    }
  }

  .home-topbar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px 18px 8px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  
  .home-brand h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    letter-spacing: 0.14em;
  }
  
  .home-brand p {
    margin: 8px 0 0;
    color: var(--muted);
  }
  
  .home-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
  }
  
  .game-card {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--bg) 92%, var(--fg) 8%);
    transition:
      transform 180ms ease,
      border-color 180ms ease,
      background-color 180ms ease,
      box-shadow 180ms ease;
  }
  
  .game-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-filled);
    box-shadow: 0 14px 36px rgba(0,0,0,.18);
  }
  
  .game-card__head h2 {
    margin: 0;
    font-size: 24px;
  }
  
  .game-card__head span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
  }
  
  .verdle-preview {
    display: grid;
    gap: 6px;
    width: fit-content;
  }
  
  .vp-row {
    display: grid;
    grid-template-columns: repeat(5, 40px);
    gap: 6px;
  }
  
  .vp-tile {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--fg);
  }
  
  .vp-tile.vp-correct {
    background: var(--tile-correct);
    border-color: var(--tile-correct);
    color: #fff;
  }
  
  .vp-tile.vp-present {
    background: var(--tile-present);
    border-color: var(--tile-present);
    color: #fff;
  }
  
  .vp-tile.vp-absent {
    background: var(--tile-absent);
    border-color: var(--tile-absent);
    color: #fff;
  }
  
  .sudoku-preview {
    width: fit-content;
  }
  
  .sp-grid {
    display: grid;
    grid-template-columns: repeat(9, 22px);
    grid-template-rows: repeat(9, 22px);
    border: 2px solid var(--fg);
  }
  
  .sp-grid > div {
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--fg);
    background: color-mix(in srgb, var(--bg) 90%, var(--fg) 10%);
  }
  
  .sp-grid > div:nth-child(3n) {
    border-right: 2px solid var(--fg);
  }
  
  .sp-grid > div:nth-child(9n) {
    border-right: 1px solid var(--border);
  }
  
  .sp-grid > div:nth-child(n + 19):nth-child(-n + 27),
  .sp-grid > div:nth-child(n + 46):nth-child(-n + 54) {
    border-bottom: 2px solid var(--fg);
  }
