:root {
  --paper: #f6efe3;
  --card: #fffcf6;
  --ink: #1c2a23;
  --muted: #6c786f;
  --line: #e8dcc8;
  --pine: #1e4a38;
  --pine-2: #2b6a50;
  --pine-soft: #e3eee7;
  --berry: #b3303e;
  --berry-soft: #f7e3e3;
  --gold: #c08a2c;
  --gold-soft: #f5e9cf;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(28, 42, 35, .04), 0 10px 30px -12px rgba(28, 42, 35, .18);
  --display: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(30, 74, 56, .16), transparent 70%),
    radial-gradient(600px 300px at 100% 0, rgba(179, 48, 62, .08), transparent 70%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
html, body { overflow-x: hidden; }
.wrap { position: relative; z-index: 1; max-width: 580px; margin: 0 auto; padding: 28px 18px 80px; }
.wrap.wide { max-width: 860px; }

/* Tipografía */
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold);
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(30px, 8vw, 42px); line-height: 1.05; margin: 6px 0 4px; color: var(--pine); }
h2 { font-size: 22px; color: var(--pine); }
h3 { font-size: 17px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--pine-2); }

/* Encabezado */
.hero { text-align: center; padding: 8px 0 18px; }
.hello { font-size: 17px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 500;
}

/* Cuenta regresiva */
.countdown { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.countdown .unit {
  min-width: 68px; padding: 10px 6px 8px; border-radius: 16px;
  background: var(--pine); color: #fff; text-align: center;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
.countdown .num { font-family: var(--display); font-size: 28px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.countdown .lbl { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .75; margin-top: 4px; }
.countdown-msg { text-align: center; margin-top: 16px; font-family: var(--display); font-size: 20px; color: var(--berry); }

/* Tarjetas */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; margin-top: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .icon { font-size: 22px; }
.section-note { font-size: 14px; color: var(--muted); margin-top: -6px; margin-bottom: 14px; }

/* Formularios */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=url], input[type=password], input[type=datetime-local], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--pine-2); box-shadow: 0 0 0 4px rgba(43, 106, 80, .12); }
textarea { resize: vertical; min-height: 84px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
input[type=datetime-local] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 48px; }

.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 14px; background: var(--pine); color: #fff;
  transition: transform .08s, background .15s, opacity .15s; text-decoration: none;
}
.btn:hover { background: var(--pine-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.berry { background: var(--berry); }
.btn.berry:hover { background: #c33d4b; }
.btn.ghost { background: transparent; color: var(--pine); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--pine-soft); }
.btn.small { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.btn.wa { background: #1f8f4e; }
.btn.wa:hover { background: #23a35a; }
.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 18px; width: 34px; height: 34px; border-radius: 10px; flex: none;
}
.icon-btn:hover { background: var(--berry-soft); color: var(--berry); }

/* Emojis */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-opt {
  appearance: none; border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  font-size: 22px; aspect-ratio: 1; cursor: pointer; padding: 0; transition: transform .1s, border-color .1s;
}
.emoji-opt:hover { transform: scale(1.08); }
.emoji-opt.taken { opacity: .35; }
.emoji-group { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.emoji-picker > div:first-child .emoji-group { margin-top: 0; }
.change-emoji { appearance: none; border: 0; background: none; color: var(--pine-2); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0 4px; }
.emoji-opt[aria-pressed=true] { border-color: var(--pine); background: var(--pine-soft); box-shadow: 0 0 0 3px rgba(30,74,56,.15); }

/* Participantes */
.people { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.person { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 74px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-soft); font-size: 26px; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: relative;
}
.avatar .tick {
  position: absolute; right: -4px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--pine-2); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid #fff;
}
.person .nm { font-size: 13px; font-weight: 600; text-align: center; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person.me .avatar { background: var(--pine-soft); }

/* Regalo */
.gift-stage { display: flex; flex-direction: column; align-items: center; padding: 10px 0 4px; }
.gift { position: relative; width: 150px; height: 150px; cursor: pointer; margin: 18px auto 8px; animation: wobble 2.6s ease-in-out infinite; }
.gift:focus-visible { outline: 3px solid var(--gold); outline-offset: 8px; border-radius: 12px; }
.gift .box { position: absolute; left: 12px; right: 12px; bottom: 0; height: 96px; background: var(--berry); border-radius: 8px 8px 12px 12px; box-shadow: inset 0 -10px 0 rgba(0,0,0,.12); }
.gift .lid { position: absolute; left: 2px; right: 2px; top: 34px; height: 30px; background: #c63a49; border-radius: 8px; box-shadow: 0 4px 0 rgba(0,0,0,.12); transition: transform .7s cubic-bezier(.3,1.6,.5,1), opacity .7s; transform-origin: 30% 100%; }
.gift .ribbon-v { position: absolute; left: 50%; width: 22px; margin-left: -11px; top: 34px; bottom: 0; background: var(--gold); }
.gift .lid .ribbon-v { top: 0; }
.gift .bow { position: absolute; left: 50%; top: 4px; width: 80px; height: 36px; margin-left: -40px; }
.gift .bow::before, .gift .bow::after {
  content: ''; position: absolute; top: 4px; width: 36px; height: 28px; border: 7px solid var(--gold); border-radius: 50% 50% 10% 50%;
}
.gift .bow::before { left: 2px; transform: rotate(-18deg); }
.gift .bow::after { right: 2px; transform: rotate(18deg) scaleX(-1); }
.gift.open { animation: none; }
.gift.open .lid { transform: translate(40px, -90px) rotate(32deg); opacity: 0; }
@keyframes wobble {
  0%, 70%, 100% { transform: rotate(0); }
  74% { transform: rotate(-6deg); } 78% { transform: rotate(6deg); }
  82% { transform: rotate(-4deg); } 86% { transform: rotate(3deg); }
}

.reveal-name { text-align: center; }
.reveal-name .big-emoji { font-size: 64px; line-height: 1; margin-top: 4px; }
.reveal-name .who { font-family: var(--display); font-size: clamp(34px, 9vw, 46px); color: var(--berry); font-weight: 600; line-height: 1.1; margin-top: 6px; }
.pop { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.about-quote {
  margin: 16px 0 4px; padding: 12px 14px; border-left: 3px solid var(--gold);
  background: var(--gold-soft); border-radius: 0 12px 12px 0; font-size: 15px; white-space: pre-wrap;
}

/* PIN */
.pin-input {
  display: block; width: 190px !important; margin: 6px auto 0; text-align: center;
  font-size: 30px !important; letter-spacing: .5em; padding: 10px 0 10px .5em !important; font-variant-numeric: tabular-nums;
}
.pin-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pin-row > div { text-align: center; }
.pin-row label { text-align: center; margin-top: 4px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* Muro de deseos */
.board { display: grid; gap: 8px; }
.board details { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 0 14px; }
.board summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 0; color: var(--ink); }
.board summary::-webkit-details-marker { display: none; }
.board summary .e { font-size: 24px; }
.board summary .n { flex: 1; font-weight: 600; }
.board summary .c { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.board summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.board details[open] summary::after { transform: rotate(180deg); }
.board .inner { padding: 0 0 14px; }
.board .about-quote { margin-top: 0; }

/* Lista de deseos */
.wishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wish {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.wish .dot { font-size: 18px; flex: none; }
.wish .txt { flex: 1; min-width: 0; }
.wish .txt a { font-size: 13px; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.empty { text-align: center; padding: 14px; color: var(--muted); font-size: 14px; border: 1.5px dashed var(--line); border-radius: 14px; }

/* Chat */
.tabs { display: flex; background: var(--pine-soft); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.tab {
  flex: 1; appearance: none; border: 0; background: transparent; padding: 10px 8px; border-radius: 11px;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--pine); cursor: pointer; position: relative;
}
.tab[aria-selected=true] { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--berry); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; vertical-align: 1px;
}
.chat-intro { font-size: 13.5px; color: var(--muted); text-align: center; margin: 2px 0 10px; }
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; padding: 4px 2px 8px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.msg .t { display: block; font-size: 10.5px; opacity: .6; margin-top: 2px; }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.mine { align-self: flex-end; background: var(--pine); color: #fff; border-bottom-right-radius: 6px; }
.chat-form { display: flex; gap: 8px; margin-top: 8px; }
.chat-form input { flex: 1; }

/* Link secreto */
.secret-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; word-break: break-all;
  background: #fff; border: 1.5px dashed var(--gold); border-radius: 12px; padding: 10px 12px; margin: 10px 0;
}
.callout {
  background: var(--gold-soft); border: 1px solid #ecd9ae; border-radius: 16px; padding: 14px 16px; font-size: 14px;
}
.callout.berry { background: var(--berry-soft); border-color: #efc9c9; }
.callout.pine { background: var(--pine-soft); border-color: #cfe0d5; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; z-index: 50;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: transform .25s, opacity .25s; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--berry); }

/* Admin */
.status-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--gold-soft); color: #8a6214; white-space: nowrap; }
.status-pill.drawn { background: var(--pine-soft); color: var(--pine); }
table.people-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.people-table td { padding: 10px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.people-table .who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.people-table .who span:first-child { font-size: 22px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #f0ebe2; color: var(--muted); margin: 2px 4px 2px 0; white-space: nowrap; }
.tag.ok { background: var(--pine-soft); color: var(--pine); }
.events-list { display: grid; gap: 10px; }
.event-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--line); background: #fff; border-radius: 16px; cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%;
}
.event-item:hover { border-color: var(--pine-2); }
details summary { cursor: pointer; font-weight: 600; color: var(--pine); }
details[open] summary { margin-bottom: 6px; }
.hidden { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--pine); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
footer.foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 30px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 480px) {
  .row { flex-direction: column; gap: 0; }
}
@media (max-width: 420px) {
  .countdown .unit { min-width: 60px; }
  .card { padding: 18px; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
}
