/* Approved Marathon-inspired system. Real game assets and semantic rarity stay intact. */
:root,
html[data-theme='dark'] {
  --page: #070807;
  --surface: #0d100c;
  --surface-raised: #151a12;
  --surface-hover: #1b2116;
  --surface-input: #090c08;
  --ink: #f2f3eb;
  --muted: #a4aa9f;
  --faint: #858d7f;
  --border: #363b32;
  --border-strong: #626b58;
  --accent: #c0fe04;
  --accent-dark: #c0fe04;
  --accent-ink: #080b03;
  --accent-border: #8eb905;
  --tint: #202a0c;
  --soft: #10140d;
  --radius: 0px;
  --shadow: none;
  --shadow-popover: 0 12px 24px #0006;
  --focus: #c0fe04;
  --toast-bg: #f2f3eb;
  --toast-ink: #10120e;
  --series-1: #c0fe04;
  --sidebar-width: 0px;
  --topbar-height: 68px;
  --header-offset: 68px;
  --page-gutter: clamp(20px, 2vw, 40px);
  --content-width: 1920px;
  --marathon-paper: #f2f3eb;
  --marathon-paper-ink: #10120e;
  --marathon-paper-muted: #5e635a;
  --marathon-paper-border: #bcc0b7;
  --font-sans: 'Baozhao SC', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}
html[data-theme='light'] {
  --page: #f2f3eb;
  --surface: #fafbf5;
  --surface-raised: #e7e9df;
  --surface-hover: #e1e6d8;
  --surface-input: #fff;
  --ink: #10120e;
  --muted: #545e4a;
  --faint: #68745d;
  --border: #b6bead;
  --border-strong: #808d70;
  --accent: #466600;
  --accent-dark: #354e00;
  --accent-ink: #fff;
  --accent-border: #6d872e;
  --tint: #e1eccb;
  --soft: #e9ecdf;
  --focus: #466600;
  --toast-bg: #10120e;
  --toast-ink: #f2f3eb;
  --series-1: #466600;
  --shadow-popover: 0 12px 24px #17200920;
}
body { font-family: var(--font-sans); font-size: 15px; }
button, input, select, textarea { font-family: var(--font-sans); }
h1, h2, h3, h4 { font-family: var(--font-sans); }
button, input, select, textarea, .portal-panel, .table-panel, .filter-panel,
.gc-guide, .gc-mini-card, .gc-card, .gc-toolbar, .gc-filter-panel,
.action-panel, .at-panel, .guide-budget, .mr-catalog, .theme-menu,
.en-item-card, .task-atlas, .ta-panel, dialog { border-radius: 0; box-shadow: none; }
button, a, input, select, textarea { transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
html[data-theme] select { background-image: none; border-radius: 0; }
[hidden] { display: none !important; }

/* One horizontal shell; the existing drawer remains the mobile navigation. */
.portal-topbar { left: 0; gap: clamp(16px, 2vw, 36px); height: var(--topbar-height); background: var(--page); padding: 0 var(--page-gutter); }
.header-brand { display: flex; gap: 10px; align-items: center; flex-shrink: 0; min-height: 44px; padding: 0; background: transparent; }
.header-brand .brand-mark { display: block; width: 34px; height: 34px; fill: currentColor; stroke: none; color: var(--accent); }
.header-brand span { font-size: 25px; font-weight: 950; letter-spacing: -.06em; color: var(--ink); }
.desktop-navigation { display: flex; align-items: stretch; flex: 1; align-self: stretch; gap: clamp(8px, 1.4vw, 24px); min-width: 0; }
.desktop-navigation > button, .desktop-nav-group > button { display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 10px; border: 0; border-bottom: 4px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; font-size: 15px; font-weight: 650; }
.desktop-navigation > button:hover, .desktop-nav-group > button:hover { color: var(--ink); }
.desktop-navigation > button.active, .desktop-nav-group > button.active, .desktop-nav-group > button[aria-expanded='true'] { border-bottom-color: var(--accent); color: var(--accent); }
.desktop-nav-group { position: relative; }
.desktop-nav-menu { position: absolute; top: 100%; left: 0; min-width: 190px; padding: 6px; border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-popover); }
.desktop-nav-menu button { display: block; width: 100%; min-height: 44px; padding: 10px 14px; color: var(--ink); text-align: left; font-size: 14px; }
.desktop-nav-menu button:hover, .desktop-nav-menu button.active { background: var(--tint); color: var(--accent); }
.theme-picker { margin-left: auto; }
.theme-toggle { gap: 14px; min-height: 38px; padding: 6px 0 6px 18px; border: 0; border-left: 1px solid var(--border); background: transparent; font-size: 12px; color: var(--ink); }
.theme-swatches { display: flex; gap: 9px; }
.theme-swatches i { display: block; width: 17px; height: 17px; background: #c0fe04; }
.theme-swatches i + i { background: #7b8175; }
.theme-menu button { border-radius: 0; }
.app-main, body[data-page='map'] .app-main { width: 100%; margin: 0; padding: calc(var(--topbar-height) + 20px) var(--page-gutter) 32px; }
.app-main > .hero, .app-main > #workspace, .app-main > #portal-view, .app-main > .weapon-tabs, .section-navigation, .marathon-footer { max-width: var(--content-width); width: 100%; margin-left: auto; margin-right: auto; }
body[data-page='home'] #portal-view { gap: 0; }
.section-navigation, .guide-codex-tabs { display: flex; gap: 20px; flex-wrap: nowrap; overflow-x: auto; margin-top: -20px; margin-bottom: 24px; padding: 0; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.section-navigation button, .guide-codex-tabs button { flex: 0 0 auto; display: block; min-height: 52px; padding: 12px 14px 10px; border: 0; border-bottom: 4px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font: 600 15px/1.4 var(--font-sans); white-space: nowrap; }
.section-navigation button:hover, .guide-codex-tabs button:hover { background: transparent; color: var(--ink); }
.section-navigation button.active, .guide-codex-tabs button.active { border-color: var(--accent); color: var(--accent); background: transparent; }
body[data-page] .app-main > .hero { min-height: 0; margin-top: 0; margin-bottom: 24px; }
body[data-page] .app-main > .hero h1 { margin: 0; font-size: clamp(36px, 3.3vw, 48px); line-height: 1.2; font-weight: 950; letter-spacing: -.045em; }
body[data-page] .app-main > .hero p { margin-top: 8px; font-size: 14px; line-height: 1.6; }
body[data-page='home'] .app-main > .hero,
body[data-page='codex/collection'] .app-main > .hero,
body[data-page='map'] .app-main > .hero { display: none; }
.marathon-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; color: var(--faint); font-size: 12px; }
.comparison-tray { left: 0; }

/* Overview: map-led hero, one password band, three useful information regions. */
.mh-hero { display: grid; grid-template-columns: .92fr 1.08fr; gap: 28px; align-items: stretch; margin-bottom: 20px; min-width: 0; }
.mh-hero-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.mh-hero-copy h1 { margin: 0; color: var(--ink); font-weight: 950; font-size: clamp(72px, 7.1vw, 112px); letter-spacing: -.065em; line-height: 1.1; }
.mh-hero-copy > p { margin: 10px 0 17px; font-size: clamp(18px, 1.7vw, 27px); line-height: 1.4; font-weight: 750; }
.mh-hero-actions { display: flex; gap: 14px; width: 100%; }
.mh-hero-actions button { min-height: 48px; min-width: 160px; padding: 10px 24px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 18px; line-height: 1.4; font-weight: 800; }
.mh-hero-actions .mh-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-width: 200px; }
.mh-hero-actions button:hover { background: var(--surface-hover); }
.mh-hero-actions .mh-primary:hover { background: var(--accent-dark); }
.mh-hero-map { position: relative; overflow: hidden; height: clamp(218px, 17vw, 276px); min-width: 0; background: #282c27; }
.mh-hero-map > img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 43%; filter: grayscale(1); }
.mh-map-caption { position: absolute; inset: auto 18px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; color: #fff; }
.mh-map-caption strong { font-size: 24px; line-height: 1.3; font-weight: 900; text-shadow: 0 1px 5px #000; }
.mh-map-caption button { border: 1px solid #c0fe04; background: #070807; padding: 8px 16px; color: #c0fe04; font-weight: 750; font-size: 15px; min-height: 40px; }
.guide-daily { margin: 0 0 22px; padding: 14px 0 16px; border: 0; border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-radius: 0; background: transparent; box-shadow: none; }
.guide-daily .portal-section-header { display: flex; align-items: center; margin-bottom: 9px; gap: 16px; }
.guide-daily .portal-section-header > div { display: flex; gap: 18px; align-items: baseline; }
.guide-daily .portal-section-header h2 { margin: 0; font-size: 30px; font-weight: 950; letter-spacing: -.04em; }
.guide-daily .portal-section-header p { font-size: 12px; margin: 0; }
.guide-daily .guide-date { margin-left: auto; border: 0; padding: 0; background: transparent; color: var(--muted); font: 13px/1.4 var(--font-mono); }
.guide-daily .daily-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.guide-daily .daily-cell { border: 0; border-right: 1px solid var(--border); border-radius: 0; padding: 0 12px; gap: 2px; background: transparent; }
.guide-daily .daily-cell:last-child { border-right: 0; }
.guide-daily .daily-cell > span { font-size: 15px; font-weight: 650; }
.guide-daily .daily-cell:not(.is-pending) small, .guide-daily > .guide-source { display: none; }
.guide-daily .daily-cell.is-pending small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.guide-daily .guide-password, .guide-daily .guide-password-record, .guide-daily .guide-password-digits { max-width: 160px; }
.guide-daily .guide-password-digits { gap: 1px; }
.guide-daily .guide-nixie-glyph { max-height: 64px; }
.guide-daily .guide-password:hover { background: transparent; }
.mh-overview-grid { display: grid; grid-template-columns: .28fr .42fr .3fr; gap: 20px; min-width: 0; }
.mh-overview-grid > * { min-width: 0; }
.mh-tools { border: 1px solid var(--border); }
.mh-tools > h2 { margin: 0; padding: 10px 18px; background: var(--accent); color: var(--accent-ink); font-size: clamp(25px, 2.1vw, 32px); line-height: 1.35; font-weight: 950; letter-spacing: -.045em; }
.mh-tools nav { display: flex; flex-direction: column; }
.mh-tools nav button { display: flex; align-items: center; gap: 20px; min-height: 51px; padding: 10px 18px; border-bottom: 1px solid var(--border); color: var(--ink); text-align: left; font-size: 18px; font-weight: 650; background: transparent; }
.mh-tools nav button:last-child { border-bottom: 0; }
.mh-tools nav button:hover { color: var(--accent); background: var(--surface-hover); }
.mh-tools nav svg { width: 27px; height: 27px; flex: 0 0 27px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mh-ammo { background: var(--marathon-paper); color: var(--marathon-paper-ink); padding: 12px 22px 18px; --ink: var(--marathon-paper-ink); --muted: var(--marathon-paper-muted); --border: var(--marathon-paper-border); }
.mh-reference-column { display: flex; flex-direction: column; gap: 16px; }
.mh-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.mh-section-head h2 { margin: 0; color: inherit; font-size: clamp(22px, 1.9vw, 30px); line-height: 1.35; font-weight: 950; letter-spacing: -.04em; }
.mh-section-head > span, .mh-section-head > button { color: var(--muted); font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.mh-data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.mh-data-table th { padding: 7px 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.mh-data-table td { border-bottom: 1px solid var(--border); padding: 7px 0; color: var(--ink); font-variant-numeric: tabular-nums; }
.mh-data-table th:last-child, .mh-data-table td:last-child { text-align: right; white-space: nowrap; }
.mh-data-table td:last-child { font-family: var(--font-mono); font-size: 17px; font-weight: 650; }
.mh-item { display: flex; align-items: center; min-width: 0; gap: 12px; }
.mh-item > span:last-child { font-size: 14px; overflow-wrap: anywhere; font-weight: 600; }
.mh-item-image { display: block; width: 40px; height: 32px; flex: 0 0 40px; border: 0; border-radius: 0; background: transparent; }
.mh-item-image .gc-object-image { object-fit: contain; }
.mh-manufacture .mh-item-image { width: 30px; height: 27px; flex-basis: 30px; }
.mh-manufacture .mh-item { gap: 8px; }
.mh-manufacture .mh-data-table td { padding: 5px 0; }
.mh-manufacture .mh-data-table td:last-child { font-size: 15px; }
.mh-weapon-table td { padding: 7px 0; font: 14px/1.4 var(--font-mono); }
.mh-weapon-table td:last-child { font-size: 14px; }
.mh-loading { padding: 24px 0; color: var(--muted); }

@media (min-width: 901px) {
  .app-sidebar { display: none; }
  body[data-page='weapons'] .app-main { padding-bottom: 130px; }
}
@media (min-width: 901px) and (max-width: 1200px) {
  .portal-topbar { gap: 12px; }
  .header-brand span { font-size: 21px; }
  .header-brand .brand-mark { width: 28px; height: 28px; }
  .desktop-navigation { gap: 2px; }
  .desktop-navigation > button, .desktop-nav-group > button { padding: 0 9px; font-size: 13px; }
  .theme-toggle { gap: 8px; padding-left: 10px; min-width: 0; }
  .theme-swatches i { width: 14px; height: 14px; }
  .mh-hero { gap: 20px; }
  .mh-hero-copy h1 { font-size: 78px; }
  .mh-hero-actions button { min-width: 130px; padding: 10px 16px; font-size: 16px; }
  .mh-hero-actions .mh-primary { min-width: 165px; }
  .mh-overview-grid { grid-template-columns: .25fr .42fr .33fr; gap: 14px; }
  .mh-tools nav button { gap: 12px; font-size: 16px; }
  .mh-ammo { padding-left: 16px; padding-right: 16px; }
  .mh-section-head h2 { font-size: 24px; }
}
@media (max-width: 900px) {
  :root, html[data-theme] { --page-gutter: 16px; --topbar-height: 64px; --header-offset: 64px; --mobile-nav-height: 64px; }
  .desktop-navigation { display: none; }
  .portal-topbar { padding: 0 12px 0 6px; gap: 7px; }
  .header-brand { flex: 1; gap: 6px; }
  .header-brand span { font-size: 23px; }
  .header-brand .brand-mark { width: 28px; height: 28px; }
  .theme-toggle { border-left: 0; padding: 6px; min-width: 44px; gap: 8px; }
  .theme-caption { font-size: 11px; }
  .theme-swatches { gap: 5px; }
  .theme-swatches i { width: 13px; height: 13px; }
  .app-sidebar { background: var(--page); width: 290px; }
  .app-sidebar .main-nav button, .guide-codex-subnav button { border-radius: 0; }
  .app-sidebar .game-name { display: none; }
  .app-sidebar .main-nav button.active { border-left-color: var(--accent); }
  .app-main, body[data-page='map'] .app-main { padding: calc(var(--topbar-height) + 16px) var(--page-gutter) calc(230px + env(safe-area-inset-bottom)); }
  body[data-page]:not([data-page='weapons']) .app-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .section-navigation, .guide-codex-tabs { margin-top: -16px; margin-bottom: 18px; gap: 8px; }
  .section-navigation button, .guide-codex-tabs button { min-height: 48px; padding: 11px 12px 8px; font-size: 14px; }
  body[data-page] .app-main > .hero { margin-bottom: 18px; }
  body[data-page] .app-main > .hero h1 { font-size: 36px; }
  body[data-page] .app-main > .hero p { font-size: 13px; margin-top: 6px; }
  .mh-hero { gap: 18px; grid-template-columns: 1fr 1fr; }
  .mh-hero-copy h1 { font-size: clamp(46px, 8vw, 68px); }
  .mh-hero-copy > p { font-size: 17px; }
  .mh-hero-actions { gap: 8px; }
  .mh-hero-actions button, .mh-hero-actions .mh-primary { flex: 1; min-width: 0; min-height: 44px; padding: 8px; font-size: 15px; }
  .mh-hero-map { height: 200px; }
  .mh-map-caption { inset: auto 12px 12px; gap: 8px; }
  .mh-map-caption strong { font-size: 20px; }
  .mh-map-caption button { padding: 6px 10px; font-size: 13px; }
  .guide-daily .daily-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .guide-daily .daily-cell:nth-child(3n) { border-right: 0; }
  .guide-daily .portal-section-header h2 { font-size: 26px; }
  .guide-daily .portal-section-header > div { gap: 12px; }
  .mh-overview-grid { grid-template-columns: .9fr 1.1fr; gap: 16px; }
  .mh-reference-column { grid-column: 1/-1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .mh-tools > h2 { font-size: 28px; }
  .mh-section-head h2 { font-size: 25px; }
  .mobile-nav { border-top: 1px solid var(--border-strong); background: var(--page); }
  .mobile-nav button { border-radius: 0; }
  .mobile-nav button.active { background: var(--tint); color: var(--accent); }
  .marathon-footer { font-size: 11px; }
}
@media (max-width: 600px) {
  .theme-caption { display: none; }
  .header-brand span { font-size: 22px; }
  .mh-hero { grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
  .mh-hero-copy h1 { font-size: clamp(58px, 17vw, 80px); }
  .mh-hero-copy > p { font-size: 18px; margin: 7px 0 14px; }
  .mh-hero-actions { max-width: 100%; }
  .mh-hero-map { height: 150px; }
  .mh-map-caption strong { font-size: 22px; }
  .guide-daily { padding: 12px 0 14px; margin-bottom: 18px; }
  .guide-daily .portal-section-header { align-items: baseline; gap: 6px; }
  .guide-daily .portal-section-header > div { display: block; }
  .guide-daily .portal-section-header h2 { font-size: 26px; }
  .guide-daily .portal-section-header p { margin-top: 3px; font-size: 11px; }
  .guide-daily .guide-date { font-size: 11px; white-space: nowrap; }
  .guide-daily .daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .guide-daily .daily-cell { padding: 0 12px; }
  .guide-daily .daily-cell:nth-child(3n) { border-right: 1px solid var(--border); }
  .guide-daily .daily-cell:nth-child(2n) { border-right: 0; }
  .guide-daily .daily-cell > span { font-size: 13px; }
  .guide-daily .guide-password, .guide-daily .guide-password-record, .guide-daily .guide-password-digits { max-width: 140px; }
  .guide-daily .guide-nixie-glyph { max-height: 54px; }
  .mh-overview-grid { grid-template-columns: 1fr; gap: 18px; }
  .mh-tools nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mh-tools nav button { min-height: 58px; padding: 10px 12px; gap: 10px; font-size: 15px; }
  .mh-tools nav button:nth-child(odd) { border-right: 1px solid var(--border); }
  .mh-tools nav button:nth-last-child(-n+2) { border-bottom: 0; }
  .mh-tools nav svg { width: 24px; height: 24px; flex-basis: 24px; }
  .mh-tools > h2 { padding: 9px 12px; font-size: 26px; }
  .mh-ammo { padding: 14px 16px 18px; }
  .mh-reference-column { grid-template-columns: 1fr; gap: 22px; }
  .mh-section-head h2 { font-size: 25px; }
  .mh-data-table td { padding: 9px 0; }
  .mh-item-image { width: 44px; height: 38px; flex-basis: 44px; }
  .mh-data-table td:last-child { font-size: 18px; }
  .mh-weapon-table td:last-child { font-size: 14px; }
  .mh-manufacture .mh-data-table td { padding: 9px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
