/* Slots Promo EV — frontend styles.
   Design-token driven, fluid (clamp), responsive grid, light + dark.
   Shares the design language of the UK Salary Context calculator. */

:root {
  /* chrome / ink */
  --plane:        #f9f9f7;
  --surface:      #fcfcfb;
  --surface-2:    #f3f2ee;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --muted:        #898781;
  --line:         #e1e0d9;
  --ring:         rgba(11, 11, 11, 0.10);
  --accent:       #2a78d6;
  --accent-ink:   #ffffff;
  --accent-tint:  rgba(42, 120, 214, 0.10);

  /* verdict semantics */
  --good:      #0b8f5a;
  --good-tint: rgba(11, 143, 90, 0.12);
  --bad:       #d03b3b;
  --bad-tint:  rgba(208, 59, 59, 0.12);
  --even:      #b9770a;
  --even-tint: rgba(185, 119, 10, 0.12);

  --shadow: 0 1px 2px rgba(11,11,11,.04), 0 8px 24px -12px rgba(11,11,11,.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --plane:        #0d0d0d;
    --surface:      #1a1a19;
    --surface-2:    #232321;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --muted:        #898781;
    --line:         #2c2c2a;
    --ring:         rgba(255, 255, 255, 0.10);
    --accent:       #3987e5;
    --accent-tint:  rgba(57, 135, 229, 0.16);

    --good:      #16b06e;
    --good-tint: rgba(22, 176, 110, 0.16);
    --bad:       #ec5a5a;
    --bad-tint:  rgba(236, 90, 90, 0.16);
    --even:      #fab219;
    --even-tint: rgba(250, 178, 25, 0.16);

    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--accent-tint), transparent 60%),
    var(--plane);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: min(1080px, 100% - 2.5rem);
  margin-inline: auto;
  padding-block: clamp(1.75rem, 4vw, 3.5rem);
}

/* ---- masthead ---------------------------------------------------------- */
.masthead { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.masthead h1 {
  margin: 0;
  font-size: clamp(1.7rem, 1rem + 3vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.tagline {
  margin: .6rem 0 0;
  color: var(--ink-2);
  font-size: clamp(.95rem, .9rem + .3vw, 1.1rem);
  max-width: 56ch;
}
.tagline em { color: var(--ink); font-style: normal; font-weight: 600; }

/* ---- layout ------------------------------------------------------------ */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 2.4vw, 1.75rem);
}
.results-panel { position: relative; min-height: 420px; }

/* ---- form -------------------------------------------------------------- */
form { display: grid; gap: 1.15rem; }
.field { display: grid; gap: .4rem; min-width: 0; }
label, .field__label {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink-2);
}

input[type=text] {
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }

/* percentage inputs */
.money, .pct { position: relative; display: flex; align-items: center; }
.pct input { padding-right: 2rem; text-align: right; }
.pct__sign { position: absolute; right: .8rem; color: var(--muted); pointer-events: none; }

/* hero RTP input */
.field--hero label { font-size: .85rem; }
.pct--hero input {
  font-size: clamp(1.5rem, 1rem + 2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: .5rem 2.4rem .5rem .7rem;
  font-variant-numeric: tabular-nums;
}
.pct--hero .pct__sign { font-size: 1.5rem; right: 1rem; }

.money__sign {
  position: absolute; left: .7rem; color: var(--muted); pointer-events: none;
}
.money--sm .money__sign { font-size: 1rem; }
.money--sm input {
  font-size: 1rem; font-weight: 600; padding: .55rem .7rem .55rem 1.5rem;
  font-variant-numeric: tabular-nums;
}

.field__err {
  margin: 0; min-height: 1em;
  font-size: .78rem; font-weight: 600; color: var(--bad);
}

/* label row with hint / info trigger */
.labelrow { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.field__hint { font-size: .72rem; font-weight: 500; color: var(--muted); text-align: right; }
.info-btn {
  display: inline-flex; align-items: center;
  color: var(--accent); background: none; border: none; padding: .1rem;
  cursor: pointer; border-radius: 6px;
}
.info-btn:hover { color: var(--ink); }
.info-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }

.form-note {
  margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.5;
  border-top: 1px solid var(--line); padding-top: 1rem;
}

/* ---- promo tiers ------------------------------------------------------- */
.tiers { display: grid; gap: .7rem; }
.tier {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  grid-template-areas:
    "num stake reward del"
    "num type  type   del";
  align-items: end;
  gap: .55rem .7rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .7rem .8rem;
}
.tier__num {
  grid-area: num; align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.6rem; height: 1.6rem; flex: none;
  font-size: .8rem; font-weight: 700; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.tier__field:nth-of-type(1) { grid-area: stake; }
.tier__field:nth-of-type(2) { grid-area: reward; }
.tier__field--type { grid-area: type; }
.tier__field label, .tier__field .field__label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.tier .money--sm input { background: var(--surface); }
.tier__del {
  grid-area: del; align-self: center;
  display: inline-flex; padding: .35rem; flex: none;
  color: var(--muted); background: none; border: none; border-radius: 8px; cursor: pointer;
  transition: color .15s, background .15s;
}
.tier__del:hover { color: var(--bad); background: var(--bad-tint); }
.tier__del:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.tier--sole .tier__del { visibility: hidden; }

.add-tier {
  display: inline-flex; align-items: center; gap: .4rem; justify-self: start;
  margin-top: .6rem;
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--accent);
  background: none; border: 1px dashed var(--line); border-radius: 999px;
  padding: .4rem .9rem; cursor: pointer; transition: all .15s;
}
.add-tier:hover { border-color: var(--accent); background: var(--accent-tint); }
.add-tier:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }

/* segmented control */
.segmented { display: flex; flex-wrap: wrap; gap: .35rem; }
.segmented button {
  font: inherit; font-size: .8rem; font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .32rem .7rem;
  cursor: pointer;
  transition: all .15s;
}
.segmented button:hover { border-color: var(--muted); color: var(--ink); }
.segmented button[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.segmented button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---- results ----------------------------------------------------------- */
.results { display: grid; gap: clamp(1.25rem, 2.5vw, 1.75rem); }

.hero {
  padding-bottom: clamp(1rem, 2vw, 1.4rem);
  border-bottom: 1px solid var(--line);
}
.hero__label {
  margin: 0; font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.hero__tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle;
  color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: .12rem .5rem;
  margin-left: .3rem;
}
.hero__value {
  margin: .2rem 0 .15rem;
  font-size: clamp(2.4rem, 1.4rem + 5vw, 3.6rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero__value.is-good { color: var(--good); }
.hero__value.is-bad  { color: var(--bad); }
.hero__value.is-even { color: var(--even); }
.hero__sub { margin: 0; color: var(--ink-2); font-weight: 500; }
.hero__sub b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.hero__dot { margin: 0 .55rem; color: var(--muted); }
.verdict { font-weight: 700; }
.verdict.is-good { color: var(--good); }
.verdict.is-bad  { color: var(--bad); }
.verdict.is-even { color: var(--even); }

.hero__hourly {
  margin: .9rem 0 0; display: inline-flex; align-items: center; gap: .8rem;
  padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2);
}
.hourly-pair { display: inline-flex; flex-direction: column; line-height: 1.15; }
.hourly-pair b { font-size: 1.05rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.hourly-pair:first-child b { color: var(--good); }
.hourly-pair:last-child b { color: var(--bad); }
.hourly-pair small { font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.hourly-arrow { color: var(--muted); flex: none; }

/* ---- advisory ---------------------------------------------------------- */
.advisory { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.advisory li {
  display: flex; gap: .5rem; align-items: flex-start;
  font-size: .84rem; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--even); border-radius: 8px; padding: .55rem .7rem;
}
.advisory li::before { content: "⚠"; color: var(--even); }

/* ---- tier results ------------------------------------------------------ */
.breakdown { margin: 0; }
.breakdown figcaption {
  font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .7rem;
}
.tier-results { display: grid; gap: .7rem; }

.tres {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .8rem .9rem;
  display: grid; gap: .6rem;
}
.tres--best { border-color: var(--good); box-shadow: 0 0 0 2px var(--good-tint); }
.tres__top { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.tres__title { font-size: .9rem; font-weight: 650; color: var(--ink); }
.tres__title b { font-variant-numeric: tabular-nums; }
.tres__title .arrow { color: var(--muted); margin: 0 .1rem; }
.tres__ev { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tres__ev.is-good { color: var(--good); }
.tres__ev.is-bad  { color: var(--bad); }
.tres__ev.is-even { color: var(--even); }

/* diverging EV bar: reward value (green) vs stake cost (red) around a centre line */
.tres__bar {
  position: relative; height: 22px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line); overflow: hidden;
}
.tres__mid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; }
.tres__fill { position: absolute; top: 0; bottom: 0; transition: width .4s cubic-bezier(.2,.7,.2,1), left .4s cubic-bezier(.2,.7,.2,1); }
.tres__fill--pos { background: var(--good); border-radius: 0 5px 5px 0; }
.tres__fill--neg { background: var(--bad); border-radius: 5px 0 0 5px; }

.tres__foot {
  display: flex; flex-wrap: wrap; gap: .4rem 1rem;
  font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.tres__foot .chip {
  font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px;
}
.tres__foot .chip.is-good { color: var(--good); background: var(--good-tint); }
.tres__foot .chip.is-bad  { color: var(--bad);  background: var(--bad-tint); }
.tres__foot .chip.is-even { color: var(--even); background: var(--even-tint); }
.tres__foot .k { color: var(--muted); }
.tres__foot .v { font-weight: 700; color: var(--ink); }

/* ---- stat tiles -------------------------------------------------------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 420px) { .stats { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .85rem .95rem;
}
.stat__label {
  margin: 0 0 .3rem; font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.stat__value { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat__note { margin: .2rem 0 0; font-size: .82rem; color: var(--ink-2); }
.stat--action {
  font: inherit; text-align: left; width: 100%; cursor: pointer;
  display: block; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}
.stat--action .stat__label { display: flex; align-items: center; justify-content: space-between; }
.stat--action .stat__value, .stat--action .stat__note { display: block; }
.stat__cue {
  display: inline-flex; align-items: center; gap: .1rem;
  color: var(--accent); letter-spacing: 0; text-transform: none; font-size: .72rem;
  opacity: .85; transition: gap .15s, opacity .15s;
}
.stat--action:hover {
  border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-tint); transform: translateY(-1px);
}
.stat--action:hover .stat__cue { opacity: 1; gap: .28rem; }
.stat--action:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 2rem 1rem; }
.empty p { margin: 0; }

[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---- colophon ---------------------------------------------------------- */
.colophon {
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  color: var(--muted); font-size: .82rem;
}
.colophon p { margin: 0 0 .3rem; max-width: 74ch; }
.colophon #provenance { color: var(--ink-2); }
.colophon .fine strong { color: var(--ink-2); }

/* ---- how-it-works dialog ----------------------------------------------- */
.dialog {
  padding: 0; border: none; background: transparent;
  max-width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(11, 11, 11, 0.5); backdrop-filter: blur(2px); }
.dialog__panel {
  background: var(--surface);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5);
  max-height: calc(100dvh - 2rem);
  overflow: hidden auto;
}
.dialog[open] { animation: dialog-in .18s cubic-bezier(.2, .7, .2, 1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px); } }
.dialog__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.25rem .75rem;
}
.dialog__head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.dialog__close {
  flex: none; display: inline-flex; padding: .3rem; margin: -.3rem -.3rem -.3rem 0;
  color: var(--muted); background: none; border: none; border-radius: 8px; cursor: pointer;
}
.dialog__close:hover { color: var(--ink); background: var(--surface-2); }
.dialog__close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.dialog__body { padding: 0 1.25rem 1.25rem; }
.dialog__body p { margin: 0 0 .9rem; color: var(--ink-2); font-size: .92rem; }
.dialog__body strong { color: var(--ink); font-weight: 650; }
.dialog__body b { color: var(--ink); font-weight: 650; }
.how__h { margin: 1.3rem 0 .5rem; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.how__eq {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .9rem; color: var(--ink) !important;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: .6rem .8rem; line-height: 1.7;
}
.dialog__note { font-size: .85rem !important; color: var(--muted) !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
