/* Secret Santa - Christmas theme, mobile-first, no framework. */

:root {
  --bg: #f7f1e6;
  --ink: #2b1d1d;
  --muted: #8a7567;
  --card: #ffffff;
  --red: #b3272d;        /* holly red */
  --red-dark: #8f1d23;
  --pine: #1f5c43;       /* pine green */
  --pine-dark: #174536;
  --gold: #c98a2d;
  --line: #eadfd0;
  --ok: #1f5c43;
  --danger: #b3272d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 500px at 50% -100px, rgba(31, 92, 67, 0.10), transparent),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

/* --- header ----------------------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, var(--pine-dark), var(--pine));
  color: #fff;
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 12px; padding-bottom: 12px;
}
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: 0.2px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link { color: #e6efe9; text-decoration: none; font-size: 0.9rem; padding: 6px 10px; border-radius: 8px; }
.nav-link:hover { background: rgba(255,255,255,0.14); color: #fff; }
.nav-auth { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-user { font-weight: 700; color: #ffe9c4; }

main.wrap { padding-top: 20px; padding-bottom: 56px; }

/* --- hero (landing) ---------------------------------------------------- */
.hero { text-align: center; padding: 30px 8px 22px; }
.hero-emoji { font-size: 3.2rem; animation: sway 3s ease-in-out infinite; }
.hero-title { font-size: 1.9rem; margin: 8px 0 6px; color: var(--pine-dark); }
.hero-sub { color: var(--muted); margin: 0 0 8px; font-size: 1.02rem; }
@keyframes sway { 0%,100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }

/* --- headings / text --------------------------------------------------- */
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
.dim { color: var(--muted); }
.small { font-size: 0.85rem; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f3ecdf; padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }

/* --- cards ------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(43, 29, 29, 0.06);
}
.auth-card { max-width: 400px; margin: 4px auto 24px; }
.card-test { border-color: var(--gold); background: #fffaf0; }

/* --- forms ------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; }
.inline-label { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); width: 100%; font-size: 1rem;
}
input:focus, select:focus { outline: 2px solid var(--pine); outline-offset: 1px; }
.inline-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.inline-row input, .inline-row select { width: auto; flex: 1 1 140px; min-width: 120px; }
.row-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.row-form input { width: auto; flex: 1 1 120px; min-width: 100px; }
.row-form select { width: auto; flex: 1 1 130px; min-width: 110px; }

/* buttons: ≥44px tap targets */
.cta, .ghost-btn, .link-btn {
  font: inherit; border: none; border-radius: 10px; cursor: pointer; min-height: 44px;
  padding: 10px 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.cta { background: linear-gradient(180deg, var(--red), var(--red-dark)); color: #fff; box-shadow: 0 2px 6px rgba(143,29,35,0.3); }
.cta:hover { filter: brightness(1.06); }
.cta.big { font-size: 1.1rem; width: 100%; min-height: 56px; }
.ghost-btn { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.ghost-btn:hover { border-color: var(--pine); color: var(--pine); }
.ghost-btn.danger { color: var(--danger); border-color: #ecc9c9; }
.link-btn { background: none; color: var(--pine); padding: 4px 8px; min-height: 44px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.inline-form { display: inline; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- tables (admin) ---------------------------------------------------- */
.admin-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.admin-table th, .admin-table td {
  text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line);
  vertical-align: top; font-size: 0.92rem;
}
.admin-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
.row-actions { white-space: nowrap; }
@media (max-width: 520px) {
  .admin-table thead { display: none; }
  .admin-table tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .admin-table td { display: block; border: none; padding: 4px 0; }
}

/* --- members grid ------------------------------------------------------ */
.member-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px; border: none; padding: 0; margin: 12px 0;
}
.checkbox-label {
  flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 0.92rem;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.checkbox-label input { width: 18px; height: 18px; }

/* --- messages ---------------------------------------------------------- */
.form-error { color: var(--danger); font-weight: 600; }
.form-ok { color: var(--ok); font-weight: 600; }

/* --- test badge + hash view ------------------------------------------- */
.badge-test {
  display: inline-block; background: var(--gold); color: #fff; font-size: 0.72rem;
  font-weight: 800; letter-spacing: 0.5px; padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.test-results { background: #fff7e6; border: 1px dashed var(--gold); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.test-results h3 { margin: 0 0 6px; font-size: 0.95rem; }
.hash-view { margin: 10px 0; }
.hash-view summary { cursor: pointer; color: var(--pine); font-weight: 600; padding: 6px 0; }
.hash-view summary:hover { text-decoration: underline; }

/* --- reveal card ------------------------------------------------------- */
.reveal { position: relative; text-align: center; min-height: 150px; }
.reveal-face {
  width: 100%; min-height: 150px; border: none; border-radius: 14px; cursor: pointer;
  background: linear-gradient(160deg, var(--red), var(--red-dark)); color: #fff;
  font-size: 1.3rem; font-weight: 800; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(143,29,35,0.35);
  transition: transform 0.15s ease;
}
.reveal-face:hover { transform: scale(1.02); }
.reveal-answer { display: none; padding: 18px 8px; }
.reveal.is-open .reveal-face { display: none; }
.reveal.is-open .reveal-answer { display: block; animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.result-label { color: var(--muted); margin: 0 0 6px; }
.result-name { font-size: 1.8rem; font-weight: 800; color: var(--pine); margin: 0; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- confetti ---------------------------------------------------------- */
.confetti {
  position: absolute; top: 50%; left: 50%; font-size: 1.2rem; pointer-events: none;
  animation: fly 1.4s ease-out forwards;
}
@keyframes fly {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.4) rotate(180deg); opacity: 0; }
}
