@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,800&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --red: #b3122e;
  --red-dark: #7a0c1f;
  --green: #0f5132;
  --green-light: #1c7a4d;
  --gold: #f0a500;
  --cream: #fbf6ee;
  --paper: #ffffff;
  --ink: #1f1a17;
  --muted: #7c726a;
  --line: #ece3d6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(60, 20, 10, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(179, 18, 46, .14), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(15, 81, 50, .14), transparent 60%),
    var(--cream);
  min-height: 100vh;
}
h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; letter-spacing: -.01em; }
a { color: var(--red); }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, var(--red), var(--red-dark)); display: grid; place-items: center; font-size: 24px; box-shadow: var(--shadow); }
.brand h1 { font-size: 22px; margin: 0; }
.brand small { color: var(--muted); display: block; font-size: 13px; }
.top .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons & inputs */
.btn { border: 0; border-radius: 999px; padding: 11px 20px; font: 600 14px 'Manrope', sans-serif; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(179, 18, 46, .28); }
.btn-primary:hover { background: var(--red-dark); }
.btn-green { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(15, 81, 50, .25); }
.btn-green:hover { background: var(--green-light); }
.btn-ghost { background: rgba(255, 255, 255, .7); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid rgba(179, 18, 46, .3); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

label { font-weight: 600; font-size: 13px; color: var(--muted); display: block; margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; font: 500 15px 'Manrope', sans-serif; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(179, 18, 46, .10); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }

/* Cards */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; border: 1px solid rgba(0, 0, 0, .03); }
.card h2 { margin: 0 0 6px; font-size: 22px; }
.card h3 { margin: 0 0 10px; font-size: 18px; }
.card p.sub { margin: 0 0 14px; color: var(--muted); }
.grid { display: grid; gap: 20px; grid-template-columns: 1.25fr 1fr; }
.stack { display: grid; gap: 20px; align-content: start; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

/* Login */
.login { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.login .card { width: 100%; max-width: 430px; text-align: center; padding: 36px 30px; }
.login .hero { font-size: 64px; line-height: 1; margin-bottom: 8px; animation: bob 3s ease-in-out infinite; }
.login h1 { margin: 6px 0 4px; font-size: 30px; }
.login p { color: var(--muted); margin: 0 0 18px; }
.login form { text-align: left; }
.login .btn { width: 100%; justify-content: center; margin-top: 16px; padding: 14px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: 12px; font-weight: 700; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: 500 13px 'Manrope'; margin-top: 12px; text-decoration: underline; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

/* Reveal */
.reveal { text-align: center; padding: 34px 24px; background: linear-gradient(160deg, var(--green), #093822); color: #fff; position: relative; overflow: hidden; }
.reveal::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1.5px, transparent 1.5px); background-size: 22px 22px; }
.reveal > * { position: relative; }
.reveal .label { text-transform: uppercase; letter-spacing: .15em; font-size: 12px; opacity: .8; }
.reveal .who { font-family: 'Fraunces', serif; font-size: 40px; font-weight: 800; margin: 10px 0 4px; }
.reveal .dept { opacity: .8; }
.gift { font-size: 92px; cursor: pointer; display: inline-block; user-select: none; transition: transform .2s; animation: wiggle 2.4s ease-in-out infinite; }
.gift:hover { transform: scale(1.08); }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
.pop { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.wish-box { background: #fff7e6; border-left: 4px solid var(--gold); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; line-height: 1.55; }
.empty { color: var(--muted); font-style: italic; }

.waiting { text-align: center; padding: 36px 24px; }
.waiting .big { font-size: 70px; }

.info-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.info-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--cream); border-radius: 12px; }
.info-list .ic { font-size: 20px; }
.info-list b { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding: 4px 2px 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.them { background: var(--cream); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--red); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg small { display: block; opacity: .6; font-size: 11px; margin-top: 4px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }

/* Admin */
.tabs { display: flex; gap: 6px; background: rgba(255, 255, 255, .6); padding: 6px; border-radius: 999px; border: 1px solid var(--line); width: fit-content; margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 9px 18px; border-radius: 999px; font: 600 14px 'Manrope'; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--ink); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e3f4ea; color: var(--green); }
.pill.no { background: #f6eee4; color: var(--muted); }
.pill.red { background: #fde8ec; color: var(--red); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 160px; }
.row > .btn { flex: 0 0 auto; }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.banner { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.banner.warn { background: #fff4d6; color: #7a5600; }
.banner.ok { background: #e3f4ea; color: var(--green); }
.draw-hero { text-align: center; padding: 40px 24px; }
.draw-hero .big { font-size: 80px; }
.check { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 12px 0; font-weight: 600; color: var(--ink); }
.check input { width: auto; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 50; transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); max-width: 90vw; text-align: center; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

.modal { position: fixed; inset: 0; background: rgba(20, 10, 5, .45); display: grid; place-items: center; z-index: 40; padding: 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
