/* Tank Planner — mobile-first, dark-mode aware.
   Token system reused from the Statlas game rail (game/style.css). */
:root {
  --bg: #f5f7f7;
  --card: #ffffff;
  --text: #17201f;
  --muted: #64706e;
  --line: #dde4e2;
  --accent: #1f6f8b;
  --accent-text: #ffffff;
  --ok: #e2f3e8;      --ok-line: #3f9c65;
  --info: #e8eff5;    --info-line: #5b87a8;
  --warn: #fdf3d0;    --warn-line: #d9a92c;
  --danger: #fbe2e0;  --danger-line: #d96b62;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121516;
    --card: #1c2021;
    --text: #e9edec;
    --muted: #97a3a0;
    --line: #2e3536;
    --accent: #4ba3c3;
    --accent-text: #0d2129;
    --ok: #1c352a;      --ok-line: #3f9c65;
    --info: #1d2b36;    --info-line: #5b87a8;
    --warn: #3a3315;    --warn-line: #d9a92c;
    --danger: #3d201e;  --danger-line: #d96b62;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.wrap { max-width: 34rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.top { text-align: center; margin-bottom: 1rem; }
h1 { font-size: 1.7rem; letter-spacing: 0.02em; }
.tagline { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 0.8rem; padding: 1rem; margin-bottom: 1rem;
}
.card-title { font-size: 1.05rem; margin-bottom: 0.7rem; }

.tank-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field { flex: 1; min-width: 9rem; display: flex; flex-direction: column; gap: 0.25rem; }
.field-label { font-size: 0.8rem; color: var(--muted); }
.field-hint { font-size: 0.75rem; color: var(--muted); min-height: 1em; }

input[type="number"], input[type="text"], select {
  width: 100%; font-size: 1rem; padding: 0.6rem 0.7rem;
  border: 1px solid var(--line); border-radius: 0.6rem;
  background: var(--bg); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.presets { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.7rem; }
.preset {
  font-size: 0.8rem; padding: 0.3rem 0.6rem; border-radius: 1rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  cursor: pointer;
}
.preset:hover { border-color: var(--accent); color: var(--text); }

button {
  font-size: 1rem; padding: 0.6rem 1rem; border: none; border-radius: 0.6rem;
  background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer;
}
button:active { transform: translateY(1px); }

.input-wrap { position: relative; }
.suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
  background: var(--card); border: 1px solid var(--line); border-radius: 0.6rem;
  overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
.sug {
  display: block; width: 100%; text-align: left; background: none;
  color: var(--text); font-weight: 400; border-radius: 0;
  padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--line);
}
.sug:last-child { border-bottom: none; }
.sug:hover, .sug.active { background: var(--accent); color: var(--accent-text); }
.sug .sci { font-size: 0.78rem; opacity: 0.75; font-style: italic; }

.stock { display: grid; gap: 0.4rem; margin-top: 0.75rem; }
.stock-empty { color: var(--muted); font-size: 0.9rem; margin-top: 0.75rem; }
.stock-row {
  display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.45rem 0.6rem;
}
.stock-name { flex: 1; min-width: 0; }
.stock-common { font-weight: 600; font-size: 0.95rem; }
.stock-meta { font-size: 0.75rem; color: var(--muted); }
.count-btn {
  width: 2rem; height: 2rem; padding: 0; font-size: 1.1rem; line-height: 1;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
}
.count { min-width: 2rem; text-align: center; font-weight: 600; }
.remove-btn {
  background: none; color: var(--muted); font-size: 1.1rem; padding: 0.2rem 0.4rem;
}
.remove-btn:hover { color: var(--danger-line); }

.meter-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.meter {
  flex: 1; height: 0.6rem; border-radius: 0.3rem; background: var(--bg);
  border: 1px solid var(--line); overflow: hidden;
}
.meter-fill { height: 100%; width: 0; background: var(--ok-line); transition: width 0.25s; }
.meter-fill.warn { background: var(--warn-line); }
.meter-fill.danger { background: var(--danger-line); }
.meter-label { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.verdicts { list-style: none; display: grid; gap: 0.4rem; }
.verdict {
  border: 1px solid var(--line); border-left-width: 4px;
  border-radius: 0.5rem; padding: 0.55rem 0.7rem; font-size: 0.92rem;
}
.verdict.ok      { background: var(--ok);     border-left-color: var(--ok-line); }
.verdict.info    { background: var(--info);   border-left-color: var(--info-line); }
.verdict.warning { background: var(--warn);   border-left-color: var(--warn-line); }
.verdict.danger  { background: var(--danger); border-left-color: var(--danger-line); }
.verdict .sev { font-weight: 700; font-size: 0.75rem; letter-spacing: 0.05em;
  text-transform: uppercase; display: block; margin-bottom: 0.1rem; }

.share-row { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.9rem; }
.share-msg { font-size: 0.85rem; color: var(--muted); }

.foot { margin-top: 2rem; color: var(--muted); font-size: 0.72rem; text-align: center; }
