:root {
  color-scheme: dark;
  --bg: #080c0b;
  --panel: #111815;
  --panel-2: #18211d;
  --line: #2d3b34;
  --text: #f1f5ef;
  --muted: #94a39a;
  --accent: #d8f25b;
  --accent-dark: #99ad38;
  --danger: #ff796f;
  --warning: #ffbf55;
  --ok: #75e6a5;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.native-store-build .web-only { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(216, 242, 91, .12), transparent 34rem),
    linear-gradient(180deg, #0d1411 0, var(--bg) 24rem);
  color: var(--text);
}

body.loading { overflow: hidden; }
body.loading .shell { visibility: hidden; opacity: 0; }
.shell { opacity: 1; transition: opacity .45s ease; }

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 38%, rgba(216, 242, 91, .12), transparent 18rem),
    linear-gradient(160deg, #111a16, #070a09 66%);
  opacity: 1;
  transition: opacity .45s ease, transform .45s ease;
}

.splash-screen::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(216, 242, 91, .16);
  clip-path: polygon(0 0, 72px 0, 72px 1px, 1px 1px, 1px 72px, 0 72px, 0 0, 100% 0, 100% 72px, calc(100% - 1px) 72px, calc(100% - 1px) 1px, calc(100% - 72px) 1px, calc(100% - 72px) 0, 100% 0, 100% 100%, calc(100% - 72px) 100%, calc(100% - 72px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 72px), 100% calc(100% - 72px), 100% 100%, 0 100%, 0 calc(100% - 72px), 1px calc(100% - 72px), 1px calc(100% - 1px), 72px calc(100% - 1px), 72px 100%, 0 100%);
}

.splash-screen.leaving { opacity: 0; transform: scale(1.015); pointer-events: none; }
.splash-content { width: min(100%, 330px); text-align: center; }
.splash-logo { width: 104px; height: 104px; margin-bottom: 24px; filter: drop-shadow(0 0 28px rgba(216, 242, 91, .15)); }
.splash-content .eyebrow { margin-bottom: 8px; }
.splash-content h1 { margin-bottom: 52px; font-size: clamp(32px, 10vw, 46px); letter-spacing: -.055em; }
.splash-loading { margin-bottom: 11px; color: var(--muted); font: 800 10px ui-monospace, monospace; letter-spacing: .28em; }
.loading-track { height: 4px; overflow: hidden; border-radius: 999px; background: #25302b; }
.loading-track i { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; animation: splash-progress 4s linear forwards; box-shadow: 0 0 12px rgba(216, 242, 91, .45); }
.splash-credit { margin: 12px 0 0; color: #68766e; font: 650 10px ui-monospace, monospace; letter-spacing: .06em; text-align: center; }
.splash-credit strong { color: #8f9d95; font-weight: 800; }
@keyframes splash-progress { to { transform: scaleX(1); } }

.weapon-screen {
  min-height: 100vh;
  padding: max(36px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));
  background:
    linear-gradient(rgba(216, 242, 91, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 242, 91, .025) 1px, transparent 1px);
  background-size: 36px 36px;
}
.weapon-select-shell { width: min(100%, 640px); margin: 0 auto; padding-top: clamp(32px, 10vh, 96px); }
.weapon-select-shell h1 { margin-bottom: 8px; font-size: clamp(34px, 9vw, 52px); }
.weapon-intro { margin-bottom: 32px; color: var(--muted); }
.weapon-list { display: grid; gap: 12px; }
.weapon-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 50px 18px 18px;
  color: var(--text);
  background: linear-gradient(110deg, rgba(216,242,91,.07), transparent 45%), var(--panel);
  text-align: left;
  cursor: pointer;
}
.weapon-card:hover, .weapon-card:focus-visible { border-color: var(--accent-dark); transform: translateY(-1px); }
.weapon-card:active { transform: translateY(1px); }
.weapon-number { color: var(--accent); font: 800 11px ui-monospace, monospace; letter-spacing: .12em; }
.weapon-copy { display: grid; gap: 6px; }
.weapon-copy strong { font-size: 21px; letter-spacing: -.025em; }
.weapon-copy small, .weapon-range { color: var(--muted); font: 750 10px ui-monospace, monospace; letter-spacing: .06em; }
.weapon-range { color: var(--accent); white-space: nowrap; }
.weapon-arrow { position: absolute; right: 18px; color: var(--accent); font-size: 22px; }
.weapon-footnote { margin: 20px 2px; color: #718078; font-size: 11px; }
.picker-coffee-button { display: block; min-height: 50px; margin: 4px auto 0; padding: 11px 18px; border-radius: 13px; font-size: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.22); }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 18px; }
.legal-links a { color: #94a39a; font-size: 11px; font-weight: 750; text-decoration: none; }
.legal-links a:hover, .legal-links a:focus-visible { color: var(--accent); text-decoration: underline; }
.copyright { margin: 9px 0 0; color: #607068; font-size: 10px; text-align: center; }

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(100%, 640px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));
}

.hero { position: relative; display: flex; align-items: center; gap: 14px; margin: 8px 4px 24px; padding-right: 62px; }
.brand-mark {
  display: grid; place-items: center; flex: 0 0 54px; height: 54px;
  border: 1px solid var(--accent-dark); color: var(--accent); font-weight: 900; font-size: 28px;
  background: linear-gradient(135deg, rgba(216,242,91,.14), transparent);
  clip-path: polygon(12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%, 0 50%);
}
.eyebrow, .step { margin: 0 0 3px; color: var(--accent); font: 800 11px/1.1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: clamp(26px, 7vw, 36px); line-height: 1; letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
.subtitle { margin: 0; color: var(--muted); font-size: 14px; }
.change-weapon { position: absolute; right: 0; top: 0; min-height: 34px; border: 1px solid var(--accent-dark); border-radius: 8px; padding: 7px 10px; color: var(--accent); background: rgba(216,242,91,.06); font: 800 10px ui-monospace, monospace; letter-spacing: .06em; cursor: pointer; }
.change-weapon:hover, .change-weapon:focus-visible { background: rgba(216,242,91,.13); }

.panel, .solution {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 24, 21, .93);
  box-shadow: 0 18px 48px rgba(0,0,0,.22);
}
.coordinates { padding: 20px; }
.operating-cost { margin-top: 14px; padding: 20px; }
.supply-badge { border: 1px solid rgba(216,242,91,.35); border-radius: 999px; padding: 6px 9px; color: var(--accent); background: rgba(216,242,91,.06); font: 800 9px ui-monospace, monospace; letter-spacing: .06em; text-align: center; }
.cost-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 10px; margin-top: 15px; }
.cost-grid article { min-height: 86px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--panel-2); }
.cost-grid strong { display: block; font-size: 20px; line-height: 1.15; letter-spacing: -.025em; }
.ammo-note { margin: 12px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.section-heading, .solution-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading.compact { margin-top: 0; }
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
label span { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
input {
  width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 12px;
  outline: none; padding: 0 13px; background: #090e0c; color: var(--text); font-size: 20px; font-weight: 750;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(216,242,91,.1); }
input.invalid { border-color: var(--danger); }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); }
.divider span { height: 1px; background: var(--line); }
.divider b { text-transform: uppercase; font: 700 10px ui-monospace, monospace; letter-spacing: .16em; }

.text-button, .icon-button { border: 0; color: var(--accent); background: transparent; cursor: pointer; font-weight: 750; }
.text-button { padding: 8px 0; font-size: 13px; }
.text-button:active, .icon-button:active { transform: scale(.96); }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; font-size: 22px; }

.solution { margin-top: 14px; overflow: hidden; border-color: #4d5928; }
.solution-topline { padding: 18px 20px; border-bottom: 1px solid var(--line); background: rgba(216,242,91,.035); }
.status { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--muted); font: 800 10px ui-monospace, monospace; letter-spacing: .05em; text-transform: uppercase; text-align: center; }
.status.ok { color: var(--ok); border-color: rgba(117,230,165,.4); background: rgba(117,230,165,.08); }
.status.out { color: var(--danger); border-color: rgba(255,121,111,.4); background: rgba(255,121,111,.08); }
.status.close { color: var(--warning); border-color: rgba(255,191,85,.4); background: rgba(255,191,85,.08); }
.empty-state { min-height: 235px; display: grid; place-content: center; justify-items: center; padding: 32px; color: var(--muted); text-align: center; }
.empty-state p { max-width: 280px; margin: 20px 0 0; font-size: 14px; }
.radar { position: relative; width: 72px; height: 72px; border: 1px solid #415048; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 13px, rgba(148,163,154,.18) 14px 15px); }
.radar::before, .radar::after { content: ""; position: absolute; background: #415048; }
.radar::before { left: 50%; top: 0; width: 1px; height: 100%; }
.radar::after { top: 50%; left: 0; height: 1px; width: 100%; }
.radar i { position: absolute; left: 50%; top: 50%; width: 32px; height: 1px; transform-origin: left; background: linear-gradient(90deg, var(--accent), transparent); animation: scan 3s linear infinite; }
@keyframes scan { to { transform: rotate(360deg); } }

.results { padding: 20px; }
.primary-result { margin-bottom: 12px; border-radius: 14px; padding: 17px; background: var(--accent); color: #11150b; }
.result-label { display: block; margin-bottom: 5px; font: 800 10px ui-monospace, monospace; letter-spacing: .11em; opacity: .72; }
.primary-result strong { font-size: 46px; line-height: 1; letter-spacing: -.05em; }
strong small { font-size: .38em; letter-spacing: 0; opacity: .72; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-grid article { min-height: 104px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--panel-2); }
.result-grid strong { display: block; font-size: 27px; letter-spacing: -.035em; }
.result-grid .delta { font-size: 19px; }
.delta-caption { color: var(--muted); font-size: 10px; }
.arc-label { display: block; margin-top: 4px; color: var(--muted); font: 750 9px ui-monospace, monospace; letter-spacing: .07em; }
.secondary-arc { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font: 750 9px ui-monospace, monospace; }
.secondary-arc b { color: var(--text); font-size: 11px; }
.solution-note { min-height: 36px; margin: 14px 2px 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--accent); color: #12170d; cursor: pointer; font-weight: 850; }
.primary-button:active { background: #c4dd4e; transform: translateY(1px); }

.info { margin-top: 14px; }
.info summary { padding: 18px 20px; cursor: pointer; font-weight: 750; }
.info-body { padding: 0 20px 20px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.info-body code { display: block; overflow-x: auto; border-radius: 10px; padding: 12px; color: var(--accent); background: #080c0b; font-size: 12px; }
footer { padding: 20px 5px 0; color: #718078; font-size: 11px; line-height: 1.5; }
.footer-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.coffee-button { min-height: 38px; border: 1px solid #735d3a; border-radius: 10px; padding: 8px 11px; color: #f2d7a9; background: rgba(135,96,48,.12); cursor: pointer; font-size: 12px; font-weight: 800; }
.coffee-button:hover, .coffee-button:focus-visible { border-color: #b68a4d; background: rgba(135,96,48,.22); }
footer .danger { color: var(--danger); }
.coffee-dialog { width: min(calc(100% - 32px), 420px); border: 1px solid #4d5928; border-radius: 18px; padding: 0; color: var(--text); background: transparent; box-shadow: 0 24px 80px rgba(0,0,0,.65); }
.coffee-dialog::backdrop { background: rgba(2,5,4,.78); backdrop-filter: blur(5px); }
.coffee-card { position: relative; padding: 24px; background: linear-gradient(145deg, rgba(216,242,91,.055), transparent 45%), var(--panel); }
.coffee-card h2 { margin-bottom: 10px; font-size: 24px; }
.coffee-card > p:not(.eyebrow) { margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.coffee-card > small { display: block; margin-top: 13px; color: #718078; text-align: center; font-size: 10px; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #0a0f0d; cursor: pointer; font-size: 22px; line-height: 1; }
.donation-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.donation-grid a { display: grid; place-items: center; min-height: 52px; border: 1px solid #735d3a; border-radius: 11px; color: #171006; background: #efc47f; text-decoration: none; font-size: 18px; font-weight: 900; }
.donation-grid a:hover, .donation-grid a:focus-visible { background: #ffda9a; transform: translateY(-1px); }
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 10; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; background: #202b26; color: var(--text); font-size: 12px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 390px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .coordinates, .operating-cost, .results { padding: 16px; }
  .cost-grid { grid-template-columns: 1fr; }
  .donation-grid { grid-template-columns: 1fr; }
  .solution-topline { padding: 16px; }
  .result-grid strong { font-size: 24px; }
  .weapon-card { grid-template-columns: 30px 1fr; }
  .weapon-range { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
