/* Carmotech brand: monochrome (MARCA.md). Green / yellow / red appear only
   as verdict colors, never as decoration. The one decorative accent is the
   chrome-blue edge on cards and bubbles (see .glass::after). */
:root {
  --bg: #0a0a0a;
  --surface: #151517;
  --surface-2: #333134;
  --text: #ffffff;
  --muted: #a4a4a8;
  --soft: #d3d3d5;
  --border: rgba(255, 255, 255, 0.12);
  --green: #2fd18b;
  --yellow: #f5c542;
  --red: #ff5a6e;
  --radius: 18px;
  --blue-glow: rgba(61, 123, 255, 0.55);
  --chrome-text: linear-gradient(135deg, #ffffff 0%, #b5ceff 24%, #5b8cff 50%, #3d6fee 62%, #c9dcff 82%, #ffffff 100%);
  --chrome-edge: linear-gradient(135deg, #ffffff 0%, #9bbcff 20%, #3d6fee 44%, #1f46b8 56%, #b9d0ff 78%, #ffffff 100%);
  --shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 18px 40px -12px rgba(0, 0, 0, 0.8),
    0 6px 14px -6px rgba(0, 0, 0, 0.6),
    0 0 22px -6px var(--blue-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(700px 420px at 100% 15%, rgba(255, 255, 255, 0.04), transparent 60%);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

.page { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Glass ---------- */
.glass {
  position: relative;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025) 45%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
/* Chrome-blue edge: a metallic gradient ring drawn only on the border area. */
.glass::after {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1.5px;
  border-radius: inherit;
  background: var(--chrome-edge);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0.85;
  pointer-events: none;
}
.glass.float::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translate(6px, 7px);
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
  z-index: -1;
}
.card { padding: 20px 22px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .inputs h2 { font-size: 16px; font-weight: 700; }
.card-head span { font-size: 13px; color: var(--muted); }
.inputs h2 { margin-bottom: 4px; }

/* ---------- Header ---------- */
.brand-bar { display: flex; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 4px 4px 0; }
.brand-bar img { border-radius: 14px; flex: none; box-shadow: 0 0 18px -4px var(--blue-glow); }
/* Chrome-blue lettering: metallic gradient clipped to the text, with a soft glow. */
.brand-bar h1 {
  font-size: clamp(26px, 4.4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: var(--chrome-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(61, 123, 255, 0.5));
}
.brand-bar p { color: var(--soft); font-size: clamp(16px, 2.2vw, 20px); font-weight: 500; }

/* ---------- Hero ---------- */
.hero { padding: 22px 24px 20px; }
.hero-kicker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: #fff; font-size: clamp(20px, 3vw, 28px); font-weight: 700; letter-spacing: -0.01em; }
.hero-kicker .goal-input { min-height: 56px; padding: 0 16px; }
.hero-kicker .goal-input input { font-size: clamp(24px, 3.4vw, 32px); }
.hero-kicker .goal-input span { font-size: 16px; }
.goal-input, .unit-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
}
.goal-input:focus-within, .unit-input:focus-within { outline: 2px solid #fff; outline-offset: 2px; }
.goal-input input { width: 7ch; border: 0; background: transparent; color: #fff; font: inherit; font-size: 20px; font-weight: 800; outline: none; font-variant-numeric: tabular-nums; }
.goal-input span, .unit-input span { color: var(--muted); font-weight: 600; font-size: 14px; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hero-main { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-top: 16px; }
.stat { padding: 16px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.hero-num { font-size: clamp(32px, 5vw, 44px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-unit { color: var(--muted); font-size: 14px; }
.hero-foot { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.results { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.inputs { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 18px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; color: var(--soft); font-weight: 500; }
.field .unit-input { width: 100%; min-height: 50px; padding: 0 14px; border-radius: 14px; }
.field .unit-input input { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.unit-input:focus-within, .goal-input:focus-within { border-color: #9bbcff; box-shadow: 0 0 14px -2px var(--blue-glow); }

.bumps { border: 0; display: flex; flex-direction: column; gap: 10px; }
.bumps legend { font-size: 13px; color: var(--soft); font-weight: 600; margin-bottom: 8px; }
.bump { padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); display: flex; flex-direction: column; gap: 10px; }
.bump.off .bump-fields { opacity: 0.4; pointer-events: none; }
.bump-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bump-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.unit-input { min-height: 40px; padding: 0 10px; border-radius: 12px; }
.unit-input input { width: 100%; min-width: 0; border: 0; background: transparent; color: #fff; font: inherit; font-size: 15px; font-weight: 600; outline: none; }

.toggles { display: flex; flex-direction: column; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--soft); cursor: pointer; min-height: 32px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5); transition: background 160ms; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #5a5a5f; transition: transform 160ms, background 160ms; }
.toggle input:checked + .switch { background: rgba(255, 255, 255, 0.28); border-color: rgba(255, 255, 255, 0.6); }
.toggle input:checked + .switch::after { transform: translateX(20px); background: #fff; }
.toggle input:focus-visible + .switch { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Results ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.hero-num, .kpi-value:not(.up):not(.down) {
  background: var(--chrome-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(61, 123, 255, 0.45));
}
.up { color: var(--green); }
.down { color: var(--red); }

.verdict { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; border: 1px solid; }
.verdict .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.verdict.green { color: var(--green); background: rgba(47, 209, 139, 0.12); border-color: rgba(47, 209, 139, 0.4); }
.verdict.yellow { color: var(--yellow); background: rgba(245, 197, 66, 0.12); border-color: rgba(245, 197, 66, 0.4); }
.verdict.red { color: var(--red); background: rgba(255, 90, 110, 0.12); border-color: rgba(255, 90, 110, 0.4); }
.verdict-text { margin-top: 12px; color: var(--soft); font-size: 14px; }

.scale { position: relative; height: 8px; margin-top: 18px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); }
.scale-fill { height: 100%; border-radius: 8px; background: #fff; transition: width 160ms; }
.scale-fill[data-tone="green"] { background: linear-gradient(90deg, #1fae73, var(--green)); }
.scale-fill[data-tone="yellow"] { background: linear-gradient(90deg, #d9a92c, var(--yellow)); }
.scale-fill[data-tone="red"] { background: linear-gradient(90deg, #ff8a5a, var(--red)); }
.mark { position: absolute; top: -5px; width: 2px; height: 18px; background: #fff; border-radius: 2px; }
.mark.loss { background: var(--red); }
.scale-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.scale-legend b { color: #fff; }

.rules { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: flex; gap: 14px; align-items: flex-start; }
.rule-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #0a0a0a; font-weight: 800; font-size: 14px; display: grid; place-items: center; }
.rules div { display: flex; flex-direction: column; font-size: 14px; }
.rules div span { color: var(--muted); font-size: 13px; }

.breakdown { list-style: none; display: flex; flex-direction: column; }
.breakdown li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); font-size: 14px; }
.breakdown li:first-child { border-top: 0; }
.breakdown li span { color: var(--soft); }
.breakdown b { font-variant-numeric: tabular-nums; }
.breakdown .minus { color: var(--red); }
.breakdown .total { border-top: 1px solid rgba(255, 255, 255, 0.3); font-size: 16px; }
.breakdown .total span { color: #fff; font-weight: 600; }

/* ---------- Scenarios ---------- */
.scenario-row { display: flex; gap: 10px; flex-wrap: wrap; }
.text-input { flex: 1; min-width: 180px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.05); color: #fff; font: inherit; font-size: 15px; }
.text-input:focus { outline: 2px solid #fff; outline-offset: 1px; }
.btn { min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--border); background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)); color: #fff; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); transition: transform 160ms, border-color 160ms; }
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.5); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.btn-primary { background: #fff; color: #0a0a0a; border-color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }
.scenario-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; }
.scenario-list li { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); font-size: 14px; }
.scenario-list li:first-child { border-top: 0; }
.scenario-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scenario-list li.empty { color: var(--muted); }

.footnote { text-align: center; font-size: 12px; color: #6b6b70; padding-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .kpis { grid-template-columns: 1fr; }
  .brand-bar h1 { font-size: 20px; }
  .hero { padding: 18px; }
  .hero-main { grid-template-columns: 1fr; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
