/* Airsoft-Rechner – Stil
   Farben und Maße stehen alle hier oben. Für den Look von Quest/MyWatch2Gether nur diese Variablen anpassen. */
:root {
  --bg: #0e1014;
  --bg-2: #12151b;
  --card: #171b22;
  --card-2: #1d222b;
  --line: #272d38;
  --line-2: #323a47;
  --text: #e9ebef;
  --muted: #929bab;
  --faint: #6b7383;
  --accent: #e3a548;
  --accent-2: #f0b964;
  --accent-ink: #1b1305;
  --accent-soft: rgba(227, 165, 72, .14);
  --ok: #63c27d;
  --ok-soft: rgba(99, 194, 125, .14);
  --bad: #ef6b5c;
  --bad-soft: rgba(239, 107, 92, .14);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .25);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
  --maxw: 880px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(227, 165, 72, .07), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
b { font-weight: 650; }

/* ---------------------------------------------------------------- Kopf */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(14, 16, 20, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .2px;
  white-space: nowrap;
}
.logo { width: 26px; height: 26px; color: var(--accent); flex: none; }
.tabs {
  margin-left: auto;
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.tabs a {
  padding: 7px 16px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- Inhalt */
main { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 8px; }
.panel { display: grid; gap: 14px; }

.card {
  background: linear-gradient(180deg, var(--card), var(--card) 60%, #161a20);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2, h3 { margin: 0; letter-spacing: .1px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.note, .hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.hint:empty { display: none; }
.opt { color: var(--faint); font-weight: 500; font-size: 12px; margin-left: 4px; }

/* ---------------------------------------------------------------- Felder */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field + .field, .field + .trio, .trio + .field, .grid2 + .field, .grid3 + .field { margin-top: 14px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
.grid2, .grid3, .trio { display: grid; gap: 14px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3, .trio { grid-template-columns: repeat(3, 1fr); }
.grid2 .field + .field, .grid3 .field + .field, .trio .field + .field { margin-top: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }

.input-unit {
  display: flex; align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.input-unit:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-unit.narrow { max-width: 150px; }
.input-unit input {
  flex: 1; min-width: 0; width: 100%;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 16px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.input-unit input::placeholder { color: var(--faint); }
.unit { padding: 0 12px 0 4px; color: var(--faint); font-weight: 600; font-size: 13px; white-space: nowrap; }

.field.big input { font-size: 26px; font-weight: 700; padding: 12px 12px 10px; letter-spacing: -.3px; }
.field.big .unit { font-size: 15px; }
.field.big .input-unit.is-src { border-color: var(--accent); }
.field.big .input-unit.is-src .unit { color: var(--accent); }

textarea {
  width: 100%; resize: vertical; min-height: 76px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); font: 15px/1.5 var(--mono); padding: 10px 12px; outline: 0;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none;
}
select {
  width: 100%; appearance: none; -webkit-appearance: none;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: 16px; padding: 10px 36px 10px 12px; outline: 0;
}
select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Schnellauswahl */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
  border: 1px solid var(--line-2); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: all .12s;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

/* Umschalter */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; flex: none; }
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 650; padding: 6px 12px; border-radius: 7px; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }
.input-unit .seg.sm { margin-right: 4px; border: 0; background: transparent; }
.seg.sm button { padding: 5px 9px; font-size: 12.5px; }

/* Limit */
.limit-row { display: flex; gap: 10px; align-items: stretch; }
.limit-row .input-unit { max-width: 170px; }
.verdict { display: flex; align-items: center; font-size: 14px; font-weight: 600; border-radius: var(--radius-sm); padding: 0 12px; }
.verdict:empty { display: none; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.bad { background: var(--bad-soft); color: var(--bad); }

/* Ausklappbereiche */
details.more { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
details.more > summary, details.explain > summary {
  cursor: pointer; list-style: none; color: var(--muted); font-weight: 650; font-size: 14px;
  display: flex; align-items: center; gap: 8px; user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; margin-right: 2px;
}
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { color: var(--text); }
details.more[open] > summary { margin-bottom: 12px; }
details.more .hint { margin: 0 0 12px; }
details.explain { padding: 14px 18px; }
details.explain[open] { padding-bottom: 18px; }
details.explain[open] > summary { margin-bottom: 8px; }
details.explain p, details.explain li { color: #c4c9d3; font-size: 14px; }
details.explain ol { padding-left: 20px; margin: 8px 0; }
details.explain li + li { margin-top: 6px; }

/* ---------------------------------------------------------------- Tabelle */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; color: var(--faint); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .5px; padding: 6px 10px; }
.tbl td { text-align: right; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 15px; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td:first-child { color: var(--muted); font-weight: 600; }
.tbl tr.cur td { background: var(--accent-soft); color: var(--accent-2); }
.tbl tr.cur td:first-child { color: var(--accent-2); border-radius: 8px 0 0 8px; }
.tbl tr.cur td:last-child { border-radius: 0 8px 8px 0; }
.tbl .lim-col { color: var(--muted); }
.tbl.no-limit .lim-col { display: none; }

/* ---------------------------------------------------------------- Ergebnisse */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stats:empty { display: none; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stat .k { color: var(--faint); font-size: 12px; font-weight: 650; }
.stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.2px; line-height: 1.3; }
.stat .v small { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-left: 3px; display: inline-block; letter-spacing: 0; }
.stat.hl { border-color: var(--accent); background: var(--accent-soft); }
.stat.hl .v { color: var(--accent-2); }
.stat.bad { border-color: var(--bad); background: var(--bad-soft); }
.stat.bad .v { color: var(--bad); }
.stat.ok { border-color: rgba(99, 194, 125, .5); }

.result { padding: 20px 18px; }
.result:empty { display: none; }
.hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero .num { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.05; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.hero .lbl { font-size: 16px; color: var(--muted); font-weight: 600; }
.hero-sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
.hero-sub b { color: var(--text); }
.result .stats { margin-top: 16px; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.err::before { content: "!"; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--bad-soft); text-align: center; line-height: 20px; font-weight: 800; }
.idle { color: var(--muted); font-size: 14px; }
.compare {
  margin-top: 14px; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--line-2);
  color: var(--muted); font-size: 13.5px;
}
.compare b { color: var(--text); }
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); vertical-align: 2px;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------------------------------------------------------------- Fuß */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; color: var(--faint); font-size: 12.5px;
}
.foot .dot { opacity: .6; }

/* ---------------------------------------------------------------- Handy */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .top-inner { padding: 8px 12px; gap: 10px; }
  .brand span { display: none; }
  .tabs { flex: 1; justify-content: space-between; }
  .tabs a { flex: 1; text-align: center; padding: 8px 6px; }
  main { padding: 12px 10px 4px; }
  .card { padding: 15px; border-radius: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .trio { grid-template-columns: 1fr; gap: 10px; }
  .field.big input { font-size: 24px; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .grid3 .unit { padding-right: 8px; }
  .grid3 input { padding: 10px 8px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero .num { font-size: 38px; }
  .card-head { flex-wrap: wrap; }
}
@media (min-width: 641px) and (max-width: 760px) {
  .trio .field.big input { font-size: 22px; }
}
