/* Lopsided: a brass balance, a blue side and an orange side */
@font-face { font-family: "Young Serif"; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #EEF1FF;
  --card: #FFFFFF;
  --ink: #1B1F3B;
  --muted: #5B6185;
  --line: #D6DBF2;
  --left: #3B5BDB;
  --right: #E8590C;
  --brass: #C99A2E;
  --good: #1E9E63;
  --bad: #D9483B;
  --display: "Young Serif", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11142A; --card: #1B1F3B; --ink: #EEF1FF; --muted: #A3A9CF; --line: #2E3359; --left: #748FFC; --right: #FF922B; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); line-height: 1.45; min-height: 100vh; }
a { color: inherit; }
button, input { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.icon-btn:hover { background: var(--card); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 0 4px; }
h1 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; margin: 0; line-height: 1; }
.sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.card { background: var(--card); border-radius: 20px; padding: 20px 18px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(27, 31, 59, .5); }
.kicker { margin: 0; color: var(--muted); font-weight: 600; }
.go { width: 100%; border: 0; border-radius: 16px; padding: 15px; background: var(--ink); color: var(--card); font-weight: 800; font-size: 1.15rem; cursor: pointer; }
.fine { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 10px 0 0; }

/* balance */
.balance { display: block; width: 100%; max-width: 360px; margin: 0 auto -6px; }
.balance .stand { fill: var(--line); }
.balance .beam rect { fill: var(--brass); }
.balance .pivot { fill: var(--ink); }
.balance .pan path { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.balance .pan .dish { stroke: none; }
.balance .pan-l .dish { fill: var(--left); }
.balance .pan-r .dish { fill: var(--right); }
.balance text { font: 700 13px var(--ui); fill: var(--muted); text-anchor: middle; }

/* sides */
.ask { font-family: var(--display); font-size: 1.5rem; margin: 6px 0 10px; text-align: center; }
.side {
  display: block; width: 100%; text-align: left; border: 2px solid var(--line); background: var(--card);
  border-radius: 18px; padding: 12px 14px 14px; cursor: pointer; position: relative; transition: border-color .15s, box-shadow .15s;
}
.side-tag { display: block; font-weight: 800; font-size: 0.8rem; margin-bottom: 6px; }
.side-l .side-tag { color: var(--left); }
.side-r .side-tag { color: var(--right); }
.side-l[aria-checked="true"] { border-color: var(--left); box-shadow: 0 0 0 3px color-mix(in srgb, var(--left) 25%, transparent); }
.side-r[aria-checked="true"] { border-color: var(--right); box-shadow: 0 0 0 3px color-mix(in srgb, var(--right) 25%, transparent); }
.side.locked { cursor: default; }
.vs { text-align: center; margin: 6px 0; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.eq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 6px; line-height: 1.25; }
.op { font-weight: 800; font-size: 1.15rem; color: var(--muted); padding: 0 2px; }
.paren { font-weight: 300; font-size: 1.6rem; color: var(--muted); line-height: 1; }
.sq { font-weight: 800; color: var(--muted); align-self: flex-start; margin-left: -4px; }
.chip {
  border: 0; background: var(--bg); border-radius: 10px; padding: 6px 9px; font-size: 0.93rem; font-weight: 600;
  cursor: pointer; text-align: left;
}
.chip:hover { background: color-mix(in srgb, var(--brass) 18%, var(--bg)); }
.chip.on { box-shadow: inset 0 0 0 2px var(--brass); }
.chip .val { display: block; font-weight: 800; color: var(--brass); font-size: 0.85rem; }
.hintbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 0; background: var(--card); border-radius: 12px; padding: 10px 12px; font-size: 0.9rem; }
.hintbar[hidden] { display: none; }
.mini { border: 0; border-radius: 10px; padding: 8px 12px; background: var(--brass); color: #fff; font-weight: 800; white-space: nowrap; cursor: pointer; }

/* dial */
.dial { margin-top: 14px; }
.dial-q { margin: 0; font-weight: 600; }
.dial-val { font-family: var(--display); font-size: 2rem; margin: 2px 0 6px; }
#dial-in { width: 100%; accent-color: var(--brass); height: 36px; }
.dial-ticks { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin: -2px 0 14px; }

/* results */
.done { margin-top: 12px; }
.big { font-family: var(--display); font-size: 3rem; line-height: 1; margin: 6px 0 6px; }
.big small { font-size: 1.1rem; color: var(--muted); }
.res-line { margin: 0 0 14px; }
.breakdown { margin-bottom: 14px; }
.bd-side { border-left: 4px solid var(--line); padding: 2px 0 2px 12px; margin-bottom: 12px; }
.bd-side.l { border-color: var(--left); }
.bd-side.r { border-color: var(--right); }
.bd-head { font-weight: 800; margin: 0 0 4px; }
.bd-side ul { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.bd-side li { margin: 3px 0; }
.bd-side li b { font-variant-numeric: tabular-nums; }
.bd-side li small { color: var(--muted); }
.ok { color: var(--good); }
.no { color: var(--bad); }

/* ads */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.ad-label { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 4px; }

.foot { display: flex; justify-content: center; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: 0.9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
.dlg::backdrop { background: rgba(10, 12, 30, .5); }
.dlg h2 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; font-size: 1.6rem; }
.dlg p { color: var(--muted); }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--bg); border-radius: 10px; padding: 10px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .side, .toast { transition: none; } }
