/* Advent of Cyber — cozy winter night theme */
:root {
  --bg: #070b22;
  --bg-2: #0e1538;
  --panel: rgba(20, 28, 70, 0.72);
  --panel-solid: #131b45;
  --panel-2: rgba(255, 255, 255, 0.04);
  --line: rgba(160, 180, 255, 0.16);
  --text: #e9edff;
  --muted: #8f98c4;
  --gold: #ffcf5a;
  --gold-2: #ffb703;
  --green: #3ddc97;
  --red: #ff5a6e;
  --ice: #9fd8ff;
  --purple: #9b5de5;
  --discord: #5865f2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --pixel: "Silkscreen", "JetBrains Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.6 var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(61, 220, 151, 0.12), transparent 60%),
    radial-gradient(900px 500px at 10% -20%, rgba(155, 93, 229, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed;
  display: flex;
  flex-direction: column;
}
a { color: var(--ice); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
code, kbd { font-family: var(--font); background: rgba(255, 255, 255, 0.07); border-radius: 6px; padding: 0.1em 0.4em; font-size: 0.92em; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; }
h2 { font-size: 1.15rem; color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; }
.title-pixel { font-family: var(--pixel); font-weight: 700; letter-spacing: 0.02em; text-shadow: 0 0 18px rgba(255, 207, 90, 0.35); }
.accent { color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 2rem !important; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.topbar, .wrap, .footer { position: relative; z-index: 1; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 34, 0.75);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.logo { display: flex; align-items: baseline; gap: 0.45rem; font-family: var(--pixel); font-size: 1.15rem; color: var(--text); white-space: nowrap; }
.logo:hover { text-decoration: none; color: #fff; }
.logo-mark { color: var(--ice); animation: spin 12s linear infinite; display: inline-block; }
.logo-year { color: var(--gold); }
.nav { display: flex; gap: 0.2rem; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 0.35rem 0.7rem; border-radius: 999px; }
.nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav a.active { color: var(--gold); background: rgba(255, 207, 90, 0.1); }
.nav .admin-link { color: var(--red); }
.me { display: flex; align-items: center; gap: 0.5rem; }
.chip { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.75rem 0.2rem 0.25rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); max-width: 220px; }
.chip img { border-radius: 50%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { text-decoration: none; border-color: var(--ice); }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; font-size: 1.1rem; padding: 0.2rem; }
button.link:hover { color: var(--red); }

/* ---------- layout ---------- */
.wrap { width: min(1200px, 100%); margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); flex: 1; }
.footer { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: 0.8rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 2.5vw, 1.6rem); box-shadow: var(--shadow); backdrop-filter: blur(6px); margin-bottom: 1.4rem; }
.card-inner { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.page-head { margin-bottom: 1.2rem; }
.page-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 0.2rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.lead { font-size: 1.05rem; color: #cfd6ff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: 600 0.92rem var(--font); padding: 0.6rem 1.1rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: progress; transform: none; }
.btn-lg { padding: 0.8rem 1.4rem; font-size: 1rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-primary { background: linear-gradient(180deg, #ffd977, var(--gold-2)); color: #2a1a00; border-color: transparent; }
.btn-primary:hover { color: #2a1a00; }
.btn-discord { background: var(--discord); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(255, 90, 110, 0.15); border-color: rgba(255, 90, 110, 0.5); color: #ffb3bd; }
.btn-gift { background: linear-gradient(135deg, #e63950, #b5179e); border-color: transparent; color: #fff; }
.btn.busy { opacity: 0.7; cursor: progress; animation: pulse 1.2s infinite; }
.tag { display: inline-block; font-size: 0.72rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.tag-ok { color: var(--green); border-color: rgba(61, 220, 151, 0.4); }
.tag-banned { color: var(--red); border-color: rgba(255, 90, 110, 0.5); }

/* ---------- hero / home ---------- */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.5rem; align-items: center; margin: 0.5rem 0 1.5rem; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.4rem); margin-bottom: 0.4rem; }
.hero .btn { margin: 0.4rem 0.4rem 0 0; }
.countdown-card { text-align: center; padding: 1.4rem; border-radius: var(--radius); border: 1px solid rgba(255, 207, 90, 0.35); background: linear-gradient(180deg, rgba(255, 207, 90, 0.08), rgba(255, 207, 90, 0.02)); box-shadow: 0 0 40px rgba(255, 207, 90, 0.08) inset; }
.countdown-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; }
.countdown { font-family: var(--pixel); font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--gold); margin: 0.3rem 0; font-variant-numeric: tabular-nums; }
.countdown.big { font-size: clamp(2rem, 7vw, 3.6rem); }
.countdown-sub { color: var(--muted); font-size: 0.85rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.8rem; margin-bottom: 1.6rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; display: flex; flex-direction: column; }
.stat-value { font-size: 1.3rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-title .stat-value { color: var(--gold); font-size: 1.05rem; padding-top: 0.2rem; }

/* ---------- calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(0.5rem, 1.5vw, 1rem); perspective: 1200px; }
.door { position: relative; aspect-ratio: 1; border-radius: 12px; display: block; color: var(--text); }
.door:hover { text-decoration: none; }
.door-front {
  position: absolute; inset: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #1e2a6b, #141c4b);
  transform-origin: left center; transition: transform 0.6s cubic-bezier(0.3, 1.4, 0.5, 1), box-shadow 0.3s;
  backface-visibility: hidden; overflow: hidden; z-index: 2;
}
.door-num { font-family: var(--pixel); font-size: clamp(1.4rem, 4vw, 2.6rem); line-height: 1; }
.door-title { font-size: 0.7rem; color: var(--muted); max-width: 90%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.3rem; }
.door-date { font-size: 0.7rem; color: var(--muted); margin-top: 0.3rem; }
.door-lock { font-size: 1rem; opacity: 0.55; margin-top: 0.2rem; }
.door-ribbon { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent calc(50% - 5px), rgba(255, 90, 110, 0.55) calc(50% - 5px), rgba(255, 90, 110, 0.55) calc(50% + 5px), transparent calc(50% + 5px)),
              linear-gradient(0deg, transparent calc(50% - 5px), rgba(255, 90, 110, 0.55) calc(50% - 5px), rgba(255, 90, 110, 0.55) calc(50% + 5px), transparent calc(50% + 5px)); }
.door-open .door-num { position: relative; z-index: 1; text-shadow: 0 2px 8px #000; }
.door-behind {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  background-image: url("/static/img/puzzle.svg");
  background-size: calc(var(--cols) * 100%) calc(var(--rows) * 100%);
  background-position: calc(var(--px) / (var(--cols) - 1) * 100%) calc(var(--py) / (var(--rows) - 1) * 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 207, 90, 0.6), 0 0 24px rgba(255, 207, 90, 0.25);
}
.door-locked .door-front { filter: saturate(0.4) brightness(0.75); border-style: dashed; }
.door-open .door-front { border-color: rgba(255, 207, 90, 0.75); box-shadow: 0 0 22px rgba(255, 207, 90, 0.25); animation: glow 2.4s ease-in-out infinite; }
.door-open:hover .door-front { transform: rotateY(-22deg); }
.door-partial .door-front { border-color: var(--ice); transform: rotateY(-35deg); }
.door-solved .door-front { transform: rotateY(-105deg); box-shadow: -6px 0 18px rgba(0, 0, 0, 0.4); }
.door-solved:hover .door-front { transform: rotateY(-95deg); }
.door-star { position: absolute; top: 6px; right: 8px; font-size: 1rem; }
.door-solved::after { content: "⭐"; position: absolute; right: 6px; bottom: 4px; font-size: 1.1rem; z-index: 3; filter: drop-shadow(0 0 6px rgba(255, 207, 90, 0.9)); }
.legend { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: center; color: var(--muted); font-size: 0.8rem; margin-top: 1.2rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
.dot-open { background: var(--gold); }
.dot-solved { background: var(--green); }
.dot-locked { background: #39406e; }

/* ---------- day page ---------- */
.day-nav { display: flex; justify-content: space-between; margin-bottom: 1rem; font-size: 0.9rem; }
.chall-head h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); margin: 0.3rem 0 0.5rem; }
.day-badge { display: inline-block; font-family: var(--pixel); color: var(--gold); font-size: 0.95rem; }
.tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tag-cat { color: var(--ice); border-color: rgba(159, 216, 255, 0.4); }
.diff-easy, .diff-beginner { color: var(--green); border-color: rgba(61, 220, 151, 0.4); }
.diff-medium { color: var(--gold); border-color: rgba(255, 207, 90, 0.4); }
.diff-hard, .diff-insane { color: var(--red); border-color: rgba(255, 90, 110, 0.4); }
.chall-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.5rem; }
.prose { line-height: 1.75; }
.prose pre { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 0.3rem 0.6rem; }
.prose blockquote { margin: 0; padding: 0.4rem 1rem; border-left: 3px solid var(--gold); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.resources { display: flex; flex-direction: column; gap: 0.8rem; margin: 1.4rem 0; align-items: flex-start; }
.instance { width: 100%; border: 1px dashed rgba(159, 216, 255, 0.4); border-radius: 12px; padding: 1rem; background: rgba(159, 216, 255, 0.04); }
.instance-row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.instance .conn { font-size: 1rem; padding: 0.4rem 0.7rem; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 8px; user-select: all; word-break: break-all; }
.instance .expires { color: var(--muted); font-size: 0.85rem; }
.flag-form { display: flex; gap: 0.6rem; margin-top: 1.4rem; }
.flag-form input {
  flex: 1; min-width: 0; font: 1rem var(--font); color: var(--text); padding: 0.7rem 0.9rem; border-radius: 10px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); outline: none;
}
.flag-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 90, 0.2); }
.flag-form.shake { animation: shake 0.4s; }
.flag-result { min-height: 1.6em; margin-top: 0.5rem; }
.flag-result.ok { color: var(--green); }
.flag-result.bad { color: var(--red); }
.solved-banner { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; padding: 1rem 1.2rem; border-radius: 12px; background: linear-gradient(90deg, rgba(61, 220, 151, 0.15), rgba(61, 220, 151, 0.03)); border: 1px solid rgba(61, 220, 151, 0.4); }
.big-star { font-size: 2.2rem; filter: drop-shadow(0 0 10px rgba(255, 207, 90, 0.8)); animation: bob 2.5s ease-in-out infinite; }
.banner { padding: 0.5rem 0.8rem; border-radius: 10px; margin-bottom: 1rem; font-size: 0.85rem; }
.banner-admin { background: rgba(255, 90, 110, 0.12); border: 1px solid rgba(255, 90, 110, 0.4); }
.admin-box { margin-top: 1.4rem; font-size: 0.85rem; color: var(--muted); }
.admin-box code { color: var(--gold); word-break: break-all; }

.candle-card { text-align: center; padding: 1rem; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 1rem; }
.pts-now { font-family: var(--pixel); font-size: 2.6rem; color: var(--gold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.pts-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; }
.candle { position: relative; width: 34px; height: 120px; margin: 1rem auto 0.6rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.wax { width: 34px; height: calc(10px + var(--melt) * 96px); border-radius: 6px 6px 4px 4px; transition: height 1s linear;
  background: linear-gradient(90deg, #e63950 0 45%, #ff6b81 45% 60%, #e63950 60%); box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.25); position: relative; }
.wax::before { content: ""; position: absolute; top: -6px; left: 50%; width: 2px; height: 8px; background: #333; transform: translateX(-50%); }
.flame { width: 14px; height: 22px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; margin-bottom: 4px;
  background: radial-gradient(circle at 50% 70%, #fff7c2 0 20%, #ffcf5a 40%, #ff8c2b 70%, transparent 72%);
  filter: drop-shadow(0 0 10px rgba(255, 180, 60, 0.9)); animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
[data-solved="1"] .flame { animation: none; opacity: 0.25; filter: none; }

.solvers h3 { font-size: 0.95rem; margin-bottom: 0.6rem; }
.first-blood { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; font-size: 0.85rem; }
.first-blood a { display: inline-flex; align-items: center; gap: 0.35rem; }
.first-blood img, .avatars img { border-radius: 50%; }
.avatars { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.avatars img { border: 2px solid var(--line); transition: transform 0.15s; }
.avatars a:hover img { transform: scale(1.15); border-color: var(--gold); }

/* ---------- locked / error / login ---------- */
.locked, .error, .login { max-width: 620px; margin: 2rem auto; text-align: center; }
.locked-door { width: 140px; height: 160px; margin: 0 auto 1rem; border-radius: 12px; border: 2px dashed rgba(255, 255, 255, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--pixel); font-size: 3rem;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 10px, transparent 10px 20px), #141c4b; }
.locked-door i { font-style: normal; font-size: 1.4rem; }
.error-art { font-size: 4rem; animation: bob 3s ease-in-out infinite; }
.error h1 { font-size: 3rem; margin: 0.2rem 0; }
.dev-login { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 0.7rem; align-items: center; }
.dev-login h2 { font-size: 1rem; }
.dev-login input[name="name"] { font: 1rem var(--font); padding: 0.6rem 0.8rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); color: var(--text); width: min(320px, 100%); }
.toggle { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--muted); cursor: pointer; font-size: 0.85rem; }

/* ---------- scoreboard ---------- */
.table-wrap { overflow-x: auto; }
.board, .table { width: 100%; border-collapse: collapse; }
.board th, .table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board td, .table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid rgba(160, 180, 255, 0.07); vertical-align: middle; }
.table .num, .board .col-pts { text-align: right; }
.table.narrow { width: auto; min-width: 280px; }
.table tr.dim td { opacity: 0.5; }
.trunc { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.col-rank { width: 3rem; text-align: center !important; font-weight: 800; }
.col-pts strong { font-size: 1.1rem; color: var(--gold); }
.elf { display: flex; align-items: center; gap: 0.7rem; color: var(--text); }
.elf:hover { text-decoration: none; }
.elf img { border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.elf span { display: flex; flex-direction: column; min-width: 0; }
.elf strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.elf small { color: var(--muted); font-size: 0.72rem; }
.board tr.is-me td { background: rgba(159, 216, 255, 0.07); }
.board tr.top1 .elf img { border-color: #ffd700; box-shadow: 0 0 12px rgba(255, 215, 0, 0.5); }
.board tr.top2 .elf img { border-color: #c0c8e0; }
.board tr.top3 .elf img { border-color: #d08a4f; }
.cells { display: grid; grid-template-columns: repeat(12, 10px); gap: 3px; }
.cell { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); }
.cell.ontime { background: var(--gold); box-shadow: 0 0 6px rgba(255, 207, 90, 0.6); }
.cell.late { background: #8e9bd8; }
.page-head .cell { vertical-align: middle; margin: 0 3px 0 8px; }
.badge-mini { font-size: 1.05rem; margin-right: 1px; cursor: default; }
.col-badges { max-width: 220px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.6s infinite; margin-right: 4px; }

/* ---------- profile & badges ---------- */
.profile { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.profile-avatar { border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 24px rgba(255, 207, 90, 0.35); }
.profile-info h1 { margin: 0; }
.profile-title { color: var(--gold); font-family: var(--pixel); margin-bottom: 0.4rem; }
.profile-stats { display: flex; gap: 1.2rem; flex-wrap: wrap; color: var(--muted); }
.profile-stats strong { color: var(--text); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.7rem; }
.badge-grid.compact { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 1rem; }
.badge { display: grid; grid-template-columns: 2.4rem 1fr; grid-template-rows: auto auto; column-gap: 0.6rem; align-items: center; padding: 0.7rem 0.8rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.badge-emoji { grid-row: span 2; font-size: 1.8rem; text-align: center; }
.badge-name { font-weight: 800; font-size: 0.9rem; }
.badge-desc { font-size: 0.74rem; color: var(--muted); line-height: 1.35; }
.badge.earned { border-color: rgba(255, 207, 90, 0.45); background: linear-gradient(135deg, rgba(255, 207, 90, 0.1), transparent); }
.badge.locked { opacity: 0.45; }
.badge.locked .badge-emoji { filter: grayscale(1); }

/* ---------- puzzle ---------- */
.puzzle-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.puzzle-progress { font-family: var(--pixel); color: var(--gold); }
.puzzle-wrap { padding: 0.6rem; overflow: hidden; }
#puzzle svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.pz-slot { fill: rgba(255, 255, 255, 0.025); stroke: rgba(160, 180, 255, 0.22); stroke-width: 1.5; stroke-dasharray: 6 6; }
.pz-board-bg { fill: rgba(0, 0, 0, 0.25); stroke: rgba(160, 180, 255, 0.25); }
.pz-tray-bg { fill: rgba(255, 255, 255, 0.02); stroke: rgba(160, 180, 255, 0.12); stroke-dasharray: 4 8; }
.pz-tray-label { fill: var(--muted); font: 600 22px var(--font); letter-spacing: 0.1em; }
.pz-ghost { opacity: 0; transition: opacity 0.4s; pointer-events: none; }
.pz-ghost.on { opacity: 0.14; }
.pz-piece { cursor: grab; }
.pz-piece.dragging { cursor: grabbing; }
.pz-piece .pz-edge { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2; }
.pz-piece.loose .pz-edge { stroke: var(--gold); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(255, 207, 90, 0.8)); }
.pz-piece.loose:not(.dragging) .pz-inner { animation: wiggle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pz-piece.placed { cursor: default; }
.pz-piece.placed .pz-edge { stroke: rgba(0, 0, 0, 0.25); stroke-width: 1; }
.pz-piece.locked { cursor: not-allowed; }
.pz-piece.locked .pz-edge { stroke: rgba(255, 255, 255, 0.25); stroke-width: 2; }
.pz-back-num { font: 700 64px var(--pixel); fill: #fff; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 6px; }
.pz-back-lock { font-size: 34px; text-anchor: middle; }
.puzzle-teaser { position: relative; }
.teaser-img { width: 100%; display: block; border-radius: 10px; filter: blur(14px) saturate(0.7); }
.teaser-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem; text-align: center; }
.puzzle-done { text-align: center; padding: 0.6rem; color: var(--green); font-weight: 800; }

/* ---------- admin ---------- */
.sync-report { margin: 0.8rem 0; padding: 0.8rem 1rem; border-radius: 10px; background: var(--panel-2); font-size: 0.85rem; }
.sync-report .err { color: var(--red); }

/* ---------- toast & confetti ---------- */
#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--panel-solid); border: 1px solid var(--line); color: var(--text);
  padding: 0.75rem 1.2rem; border-radius: 12px; box-shadow: var(--shadow); z-index: 50; transition: transform 0.3s ease; max-width: calc(100% - 2rem); }
#toast.show { transform: translate(-50%, 0); }
#toast.ok { border-color: rgba(61, 220, 151, 0.6); }
#toast.bad { border-color: rgba(255, 90, 110, 0.6); }
.confetti { position: fixed; pointer-events: none; z-index: 60; font-size: 18px; will-change: transform, opacity; }

/* ---------- animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow { 50% { box-shadow: 0 0 34px rgba(255, 207, 90, 0.45); } }
@keyframes flicker { 0%, 100% { transform: scaleY(1) rotate(-2deg); } 50% { transform: scaleY(1.12) rotate(2deg); } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(1.5deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .chall-grid { grid-template-columns: 1fr; }
  .chall-side { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  .candle-card { margin-bottom: 0; }
  .calendar { grid-template-columns: repeat(4, 1fr); }
  .col-badges { display: none; }
}
@media (max-width: 560px) {
  .calendar { grid-template-columns: repeat(3, 1fr); }
  .chall-side { grid-template-columns: 1fr; }
  .flag-form { flex-direction: column; }
  .topbar { gap: 0.5rem; }
  .logo { font-size: 0.95rem; }
  .me { margin-left: auto; }
  .nav { order: 3; flex: 1 0 100%; justify-content: space-between; }
  .candle { display: none; }
  .col-days { display: none; }
  .chip span { display: none; }
  .chip { padding-right: 0.25rem; }
}
