/* LEEgacy Annual White Elephant: evergreen, cranberry and gold. The wrapped-gift tiles are the one loud thing. */
:root {
  --night: #0D3324;
  --night-2: #124230;
  --night-3: #1B573F;
  --line: #2B6B51;
  --snow: #FBF8F3;
  --mist: #BCD6C8;
  --gold: #E8B64A;
  --gold-ink: #3A2A05;
  --cranberry: #C8324B;
  --pine: #3C8A5C;
  --ice: #CFE6F5;
  --radius-s: 8px;
  --radius-m: 14px;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, #1A5A40 0%, transparent 70%),
    var(--night);
  color: var(--snow);
  font: 400 17px/1.5 var(--body);
}
a { color: var(--gold); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#app { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: calc(58px + env(safe-area-inset-top)) 18px 80px; }
#app.wide { max-width: none; padding: 62px 36px 28px; }

h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; }
h1 { font-size: clamp(30px, 7vw, 44px); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 12px; }
.muted { color: var(--mist); }
.small { font-size: 14px; }

/* ----- header ----- */
.party {
  margin-bottom: 22px; padding: 22px 22px 20px; border-radius: 18px;
  background:
    radial-gradient(130% 120% at 0% 0%, rgba(255,255,255,.12), transparent 55%),
    linear-gradient(160deg, #D23A52 0%, #A82039 100%);
  box-shadow: 0 10px 0 rgba(0,0,0,.18);
}
.party .when { color: #FBE3E7; margin-top: 8px; }
.party .when strong { color: #fff; font-weight: 700; }
.party .notes { margin-top: 10px; color: #FBE3E7; white-space: pre-line; }

/* ----- sections ----- */
.section { margin-top: 30px; }
.panel {
  background: var(--night-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px;
}
.panel + .panel { margin-top: 12px; }

/* ----- status banner (whose turn) ----- */
.status {
  border-radius: var(--radius-m);
  padding: 18px 20px;
  background: var(--night-2);
  border: 1px solid var(--line);
}
.status .big { font-family: var(--display); font-size: 28px; font-weight: 800; line-height: 1.1; }
.status.you { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.status.you .muted { color: #5C4513; }
.status.done { background: var(--cranberry); border-color: var(--cranberry); }

/* ----- buttons ----- */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px;
  background: var(--night-3); color: var(--snow); font-weight: 700;
  text-decoration: none;
}
.btn:hover { background: #236C4F; }
.btn.primary { background: var(--gold); color: var(--gold-ink); }
.btn.primary:hover { background: #F1C665; }
.btn.danger { background: transparent; color: #FF9AA9; box-shadow: inset 0 0 0 1.5px #8E3346; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ----- forms ----- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
label.field > small { display: block; color: var(--mist); margin-top: 4px; font-size: 14px; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-s);
  background: var(--night); border: 1.5px solid var(--line);
}
input:focus, textarea:focus { border-color: var(--gold); outline: none; }
textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle:first-child { border-top: 0; }
.toggle input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--gold); flex: none; }
.toggle b { display: block; }

/* ----- tabs ----- */
.tabs { display: flex; gap: 6px; margin: 4px 0 22px; background: var(--night-2); padding: 5px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 999px; min-height: 40px; font-weight: 700; cursor: pointer; color: var(--mist); }
.tabs button[aria-selected=true] { background: var(--cranberry); color: #fff; }

/* ----- people list ----- */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.people li:first-child { border-top: 0; }
.people .who b { font-size: 18px; }
.people .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.badge { font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--night-3); color: var(--mist); }
.badge.yes { background: var(--pine); color: #F1FBF5; }
.badge.gold { background: var(--gold); color: var(--gold-ink); }

/* ----- the gift table ----- */
.table { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.wide .table { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }

.gift {
  position: relative; border: 0; padding: 0; text-align: left; cursor: default;
  border-radius: 10px; min-height: 150px; display: flex; flex-direction: column;
  background: var(--snow); color: var(--night);
}
button.gift { cursor: pointer; }
button.gift:hover .wrap { transform: translateY(-3px) rotate(-1deg); }

/* wrapped */
.gift .wrap {
  flex: 1; border-radius: 10px; position: relative; overflow: hidden;
  transition: transform .15s ease;
  box-shadow: 0 6px 0 rgba(0,0,0,.25);
}
.gift .wrap::before, .gift .wrap::after { content: ''; position: absolute; background: var(--ribbon, var(--gold)); }
.gift .wrap::before { left: 50%; top: 0; bottom: 0; width: 16px; transform: translateX(-50%); }
.gift .wrap::after { top: 44%; left: 0; right: 0; height: 16px; }
.gift .num {
  position: absolute; z-index: 2; left: 50%; top: 44%; transform: translate(-50%, calc(-50% + 8px));
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--snow); color: var(--night);
  font: 800 22px/1 var(--display);
  box-shadow: 0 0 0 4px var(--ribbon, var(--gold));
}
.gift .hint {
  position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px;
  font-size: 13px; line-height: 1.25; color: var(--snow);
  background: rgba(13,51,36,.85); padding: 4px 8px; border-radius: 6px; width: fit-content; max-width: calc(100% - 16px);
}
.wide .gift { min-height: 200px; }
.wide .gift .num { width: 64px; height: 64px; font-size: 28px; }
.wide .gift .hint { font-size: 15px; }

.paper-0 { background: repeating-linear-gradient(45deg, #C8324B 0 14px, #DA4A62 14px 28px); --ribbon: #F4F6FB; }
.paper-1 { background: radial-gradient(circle, #FBF8F3 2.5px, transparent 3px) 0 0 / 18px 18px, #3C8A5C; --ribbon: #C8324B; }
.paper-2 { background: linear-gradient(90deg, rgba(255,255,255,.22) 50%, transparent 0) 0 0 / 22px 22px, linear-gradient(rgba(140,80,0,.14) 50%, transparent 0) 0 0 / 22px 22px, #E8B64A; --ribbon: #C8324B; }
.paper-3 { background: repeating-linear-gradient(45deg, #FBF8F3 0 11px, #C8324B 11px 22px); --ribbon: #3C8A5C; }
.paper-4 { background: linear-gradient(90deg, rgba(232,182,74,.28) 3px, transparent 3px) 0 0 / 24px 24px, linear-gradient(rgba(232,182,74,.28) 3px, transparent 3px) 0 0 / 24px 24px, #8E1B2E; --ribbon: #E8B64A; }
.paper-5 { background: radial-gradient(circle, rgba(255,255,255,.9) 2px, transparent 2.5px) 0 0 / 14px 14px, radial-gradient(circle, rgba(255,255,255,.55) 1.5px, transparent 2px) 7px 7px / 14px 14px, #1E5E43; --ribbon: #E8B64A; }

/* opened */
.gift.opened { padding: 14px; gap: 8px; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.gift.opened .what { font: 700 18px/1.2 var(--display); }
.wide .gift.opened .what { font-size: 22px; }
.gift.opened .tag { font-size: 14px; color: #55615A; margin-top: auto; display: flex; align-items: center; gap: 7px; }
.gift.opened .tag b { color: var(--night); }
.gift.opened .meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #55615A; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: #D9D3C8; }
.pips i.on { background: var(--cranberry); }
.gift.frozen { background: var(--ice); }
.gift.frozen .meta b { color: #1D5A86; }
.gift.mine { box-shadow: 0 0 0 3px var(--gold), 0 6px 0 rgba(0,0,0,.25); }
.gift .act {
  margin-top: 8px; align-self: stretch; text-align: center;
  background: var(--cranberry); color: #fff; border-radius: 999px; font-weight: 700; padding: 8px 10px;
}
.gift .nope { margin-top: 8px; font-size: 13px; color: #55615A; text-align: center; }
.gift.dim { opacity: .55; }
.gift .yours { position: absolute; z-index: 2; top: 8px; left: 8px; font-size: 13px; font-weight: 700; background: var(--snow); color: var(--night); padding: 2px 8px; border-radius: 999px; }

/* ----- turn order ----- */
.order { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.order li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--night-2); border: 1px solid var(--line); color: var(--mist); font-size: 15px; }
.order li.past { opacity: .5; }
.order li.now { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 700; }
.order li.victim { background: var(--cranberry); color: #fff; border-color: var(--cranberry); font-weight: 700; }

/* ----- log ----- */
.log { list-style: none; padding: 0; margin: 0; }
.log li { padding: 8px 0; border-top: 1px solid var(--line); color: var(--mist); }
.log li:first-child { border-top: 0; color: var(--snow); }

/* ----- board (TV) ----- */
.board { display: grid; grid-template-columns: minmax(300px, 30%) 1fr; gap: 36px; align-items: start; }
.board .picking { font: 800 clamp(40px, 5vw, 76px)/1 var(--display); letter-spacing: -0.02em; margin: 8px 0 14px; }
.board .picking.victim { color: #FF8C9E; }
.board .side { position: sticky; top: 28px; display: grid; gap: 26px; }
@media (max-width: 900px) { .board { grid-template-columns: 1fr; } .board .side { position: static; } }

/* ----- results ----- */
.results { list-style: none; padding: 0; margin: 0; }
.results li { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.results .from { color: var(--mist); font-size: 14px; }

/* ----- sheet (confirm) ----- */
.scrim { position: fixed; inset: 0; background: rgba(4,20,13,.7); display: grid; align-items: end; justify-items: center; z-index: 20; }
.sheet {
  width: min(560px, 100%); background: var(--night-2); border: 1px solid var(--line);
  border-radius: 22px 22px 0 0; padding: 24px 22px max(24px, env(safe-area-inset-bottom));
}
.sheet h2 { font-size: 26px; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 22px; } }

/* ----- reveal: the one orchestrated moment ----- */
.reveal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(4,20,13,.85); cursor: pointer; padding: 20px; }
.reveal .card {
  background: var(--snow); color: var(--night); border-radius: 20px; padding: 34px 30px 28px;
  width: min(520px, 100%); text-align: center; position: relative;
  animation: pop .55s cubic-bezier(.2,1.4,.4,1) both;
}
.reveal .lid {
  position: absolute; left: 50%; top: -34px; width: 70%; height: 46px; transform: translateX(-50%);
  border-radius: 10px; animation: lid .6s ease-out both;
}
.reveal .who { color: #55615A; font-size: 18px; }
.reveal .what { font: 800 clamp(30px, 6vw, 52px)/1.05 var(--display); margin: 10px 0 8px; letter-spacing: -0.02em; }
.wide .reveal .what { font-size: 72px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes lid { from { transform: translate(-50%, 34px) rotate(0); } to { transform: translate(-50%, -40px) rotate(-12deg); opacity: 0; } }

/* ----- toast ----- */
#toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  background: var(--snow); color: var(--night); padding: 12px 18px; border-radius: 999px; font-weight: 700;
  transition: transform .25s ease; z-index: 40; max-width: calc(100% - 30px);
}
#toast:not(.show) { visibility: hidden; }
#toast.show { transform: translate(-50%, 0); }
#toast.err { background: #FFD5DC; color: #5A0C1A; }

.center { text-align: center; }
.empty { padding: 26px; text-align: center; color: var(--mist); border: 1.5px dashed var(--line); border-radius: var(--radius-m); }
.secret { filter: blur(6px); user-select: none; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ----- photos ----- */
.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  object-fit: cover; color: #fff; font-family: var(--display); font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 2px var(--snow); vertical-align: middle; overflow: hidden;
}
.order li.now .avatar { box-shadow: 0 0 0 2px var(--gold-ink); }
.with-face { display: flex; gap: 14px; align-items: center; }
.with-face > div { min-width: 0; }
.status.with-face .avatar { box-shadow: 0 0 0 3px var(--snow); }
.status.you.with-face .avatar { box-shadow: 0 0 0 3px var(--gold-ink); }
.who-line { display: flex; align-items: center; gap: 10px; }
.board-face { box-shadow: 0 0 0 4px var(--gold); margin: 10px 0 4px; }
.reveal-face { margin: -70px auto 10px; display: grid; box-shadow: 0 0 0 5px var(--snow), 0 6px 18px rgba(0,0,0,.3); position: relative; z-index: 2; }
.filebtn { position: relative; overflow: hidden; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.filebtn:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-width: 520px) { .people li:has(.row) { grid-template-columns: 1fr; } .people li .row { justify-content: flex-start; } }

/* ----- gift photos ----- */
.gift .wrap.has-photo { background-size: cover; background-position: center; background-color: var(--night-3); }
.gift .wrap.has-photo::before, .gift .wrap.has-photo::after { display: none; }
.gift .wrap.has-photo .num { top: 12px; left: 12px; transform: none; width: 40px; height: 40px; font-size: 18px; box-shadow: 0 0 0 3px var(--gold); }
.wide .gift .wrap.has-photo .num { width: 50px; height: 50px; font-size: 22px; }
.gift-pic { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.reveal-pic { display: block; width: 100%; max-height: 46vh; object-fit: contain; border-radius: 10px; margin: 12px 0 4px; background: #EFEAE0; }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.slots.compact { margin: 10px 0 0; }
.slot { background: var(--night); border: 1.5px dashed var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.slot small { font-size: 13px; line-height: 1.3; margin-bottom: 4px; }
.slot-pic { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--night-2); display: grid; place-items: center; color: var(--mist); font-size: 14px; margin-bottom: 4px; }
.slot-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .row { gap: 6px; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
/* Hidden "before wrapping" photos on the organizer page: blurred to a soft color wash until tapped. */
img.secret { filter: blur(40px) saturate(.35) brightness(.95); clip-path: inset(0 round 8px); }
.hidden-pic { display: grid; place-items: center; text-align: center; width: 100%; height: 100%; padding: 10px; font-size: 13px; line-height: 1.35; color: var(--mist);
  background: repeating-linear-gradient(45deg, #124230 0 10px, #17503A 10px 20px); }
.hidden-pic.small-pic { width: 64px; height: 64px; border-radius: 6px; font-size: 11px; padding: 4px; }

/* ----- decorations ----- */
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#lights {
  position: absolute; top: env(safe-area-inset-top); left: 0; right: 0; height: 48px; overflow: hidden;
  pointer-events: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M0 5 Q24 27 48 5' fill='none' stroke='%23051710' stroke-width='2.2'/%3E%3C/svg%3E") repeat-x 0 0;
}
.bulb {
  position: absolute; top: 18px; width: 10px; height: 16px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c); box-shadow: 0 0 10px 3px var(--c);
  animation: twinkle 2s ease-in-out infinite alternate;
}
.bulb::before { content: ''; position: absolute; left: 2px; top: -4px; width: 6px; height: 5px; border-radius: 1px; background: #1E2A24; }
@keyframes twinkle {
  0%, 40% { opacity: 1; box-shadow: 0 0 12px 4px var(--c); }
  100% { opacity: .45; box-shadow: 0 0 2px 0 var(--c); }
}
.email-line { overflow-wrap: anywhere; }
.status.you a.btn:hover { filter: brightness(1.1); }
