:root {
  --wine: #8b1e3f;
  --wine-dark: #6b1430;
  --gold: #e8b931;
  --gold-dark: #c49216;
  --cream: #fff8ee;
  --card: #ffffff;
  --ink: #2a1a1f;
  --muted: #7a6a6f;
  --line: #eadfd3;
  --green: #2f8f4e;
  --grey: #b9aeb1;
  --radius: 18px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", "Noto Sans Georgian", "BPG Arial", Roboto, sans-serif;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--wine); }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + var(--safe-t)) 16px calc(var(--tabs-h) + 24px + var(--safe-b));
}

.splash { display: grid; place-items: center; min-height: 70vh; }
.logo { font-weight: 800; font-size: 28px; letter-spacing: 0.5px; color: var(--wine); }
.logo span { color: var(--gold-dark); }
.splash .logo { font-size: 44px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top h1 { font-size: 22px; margin: 0; line-height: 1.25; }
.back { background: none; border: 0; font-size: 26px; padding: 4px 8px 4px 0; cursor: pointer; color: var(--wine); }

h2 { font-size: 17px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 0 var(--line), 0 4px 14px rgba(139, 30, 63, 0.06);
}
a.card { display: block; text-decoration: none; color: inherit; }
.card + .card { margin-top: 10px; }
.card.cancelled { opacity: 0.55; }
.card .title { font-weight: 700; font-size: 17px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 14px; padding: 12px 16px; min-height: 46px;
  background: var(--wine); color: #fff; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn.block { width: 100%; }
.btn.ghost { background: #f3e9df; color: var(--ink); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.green { background: var(--green); }
.btn.danger { background: #fbe4e4; color: #a11; }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 11px; }
.btn.selected { outline: 3px solid var(--gold); outline-offset: 1px; }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: #f3e9df; }
.chip.in { background: #e3f4e8; color: var(--green); }
.chip.gza { background: #fde9ee; color: var(--wine); }
.chip.out { background: #eee; color: #777; }

/* The big "გზა" button (R4): the largest control on the meetup card. */
.gza-wrap { display: grid; place-items: center; margin: 18px 0 8px; }
.gza-btn {
  width: min(62vw, 230px); height: min(62vw, 230px); border-radius: 50%;
  border: 0; cursor: pointer; color: #fff; font-size: 54px; font-weight: 900; letter-spacing: 1px;
  background: radial-gradient(circle at 35% 30%, #c0365f, var(--wine) 55%, var(--wine-dark));
  box-shadow: 0 10px 0 var(--wine-dark), 0 18px 30px rgba(107, 20, 48, 0.35);
  transition: transform 0.08s, box-shadow 0.08s;
}
.gza-btn small { display: block; font-size: 15px; font-weight: 600; letter-spacing: 0; opacity: 0.9; }
.gza-btn:active { transform: translateY(8px); box-shadow: 0 2px 0 var(--wine-dark), 0 6px 14px rgba(107, 20, 48, 0.3); }
.gza-btn[disabled] { filter: grayscale(1); opacity: 0.5; }

.rsvp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

.people .person { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.people .person:last-child { border-bottom: 0; }
.person .emoji { font-size: 20px; width: 26px; text-align: center; }
.person .who { flex: 1; min-width: 0; }
.person .name { font-weight: 600; }
.late { color: var(--wine); font-style: italic; font-size: 14px; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 6px; }

.pay { display: flex; gap: 12px; align-items: center; }
.pay .medal-sm { font-size: 34px; }

.fab { position: sticky; top: 0; }

.banner { background: #fff3cf; border: 1px solid #f0d98a; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.banner .row { margin-top: 8px; }
.warn { background: #fde9ee; border: 1px solid #f3bccb; border-radius: 14px; padding: 12px 14px; margin: 10px 0; font-size: 14px; }

label.field { display: block; margin-top: 14px; font-weight: 600; font-size: 14px; }
label.field input, label.field textarea, label.field select, .input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: #fff; font-weight: 400; font-size: 16px;
}
textarea { resize: vertical; min-height: 70px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choice { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.choice.on { border-color: var(--wine); background: #fde9ee; color: var(--wine); font-weight: 700; }

.tabs[hidden] { display: none; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); text-decoration: none; }
.tabs a span { font-size: 22px; line-height: 1.1; }
.tabs a.on { color: var(--wine); font-weight: 700; }

/* Bottom sheets */
.sheet-bg { position: fixed; inset: 0; background: rgba(42, 26, 31, 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet { background: var(--cream); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + var(--safe-b)); max-height: 88vh; overflow: auto; animation: up 0.2s; }
.sheet h3 { margin: 0 0 12px; font-size: 19px; }
.eta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.eta-grid .btn { min-height: 64px; font-size: 20px; }

/* Medal celebration (R5) */
.medal-screen { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 35%, #fff4c9, #f5d36a 45%, #c49216); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; animation: fade 0.2s; }
.medal-big { font-size: 140px; line-height: 1; animation: pop 0.6s cubic-bezier(.2,1.6,.4,1); }
.medal-name { font-size: 34px; font-weight: 900; margin-top: 10px; color: var(--wine-dark); }
.medal-title { font-size: 20px; font-weight: 700; margin: 14px 0 6px; max-width: 420px; }
.medal-amount { font-size: 13px; color: #6b5420; }

.board .rank { display: flex; align-items: center; gap: 12px; }
.board .medal { font-size: 40px; width: 52px; text-align: center; }
.board .count { font-size: 24px; font-weight: 900; color: var(--wine); }
.board .total { font-size: 12px; color: var(--muted); }

.code { font-size: 40px; font-weight: 900; letter-spacing: 8px; text-align: center; color: var(--wine); margin: 10px 0; }
.link-box { word-break: break-all; background: #fff; border: 1.5px dashed var(--gold-dark); border-radius: 12px; padding: 10px 12px; font-size: 13px; }

#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + 14px + var(--safe-b)); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 14px; max-width: 92vw; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up 0.2s; }
.toast button { background: var(--gold); color: var(--ink); border: 0; border-radius: 10px; padding: 6px 10px; font-weight: 700; cursor: pointer; }

.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty .big { font-size: 50px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: scale(0.2) rotate(-30deg); } to { transform: none; } }
