:root { --red:#b91c1c; --red-dark:#7f1d1d; --green:#166534; --gold:#d97706; --cream:#fefce8; --ink:#1f2937; }
* { box-sizing:border-box; }
body { margin:0; font-family:Inter,system-ui,-apple-system,sans-serif; color:var(--ink); background:linear-gradient(145deg,#fffaf0,#eefcf3); min-height:100vh; }
.snow-app { min-height:100vh; display:grid; place-content:center; width:min(92%,460px); margin:auto; gap:16px; padding:24px 0; }
.brand,.admin-header { display:flex; align-items:center; gap:10px; color:var(--red); }
.brand { justify-content:center; }.brand h1 { font-size:22px; }
.login-snow { position:fixed; inset:0; z-index:0; pointer-events:none; overflow:hidden; }
.login-snow i { position:absolute; width:7px; height:7px; border-radius:50%; background:white; box-shadow:0 0 8px rgba(255,255,255,.9); animation:snowfall 9s linear infinite; }
.login-snow i:nth-child(1){left:8%;top:-10px}.login-snow i:nth-child(2){left:20%;top:-30px;animation-delay:-3s}.login-snow i:nth-child(3){left:36%;top:-5px;animation-delay:-5s}.login-snow i:nth-child(4){left:52%;top:-20px;animation-delay:-1s}.login-snow i:nth-child(5){left:68%;top:-25px;animation-delay:-7s}.login-snow i:nth-child(6){left:82%;top:-8px;animation-delay:-4s}.login-snow i:nth-child(7){left:92%;top:-35px;animation-delay:-6s}.login-snow i:nth-child(8){left:44%;top:-15px;animation-delay:-8s}
@keyframes snowfall { to{transform:translateY(calc(100vh + 40px)) rotate(180deg)} }
.login-decoration { display:flex; align-items:center; justify-content:center; gap:18px; color:#d97706; margin:-4px 0 14px; }
.login-decoration b { font-size:38px; filter:drop-shadow(0 5px 8px rgba(185,28,28,.12)); }
.login-decoration span { font-size:16px; animation:twinkle 1.2s ease-in-out infinite alternate; }
#login-view { position:relative; z-index:2; border:1px solid rgba(185,28,28,.16); background:rgba(255,255,255,.94); backdrop-filter:blur(8px); text-align:center; }
#login-view h2 { margin-bottom:8px; color:#7f1d1d; font-family:Georgia,"Times New Roman",serif; font-size:32px; }
#login-view label { text-align:left; }
#login-view select { height:50px; border-color:#cbd5b8; background:#fffef8; }
.login-intro { margin:-6px 0 8px; color:#6b7280; line-height:1.5; }
.card { background:rgba(255,255,255,.96); border:1px solid rgba(185,28,28,.12); border-radius:20px; padding:24px; box-shadow:0 16px 50px rgba(31,41,55,.10); }
.narrow { width:min(92vw,420px); margin:auto; }
.eyebrow { color:var(--red); font-weight:800; text-transform:uppercase; letter-spacing:.12em; font-size:12px; margin:0 0 6px; }
h2 { margin:0 0 18px; }
label { display:block; font-size:13px; font-weight:700; margin:14px 0 7px; }
input,select { width:100%; border:1px solid #d1d5db; border-radius:10px; padding:12px; font:inherit; background:white; }
.pin-input { text-align:center; letter-spacing:.55em; font-size:24px; font-weight:800; }
.optional { color:#6b7280; font-weight:500; }
.personal-pin { margin:18px auto 6px; max-width:280px; padding:12px; border:1px dashed #d97706; border-radius:12px; background:#fffbeb; }
.personal-pin small { display:block; color:#6b7280; margin-bottom:5px; }
.personal-pin strong { color:var(--red); font-size:24px; letter-spacing:.35em; }
button { border:0; border-radius:10px; padding:12px 16px; font-weight:800; cursor:pointer; }
.primary { background:var(--red); color:white; width:100%; margin-top:16px; }.primary:hover { background:var(--red-dark); }
.secondary { background:var(--green); color:white; }.danger { background:#fee2e2; color:#991b1b; }.link-button { background:transparent; color:var(--red); padding:4px; }
.hidden { display:none!important; }.error { color:#b91c1c; min-height:20px; }
.christmas-room { position:relative; height:390px; margin:14px 0 6px; overflow:hidden; border:1px solid #e7d8ad; border-radius:18px; background:linear-gradient(180deg,#f8edd0 0 68%,#d7b98b 68% 100%); box-shadow:inset 0 0 40px rgba(127,29,29,.08); }
.wall-title,.wall-family { position:absolute; z-index:6; left:0; right:0; text-align:center; color:#b7791f; font-family:Georgia,"Times New Roman",serif; text-shadow:0 1px 0 #fff7c7,0 2px 6px rgba(90,55,0,.28); }
.wall-title { top:46px; font-size:14px; letter-spacing:.18em; text-transform:uppercase; }
.wall-family { top:66px; font-size:21px; font-weight:800; letter-spacing:.05em; }
.corner-garland { position:absolute; z-index:4; top:-8px; width:43%; height:180px; border-top:7px solid #166534; border-radius:50%; transform-origin:top center; pointer-events:none; }
.corner-garland::after { content:""; position:absolute; left:0; right:0; top:-10px; height:40px; border-bottom:3px dotted #3f7d35; border-radius:50%; }
.corner-garland i { position:absolute; width:12px; height:12px; border-radius:50%; background:#facc15; box-shadow:0 0 10px #facc15; animation:twinkle 1.2s ease-in-out infinite alternate; }
.corner-garland i:nth-child(1){left:12%;top:12px}.corner-garland i:nth-child(2){left:29%;top:25px;animation-delay:.2s;background:#ef4444;box-shadow:0 0 10px #ef4444}.corner-garland i:nth-child(3){left:46%;top:34px;animation-delay:.4s}.corner-garland i:nth-child(4){left:64%;top:41px;animation-delay:.6s;background:#ef4444;box-shadow:0 0 10px #ef4444}.corner-garland i:nth-child(5){left:82%;top:44px;animation-delay:.8s}
.corner-garland-left { left:-18px; transform:rotate(35deg); }
.corner-garland-right { right:-18px; transform:rotate(-35deg); }
@keyframes twinkle { from{opacity:.35;transform:scale(.75)} to{opacity:1;transform:scale(1.15)} }
.stockings { position:absolute; z-index:3; top:121px; left:5%; right:5%; display:flex; flex-direction:column; gap:12px; }
.family-row { width:100%; }
.family-row h3 { margin:0 0 5px; text-align:center; color:#7f1d1d; font-family:Georgia,"Times New Roman",serif; font-size:13px; letter-spacing:.08em; }
.family-stockings { display:flex; justify-content:center; align-items:flex-end; gap:clamp(8px,2vw,22px); }
.stocking { position:relative; width:72px; height:112px; margin:auto; border:0; border-radius:8px 8px 18px 18px; isolation:isolate; filter:none; transform-origin:top center; transition:.18s ease; }
.stocking::before { content:""; position:absolute; z-index:3; left:-8%; top:-7%; width:116%; height:20%; border-radius:7px; background:linear-gradient(135deg,#fffdf7,#eee4cd 55%,#fff 56%); border:2px solid rgba(127,29,29,.12); box-shadow:0 3px 6px rgba(31,41,55,.14); }
.sock-name {
  position:absolute;
  z-index:5;
  left:-4%;
  right:-4%;
  top:-5%;
  height:20%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#6b3d18;
  font-family:Georgia,"Times New Roman","Apple Chancery",serif;
  font-weight:800;
  font-size:clamp(8px,.75vw,12px);
  line-height:1;
  overflow-wrap:anywhere;
  text-align:center;
  text-shadow:0 1px 0 #fff;
  transform:rotate(-1deg);
}
.stocking.name-large .sock-name { font-size:clamp(10px,.95vw,15px); }
.stocking.name-medium .sock-name { font-size:clamp(9px,.82vw,13px); letter-spacing:-.01em; }
.stocking.name-small .sock-name { font-size:clamp(8px,.68vw,11px); letter-spacing:-.02em; transform:rotate(-1deg) scaleX(.92); }
.stocking:disabled { cursor:default; opacity:1; }
.stocking-red { background:#b91c1c}.stocking-green { background:#166534}.stocking-gold { background:#d97706}
.stocking.active { z-index:5; }
.stocking.target-sock { position:relative; z-index:6; transform:scale(1.12) translateY(-6px); filter:none; outline:none; box-shadow:none; animation:none; }
.stocking.target-sock::before { border:2px solid rgba(127,29,29,.12); box-shadow:0 4px 9px rgba(31,41,55,.14); }
.stocking.target-sock::after { border:0; box-shadow:none; }
.stocking.target-sock .sock-name::after {
  content:"";
  position:absolute;
  z-index:-1;
  left:-22%;
  right:-22%;
  top:-58%;
  height:42%;
  border:2px solid #d6aa48;
  border-radius:999px;
  background:linear-gradient(90deg,#b7791f,#f4dc82,#b7791f);
  box-shadow:0 3px 8px rgba(127,29,29,.18);
}
.fireplace { position:absolute; z-index:2; left:50%; bottom:-3px; width:54%; max-width:290px; height:205px; transform:translateX(-50%); background:#9f7c58; border:12px solid #eee1c3; border-bottom:0; border-radius:8px 8px 0 0; box-shadow:0 -8px 20px rgba(31,41,55,.12); }
.mantel { position:absolute; left:-18px; right:-18px; top:-13px; height:25px; border-radius:4px; background:#eee1c3; border:3px solid #d5bf91; }
.fireplace-opening { position:absolute; left:12%; right:12%; bottom:0; height:75%; border-radius:55% 55% 5px 5px; background:#2d1b16; overflow:hidden; }
.logs { position:absolute; z-index:2; left:20%; bottom:10%; width:60%; height:14%; border-radius:20px; background:#5b3825; transform:rotate(-4deg); }
.flames { position:absolute; left:20%; right:20%; bottom:18%; height:58%; display:flex; align-items:flex-end; justify-content:center; gap:4%; }
.flames i { display:block; width:27%; height:70%; border-radius:70% 30% 65% 35%; background:#f97316; box-shadow:0 0 14px #fb923c; transform-origin:bottom; animation:flame .38s ease-in-out infinite alternate; }
.flames i:nth-child(2){height:100%;background:#fde047;animation-delay:.12s}.flames i:nth-child(3){height:82%;animation-delay:.23s}.flames i:nth-child(4){height:55%;background:#fde047;animation-delay:.06s}
@keyframes flame { from{transform:scaleY(.82) rotate(-4deg)} to{transform:scaleY(1.08) rotate(5deg)} }
.result { text-align:center; margin-top:20px; }.result h2 { color:var(--red); font-size:32px; margin:8px 0; }
.close-result { position:absolute; z-index:30; top:10px; right:10px; width:44px; height:44px; min-height:44px; padding:0; border:1px solid #e5e7eb; border-radius:50%; background:white; color:#6b7280; font-size:28px; line-height:40px; }
#draw-view { position:relative; }
#draw-view.has-reveal .christmas-room { opacity:1; filter:none; transform:none; transition:.5s ease; }
#confetti { position:fixed; inset:0; width:100%; height:100%; pointer-events:none; }
.draw-mode { overflow:hidden; }
.draw-mode .snow-app { width:100%; max-width:none; min-height:100vh; display:block; margin:0; padding:0; }
.draw-mode .brand { display:none; }
.draw-mode #draw-view { position:fixed; z-index:50; inset:0; min-height:100vh; width:100%; margin:0; border:0; border-radius:0; padding:0; background:#f8edd0; }
.draw-mode #draw-view > .eyebrow,
.draw-mode #draw-view > h2 { display:none; }
.draw-mode .christmas-room { height:100vh; min-height:560px; margin:0; border:0; border-radius:0; background:linear-gradient(180deg,#f8edd0 0 68%,#d7b98b 68% 100%); }
.draw-mode .wall-title { top:clamp(64px,9vh,100px); font-size:clamp(28px,3vw,48px); font-weight:900; letter-spacing:.12em; }
.draw-mode .wall-family { top:clamp(105px,15vh,160px); font-size:clamp(34px,5vw,74px); letter-spacing:.08em; }
.draw-mode .corner-garland { top:-20px; height:clamp(150px,20vh,220px); border-top-width:9px; }
.draw-mode .corner-garland i { width:clamp(14px,1vw,20px); height:clamp(14px,1vw,20px); }
.draw-mode .stockings {
  top:clamp(190px,24vh,245px);
  left:8%;
  right:8%;
  bottom:auto;
  height:clamp(230px,34vh,330px);
  max-height:none;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  grid-auto-rows:minmax(0,1fr);
  align-items:stretch;
  justify-content:center;
  gap:clamp(8px,1.5vw,18px);
  overflow:visible;
}
.draw-mode .family-row {
  width:100%;
  min-width:0;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  padding:8px 12px 14px;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.draw-mode .family-row h3 {
  flex:0 0 auto;
  width:max-content;
  max-width:90%;
  min-height:24px;
  margin:0 auto 8px;
  padding:5px 13px 4px;
  text-align:center;
  color:#fffdf5;
  background:#166534;
  border:2px solid #f4e2a2;
  border-radius:6px 6px 8px 8px;
  box-shadow:0 5px 10px rgba(31,41,55,.16);
  font-size:clamp(11px,1vw,16px);
  line-height:1.1;
}
.draw-mode .family-stockings {
  height:clamp(78px,11vh,112px);
  min-height:0;
  display:flex;
  justify-content:center;
  align-items:flex-end;
  gap:clamp(6px,1vw,12px);
  width:100%;
}
.draw-mode .stocking { width:clamp(48px,4.6vw,76px); height:clamp(74px,10vh,104px); max-height:none; aspect-ratio:auto; }
.draw-mode .sock-name { font-size:clamp(9px,.85vw,14px); }
.draw-mode .fireplace { width:clamp(280px,29vw,480px); max-width:none; height:clamp(210px,27vh,290px); border-width:clamp(16px,1.7vw,24px); }
.draw-mode .mantel { height:clamp(28px,3.2vh,40px); left:-26px; right:-26px; }
.draw-mode #draw-button { position:absolute; z-index:10; left:50%; bottom:clamp(24px,4vh,48px); width:min(420px,80vw); transform:translateX(-50%); margin:0; }
.draw-mode #draw-view.has-reveal .christmas-room { opacity:1; filter:none; transform:none; }
.draw-mode #draw-view.has-reveal .result {
  position:fixed;
  z-index:100;
  left:50%;
  right:auto;
  top:50%;
  bottom:auto;
  width:min(560px,48vw);
  min-height:0;
  max-height:calc(100vh - 80px);
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  margin:0;
  padding:28px 34px;
  transform:translate(-50%, -50%);
  border:3px solid #d6aa48;
  border-radius:20px;
  background:#f8edd0;
  box-shadow:0 18px 55px rgba(31,41,55,.30),0 0 0 6px rgba(214,170,72,.16);
}
.draw-mode #draw-view.has-reveal .result h2 { width:100%; margin:8px 0 12px; }
.draw-mode #draw-view.has-reveal .result form { margin-top:14px; }
.draw-mode #draw-view.has-reveal .stockings { z-index:24; width:94%; right:3%; left:3%; }
.draw-mode #draw-view.has-reveal .target-sock { z-index:30; }
.admin-app { max-width:1100px; margin:auto; padding:18px; }.admin-header { justify-content:space-between; margin-bottom:18px; }.admin-header strong { color:var(--ink); }
.stats { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }.stats article { background:white;border-radius:14px;padding:16px;text-align:center;box-shadow:0 8px 24px rgba(31,41,55,.07); }.stats span { display:block;font-size:28px;font-weight:900;color:var(--red); }.stats small { color:#6b7280; }
.admin-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:12px 0; }.wide { grid-column:1/-1; }
.inline-form,.participant-form { display:flex; gap:8px; }.inline-form button,.participant-form button { white-space:nowrap; }.participant-form { margin-bottom:12px; }
.simple-list { list-style:none;padding:0;margin:12px 0 0; }.simple-list li { display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid #eee; }
.table-wrap { overflow-x:auto; }table { width:100%;border-collapse:collapse;font-size:14px;}th,td{text-align:left;padding:10px;border-bottom:1px solid #eee;}td button{padding:6px 8px;margin-left:4px;}
.draw-controls { display:flex;justify-content:space-between;align-items:center; }.draw-controls h2 { margin-bottom:4px; }
.draw-actions { display:flex; align-items:center; gap:10px; }
.draw-actions .primary { width:auto; margin:0; white-space:nowrap; }
.participant-actions { display:flex; align-items:center; gap:8px; min-width:190px; }
.participant-actions button { margin:0; white-space:nowrap; }
.simple-list li button { margin-left:10px; }
@media(max-width:700px){
  .admin-grid{grid-template-columns:1fr}
  .wide{grid-column:auto}
  .stats{grid-template-columns:repeat(3,1fr)}
  .participant-form{display:grid}
  .draw-controls{align-items:stretch;gap:12px;flex-direction:column}
  .draw-actions{width:100%;display:grid;grid-template-columns:1fr}
  .draw-actions button{width:100%;margin:0!important}
  .participant-actions{display:grid;gap:6px;min-width:170px}
  .participant-actions button{width:100%}
}
@media(max-width:700px){
  body { background:linear-gradient(160deg,#fffaf0,#eefcf3); }
  .snow-app { width:min(100%,480px); min-height:100svh; padding:12px; align-content:start; }
  .brand { margin:8px 0 4px; }
  .card { border-radius:16px; padding:18px; }
  input, select, button { min-height:44px; }
  .pin-input { font-size:22px; }
  .roulette { height:132px; }
  .admin-app { width:100%; padding:10px; }
  .admin-header { padding:4px 2px; }
  .stats { gap:6px; }
  .stats article { padding:12px 6px; }
  .stats span { font-size:22px; }
  .table-wrap { margin:0 -18px; padding:0 18px; }
  th, td { padding:9px 7px; }
  td button { min-height:36px; }
  .christmas-room { height:340px; }
  .wall-title { top:40px; }
  .wall-family { top:60px; font-size:17px; }
  .stockings { top:108px; }
  .stocking { max-height:92px; }
  .fireplace { height:178px; width:60%; }
  #draw-view.has-reveal .result { left:12px; right:12px; top:76px; min-height:340px; padding:16px; }
  .draw-mode .wall-title { top:52px; }
  .draw-mode .wall-family { top:82px; }
  .draw-mode .corner-garland { top:-12px; height:120px; width:48%; border-top-width:6px; }
  .draw-mode .stockings { top:155px; left:4%; right:4%; height:clamp(190px,31vh,260px); max-height:none; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .draw-mode .family-row { padding:6px 5px 9px; border-radius:12px; }
  .draw-mode .family-row h3 { min-height:18px; margin-bottom:5px; padding:3px 7px; font-size:9px; }
  .draw-mode .family-stockings { height:58px; gap:3px; }
  .draw-mode .stocking { width:clamp(40px,11vw,56px); height:58px; }
  .draw-mode .stocking span { font-size:9px; }
  .draw-mode .fireplace { width:62%; height:220px; }
  .draw-mode #draw-view.has-reveal .result { left:12px; right:12px; top:50%; width:auto; min-height:0; max-height:calc(100svh - 24px); transform:translateY(-50%); padding:16px 12px; }
  .draw-mode #draw-view.has-reveal .stockings { z-index:24; width:auto; right:3%; left:3%; }
}
