/* ========================================================
   PuntiPong — design tokens
   Palette drawn from the table itself: felt green, ivory
   line-white, orange competition ball, blade black.
   ======================================================== */
:root {
  --green-deep:   #0D3B30;
  --green-panel:  #123F33;
  --green-line:   #1B5C4B;
  --ivory:        #F3EFE1;
  --ivory-dim:    #C9CDBF;
  --orange:       #E8592D;
  --orange-soft:  #F2794F;
  --black-blade:  #17130F;
  --gold:         #C9A227;

  --font-display: 'Anton', sans-serif;
  --font-body:    'Space Grotesk', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--green-deep);
  color: var(--ivory);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 12% 8%, rgba(232,89,45,0.10), transparent 40%),
    radial-gradient(circle at 90% 85%, rgba(201,162,39,0.08), transparent 45%);
  padding-bottom: 48px;
  position: relative;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .ball { transition: transform 0.2s ease-out; }
}

/* decorative ball — quiet, ambient */
.ball {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--orange-soft), var(--orange) 70%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 6px 14px rgba(0,0,0,0.35);
  pointer-events: none;
}

/* ---------- header ---------- */
.topbar {
  padding: 28px 20px 18px;
  max-width: 640px;
  margin: 0 auto;
}
.topbar__mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}
.eyebrow {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange-soft);
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--ivory);
}
h1 span { color: var(--orange); }
.topbar__sub {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ivory-dim);
  max-width: 46ch;
}

/* ---------- net divider (signature motif) ---------- */
.net {
  max-width: 640px;
  margin: 0 auto;
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    rgba(243,239,225,0.55) 0 8px,
    transparent 8px 16px
  );
}
.net--tight { margin: 22px auto; opacity: 0.6; }

/* ---------- tabs ---------- */
.tabs {
  max-width: 640px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tab {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ivory-dim);
  background: var(--green-panel);
  border: 1px solid var(--green-line);
  border-radius: 999px;
  padding: 12px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { border-color: var(--orange-soft); }
.tab:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.tab.is-active {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--black-blade);
}

/* ---------- main / panels ---------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 20px 0;
}
.panel { display: none; }
.panel.is-active { display: block; }

/* ---------- fields ---------- */
.field { margin-bottom: 16px; }
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ivory-dim);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
select, input[type="number"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: var(--ivory);
  background: var(--green-panel);
  border: 1px solid var(--green-line);
  border-radius: 10px;
  padding: 12px 14px;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--orange-soft) 50%),
                     linear-gradient(135deg, var(--orange-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
select:focus-visible, input:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}
input::placeholder { color: rgba(243,239,225,0.35); }

.hint {
  margin: 4px 2px 0;
  font-size: 12px;
  color: var(--ivory-dim);
  line-height: 1.5;
}

/* readout for base points */
.readout-inline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: var(--green-panel);
  border: 1px solid var(--green-line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
}
.readout-inline__label {
  font-size: 12.5px;
  color: var(--ivory-dim);
  font-weight: 600;
}
.readout-inline__value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--orange-soft);
}

/* ---------- toggle switch ---------- */
.switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  flex-shrink: 0;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--green-line);
  position: relative;
  margin-top: 2px;
  transition: background 0.15s ease;
}
.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ivory);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch__track { background: var(--orange); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--orange-soft); outline-offset: 2px; }
.switch__label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ivory);
  line-height: 1.4;
}
.field--toggle { margin-bottom: 14px; }
.field--check label { margin-bottom: 0; }
.field--check { padding-top: 26px; }

.bonus-fields { margin-top: 4px; }
.is-hidden { display: none !important; }

/* ---------- result / scoreboard ---------- */
.result {
  background: var(--black-blade);
  border: 1px solid #2a241d;
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  text-align: center;
  margin: 6px 0 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.result__label {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ivory-dim);
}
.result__value {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.result__breakdown {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.result__breakdown .row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ivory-dim);
  padding: 3px 2px;
}
.result__breakdown .row span:last-child { color: var(--ivory); font-weight: 600; }
.result__breakdown .row.total {
  border-top: 1px dashed rgba(243,239,225,0.2);
  margin-top: 4px;
  padding-top: 8px;
  color: var(--ivory);
}
.result__breakdown .row.total span { color: var(--orange-soft) !important; }

/* ---------- footer ---------- */
footer {
  max-width: 640px;
  margin: 26px auto 0;
  padding: 0 20px;
}
footer p {
  font-size: 11.5px;
  line-height: 1.6;
  color: rgba(201,205,191,0.6);
}

@media (max-width: 380px) {
  h1 { font-size: 34px; }
  .result__value { font-size: 46px; }
}
