:root {
  --bg: #07101f;
  --bg-soft: rgba(9, 17, 34, 0.84);
  --bg-panel: linear-gradient(180deg, rgba(15, 25, 46, 0.96), rgba(8, 14, 28, 0.96));
  --bg-panel-alt: linear-gradient(180deg, rgba(245, 248, 255, 0.95), rgba(223, 232, 255, 0.95));
  --text: #f8fbff;
  --text-soft: #b6c7e4;
  --line: rgba(148, 174, 227, 0.24);
  --blue: #0d5bff;
  --blue-2: #3b8dff;
  --gold: #ffc928;
  --gold-2: #ffe178;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 8px 22px rgba(3, 10, 22, 0.26);
  --pixel-font: "Press Start 2P", cursive;
  --ui-font: "Inter", system-ui, sans-serif;
}

body[data-theme="day"] {
  --bg: #cfe0ff;
  --bg-soft: rgba(236, 243, 255, 0.92);
  --bg-panel: var(--bg-panel-alt);
  --text: #0e1a31;
  --text-soft: #395277;
  --line: rgba(14, 26, 49, 0.12);
  --shadow: 0 18px 45px rgba(31, 61, 118, 0.16);
  --shadow-soft: 0 10px 24px rgba(31, 61, 118, 0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  line-height: 1.55;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; font: inherit; }

.world, .world-grid, .world-glow { position: fixed; inset: 0; pointer-events: none; }
.world-back {
  z-index: -4;
  background:
    radial-gradient(circle at 14% 18%, rgba(13, 91, 255, 0.30), transparent 38%),
    radial-gradient(circle at 86% 12%, rgba(255, 201, 40, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(4, 9, 19, 0.96), rgba(6, 14, 30, 0.96));
}
body[data-theme="day"] .world-back {
  background:
    radial-gradient(circle at 14% 18%, rgba(13, 91, 255, 0.24), transparent 40%),
    radial-gradient(circle at 86% 12%, rgba(255, 201, 40, 0.20), transparent 30%),
    linear-gradient(180deg, rgba(224, 236, 255, 0.96), rgba(205, 222, 255, 0.96));
}
.world-front {
  z-index: -3;
  opacity: .8;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.8), rgba(0,0,0,.18));
}
.world-grid {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(10,22,42,0), rgba(10,22,42,.28)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(180deg, rgba(255,255,255,.025) 0 1px, transparent 1px 96px);
}
.world-glow {
  z-index: -1;
  background:
    radial-gradient(circle at 50% -10%, rgba(13, 91, 255, .24), transparent 44%),
    radial-gradient(circle at 50% 110%, rgba(255, 201, 40, .10), transparent 28%);
}
.container { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.section { position: relative; padding: 44px 0; }
.section--hero { padding-top: 24px; padding-bottom: 28px; }
.section--alt { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.00)); }
body[data-theme="day"] .section--alt { background: linear-gradient(180deg, rgba(255,255,255,.26), rgba(255,255,255,.12)); }

.header {
  position: relative;
  z-index: 50;
  background: linear-gradient(180deg, rgba(5, 11, 22, 0.92), rgba(5, 11, 22, 0.76));
  border-bottom: 3px solid rgba(13, 91, 255, 0.28);
  box-shadow: 0 12px 34px rgba(0,0,0,.20);
}
body[data-theme="day"] .header {
  background: linear-gradient(180deg, rgba(246, 249, 255, 0.94), rgba(235, 241, 255, 0.84));
  border-bottom-color: rgba(13, 91, 255, 0.18);
}
.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
}
.brand { display: inline-grid; gap: 6px; align-self: center; }
.brand__title,
.brand__subtitle,
.inventory-nav__item,
.theme-toggle,
.theme-auto,
.nav-toggle,
.pixel-pill,
.pixel-mini,
.meter__label,
.meter__value,
.panel__title,
.section-head__eyebrow,
.ip-panel__head,
.btn,
.toast__label,
.section-label,
.news-card__tag,
.news-card__pin { font-family: var(--pixel-font); }
.brand__title { font-size: clamp(14px, 1.25vw, 18px); letter-spacing: .06em; line-height: 1.35; text-shadow: 2px 2px 0 rgba(0,0,0,.26); }
.brand__subtitle { font-size: 9px; color: var(--text-soft); line-height: 1.3; }

.inventory-nav {
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 8px;
  width: min(100%, 760px);
}
.inventory-nav__item,
.theme-toggle,
.theme-auto,
.inventory-slot,
.btn,
.nav-toggle,
.btn-chip,
.modal__close {
  position: relative;
  border: 3px solid #0b1322;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.12), inset 0 -3px 0 rgba(0,0,0,.24), 0 6px 0 rgba(5, 12, 24, .42), 0 12px 26px rgba(0,0,0,.16);
}
.inventory-nav__item {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(23, 41, 78, 0.96), rgba(12, 22, 42, 0.96));
  color: #f4f8ff;
  font-size: 10px;
  text-align: center;
  letter-spacing: .02em;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}
.inventory-nav__item:hover, .inventory-nav__item.active { transform: translateY(-2px); filter: brightness(1.05); border-color: rgba(255, 201, 40, 0.62); }
.inventory-nav__item.active::after, .inventory-slot::after, .btn::after, .theme-toggle::after, .theme-auto::after, .nav-toggle::after, .btn-chip::after, .modal__close::after {
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(255,255,255,.08); pointer-events: none;
}
.theme-controls { display: flex; gap: 8px; align-items: center; }
.theme-toggle, .theme-auto, .nav-toggle {
  min-height: 52px; padding: 0 14px; cursor: pointer; font-size: 10px;
  background: linear-gradient(180deg, rgba(12, 99, 255, .98), rgba(7, 56, 168, .98)); color: #f7faff;
}
.theme-toggle { min-width: 120px; color: #0e1a31; background: linear-gradient(180deg, rgba(255, 201, 40, 0.98), rgba(227, 168, 20, 0.98)); }
.theme-auto { min-width: 88px; }
.theme-auto.is-auto { box-shadow: inset 0 0 0 2px rgba(255, 201, 40, .22), inset 0 2px 0 rgba(255,255,255,.12), inset 0 -3px 0 rgba(0,0,0,.24), 0 6px 0 rgba(5, 12, 24, .42), 0 12px 26px rgba(0,0,0,.16); }
.nav-toggle { display: none; width: 56px; padding: 0; place-items: center; }
.nav-toggle span { display: block; width: 22px; height: 3px; margin: 3px auto; background: #fff; }

.hero__grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr); gap: 20px; }
.hero__side { display: grid; gap: 20px; }
.panel, .news-card {
  position: relative;
  overflow: hidden;
  border: 4px solid rgba(9, 17, 31, 0.88);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}
.panel::before, .news-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid var(--line); pointer-events: none; }
.panel, .news-card { padding: 24px; }
.panel__topline, .panel__title-row, .ip-panel__head, .hero__actions, .hero__stats, .ip-panel__tags, .cta-strip, .footer__inner, .modal__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.panel__title-row { align-items: center; justify-content: space-between; margin-bottom: 18px; }
.panel__title { margin: 0; font-size: clamp(12px, 1.15vw, 16px); line-height: 1.45; }
.panel__text, .section-head__text, .hero__subtitle, .footer p, .news-card__text, .status, .label, .modal__text { margin: 0; color: var(--text-soft); font-size: 15px; }
.pixel-pill, .pixel-mini, .section-label, .news-card__tag, .news-card__pin {
  display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 8px 10px;
  background: linear-gradient(180deg, rgba(16, 98, 255, .98), rgba(8, 56, 164, .98)); border: 2px solid rgba(7, 17, 33, .86);
  color: #f5f8ff; font-size: 9px; line-height: 1.45; text-transform: uppercase;
}
.pixel-pill--gold, .btn--gold, .news-card__pin { background: linear-gradient(180deg, rgba(255, 201, 40, .98), rgba(219, 162, 18, .98)); color: #1d1300; }
.hero__title { margin: 0 0 10px; font-size: clamp(30px, 4.2vw, 56px); line-height: 1.04; font-weight: 900; letter-spacing: -.03em; }
.hero__subtitle { max-width: 860px; margin-bottom: 20px; font-size: clamp(16px, 1.5vw, 19px); }
.hero__stats { margin-bottom: 18px; }
.meter {
  flex: 1 1 240px; min-width: 240px; padding: 16px; border: 3px solid rgba(9, 17, 31, 0.86);
  background: linear-gradient(180deg, rgba(10, 18, 35, 0.88), rgba(5, 10, 22, 0.88)); box-shadow: var(--shadow-soft);
}
body[data-theme="day"] .meter { background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(229,238,255,.86)); }
.meter__label, .meter__value { display: flex; justify-content: space-between; font-size: 9px; }
.meter__value { margin-top: 6px; color: var(--text); }
.meter__track { margin-top: 12px; height: 18px; padding: 3px; background: #070e1b; border: 3px solid #000; box-shadow: inset 0 2px 0 rgba(255,255,255,.06); }
.meter__fill { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--blue) 0 28px, var(--blue-2) 28px 56px); box-shadow: 0 0 16px rgba(13, 91, 255, 0.42); }
.meter__fill--a { width: 96%; }
.meter__fill--b { width: 78%; }

.btn, .btn-chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 18px; font-size: 10px; color: #f7faff;
  text-transform: uppercase; cursor: pointer; background: linear-gradient(180deg, rgba(12, 99, 255, .98), rgba(7, 56, 168, .98)); transition: transform .15s ease, filter .15s ease;
}
.btn:hover, .theme-toggle:hover, .theme-auto:hover, .inventory-slot:hover, .nav-toggle:hover, .btn-chip:hover, .modal__close:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn--ghost, .inventory-slot, .btn-chip { background: linear-gradient(180deg, rgba(26, 44, 81, .98), rgba(10, 18, 34, .98)); }
.btn--primary { background: linear-gradient(180deg, rgba(18, 110, 255, .98), rgba(7, 58, 176, .98)); }
.btn--gold { color: #171100; }

.ip-panel { margin-top: 20px; padding: 20px; border: 3px solid rgba(13, 91, 255, 0.24); background: linear-gradient(180deg, rgba(7, 15, 31, 0.88), rgba(7, 14, 28, 0.70)); }
body[data-theme="day"] .ip-panel { background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(229,238,255,.74)); }
.ip-panel__head { justify-content: space-between; margin-bottom: 16px; font-size: 9px; }
.ip-panel__value { font-size: clamp(22px, 3vw, 36px); font-weight: 900; letter-spacing: -.03em; margin-bottom: 16px; }
.filter-stack { display: grid; gap: 12px; }
.input, .textarea {
  width: 100%;
  border: 3px solid rgba(9,17,31,.86);
  background: linear-gradient(180deg, rgba(10, 18, 35, 0.88), rgba(5, 10, 22, 0.88));
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  box-shadow: var(--shadow-soft);
}
body[data-theme="day"] .input,
body[data-theme="day"] .textarea { background: linear-gradient(180deg, rgba(255,255,255,.88), rgba(229,238,255,.88)); }
.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.select { appearance: none; -webkit-appearance: none; }
.inventory-grid, .news-grid { display: grid; gap: 14px; }
.inventory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inventory-slot { display: grid; align-content: center; justify-items: start; min-height: 116px; padding: 16px; color: #f6faff; }
.inventory-slot span { font-family: var(--pixel-font); font-size: 10px; }
.inventory-slot small { margin-top: 10px; color: #bdd0f5; font-family: var(--ui-font); font-size: 13px; }

.section-head { display: grid; gap: 12px; margin-bottom: 18px; }
.section-head__eyebrow { font-size: 10px; color: var(--gold); }
.section-head__title { margin: 0; font-size: clamp(26px, 3vw, 42px); line-height: 1.08; }
.section-label { margin: 10px 0 14px; }
.news-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.news-card__top, .news-card__badges, .news-card__highlights, .form-grid, .input-row, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.news-card__top { justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.news-card__meta, .modal__meta { color: var(--text-soft); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
.news-card__title, .modal__title { margin: 0 0 10px; font-size: 22px; line-height: 1.12; }
.news-card__text { margin-bottom: 14px; }
.news-card__highlights { margin-bottom: 14px; }
.kv {
  display: inline-flex; align-items: center; min-height: 34px; padding: 8px 12px;
  border: 2px solid rgba(13, 91, 255, .20); background: linear-gradient(180deg, rgba(10, 19, 36, .78), rgba(8, 14, 25, .60));
  color: var(--text); font-size: 12px;
}
body[data-theme="day"] .kv { background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(235,242,255,.66)); }
.news-card__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-block { margin-top: 14px; }
.label { display: block; margin-bottom: 8px; font-size: 13px; }
.input-row { align-items: center; flex-wrap: nowrap; }
.skin-box {
  width: 74px; height: 74px; flex: 0 0 74px;
  display: grid; place-items: center; border: 3px solid rgba(9,17,31,.86);
  background: linear-gradient(180deg, rgba(23, 41, 78, 0.96), rgba(12, 22, 42, 0.96));
}
.skin-box img { width: 56px; height: 56px; image-rendering: pixelated; }
.form-actions { margin-top: 14px; align-items: center; }
.status { font-size: 14px; }

.footer { padding: 26px 0 34px; border-top: 3px solid rgba(13, 91, 255, 0.20); background: linear-gradient(180deg, rgba(8, 14, 28, 0.82), rgba(7, 12, 23, 0.94)); }
body[data-theme="day"] .footer { background: linear-gradient(180deg, rgba(246, 249, 255, 0.8), rgba(231, 239, 255, 0.92)); }
.footer__inner { align-items: center; justify-content: space-between; }
.footer__meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-soft); }

.toast {
  position: fixed; left: 18px; top: 18px; z-index: 70; min-width: 240px; max-width: min(420px, calc(100vw - 36px));
  padding: 16px 18px; border: 3px solid rgba(7, 17, 33, .88); background: linear-gradient(180deg, rgba(14, 24, 43, .97), rgba(8, 14, 24, .97));
  box-shadow: var(--shadow); transform: translateY(-12px); opacity: 0; pointer-events: none; transition: .18s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast__label { display: block; margin-bottom: 8px; color: var(--gold-2); font-size: 9px; }
.toast__title { font-size: 14px; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.64);
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.98);
  width: min(860px, calc(100vw - 28px)); max-height: min(82vh, 760px); overflow: auto;
  padding: 20px; z-index: 91; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  border: 4px solid rgba(9,17,31,.88); background: var(--bg-panel); box-shadow: var(--shadow);
}
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal__close { min-height: 46px; min-width: 46px; padding: 0; color: var(--text); background: linear-gradient(180deg, rgba(26, 44, 81, .98), rgba(10, 18, 34, .98)); }
.modal__text { white-space: pre-wrap; margin-bottom: 14px; }
.modal__highlights { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .45s ease, transform .45s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .header__inner { grid-template-columns: auto 1fr auto; }
  .inventory-nav { width: 100%; max-width: none; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .hero__grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .header__inner { grid-template-columns: auto auto auto; }
  .nav-toggle { display: grid; justify-self: center; }
  .inventory-nav {
    display: none; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%; margin-top: 8px;
  }
  .inventory-nav.is-open { display: grid; }
  .theme-controls { justify-self: end; }
  .inventory-grid, .news-grid, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { display: grid; }
  .input-row { flex-wrap: nowrap; }
}
@media (max-width: 640px) {
  .container { width: min(100% - 20px, 1280px); }
  .header__inner { grid-template-columns: 1fr auto auto; gap: 10px; }
  .brand__title { font-size: 14px; }
  .brand__subtitle { font-size: 8px; }
  .theme-toggle, .theme-auto { min-width: 0; padding: 0 10px; }
  .section { padding: 30px 0; }
  .inventory-nav { grid-template-columns: 1fr; gap: 6px; }
  .inventory-nav__item, .theme-toggle, .theme-auto, .btn, .btn-chip { min-height: 48px; font-size: 9px; }
  .hero__title { font-size: 30px; }
  .hero__subtitle { font-size: 15px; }
  .panel, .news-card, .modal { padding: 16px; }
  .meter { min-width: 100%; }
  .hero__actions, .cta-strip, .form-actions, .news-card__actions, .ip-panel__tags, .modal__actions { flex-direction: column; }
  .btn, .btn-chip { width: 100%; }
  .inventory-grid, .news-grid, .form-grid { grid-template-columns: 1fr; }
  .ip-panel__value { font-size: 22px; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
  .toast { left: 10px; right: 10px; top: 10px; max-width: none; }
  .input-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
