/* Layout concept: a prize-counter at an arcade. Points are tickets, rewards are perforated ticket stubs. */
:root {
  --bg: #e9eefb; --surface: #ffffff; --ink: #131d45; --muted: #56618a; --line: #cfd8f0;
  --blue: #2742d8; --on-blue: #ffffff; --gold: #ffc72e; --on-gold: #1c1a05; --gold-soft: #fff3c9;
  --ok: #12805a; --ok-bg: #d9f3e8; --no: #c2323f; --no-bg: #fde3e5; --wait: #7d5200; --wait-bg: #fff0cc;
  --m0: #d43d5a; --m1: #1b8a6b; --m2: #7a3fd1; --m3: #b05e00; --m4: #1a7fc4; --m5: #a0389b; --on-m: #ffffff;
  --display: "Suez One", "Arial Hebrew", Georgia, serif;
  --body: "Assistant", "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1530; --surface: #1a2346; --ink: #eef1ff; --muted: #a3aed4; --line: #323e6e;
  --blue: #8ea2ff; --on-blue: #0e1536; --gold: #ffcf4d; --on-gold: #211c05; --gold-soft: #3a3213;
  --ok: #5fd7a8; --ok-bg: #123a30; --no: #ff8c96; --no-bg: #43202a; --wait: #ffd27a; --wait-bg: #3f3212;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0f1530; --surface: #1a2346; --ink: #eef1ff; --muted: #a3aed4; --line: #323e6e;
  --blue: #8ea2ff; --on-blue: #0e1536; --gold: #ffcf4d; --on-gold: #211c05; --gold-soft: #3a3213;
  --ok: #5fd7a8; --ok-bg: #123a30; --no: #ff8c96; --no-bg: #43202a; --wait: #ffd27a; --wait-bg: #3f3212;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.45; direction: rtl; }
#app { max-width: 720px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 110px; display: grid; gap: 22px; }
#app > * { min-width: 0; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 400; text-wrap: balance; }
h1 { font-size: 1.75rem; line-height: 1.15; }
h2 { font-size: 1.3rem; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.stack { display: grid; gap: 12px; }
.stack > * { min-width: 0; }
section { display: grid; gap: 12px; }
section > * { min-width: 0; }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Top and navigation */
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
nav.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
nav.tabs button { position: relative; flex: 1; border: 0; background: none; border-radius: 10px; padding: 9px 16px; font-weight: 700; color: var(--muted); min-height: 44px; }
nav.tabs button[aria-current="page"] { background: var(--blue); color: var(--on-blue); }
.badge { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding-inline: 5px; border-radius: 11px; background: var(--no); color: var(--surface); font-size: .78rem; margin-inline-start: 5px; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  nav.tabs { position: fixed; z-index: 5; inset: auto 0 0 0; border-radius: 0; border-width: 1px 0 0; padding: 6px max(10px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)); }
  nav.tabs button { padding-inline: 4px; }
  h1 { font-size: 1.5rem; }
}

/* Buttons */
.btn { border: 0; border-radius: 11px; background: var(--blue); color: var(--on-blue); font-weight: 700; padding: 9px 18px; min-height: 44px; }
.btn.gold { background: var(--gold); color: var(--on-gold); }
.btn.ghost { background: none; color: var(--blue); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ok { background: var(--ok-bg); color: var(--ok); }
.btn.no { background: var(--no-bg); color: var(--no); }
.btn[disabled] { background: var(--line); color: var(--muted); cursor: default; }
.btn:not([disabled]):active { transform: translateY(1px); }

/* Family members */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 14px 4px 6px; padding-inline: 5px 14px; font-weight: 700; min-height: 44px; }
.chip[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.av { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--on-m); font-weight: 700; font-size: .95rem; }

/* Ticket */
.ticket { --stub: 112px; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--stub); background: var(--surface); border-radius: 14px; overflow: hidden; }
.ticket::before, .ticket::after { content: ""; position: absolute; inset-inline-end: calc(var(--stub) - 10px); width: 20px; height: 20px; border-radius: 50%; background: var(--bg); }
.ticket::before { top: -10px; }
.ticket::after { bottom: -10px; }
.ticket .main { padding: 14px 16px; display: grid; gap: 8px; align-content: center; min-width: 0; }
.ticket .stub { border-inline-start: 2px dashed var(--line); padding: 12px 6px; display: grid; place-content: center; text-align: center; gap: 6px; }
.price { font-family: var(--display); font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.unit { font-size: .82rem; color: var(--muted); font-weight: 600; }
.ticket.hero { background: var(--gold); color: var(--on-gold); --stub: 128px; }
.ticket.hero .stub { border-inline-start-color: color-mix(in srgb, var(--on-gold) 40%, transparent); }
.ticket.hero .price { font-size: 2.7rem; }
.ticket.hero .unit { color: var(--on-gold); }
.reward-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.08rem; }
.reward-title .icon { font-size: 1.7rem; line-height: 1; flex: none; }
.meter { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* Rows */
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 12px; padding: 10px 14px; flex-wrap: wrap; }
.row .grow { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; }
.row .pts { font-family: var(--display); font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.no { background: var(--no-bg); color: var(--no); }
.empty { background: var(--surface); border-radius: 12px; padding: 18px; color: var(--muted); text-align: center; }

/* Leaderboard */
.prize { background: var(--blue); color: var(--on-blue); border-radius: 14px; padding: 16px 18px; display: grid; gap: 4px; }
.prize strong { font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1.25; }
.board .row { display: grid; grid-template-columns: 30px 32px minmax(0, 1fr) auto; }
.board .rank { font-family: var(--display); font-size: 1.25rem; text-align: center; font-variant-numeric: tabular-nums; }
.board .row.lead { background: var(--gold-soft); }
.board .meter { margin-top: 5px; }
.board .lead .meter i { background: var(--gold); }

/* Forms */
.panel { background: var(--surface); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: grid; gap: 3px; flex: 1 1 130px; min-width: 0; }
.field.narrow { flex: 0 1 92px; }
.field > span { font-size: .9rem; font-weight: 600; color: var(--muted); }
input, select { width: 100%; min-height: 44px; border: 2px solid var(--line); border-radius: 10px; background: var(--bg); padding: 7px 11px; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; min-height: 44px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.subtabs button { border: 0; background: var(--surface); border-radius: 999px; padding: 7px 15px; font-weight: 700; color: var(--muted); min-height: 40px; }
.subtabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.note { background: var(--wait-bg); color: var(--wait); border-radius: 12px; padding: 11px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-weight: 600; }
.lock { max-width: 340px; margin-inline: auto; width: 100%; text-align: center; }
.lock input { text-align: center; font-size: 1.6rem; letter-spacing: .4em; direction: ltr; }
.hero-setup { background: var(--gold); color: var(--on-gold); border-radius: 16px; padding: 22px; display: grid; gap: 6px; }
.member-row { display: flex; gap: 8px; align-items: center; }
.member-row input { flex: 1; min-width: 0; }
.member-row select { width: 96px; flex: none; }
.member-row button { flex: none; width: 44px; padding: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
#toast { position: fixed; z-index: 10; inset-inline: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: 420px; margin-inline: auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; font-weight: 600; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.auth { max-width: 460px; margin-inline: auto; width: 100%; }
.code { font-family: var(--display); font-size: 1.5rem; direction: ltr; text-align: center; letter-spacing: .08em; background: var(--gold-soft); border-radius: 12px; padding: 12px; overflow-wrap: anywhere; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; text-decoration: underline; min-height: 32px; }
input[type="password"] { direction: ltr; text-align: right; }
.member-row input[name="mpass"] { flex: 0 1 112px; }
