@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Mountains+of+Christmas:wght@700&display=swap');
:root {
  --red: #b3192b; --red-d: #7a0f1c; --green: #1d7a46; --green-d: #0f4a2a;
  --gold: #f6c453; --gold-d: #c9902a; --cream: #fff6e5; --wood: #6b3e1f; --wood-d: #4a2912;
  --ink: #241612; --night: #13202e; --night2: #1d3247;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Fredoka', system-ui, sans-serif; color: var(--cream);
  background: radial-gradient(ellipse at top, var(--night2), var(--night) 70%); background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
canvas.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: 16px 16px 40px; }
h1, h2, .title { font-family: 'Mountains of Christmas', 'Fredoka', cursive; color: var(--gold); margin: .2em 0; text-shadow: 0 3px 0 var(--red-d); }
h1 { font-size: 2.6rem; text-align: center; line-height: 1.05; }
h2 { font-size: 1.9rem; }
p { line-height: 1.45; }
a { color: var(--gold); }
.card {
  background: var(--cream); color: var(--ink); border-radius: 18px; padding: 18px; margin: 14px 0;
  box-shadow: 0 6px 0 var(--wood-d), 0 10px 24px rgba(0,0,0,.35); border: 3px solid var(--wood);
}
.card h2 { color: var(--red); text-shadow: none; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 12px; border-radius: 12px;
  border: 2px solid #d9c6a5; background: #fff; color: var(--ink);
}
input:focus { outline: 3px solid var(--gold); border-color: var(--gold-d); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 1.15rem; padding: 13px 20px; border-radius: 14px;
  border: none; cursor: pointer; color: #fff; background: var(--red); box-shadow: 0 5px 0 var(--red-d);
  text-decoration: none; transition: transform .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-d); }
.btn.green { background: var(--green); box-shadow: 0 5px 0 var(--green-d); }
.btn.gold { background: var(--gold); color: var(--ink); box-shadow: 0 5px 0 var(--gold-d); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; border: 2px solid #d9c6a5; }
.btn.small { font-size: .95rem; padding: 8px 12px; border-radius: 10px; }
.btn.block { width: 100%; margin-top: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { opacity: .7; }
.center { text-align: center; }
.err { color: var(--red); font-weight: 600; min-height: 1.3em; }

.face { width: 56px; height: 56px; border-radius: 50%; overflow: hidden; background: #ddd; flex: none; border: 3px solid var(--gold); box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.face img, .face svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.face.xl { width: 140px; height: 140px; border-width: 5px; }
.face.lg { width: 96px; height: 96px; border-width: 4px; }
.face.sm { width: 40px; height: 40px; border-width: 2px; }

.avatars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatars button { border: 3px solid transparent; border-radius: 50%; padding: 0; background: none; cursor: pointer; aspect-ratio: 1; overflow: hidden; }
.avatars button svg { width: 100%; height: 100%; display: block; }
.avatars button.on { border-color: var(--red); box-shadow: 0 0 0 3px var(--gold); }

.pin { letter-spacing: .6em; text-align: center; font-size: 1.6rem; }
.giftno {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; padding: .1em .45em;
  background: var(--red); color: #fff; border-radius: 10px; font-weight: 700; border: 2px dashed var(--gold);
}
.tag { font-size: 4rem; padding: .1em .5em; border-width: 4px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #eadbc1; font-size: .85rem; font-weight: 600; }
.pill.yes { background: #c8ecd5; } .pill.no { background: #f6c9cf; } .pill.maybe { background: #fbe6b0; }

.conn { position: fixed; top: 10px; left: 50%; transform: translate(-50%, -80px); background: var(--red); color: #fff; padding: 6px 14px; border-radius: 999px; z-index: 50; transition: transform .3s; font-weight: 600; }
.conn.show { transform: translate(-50%, 0); }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px); background: var(--green); color: #fff; padding: 12px 20px; border-radius: 14px; z-index: 60; transition: transform .3s; font-weight: 600; max-width: 90vw; text-align: center; }
#toast.show { transform: translate(-50%, 0); } #toast.bad { background: var(--red); }

/* phone game screen */
body.phone { min-height: 100vh; min-height: 100dvh; }
body.phone::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40; border: 0 solid transparent; transition: border .3s; }
body.phone.border-red::after { border: 16px solid #e53935; box-shadow: inset 0 0 40px #e53935; }
body.phone.border-green::after { border: 16px solid #2ecc71; box-shadow: inset 0 0 40px #2ecc71; }
.stage { min-height: calc(100dvh - 120px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.bigspin {
  width: 230px; height: 230px; border-radius: 50%; border: 8px solid var(--gold); font: inherit; font-weight: 700;
  font-size: 2.6rem; color: #fff; background: radial-gradient(circle at 35% 30%, #ef5350, var(--red) 55%, var(--red-d));
  box-shadow: 0 10px 0 var(--red-d), 0 0 40px rgba(246,196,83,.6); cursor: pointer; animation: pulse 1.2s infinite;
}
.bigspin:active { transform: translateY(6px); box-shadow: 0 4px 0 var(--red-d); }
@keyframes pulse { 50% { box-shadow: 0 10px 0 var(--red-d), 0 0 70px rgba(246,196,83,.95); } }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; width: 100%; }
.pickgrid button { background: var(--cream); color: var(--ink); border: 3px solid var(--wood); border-radius: 16px; padding: 10px 4px; font: inherit; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.pickgrid button .face { width: 60px; height: 60px; }
.pickgrid button.on { background: var(--gold); border-color: var(--red); }
.pickgrid button.taken { opacity: .3; pointer-events: none; }
.pickgrid button.green { border-color: #2ecc71; box-shadow: 0 0 0 3px #2ecc71; }
.holding { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(10,18,28,.92); border-top: 2px solid var(--wood); }
.big { font-size: 1.6rem; font-weight: 700; }
.huge { font-size: 2.2rem; font-weight: 700; color: var(--gold); }
.countdown { font-size: 1.4rem; color: var(--gold); font-weight: 700; }
