/* Pax & Beneficia design system tokens (source of truth: the Pax & Beneficia design system on Rob's dashboard). */
:root {
  --coup: #2A363B; --sage: #99B898; --skin: #FECEA8; --coral: #FF847C; --melon: #E84A5F;
  --board: #F7F8F8; --dot: #C9CFD1; --surface: #FFFFFF; --text: #181A18; --head: #2A363B; --line: #C9CFD1; --line-strong: #9AA5A9;
  --coup-band: #EDEFF0; --sage-band: #EBF2EA; --skin-band: #FFF3E9; --coral-band: #FFEAE8; --melon-band: #FCE6E9;
  --sage-line: #CCDCCB; --skin-line: #FEE3CC; --coral-line: #FFC4BF; --melon-line: #F4B5BE;
  --btn-bg: #2A363B; --btn-fg: #FFFFFF; --focus: #2A363B; --rec-ring: rgba(232,74,95,.28);
  --shadow-float: 0 2px 4px rgba(42,54,59,.06), 0 14px 32px rgba(42,54,59,.12);
  --ease-settle: cubic-bezier(.2,.7,.2,1); --ease-out: cubic-bezier(0,0,.2,1); --ease-float: cubic-bezier(.45,0,.55,1);
  --g: 22px;
  --font: Calibri, Carlito, "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --mono: "Lucida Console", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --board: #14191B; --dot: #2C373B; --surface: #1D2427; --text: #E9ECED; --head: #F3F5F5; --line: #364247; --line-strong: #5A6A70;
    --coup-band: #243034; --sage-band: #1E2B22; --skin-band: #30271E; --coral-band: #362322; --melon-band: #381E24;
    --sage-line: #3E5440; --skin-line: #5A4632; --coral-line: #6A3633; --melon-line: #6B2E38;
    --btn-bg: #E9ECED; --btn-fg: #14191B; --focus: #FF847C; --rec-ring: rgba(232,74,95,.35);
    --shadow-float: 0 2px 4px rgba(0,0,0,.3), 0 14px 32px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--board); }
body {
  color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.3px); background-size: 22px 22px;
  min-height: 100vh; -webkit-tap-highlight-color: transparent;
}
button, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap {
  max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--g);
  padding-left: max(var(--g), env(safe-area-inset-left)); padding-right: max(var(--g), env(safe-area-inset-right));
  padding-top: max(var(--g), env(safe-area-inset-top)); padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { border-radius: 11px; display: block; }
h1 { margin: 0; font-size: 30px; line-height: 1; color: var(--head); letter-spacing: -.02em; }
h2 { margin: 0; font-size: 20px; color: var(--head); }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--head); opacity: .8; margin: 4px 0 0; font-weight: 400; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--head); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; cursor: pointer; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-float); padding: var(--g); display: flex; flex-direction: column; gap: 14px; }
.card p { margin: 0; }

.deck-row { display: flex; align-items: center; gap: 20px; }
.rec {
  width: 104px; height: 104px; border-radius: 50%; border: 0; cursor: pointer; flex: 0 0 auto; position: relative;
  background: var(--melon); display: grid; place-items: center; box-shadow: 0 0 0 9px var(--rec-ring);
  transition: transform .2s var(--ease-settle), box-shadow .2s var(--ease-settle), filter .16s var(--ease-settle);
  touch-action: manipulation;
}
.rec .dot { width: 36px; height: 36px; border-radius: 50%; background: #FFFFFF; transition: all .16s var(--ease-settle); }
.rec.live .dot { width: 32px; height: 32px; border-radius: 7px; }
.rec.live { animation: pulse 1.6s var(--ease-float) infinite; }
.rec.paused .dot { width: 30px; height: 30px; border-radius: 50%; }
@media (hover: hover) {
  .rec:hover { transform: scale(1.06); box-shadow: 0 0 0 14px var(--rec-ring), 0 10px 24px rgba(232,74,95,.35); }
  .rec.live:hover { animation-play-state: paused; }
}
.rec:active { transform: scale(.9); box-shadow: 0 0 0 4px var(--rec-ring); filter: brightness(.9); transition-duration: .06s; }
.rec::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--melon); opacity: 0; pointer-events: none; }
.rec.tapped::after { animation: burst .45s var(--ease-out); }
.rec[disabled] { filter: grayscale(.6); opacity: .6; cursor: default; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 9px var(--rec-ring); } 50% { box-shadow: 0 0 0 18px var(--rec-ring); } }
@keyframes burst { from { opacity: .7; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
.state { font-size: 22px; font-weight: 700; color: var(--head); }
.clock { font-family: var(--mono); font-size: 16px; color: var(--head); font-variant-numeric: tabular-nums; }
canvas#meter { width: 100%; height: 56px; display: block; border-radius: 10px; background: var(--coup-band); }
.hint, .note { font-size: 13.5px; color: var(--head); }

.ctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--head); border-radius: 10px; padding: 10px 15px; font-weight: 700; font-size: 15px; cursor: pointer; transition: border-color .16s var(--ease-settle), transform .06s; touch-action: manipulation; }
.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn.danger { border-color: var(--melon); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }

#banner:empty { display: none; }
.banner { padding: 11px 14px; border-radius: 10px; font-size: 15px; color: var(--head); background: var(--melon-band); border: 1px solid var(--melon-line); }
.banner.ok { background: var(--sage-band); border-color: var(--sage-line); }
.banner.work { background: var(--skin-band); border-color: var(--skin-line); }

.result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.engine { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg button[aria-checked="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.seg button[disabled] { opacity: .45; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--head); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--btn-bg); color: var(--btn-fg); }
#resText { width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: var(--board); padding: 12px 14px; font-size: 16px; line-height: 1.55; }

.hist { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: left; width: 100%; transition: border-color .16s var(--ease-settle), transform .16s var(--ease-settle); }
@media (hover: hover) { .item:hover { border-color: var(--line-strong); transform: translateY(-2px); } }
.item-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--head); }
.time { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--head); padding: 1px 8px; border-radius: 999px; border: 1px solid; }
.tag.done { background: var(--sage-band); border-color: var(--sage-line); }
.tag.work { background: var(--skin-band); border-color: var(--skin-line); }
.tag.fail { background: var(--melon-band); border-color: var(--melon-line); }
.item-title { font-weight: 700; color: var(--head); font-size: 15.5px; }
.item-text { font-size: 14px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.retry { align-self: flex-start; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; color: var(--head); font-size: 15px; }

@media (max-width: 420px) { :root { --g: 16px; } .rec { width: 92px; height: 92px; } }
@media (prefers-reduced-motion: reduce) { .rec.live, .rec.tapped::after { animation: none; } * { transition: none !important; } }
