/* SantaZone — festive red/green/gold with frosted glass panels.
   One stylesheet for the whole app: auth screens, participant dashboard, organiser tools. */

:root {
  --red: #c81d3c;
  --red-dk: #8d0f26;
  --green: #137a4b;
  --green-dk: #0a4e2f;
  --gold: #e0a92a;
  --gold-lt: #ffd979;
  --cream: #fff8ef;
  --ink: #1b1023;
  --night1: #1a0b2e;
  --night2: #2b1035;
  --night3: #3d0f29;
  --glass: rgba(255, 255, 255, .1);
  --glass-line: rgba(255, 255, 255, .22);
  --text: #fdf6ee;
  --dim: #cdb8c8;
  --ok: #3ddc97;
  --bad: #ff8a9b;
  --radius: 20px;
  --shadow: 0 18px 44px rgba(10, 2, 18, .5);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Mountains of Christmas', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--text); font-family: var(--font);
  background:
    radial-gradient(900px 500px at 82% -8%, rgba(200, 29, 60, .34), transparent 70%),
    radial-gradient(760px 460px at 10% 108%, rgba(19, 122, 75, .34), transparent 70%),
    linear-gradient(170deg, var(--night1), var(--night2) 52%, var(--night3));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold-lt); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── snow ── */
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.app-wrap { position: relative; z-index: 1; }

/* ── shared pieces ── */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .06));
  border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  padding: 12px 20px; border: 0; border-radius: 999px; font-weight: 700; font-size: 1rem; color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dk)); box-shadow: 0 10px 26px rgba(200, 29, 60, .34);
  transition: transform .15s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .55; transform: none; cursor: default; }
.btn.green { background: linear-gradient(135deg, var(--green), var(--green-dk)); box-shadow: 0 10px 26px rgba(19, 122, 75, .34); }
.btn.gold { background: linear-gradient(135deg, var(--gold-lt), var(--gold)); color: #3a2a05; box-shadow: 0 10px 26px rgba(224, 169, 42, .3); }
.btn.ghost { background: transparent; border: 1.5px solid var(--glass-line); box-shadow: none; color: var(--text); }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: .86rem; }
.btn.wide { width: 100%; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 15px; border-radius: 14px; border: 1.5px solid var(--glass-line);
  background: rgba(14, 6, 24, .55); color: var(--text); font-size: 1rem;
}
.field textarea { min-height: 92px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--gold); outline: none; }
input.plain {
  width: 100%; padding: 13px 15px; border-radius: 14px; border: 1.5px solid var(--glass-line);
  background: rgba(14, 6, 24, .55); color: var(--text); font-size: 1rem;
}
input.plain:focus { border-color: var(--gold); outline: none; }

/* Selects outside a .field (the pairing pickers) need the same treatment, or the browser
   default gives a white box with near-invisible text on this dark theme. */
select {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--glass-line);
  background: rgba(14, 6, 24, .75); color: var(--text); font-size: 1rem; min-height: 48px;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
select:focus { border-color: var(--gold); outline: none; }
select option { background: #1a0b2e; color: var(--text); }
.hint { color: var(--dim); font-size: .86rem; margin: 6px 0 0; }
.msg { min-height: 20px; margin: 8px 0 0; font-size: .9rem; }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--ok); }

/* ── auth ── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.auth-box { width: min(430px, 100%); }
.brandmark { text-align: center; margin-bottom: 18px; }
.brandmark .tree { font-size: 3rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.brandmark h1 {
  font-family: var(--display); font-size: clamp(2.2rem, 9vw, 3rem); margin: 6px 0 2px; font-weight: 700;
  background: linear-gradient(100deg, var(--gold-lt), #fff 40%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brandmark p { margin: 0; color: var(--dim); font-size: .95rem; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(10, 4, 20, .5); padding: 5px; border-radius: 999px; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; color: var(--dim); font-weight: 700; padding: 10px; border-radius: 999px; min-height: 42px; }
.tabs button[aria-selected="true"] { background: linear-gradient(135deg, var(--red), var(--red-dk)); color: #fff; }
.auth-foot { text-align: center; margin-top: 14px; }
.linkish { background: none; border: 0; color: var(--gold-lt); text-decoration: underline; font-size: .9rem; padding: 6px; }

/* ── app chrome ── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(16, 6, 28, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-line);
}
.topbar .logo { font-family: var(--display); font-size: 1.5rem; font-weight: 700; color: var(--gold-lt); white-space: nowrap; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, .08); font-size: 1.05rem; position: relative; display: grid; place-items: center;
}
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
main { max-width: 1040px; margin: 0 auto; padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }

.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgba(16, 6, 28, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--glass-line);
}
.navbar button { border: 0; background: transparent; color: var(--dim); display: grid; gap: 2px; justify-items: center; padding: 7px 12px; border-radius: 14px; font-size: .68rem; font-weight: 700; min-width: 64px; }
.navbar button i { font-style: normal; font-size: 1.25rem; }
.navbar button[aria-current="page"] { color: var(--gold-lt); background: rgba(255, 255, 255, .08); }

/* ── dashboard ── */
.hero-card { text-align: center; position: relative; overflow: hidden; margin-bottom: 14px; }
.hero-card h2 { font-family: var(--display); font-size: clamp(1.6rem, 6vw, 2.2rem); margin: 0 0 4px; color: var(--gold-lt); }
.hero-card p { margin: 0; color: var(--dim); }
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.cd-box { background: rgba(10, 4, 20, .5); border: 1px solid var(--glass-line); border-radius: 14px; padding: 8px 12px; min-width: 62px; }
.cd-box b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.cd-box span { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.role-card { border-left: 4px solid var(--red); }
.role-card.child-card { border-left-color: var(--green); }
.role-card h3 { margin: 0 0 4px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.role-card .who { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; color: #fff; flex: none; }
.who b { font-size: 1.2rem; }
.secret { color: var(--dim); font-style: italic; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: rgba(10, 4, 20, .4); border: 1px solid var(--glass-line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

.task { background: rgba(10, 4, 20, .4); border: 1px solid var(--glass-line); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.task .t-top { display: flex; align-items: flex-start; gap: 10px; }
.task h4 { margin: 0; font-size: 1.02rem; flex: 1; }
.task p { margin: 6px 0 0; color: var(--dim); font-size: .92rem; white-space: pre-wrap; }
.pill { font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.sent { background: rgba(224, 169, 42, .2); color: var(--gold-lt); }
.pill.done { background: rgba(61, 220, 151, .18); color: var(--ok); }
.pill.approved { background: rgba(19, 122, 75, .3); color: #a6f2cd; }
.task .resp { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); font-size: .9rem; }
.task .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.empty { text-align: center; padding: 26px 14px; color: var(--dim); }
.empty .big { font-size: 2.4rem; display: block; margin-bottom: 6px; }

.quote { font-style: italic; color: var(--gold-lt); text-align: center; }
.ann { border-left: 3px solid var(--gold); padding-left: 12px; margin-bottom: 14px; }
.ann h4 { margin: 0 0 3px; }
.ann p { margin: 0; color: var(--dim); font-size: .92rem; white-space: pre-wrap; }
.ann time { font-size: .74rem; color: var(--dim); }

.notif { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.notif:last-child { border-bottom: 0; }
.notif.unread { font-weight: 600; }
.notif time { color: var(--dim); font-size: .74rem; }

table.people { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.people th { text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 8px 6px; border-bottom: 1px solid var(--glass-line); }
table.people td { padding: 9px 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.tag { font-size: .68rem; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.tag.admin { background: rgba(224, 169, 42, .25); color: var(--gold-lt); }
.tag.off { background: rgba(255, 138, 155, .2); color: var(--bad); }

.privacy-note {
  border: 1px dashed var(--glass-line); border-radius: 14px; padding: 12px 14px; color: var(--dim);
  font-size: .86rem; background: rgba(10, 4, 20, .32);
}

/* ── loading & celebration ── */
.loader { position: fixed; inset: 0; display: grid; place-items: center; background: var(--night1); z-index: 100; transition: opacity .4s; }
.loader.gone { opacity: 0; pointer-events: none; }
.loader .tree { font-size: 3.2rem; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg) } }

/* Hidden with visibility + opacity, not only a transform: translating by a percentage of its own
   height is not enough to clear the bottom offset, so an empty toast used to peek above the edge. */
.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translate(-50%, 20px); z-index: 60;
  padding: 12px 20px; border-radius: 999px; font-weight: 700; max-width: 92vw; text-align: center;
  background: linear-gradient(135deg, var(--green), var(--green-dk)); box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .4s cubic-bezier(.2,.9,.3,1.3), opacity .25s ease, visibility .25s;
}
.toast.on { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.bad { background: linear-gradient(135deg, var(--red), var(--red-dk)); }

.screen { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

@media (prefers-reduced-motion: reduce) {
  .loader .tree, .spin { animation: none; }
  .screen { animation: none; }
  .btn:hover { transform: none; }
}
@media (max-width: 480px) {
  .card { padding: 16px; }
  main { padding: 12px 11px calc(90px + env(safe-area-inset-bottom)); }
}

/* ── portals ── */
.portal-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 42vw; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--glass-line); background: rgba(255, 255, 255, .08); color: var(--text);
  font-size: .84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.portal-chip i { font-style: normal; color: var(--dim); }
.portal-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px;
  border-radius: 14px; border: 1px solid var(--glass-line); background: rgba(10, 4, 20, .4);
  color: var(--text); margin-bottom: 9px;
}
.portal-row:hover { border-color: var(--gold); }
.portal-row .pbadge { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: linear-gradient(135deg, var(--red), var(--green-dk)); flex: none; }
.portal-row b { display: block; font-size: 1rem; }
.portal-row span { font-size: .78rem; color: var(--dim); }
.portal-row .role { margin-left: auto; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: var(--dim); }
.portal-row .role.admin { background: rgba(224, 169, 42, .25); color: var(--gold-lt); }

.joincode {
  font-size: 1.4rem; font-weight: 800; letter-spacing: .12em; color: var(--gold-lt);
  background: rgba(10, 4, 20, .5); border: 1px dashed var(--glass-line); border-radius: 12px;
  padding: 12px; text-align: center; cursor: pointer;
}
.inv-line { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08); font-size: .88rem; flex-wrap: wrap; }
.inv-line:last-child { border-bottom: 0; }
.inv-line .em { flex: 1; min-width: 140px; }
.inv-link { font-size: .74rem; color: var(--gold-lt); word-break: break-all; }

/* ── QR ── */
.qr-wrap { display: flex; gap: 14px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.qr-wrap canvas { background: #fff; border-radius: 12px; padding: 8px; width: 160px; height: 160px; flex: none; }
.qr-side { flex: 1; min-width: 190px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.inv-qr { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.inv-qr canvas { background: #fff; border-radius: 10px; padding: 6px; width: 104px; height: 104px; flex: none; }

/* ── confirmation modal ── */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(4, 2, 12, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.modal-card {
  width: min(420px, 100%); border-radius: 20px; padding: 22px; text-align: center;
  background: linear-gradient(180deg, rgba(40, 18, 60, .96), rgba(16, 8, 32, .98));
  border: 1px solid var(--glass-line); box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 8px; font-size: 1.2rem; }
.modal-card p { margin: 0 0 16px; color: var(--dim); font-size: .92rem; }
.modal-card textarea {
  width: 100%; margin: 0 0 16px; padding: 12px 14px; border-radius: 14px; resize: vertical;
  border: 1.5px solid var(--glass-line); background: rgba(14, 6, 24, .6); color: var(--text); font-size: 1rem;
}
.modal-card textarea:focus { border-color: var(--gold); outline: none; }
.modal-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal-acts .btn { flex: 1; min-width: 130px; }

/* ── who's playing ── */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
.player {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 13px;
  border: 1px solid var(--glass-line); background: rgba(10, 4, 20, .4); min-width: 0;
}
.player .avatar { width: 34px; height: 34px; font-size: .95rem; }
.player .pname { min-width: 0; }
.player b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player small { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.player.me { border-color: var(--gold); }
.player.me small { color: var(--gold-lt); }

/* Unread notifications are shown in ONE place: a dot on the News tab. */
.navbar button i { position: relative; }
.navbar button i .dot {
  position: absolute; top: -2px; right: -7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bad); border: 1.5px solid rgba(16, 6, 28, .95);
}
