@layer reset, base, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, figure { margin: 0; }
  img { display: block; height: auto; max-width: 100%; }
  button, input { font: inherit; }
  button, a, input, summary { -webkit-tap-highlight-color: transparent; }
  [hidden] { display: none !important; }
}

@layer base {
  :root {
    color-scheme: dark;
    --ink: #ecede4;
    --muted: #a6b2a9;
    --faint: #74877b;
    --paper: #101b19;
    --panel: #15231f;
    --raised: #1b2b25;
    --line: #33443a;
    --gold: #edb778;
    --gold-light: #f6d5aa;
    --green: #a6c79d;
    --serif: Georgia, 'Times New Roman', serif;
    --sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  }
  html { scroll-padding-top: 32px; }
  body { background: var(--paper); color: var(--ink); font: 16px/1.65 var(--sans); overflow-wrap: break-word; }
  a { color: var(--gold-light); text-underline-offset: 4px; text-decoration-color: #6f614c; }
  a:hover { color: #fff0d8; text-decoration-color: currentColor; }
  a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
  button, summary, input[type='checkbox'] { cursor: pointer; }
  button { color: inherit; }
  ::selection { color: #101b19; background: var(--gold); }
  strong { font-weight: 650; color: #fff8e9; }
}

@layer components {
  .skip-link { position: absolute; z-index: 10; top: -80px; left: 16px; padding: 10px 16px; background: var(--gold); color: #101b19; }
  .skip-link:focus { top: 12px; }
  .announcement { display: flex; justify-content: center; gap: 20px; align-items: center; padding: 8px 24px; border-bottom: 1px solid #4a4931; background: #232b1f; color: #bac9b0; font-size: 12px; letter-spacing: .02em; }
  .announcement > span { text-transform: uppercase; font-weight: 700; letter-spacing: .12em; font-size: 10px; }
  .announcement a { text-decoration: none; color: #edcf9d; }
  .site-header { border-bottom: 1px solid var(--line); }
  .header-inner { max-width: 1280px; padding: 24px 36px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 32px; }
  .brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; color: #f3ddba; }
  .brand > span:last-child { font: 700 18px/1 var(--serif); letter-spacing: .1em; }
  .brand small { display: block; margin-top: 7px; font: 600 9px/1 var(--sans); letter-spacing: .32em; color: var(--muted); }
  .brand-icon { color: var(--gold); }
  .primary-nav { display: flex; gap: 26px; align-items: center; }
  .primary-nav a { color: #bdc6bc; font-size: 13px; text-decoration: none; padding: 8px 0; white-space: nowrap; }
  .primary-nav a:hover, .primary-nav a[aria-current] { color: var(--gold-light); }
  .primary-nav a[aria-current] { box-shadow: 0 1px 0 var(--gold); }
  .site-main { max-width: 1210px; margin: auto; padding: 54px 36px 88px; }
  .page-heading { max-width: 940px; margin: 0 0 42px; }
  .eyebrow { color: var(--gold); font: 650 10px/1.5 var(--sans); letter-spacing: .19em; text-transform: uppercase; }
  h1 { font: 400 clamp(36px, 4.2vw, 56px)/1.12 var(--serif); letter-spacing: -.035em; text-wrap: balance; margin: 15px 0 24px; }
  .article-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 11px; }
  .article-meta > span:last-child { border-left: 1px solid var(--line); padding-left: 10px; }
  .live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
  .home-lead { display: grid; grid-template-columns: 1fr 1.04fr; align-items: center; gap: 48px; margin-bottom: 62px; }
  .home-lead:not(:has(.hero-figure)) { display: block; max-width: 800px; }
  .home-heading { margin: 0; }
  .home-heading h1 { font-size: clamp(42px, 4.6vw, 62px); line-height: 1.04; }
  .home-actions { display: flex; flex-wrap: wrap; gap: 18px 24px; margin-top: 30px; align-items: center; }
  .primary-button { background: var(--gold); color: #1b2219; font-size: 13px; padding: 13px 18px; display: inline-flex; gap: 24px; justify-content: space-between; text-decoration: none; font-weight: 650; border: 1px solid var(--gold); }
  .primary-button:hover { color: #101b19; background: var(--gold-light); }
  .play-link { font-size: 12px; }
  .reading-layout { display: grid; grid-template-columns: minmax(0, 790px) 218px; gap: 64px; align-items: start; }
  .reading-layout.without-sidebar { display: block; }
  .article-content { min-width: 0; }
  .home-page .article-content { max-width: 790px; }
  .article-content > p { margin-bottom: 20px; color: #cdd3c9; }
  .article-content > p:first-child { font-size: 18px; line-height: 1.65; color: #e1e3d6; }
  .article-content h2 { font: 400 30px/1.2 var(--serif); letter-spacing: -.015em; padding-top: 36px; margin: 16px 0 18px; scroll-margin-top: 24px; }
  .article-content h3 { font-size: 17px; line-height: 1.4; margin: 28px 0 12px; }
  .article-content > ul, .article-content > ol { color: #cdd3c9; padding-left: 24px; margin-top: 14px; margin-bottom: 22px; }
  .article-content > ol > li, .article-content > ul > li { padding-left: 7px; margin-bottom: 12px; }
  .article-content li::marker { color: var(--gold); }
  .article-content code { font-size: .9em; background: var(--raised); padding: 2px 5px; border-radius: 3px; }
  .page-sidebar { position: sticky; top: 26px; margin-top: 7px; }
  .toc-disclosure { border-top: 1px solid var(--gold); padding-top: 17px; }
  .toc-disclosure summary { list-style: none; font: 650 10px/1.4 var(--sans); color: var(--gold); letter-spacing: .14em; }
  .toc-disclosure summary::-webkit-details-marker { display: none; }
  .toc { font-size: 12px; line-height: 1.55; margin-top: 17px; max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 8px; }
  .toc ul { list-style: none; padding: 0; margin: 0; }
  .toc li { margin: 0 0 12px; }
  .toc li li { margin: 8px 0 0 10px; font-size: 11px; }
  .toc a { color: #b1beb1; text-decoration: none; }
  .toc a:hover { color: var(--gold-light); }
  .deadline-note { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 21px; display: grid; gap: 6px; font-size: 11px; color: var(--muted); }
  .deadline-note strong { font: 400 27px/1.2 var(--serif); color: var(--gold-light); }
  .deadline-note a { margin-top: 7px; }
  .small-label { font-size: 9px; font-weight: 650; letter-spacing: .12em; color: var(--faint); }
  .table-container { max-width: 100%; margin: 24px 0; }
  table { border-collapse: collapse; width: 100%; font-size: 13px; line-height: 1.55; }
  th { text-align: left; font-size: 10px; letter-spacing: .075em; text-transform: uppercase; color: var(--gold); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 13px 12px; font-weight: 600; }
  td { border-bottom: 1px solid #2a3a31; padding: 14px 12px; vertical-align: top; color: #bfccbe; }
  td:first-child { color: #e7e8dc; font-weight: 550; }
  th:first-child, td:first-child { padding-left: 0; }
  .game-figure { margin: 30px 0 34px; width: 100%; }
  .original-frame { display: block; width: fit-content; max-width: 100%; margin-inline: auto; }
  .game-figure img { border: 1px solid #53604b; background: #08100d; }
  .game-figure figcaption { display: grid; gap: 5px; margin: 10px 0 0; color: #a7b7a5; font-size: 12px; line-height: 1.55; }
  .frame-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 11px; }
  .frame-links a { color: #bba98b; }
  .hero-figure { margin-top: 0; }
  .home-lead .hero-figure { margin: 0; }
  .reward-finder { margin: 38px 0 36px; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--line); padding: 24px 0 16px; }
  .finder-heading { display: flex; justify-content: space-between; gap: 24px; align-items: end; }
  .finder-heading h2 { font: 400 30px/1.2 var(--serif); padding: 0; margin: 8px 0 0; }
  .saved-progress { font-size: 11px; color: var(--green); white-space: nowrap; padding-bottom: 3px; }
  .finder-note { color: var(--muted); font-size: 12px; margin: 15px 0 23px; max-width: 580px; }
  .finder-controls { display: flex; gap: 20px; align-items: end; }
  .search-control { display: grid; gap: 7px; flex: 1; font-size: 11px; color: #b5c0b2; }
  .search-control input { width: 100%; background: #0e1713; color: var(--ink); border: 1px solid #4d5f4a; border-radius: 0; padding: 12px 13px; font-size: 14px; line-height: 1.3; appearance: none; }
  .search-control input::placeholder { color: #7f917f; }
  .remaining-control { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; padding-bottom: 13px; white-space: nowrap; }
  .remaining-control input { accent-color: var(--gold); width: 15px; height: 15px; }
  .filter-group { display: flex; gap: 7px; flex-wrap: wrap; margin: 17px 0 12px; }
  .filter { background: transparent; border: 1px solid #3c4c3e; padding: 7px 9px; font-size: 10px; line-height: 1.3; color: #b3c0ae; }
  .filter span { opacity: .6; margin-left: 4px; font-size: 9px; }
  .filter.active { background: #d3b27d; border-color: #d3b27d; color: #142018; }
  .result-status { font-size: 10px; color: var(--faint); margin-bottom: 10px; }
  .reward-ledger { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
  .reward-row { display: grid; grid-template-columns: 24px 1fr 1fr; gap: 17px; padding: 21px 0; border-bottom: 1px solid #2b3e31; scroll-margin-top: 24px; }
  .claim-check { position: relative; margin-top: 22px; width: 22px; height: 22px; }
  .claim-check input { position: absolute; width: 22px; height: 22px; margin: 0; opacity: 0; }
  .claim-check span { width: 21px; height: 21px; border: 1px solid #65765a; display: block; pointer-events: none; }
  .claim-check input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 4px; }
  .claim-check input:checked + span { background: var(--green); border-color: var(--green); }
  .claim-check input:checked + span::after { content: ''; display: block; width: 6px; height: 11px; border: solid #192b1b; border-width: 0 2px 2px 0; transform: rotate(45deg); margin: 2px 0 0 7px; }
  .reward-row.is-collected .reward-name h3 { color: #99ae91; }
  .reward-row.is-collected { background: linear-gradient(90deg, #20342244, transparent 70%); }
  .reward-meta { color: var(--gold); font-size: 9px; line-height: 1.45; letter-spacing: .035em; margin-bottom: 7px; }
  .reward-name h3 { font-size: 16px; line-height: 1.35; margin: 0 0 8px; color: #e6e9db; font-weight: 600; }
  .reward-name.has-item-image { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
  .item-thumb { display: block; width: 64px; height: 64px; margin-top: 20px; border: 1px solid #42523b; background: #223024; }
  .item-thumb img { width: 100%; height: 100%; object-fit: contain; }
  .reward-summary > p:last-child, .reward-location > p { font-size: 11px; line-height: 1.65; color: #aabda5; }
  .reward-location > p { margin: 6px 0 11px; color: #c6cfbd; }
  .reward-location details { color: #aabda5; font-size: 11px; }
  .reward-location summary { color: var(--gold-light); font-size: 11px; width: fit-content; }
  .reward-location details > p { margin: 10px 0; }
  .reward-location ol { margin: 12px 0; padding-left: 18px; }
  .reward-location li { margin-bottom: 8px; }
  .badge-link { color: #8fa38c; font-size: 10px; }
  .finder-bottom { display: flex; gap: 24px; justify-content: space-between; align-items: baseline; margin-top: 16px; }
  .finder-bottom p { font-size: 10px; color: #7f947b; }
  .subtle-button { white-space: nowrap; border: 0; padding: 4px 0; background: transparent; color: #bbaa8e; text-decoration: underline; text-underline-offset: 3px; font-size: 10px; }
  .no-results { margin: 28px 0; color: var(--gold-light); font-size: 13px; }
  .site-footer { max-width: 1280px; margin: 0 auto; padding: 36px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 48px; align-items: start; }
  .site-footer .brand { transform: scale(.85); transform-origin: left center; }
  .site-footer p { color: #80947f; font-size: 10px; line-height: 1.8; margin-top: 17px; }
  .site-footer nav { display: grid; gap: 9px; padding-top: 5px; }
  .site-footer nav a { text-decoration: none; color: #afbea8; font-size: 11px; }
  .site-footer .footer-credit { margin-top: 5px; }
}

@layer responsive {
  @media (min-width: 1200px) { .article-content > p { font-size: 16px; } }
  @media (max-width: 1000px) {
    .primary-nav { gap: 19px; }
    .reading-layout { grid-template-columns: minmax(0, 1fr) 180px; gap: 36px; }
    .home-lead { gap: 30px; }
    .home-actions { display: grid; justify-items: start; }
    .primary-button { gap: 20px; }
    .site-footer { gap: 24px; }
  }
  @media (max-width: 760px) {
    .header-inner { display: block; padding: 20px 22px 0; }
    .brand > span:last-child { font-size: 16px; }
    .brand small { font-size: 8px; }
    .primary-nav { margin-top: 18px; gap: 26px; overflow-x: auto; padding-bottom: 13px; scrollbar-width: thin; }
    .primary-nav a { font-size: 12px; padding-top: 3px; }
    .site-main { padding: 35px 22px 60px; }
    .page-heading { margin-bottom: 28px; }
    h1 { font-size: clamp(34px, 7.5vw, 49px); margin: 13px 0 22px; }
    .reading-layout { display: flex; flex-direction: column-reverse; gap: 22px; }
    .reading-layout.without-sidebar { display: block; }
    .page-sidebar { position: static; width: 100%; margin: 0; }
    .toc-disclosure { border-top-color: var(--line); border-bottom: 1px solid var(--line); padding: 13px 0; }
    .toc-disclosure summary { display: flex; justify-content: space-between; }
    .toc-disclosure summary::after { content: '−'; font-size: 14px; }
    .toc-disclosure:not([open]) summary::after { content: '+'; }
    .toc { columns: 2; column-gap: 24px; }
    .toc li { break-inside: avoid; font-size: 11px; }
    .deadline-note { display: none; }
    .article-content h2 { font-size: 27px; padding-top: 27px; }
    .article-content > p:first-child { font-size: 17px; }
    .home-lead { grid-template-columns: 1fr; gap: 30px; margin-bottom: 34px; }
    .home-heading h1 { font-size: clamp(42px, 8vw, 57px); max-width: 550px; }
    .home-actions { display: flex; gap: 17px; margin-top: 26px; }
    .game-figure { margin: 24px 0; }
    .home-lead .hero-figure { margin-top: 0; }
    .site-footer { padding: 30px 22px; grid-template-columns: 1fr 1fr; gap: 26px; }
    .footer-credit { grid-column: 1 / -1; }
  }
  @media (max-width: 520px) {
    .announcement { justify-content: space-between; gap: 8px; padding: 8px 20px; font-size: 10px; }
    .announcement > span { font-size: 8px; letter-spacing: .07em; }
    .site-main { padding-inline: 20px; }
    .article-meta { font-size: 9px; gap: 8px; }
    .article-meta > span:last-child { padding-left: 8px; }
    .eyebrow { font-size: 9px; letter-spacing: .13em; }
    .toc { columns: 1; }
    .toc > ul { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
    .toc li { margin: 0; font-size: 10px; }
    .toc li li { display: none; }
    .table-container { margin: 20px 0; }
    table, tbody, tr, td { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    tr { border-top: 1px solid var(--line); padding: 12px 0; }
    tr:last-child { border-bottom: 1px solid var(--line); }
    td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 100px 1fr; gap: 12px; font-size: 12px; }
    td::before { content: attr(data-label); color: var(--faint); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; font-weight: 500; }
    .finder-heading { display: block; }
    .finder-heading h2 { font-size: 29px; }
    .saved-progress { display: block; margin-top: 12px; font-size: 11px; }
    .finder-note { font-size: 11px; margin-top: 11px; }
    .finder-controls { display: block; }
    .remaining-control { margin-top: 12px; padding-bottom: 0; }
    .filter-group { gap: 6px; }
    .filter { font-size: 9px; padding: 7px 8px; }
    .reward-row { grid-template-columns: 22px minmax(0, 1fr); gap: 0 13px; padding: 20px 0; }
    .claim-check { grid-row: 1 / 3; margin-top: 22px; }
    .reward-location { grid-column: 2; margin-top: 13px; border-top: 1px dotted #3c503c; padding-top: 11px; }
    .reward-name h3 { font-size: 17px; }
    .reward-summary > p:last-child { font-size: 12px; }
    .reward-location > p, .reward-location details, .reward-location summary { font-size: 12px; }
    .finder-bottom { align-items: start; gap: 12px; }
    .finder-bottom p { max-width: 225px; }
    .frame-links { font-size: 11px; }
    .site-footer { display: block; }
    .site-footer nav { margin-top: 22px; }
    .site-footer .footer-credit { margin-top: 20px; }
  }
  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
    a, button { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
  }
  @media print {
    :root { color-scheme: light; }
    body { background: #fff; color: #111; }
    .announcement, .site-header, .page-sidebar, .site-footer, .finder-controls, .filter-group, .finder-bottom, .claim-check { display: none; }
    .site-main { max-width: none; padding: 0; }
    .reading-layout { display: block; }
    .reward-row { grid-template-columns: 1fr 1fr; }
    .reward-location, .reward-summary > p:last-child, .article-content > p { color: #222; }
  }
}
