:root {
  color-scheme: dark;
  --bg: #071015;
  --panel: #0d1a22;
  --panel-2: #111f28;
  --line: #294854;
  --cyan: #4fc3ee;
  --gold: #f0c86a;
  --red: #ff686e;
  --green: #70d6a0;
  --text: #edf7fb;
  --muted: #9db0b9;
  --radius: 12px;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 4%, rgba(79, 195, 238, 0.12), transparent 28rem),
    linear-gradient(135deg, rgba(79, 195, 238, 0.035) 0 1px, transparent 1px 72px),
    var(--bg);
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.calculator-shell { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; padding: 12px 0 38px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 44px; height: 52px; }
.brand span { display: grid; gap: 2px; }
.brand strong { font-family: ui-condensed, "Arial Narrow", Impact, sans-serif; font-size: 1.2rem; line-height: 1; }
.brand em { color: var(--gold); font-style: normal; font-weight: 900; }
.library-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(13, 26, 34, 0.86);
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
}

.eyebrow { margin: 0; color: var(--cyan); font-size: 0.7rem; font-weight: 950; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 24px;
  min-height: 210px;
  padding: 30px 34px;
  border: 1px solid rgba(79, 195, 238, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(110deg, rgba(13, 29, 37, 0.97), rgba(9, 20, 27, 0.92));
  box-shadow: var(--shadow);
}
.intro h1 { margin-top: 5px; font-family: ui-condensed, "Arial Narrow", Impact, sans-serif; font-size: clamp(2.8rem, 7vw, 5.2rem); line-height: 0.95; text-transform: uppercase; }
.intro p:last-child { max-width: 650px; margin: 14px 0 0; color: #c7d7dd; font-size: 1rem; }
.intro img { width: 118px; height: 118px; object-fit: contain; filter: drop-shadow(0 0 20px rgba(79, 195, 238, 0.35)); }

.calculator-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; margin-top: 18px; }
.quick-form { display: grid; gap: 12px; min-width: 0; }
.question-card, .advanced, .answer-panel, .method-card {
  border: 1px solid rgba(79, 195, 238, 0.22);
  border-radius: var(--radius);
  background: rgba(13, 26, 34, 0.95);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.19);
}
.question-card { padding: 20px; }
.question-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.question-heading > span { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border: 1px solid rgba(79, 195, 238, 0.5); border-radius: 50%; color: var(--cyan); background: rgba(79, 195, 238, 0.08); font-size: 0.85rem; font-weight: 950; }
.question-heading h2 { margin-top: 3px; font-size: 1.25rem; }

.compact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.compact-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
label > span, .choice-fieldset legend, .yes-no-fieldset legend { display: block; margin-bottom: 6px; color: #bfd0d6; font-size: 0.76rem; font-weight: 850; }
label > span small { color: var(--muted); font-size: 0.68rem; font-weight: 650; }
input, select { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid #315461; border-radius: 7px; outline: 0; color: var(--text); background: #08151b; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(79, 195, 238, 0.12); }
input::placeholder { color: #637984; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-fieldset { margin-top: 15px; }
.gear-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.hero-sync-line { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 12px 0 0; padding: 9px 11px; border: 1px solid rgba(79, 195, 238, .18); border-radius: 7px; color: var(--muted); background: rgba(79, 195, 238, .045); font-size: .68rem; line-height: 1.4; }
.hero-sync-line a { flex: 0 0 auto; color: var(--cyan); font-weight: 850; text-decoration: none; }
.gear-choices label { min-width: 0; }
.gear-choices input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gear-choice { display: grid; place-items: center; min-height: 126px; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #09161c; text-align: center; cursor: pointer; }
.gear-thumb { display: block; width: 54px; height: 54px; overflow: hidden; border: 1px solid rgba(240, 200, 106, 0.28); border-radius: 7px; background-image: url("assets/calculator/equipment-promotion.webp"); background-repeat: no-repeat; background-size: 730px auto; box-shadow: inset 0 0 18px rgba(240, 200, 106, 0.12); }
.gear-thumb-gun { background-position: -61px -39px; }
.gear-thumb-helmet { background-position: -61px -115px; }
.gear-thumb-armor { background-position: -61px -191px; }
.gear-thumb-boots { background-position: -61px -268px; }
.gear-choice strong { margin-top: 3px; color: var(--text); font-size: 0.83rem; }
.gear-choice small { min-height: 2.4em; color: var(--muted); font-size: 0.64rem; line-height: 1.2; }
.gear-choices input:checked + .gear-choice { border-color: var(--cyan); color: var(--cyan); background: rgba(79, 195, 238, 0.12); box-shadow: inset 0 0 0 1px rgba(79, 195, 238, 0.28); }
.gear-choices input:focus-visible + .gear-choice { outline: 3px solid rgba(79, 195, 238, 0.24); outline-offset: 2px; }

.form-tip { margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid var(--cyan); color: var(--muted); background: rgba(79, 195, 238, 0.045); font-size: 0.73rem; line-height: 1.45; }
.form-tip strong { color: #d9e9ee; }
.next-step { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.next-step > div { padding: 10px 11px; border: 1px solid rgba(79, 195, 238, 0.18); border-radius: 7px; background: rgba(79, 195, 238, 0.045); }
.next-step span, .next-step small { display: block; color: var(--muted); font-size: 0.68rem; }
.next-step strong { display: block; margin: 3px 0; font-size: 0.86rem; }
.next-step small { line-height: 1.35; }

.yes-no-fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 15px; }
.yes-no-fieldset legend { width: 100%; }
.yes-no-fieldset label { position: relative; }
.yes-no-fieldset input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.yes-no-fieldset label span { min-width: 62px; min-height: 36px; display: grid; place-items: center; margin: 0; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #09161c; cursor: pointer; }
.yes-no-fieldset input:checked + span { border-color: var(--cyan); color: var(--text); background: rgba(79, 195, 238, 0.13); }
.yes-no-fieldset small { margin-left: 4px; color: var(--muted); font-size: 0.73rem; }

.advanced { overflow: hidden; }
.advanced > summary, .method-card > summary, .shop-settings > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; list-style: none; }
.advanced > summary::-webkit-details-marker, .method-card > summary::-webkit-details-marker, .shop-settings > summary::-webkit-details-marker { display: none; }
.advanced > summary { min-height: 70px; padding: 14px 18px; }
.advanced > summary span:first-child { display: grid; gap: 3px; }
.advanced > summary strong { font-size: 0.91rem; }
.advanced > summary small { color: var(--muted); font-size: 0.73rem; }
.advanced > summary span:last-child { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; color: var(--cyan); font-size: 1.2rem; }
.advanced[open] > summary span:last-child { transform: rotate(45deg); }
.advanced-body { display: grid; gap: 14px; padding: 0 18px 18px; border-top: 1px solid var(--line); }
.advanced-intro { margin: 14px 0 -2px; color: var(--muted); font-size: 0.76rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.reset-button, .answer-button { min-height: 46px; padding: 0 16px; border-radius: 8px; font-weight: 900; }
.reset-button { border: 1px solid var(--line); color: var(--text); background: var(--panel); }
.answer-button { min-width: 220px; border: 1px solid var(--cyan); color: #051015; background: var(--cyan); }

.answer-panel { position: sticky; top: 16px; min-width: 0; padding: 25px; overflow: hidden; border-color: rgba(112, 214, 160, 0.48); box-shadow: var(--shadow); }
.answer-panel::before { position: absolute; inset: 0 0 auto; height: 4px; content: ""; background: var(--green); }
.answer-panel[data-answer="core"] { border-color: rgba(79, 195, 238, 0.46); }
.answer-panel[data-answer="core"]::before { background: var(--cyan); }
.answer-panel[data-answer="forge"] { border-color: rgba(255, 104, 110, 0.5); }
.answer-panel[data-answer="forge"]::before { background: var(--red); }
.answer-panel[data-answer="both"]::before { background: linear-gradient(90deg, var(--cyan), var(--red)); }
.answer-panel[data-answer="chest"]::before, .answer-panel[data-answer="save"]::before { background: var(--gold); }
.answer-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.answer-type, .answer-confidence { display: inline-flex; align-items: center; min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.63rem; font-weight: 950; letter-spacing: 0.06em; }
.answer-type { color: var(--cyan); background: rgba(79, 195, 238, 0.08); }
.answer-confidence { color: var(--muted); }
.answer-panel h2 { margin-top: 7px; font-family: ui-condensed, "Arial Narrow", Impact, sans-serif; font-size: clamp(2.45rem, 5vw, 3.65rem); line-height: 0.95; text-transform: uppercase; }
.answer-reason { margin: 14px 0 0; color: #ccdade; line-height: 1.5; }
.answer-action { margin-top: 18px; padding: 15px; border: 1px solid rgba(112, 214, 160, 0.35); border-radius: 8px; background: rgba(112, 214, 160, 0.07); }
.answer-action span, .answer-action strong, .answer-action small { display: block; }
.answer-action span { color: var(--muted); font-size: 0.69rem; font-weight: 850; text-transform: uppercase; }
.answer-action strong { margin-top: 4px; color: var(--text); font-size: 1.12rem; }
.answer-action small { margin-top: 4px; color: var(--muted); line-height: 1.4; }
.short-list { display: grid; gap: 8px; margin: 17px 0 0; padding: 0; list-style: none; }
.short-list li { position: relative; padding-left: 26px; color: #c8d6db; font-size: 0.83rem; line-height: 1.4; }
.short-list li::before { position: absolute; left: 0; top: 1px; display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 50%; color: var(--cyan); content: "✓"; font-size: 0.65rem; font-weight: 900; }
.honesty-note { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.69rem; line-height: 1.45; }
.honesty-note strong { color: #c9d9df; }

.method-card { margin-top: 18px; overflow: hidden; }
.method-card > summary { min-height: 58px; padding: 0 20px; font-size: 0.84rem; font-weight: 900; }
.method-card > summary::after { color: var(--cyan); content: "+"; font-size: 1.2rem; }
.method-card[open] > summary::after { content: "−"; }
.method-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr); gap: 22px; padding: 20px; border-top: 1px solid var(--line); }
.method-body h2 { font-size: 1.1rem; }
.method-body p { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.method-body nav { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.method-body a { padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; color: #bdeaf9; font-size: 0.7rem; font-weight: 800; text-decoration: none; }
.evidence-gallery { display: grid; gap: 9px; }
.method-body figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #08151b; }
.method-body img { display: block; width: 100%; height: 130px; object-fit: cover; object-position: center; }
.method-body figure:last-child img { object-position: center 56%; }
.method-body figcaption { padding: 8px; color: var(--muted); font-size: 0.65rem; text-align: center; }

footer { display: flex; justify-content: space-between; gap: 18px; padding: 22px 2px 0; color: var(--muted); font-size: 0.7rem; }

@media (max-width: 940px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .answer-panel { position: relative; order: 2; }
  .quick-form { order: 1; }
  .method-body { grid-template-columns: 1fr; }
  .evidence-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .calculator-shell { width: min(100% - 20px, 1180px); padding-top: 7px; }
  .topbar { min-height: 64px; }
  .brand img { width: 38px; height: 45px; }
  .brand strong { font-size: 1rem; }
  .library-link { min-height: 38px; padding: 0 10px; font-size: 0.74rem; }
  .intro { grid-template-columns: 1fr; min-height: 0; padding: 24px 20px; }
  .intro img { display: none; }
  .intro h1 { font-size: clamp(2.8rem, 15vw, 4.3rem); }
  .intro p:last-child { font-size: 0.9rem; line-height: 1.5; }
  .question-card { padding: 17px; }
  .compact-grid, .compact-grid-3, .compact-grid-4 { grid-template-columns: 1fr; }
  .gear-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-sync-line { align-items: flex-start; flex-direction: column; }
  .next-step { grid-template-columns: 1fr; }
  .yes-no-fieldset small { flex: 1 0 100%; margin: 3px 0 0; }
  .form-actions { display: grid; grid-template-columns: auto 1fr; }
  .answer-button { min-width: 0; padding: 0 12px; }
  .answer-panel { padding: 21px; }
  .answer-panel h2 { font-size: 2.65rem; }
  .evidence-gallery { grid-template-columns: 1fr; }
  .method-body img { height: 145px; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  button, a, .gear-choice, .answer-panel { transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease; }
  .answer-button:hover { transform: translateY(-1px); }
}
