/* Layout: sticky top bar + hero search, filter rail, responsive card grid of drops/codes */
  :root {
    --bg: #0d0f14;
    --surface: #161a22;
    --surface-2: #1d222c;
    --fg: #eceef3;
    --muted: #9aa3b4;
    --line: #262c38;
    --accent: #ff6a45;      /* ember orange */
    --accent-2: #2dd4a0;    /* mint for "live/free" */
    --gold: #f0b429;
    --danger: #ef5a5a;
    --ring: rgba(255,106,69,.4);
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16,18,29,.06), 0 8px 24px -12px rgba(16,18,29,.18);
    --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    color-scheme: dark;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #0d0f14;
      --surface: #161a22;
      --surface-2: #1d222c;
      --fg: #eceef3;
      --muted: #9aa3b4;
      --line: #262c38;
      --accent: #ff6a45;
      --accent-2: #2dd4a0;
      --gold: #f0b429;
      --danger: #ef5a5a;
      --ring: rgba(255,106,69,.4);
      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.6);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --bg: #0d0f14;
    --surface: #161a22;
    --surface-2: #1d222c;
    --fg: #eceef3;
    --muted: #9aa3b4;
    --line: #262c38;
    --accent: #ff6a45;
    --accent-2: #2dd4a0;
    --gold: #f0b429;
    --danger: #ef5a5a;
    --ring: rgba(255,106,69,.4);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.6);
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: env(safe-area-inset-top, 0px);
    z-index: 60;
    background: var(--surface);
  }
  a { color: inherit; text-decoration: none; }
  h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -.02em; }
  button { font-family: inherit; cursor: pointer; }

  .wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  /* ---- top bar ---- */
  header.bar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-block: 12px;
  }
  .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.18rem;
    letter-spacing: -.03em;
    flex-shrink: 0;
  }
  .logo .mark {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: #fff;
    box-shadow: 0 4px 12px -4px var(--accent);
  }
  .logo .mark svg { width: 17px; height: 17px; }
  .logo b { color: var(--accent); }
  .logo-img { height: 46px; width: auto; display: block; }
  .logo-foot .logo-img { height: 60px; }
  @media (max-width: 480px) { .logo-img { height: 40px; } }
  nav.top {
    display: flex;
    gap: 4px;
    margin-left: auto;
  }
  nav.top a {
    padding: 7px 13px;
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    transition: background .15s, color .15s;
  }
  nav.top a:hover, nav.top a.active { background: var(--surface-2); color: var(--fg); }
  .theme-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 10px;
    display: grid; place-items: center;
    color: var(--muted);
    flex-shrink: 0;
  }
  .theme-btn:hover { color: var(--fg); border-color: var(--accent); }
  .theme-btn svg { width: 17px; height: 17px; }
  nav.top a.sun-only, .theme-btn .ico-moon { display: none; }
  @media (max-width: 720px) { nav.top { display: none; } }

  /* ---- hero ---- */
  .hero {
    padding-block: 42px 28px;
    text-align: center;
  }
  .hero .eyebrow {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--accent-2);
    background: color-mix(in srgb, var(--accent-2) 14%, transparent);
    padding: 5px 12px; border-radius: 99px;
    margin-bottom: 18px;
  }
  .hero .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); animation: pulse 1.8s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }
  .hero h1 { font-size: clamp(2rem, 6vw, 3.3rem); line-height: 1.05; }
  .hero h1 em { font-style: normal; color: var(--accent); }
  .hero p.sub {
    color: var(--muted); max-width: 42ch; margin: 14px auto 0;
    font-size: 1.05rem;
  }
  .search {
    margin: 26px auto 0;
    max-width: 560px;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 6px 6px 6px 16px;
    box-shadow: var(--shadow);
  }
  .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
  .search-bar { border-top: 1px solid var(--line); background: var(--surface); padding-block: 12px; }
  .search-bar[hidden] { display: none; }
  .search-bar .search { margin: 0 auto; }
  #navSearchBtn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
  .lang { position: relative; flex-shrink: 0; }
  .lang-btn { width: auto; min-width: 62px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; font-size: .85rem; font-weight: 600; color: var(--fg); }
  .lang-btn svg { width: 16px; height: 16px; color: var(--muted); }
  .lang-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 11px; padding: 5px; min-width: 150px;
    box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 2px;
  }
  .lang-menu[hidden] { display: none; }
  .lang-menu button {
    border: none; background: none; text-align: left;
    font-family: inherit; font-size: .9rem; color: var(--fg);
    padding: 9px 12px; border-radius: 8px;
  }
  .lang-menu button:hover { background: var(--surface-2); }
  .lang-menu button.active { color: var(--accent); font-weight: 600; }
  .search svg { width: 19px; height: 19px; color: var(--muted); flex-shrink: 0; }
  .search input {
    flex: 1; min-width: 0;
    border: none; background: none; outline: none;
    font-family: inherit; font-size: 1rem; color: var(--fg);
    padding: 8px 0;
  }
  .search button {
    border: none; background: var(--accent); color: #fff;
    font-weight: 600; font-size: .92rem;
    padding: 10px 20px; border-radius: 10px;
    transition: filter .15s;
  }
  .search button:hover { filter: brightness(1.08); }

  .stats {
    display: flex; justify-content: center; gap: 36px; flex-wrap: wrap;
    margin-top: 28px;
  }
  .stat { text-align: center; }
  .stat .n { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--fg); font-variant-numeric: tabular-nums; }
  .stat .l { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

  /* ---- filter rail ---- */
  .filters {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding-block: 26px 20px;
    position: sticky; top: calc(env(safe-area-inset-top, 0px) + 61px); z-index: 20;
  }
  .chip {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-weight: 500; font-size: .88rem;
    padding: 8px 15px; border-radius: 99px;
    display: inline-flex; align-items: center; gap: 7px;
    transition: all .15s;
  }
  .chip:hover { color: var(--fg); border-color: var(--accent); }
  .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
  .chip .count {
    font-size: .74rem; padding: 1px 7px; border-radius: 99px;
    background: var(--surface-2); color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .chip.active .count { background: rgba(255,255,255,.25); color: #fff; }

  /* ---- grid ---- */
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 18px;
    padding-bottom: 60px;
  }
  @media (min-width: 820px) {
    .grid { grid-template-columns: repeat(5, 1fr); }
  }
  .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform .18s, box-shadow .18s, border-color .18s;
  }
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
  .card .top {
    position: relative;
    height: 128px;
    display: grid; place-items: center;
    overflow: hidden;
    background: #11141b;
  }
  .card .top .glow { position: absolute; inset: 0; opacity: .9; }
  .card .top[data-logo] .glow { inset: -30%; filter: blur(30px); opacity: .95; }
  .card .top .card-logo {
    position: relative; z-index: 1;
    max-height: 70px; max-width: 72%; width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,.45));
  }
  .card .top .emblem {
    position: relative; z-index: 1;
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.9rem; color: #fff;
    letter-spacing: -.03em;
    text-shadow: 0 2px 12px rgba(0,0,0,.35);
  }
  .card .badge {
    position: absolute; top: 10px; left: 10px; z-index: 2;
    font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    padding: 4px 9px; border-radius: 7px;
    background: rgba(0,0,0,.4); color: #fff; backdrop-filter: blur(4px);
  }
  .card .badge.hot { background: var(--accent); }
  .card .badge.ends { background: var(--danger); }
  .card .badge.medal { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }
  .card .badge.medal svg { width: 12px; height: 12px; }
  .card .badge.m1 { background: linear-gradient(135deg,#f7d45c,#d79a1e); color: #3a2800; }
  .card .badge.m2 { background: linear-gradient(135deg,#e7e9ee,#a9afb9); color: #2b2f36; }
  .card .badge.m3 { background: linear-gradient(135deg,#e3a36c,#ad6730); color: #3a2208; }
  .card .platform {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    font-size: .68rem; font-weight: 600;
    padding: 4px 9px; border-radius: 7px;
    background: rgba(0,0,0,.4); color: #fff; backdrop-filter: blur(4px);
  }
  .card .body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
  .card h3 { font-size: 1.05rem; line-height: 1.25; }
  .card .desc { font-size: .87rem; color: var(--muted); flex: 1; }
  .card .meta { display: flex; align-items: center; gap: 12px; font-size: .78rem; color: var(--muted); }
  .card .meta span { display: inline-flex; align-items: center; gap: 5px; }
  .card .meta svg { width: 13px; height: 13px; }

  .code-row {
    display: flex; align-items: stretch; gap: 8px;
  }
  .code-box {
    flex: 1; min-width: 0;
    border: 1px dashed var(--line);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 9px 12px;
    font-family: var(--font-mono); font-size: .9rem; font-weight: 600;
    letter-spacing: .03em;
    display: flex; align-items: center;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    color: var(--fg);
  }
  .copy-btn {
    border: none; border-radius: 10px;
    background: var(--accent); color: #fff;
    font-weight: 600; font-size: .85rem;
    padding: 0 16px;
    display: inline-flex; align-items: center; gap: 6px;
    transition: filter .15s, background .15s;
    flex-shrink: 0;
  }
  .copy-btn svg { width: 14px; height: 14px; }
  .copy-btn:hover { filter: brightness(1.08); }
  .copy-btn.done { background: var(--accent-2); }

  .claim-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--fg);
    font-weight: 600; font-size: .88rem;
    padding: 10px; border-radius: 10px;
    text-align: center;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    transition: all .15s;
  }
  .claim-btn svg { width: 15px; height: 15px; }
  .claim-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
  .review-link {
    display: block; text-align: center;
    font-size: .82rem; font-weight: 500; color: var(--muted);
    margin-top: 2px; padding: 2px 4px;
    text-decoration: none;
  }
  .review-link:hover { color: var(--accent); text-decoration: underline; }

  .empty {
    grid-column: 1 / -1;
    text-align: center; padding: 60px 20px;
    color: var(--muted);
  }
  .empty svg { width: 42px; height: 42px; opacity: .5; margin-bottom: 12px; }

  /* ---- footer ---- */
  footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding-block: 36px 40px;
  }
  .foot-grid {
    display: grid; grid-template-columns: 1.6fr repeat(3, 1fr);
    gap: 32px;
  }
  @media (max-width: 720px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
  footer h4 { font-family: var(--font-display); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
  footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
  footer a { font-size: .9rem; color: var(--muted); transition: color .15s; }
  footer a:hover { color: var(--accent); }
  footer .about p { font-size: .88rem; color: var(--muted); max-width: 32ch; margin: 12px 0 0; }
  .foot-bottom {
    margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line);
    display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    font-size: .82rem; color: var(--muted);
  }
  .disclaimer {
    background: var(--surface-2); border-radius: 10px;
    padding: 12px 15px; margin-top: 20px;
    font-size: .8rem; color: var(--muted);
    display: flex; gap: 10px; align-items: flex-start;
  }
  .disclaimer svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--gold); }

  /* modal */
  .modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
  .modal[hidden] { display: none; }
  .modal-backdrop { position: absolute; inset: 0; background: rgba(8,10,14,.55); backdrop-filter: blur(3px); }
  .modal-card {
    position: relative;
    width: min(540px, 100%);
    max-height: min(80vh, 640px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 26px 26px 28px;
    box-shadow: var(--shadow);
  }
  .modal-card h2 { font-size: 1.4rem; margin-bottom: 14px; padding-right: 30px; }
  .modal-card h2 .stars { display: block; margin-top: 6px; font-size: .95rem; color: var(--gold); letter-spacing: 2px; }
  .modal-card p { font-size: .92rem; color: var(--muted); margin: 0 0 12px; }
  .modal-card p strong { color: var(--fg); }
  .modal-card .kv { font-family: var(--font-mono); font-size: .86rem; color: var(--fg); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; margin-bottom: 10px; word-break: break-all; }
  .modal-card .tag { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); padding: 3px 9px; border-radius: 99px; margin-bottom: 14px; }
  .modal-x {
    position: absolute; top: 14px; right: 14px;
    width: 32px; height: 32px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--surface);
    display: grid; place-items: center; color: var(--muted);
  }
  .modal-x:hover { color: var(--fg); border-color: var(--accent); }
  .modal-x svg { width: 15px; height: 15px; }

  /* toast */
  #toast {
    position: fixed; z-index: 100;
    left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(20px);
    background: var(--fg); color: var(--bg);
    padding: 11px 20px; border-radius: 11px;
    font-size: .88rem; font-weight: 600;
    box-shadow: 0 10px 30px -8px rgba(0,0,0,.5);
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
    display: flex; align-items: center; gap: 8px;
  }
  #toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  #toast svg { width: 16px; height: 16px; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before { animation: none !important; transition: none !important; }
  }
