/* Тайный Санта — лёгкая новогодняя тема. Без веб-шрифтов и картинок: быстро на старых телефонах. */
:root {
  --pine-950: #071f18; --pine-900: #0b2a21; --pine-800: #10382c; --pine-700: #17493a;
  --red: #b8232f; --red-d: #8f1b25; --snow: #f7f3ea; --snow-d: #e4ddcc;
  --gold: #e2bb5e; --gold-d: #b48b2e; --ink: #1d2a24; --muted: #b9cbc2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", "DejaVu Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--pine-950); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--snow); font: 16px/1.5 var(--sans);
  background: radial-gradient(120% 70% at 50% -10%, #1a5340 0%, var(--pine-900) 55%, var(--pine-950) 100%);
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.topbar, .page, .gate, .nav-bottom { position: relative; z-index: 1; }
a { color: var(--gold); }
h1, h2 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.25rem; }
.muted, .hint { color: var(--muted); font-size: .92rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline { display: inline; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- шапка и навигация ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(226,187,94,.25); }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--snow); text-decoration: none; }
.nav a { color: var(--snow); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--gold); }
.nav-top { display: none; gap: 18px; }
.nav-top .ic { display: none; }
.nav-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around;
  background: var(--pine-950); border-top: 1px solid rgba(226,187,94,.35); padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.nav-bottom a { display: flex; flex-direction: column; align-items: center; font-size: .72rem; padding: 2px 8px; }
.nav-bottom .ic { font-size: 1.35rem; line-height: 1.2; }
.admin-nav { display: flex; flex-wrap: wrap; }
.admin .nav-bottom { display: none; }
.page { max-width: 640px; margin: 0 auto; padding: 18px 16px 96px; }
.page-wide { max-width: 980px; }
.admin .page { padding-bottom: 40px; }
@media (min-width: 760px) {
  .nav-top { display: flex; } .nav-bottom { display: none; } .page { padding-bottom: 40px; }
}

/* ---------- карточки, подарки ---------- */
.card, .notice { background: var(--pine-800); border: 1px solid rgba(226,187,94,.3); border-radius: 14px; padding: 16px; margin: 0 0 16px; }
.notice { border-left: 6px solid var(--red); }
.notice h2 { margin-bottom: .3em; font-size: 1.05rem; }
.notice.off { opacity: .6; }
.hello { font-size: 2rem; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.flash-ok { background: #1c5a3f; border: 1px solid #3c8a67; }
.flash-error { background: #5c1a22; border: 1px solid var(--red); }
.countdown-box { text-align: center; padding: 14px; margin: 0 0 16px; border: 2px dashed var(--gold); border-radius: 14px; }
.countdown-box p { margin: 0 0 4px; }
.countdown { font-family: var(--serif); font-size: 1.35rem; color: var(--gold); font-weight: 700; }
.countdown-done { font-size: 1.15rem; font-weight: 700; }
.reminder, .reminder-static { display: block; padding: 12px 14px; margin: 0 0 16px; border-radius: 12px; background: #fff3d1; color: #5a3d00; text-decoration: none; font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gift {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 22px 12px 14px; text-align: center;
  background: var(--pine-800); border: 1px solid rgba(226,187,94,.35); border-radius: 12px; color: var(--snow); text-decoration: none; overflow: hidden;
}
.gift::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 16px; margin-left: -8px; background: var(--red); opacity: .85; }
.gift::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 0; }
.gift > * { position: relative; z-index: 1; }
.gi { font-size: 2rem; background: var(--pine-800); border-radius: 50%; width: 52px; margin: 0 auto 4px; line-height: 52px; }
.gift small { color: var(--muted); background: var(--pine-800); }
.gift strong { background: var(--pine-800); padding: 0 4px; }
.gift:active { transform: scale(.98); }

/* ---------- формы ---------- */
label { display: block; font-weight: 600; margin: 14px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], textarea {
  width: 100%; padding: 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfc6b0; border-radius: 10px;
}
textarea { resize: vertical; min-height: 140px; }
.btn {
  display: inline-block; margin-top: 16px; padding: 12px 22px; font: 700 1rem var(--sans); color: #fff; background: var(--red);
  border: 2px solid var(--gold); border-radius: 999px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--red-d); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--snow); border-color: rgba(226,187,94,.5); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-danger { background: #5c1a22; }
.btn-small { padding: 6px 12px; font-size: .85rem; margin-top: 0; }
.btn-big { font-size: 1.15rem; padding: 14px 28px; margin-top: 8px; letter-spacing: .02em; }
.form-error { background: #fde3e3; color: #7a1018; padding: 10px 12px; border-radius: 8px; font-weight: 600; margin: 0 0 8px; }
.form-note { background: #fff3d1; color: #5a3d00; padding: 10px 12px; border-radius: 8px; margin: 0 0 8px; font-size: .92rem; }
.form-grid { display: grid; gap: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; }
.row-form input { flex: 1 1 160px; }
.row-form .btn { margin-top: 0; }
.locked { font-weight: 700; color: var(--gold); margin: 0; }
.wish { background: rgba(0,0,0,.2); padding: 12px; border-radius: 10px; margin: 6px 0; }

/* ---------- страница входа: подарочная бирка ---------- */
.gate { max-width: 420px; margin: 0 auto; padding: 28px 16px 40px; }
.gate-head { text-align: center; margin-bottom: 22px; }
.gate-head h1 { font-size: 2.3rem; }
.lead { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--gold); margin: 0; }
.tag-wrap { position: relative; padding-top: 34px; }
.tag-wrap::before { content: ""; position: absolute; top: 0; left: 50%; width: 3px; height: 52px; margin-left: -1px; background: var(--gold); transform: rotate(12deg); transform-origin: bottom; border-radius: 2px; }
.tag {
  position: relative; display: block; padding: 46px 22px 24px; background: var(--snow); color: var(--ink);
  clip-path: polygon(0 26px, 26px 0, calc(100% - 26px) 0, 100% 26px, 100% 100%, 0 100%); border-radius: 0 0 16px 16px;
}
.tag::before { content: ""; position: absolute; top: 12px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--pine-900); box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.tag h2 { text-align: center; color: var(--red-d); }
.tag .hint { color: #5c6b63; text-align: center; }
.tag a { color: var(--red-d); }
.tag .btn { width: 100%; }
.tag-center { text-align: center; }
.login-wrap { margin-top: 18px; }
.tag-login h2 { font-size: 1.05rem; }
.gate-count { text-align: center; color: var(--muted); margin-top: 16px; }

/* ---------- личный код ---------- */
.code-card { margin: 0 0 16px; padding: 14px; text-align: center; background: #fff3d1; color: #3d2b00; border: 2px solid var(--gold); border-radius: 14px; }
.code-title { margin: 0; font-weight: 700; }
.code-value { margin: 4px 0; font: 700 2.2rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .12em; color: var(--red-d); }
.code-note { margin: 0; font-size: .85rem; }
.code-inline { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; }

/* ---------- профиль / факты ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.steps { padding-left: 1.2em; margin: 0; } .steps li { margin: 6px 0; }

/* ---------- колесо ---------- */
.wheel-msg { text-align: center; font-weight: 700; color: var(--gold); min-height: 1.5em; }
.wheel-stage { position: relative; width: min(92vw, 440px); aspect-ratio: 1; margin: 8px auto 0; }
.wheel-ring { position: absolute; inset: 0; border-radius: 50%; padding: 10px; background: linear-gradient(145deg, var(--gold), var(--gold-d)); box-shadow: 0 6px 24px rgba(0,0,0,.45); }
#wheel { display: block; width: 100%; height: 100%; border-radius: 50%; will-change: transform; }
#wheel.spinning { transition: transform var(--spin-time, 6s) cubic-bezier(.25, .5, .35, 1); }
.pointer { position: absolute; top: -12px; left: 50%; width: 0; height: 0; margin-left: -16px; z-index: 3; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 34px solid var(--red); filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.hub { position: absolute; top: 50%; left: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; z-index: 2; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; background: var(--pine-900); border: 4px solid var(--gold); }
.wheel-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 6px 0 18px; }
.wheel-controls .btn { margin-top: 8px; }
.result { text-align: center; border: 2px solid var(--gold); }
.result-title { font-weight: 700; margin: 0 0 6px; }
.result-name { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; color: var(--gold); margin: 0 0 12px; overflow-wrap: anywhere; }
.result .wish { text-align: left; }
.secret { font-weight: 700; margin: 12px 0 0; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9; }

/* ---------- админка ---------- */
.big-state { font-size: 1.1rem; margin-top: 0; }
.counter { font-weight: 700; color: var(--gold); }
.stats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stats li { background: rgba(0,0,0,.2); padding: 10px; border-radius: 10px; }
.stats b { display: block; font-family: var(--serif); font-size: 1.6rem; color: var(--gold); }
.table-wrap { overflow-x: auto; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--pine-800); border-radius: 10px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(226,187,94,.2); vertical-align: top; }
th { color: var(--gold); font-family: var(--serif); }
.actions { white-space: nowrap; }
.actions form, .actions a { margin: 2px 4px 2px 0; }
summary { cursor: pointer; color: var(--gold); }
.logout { margin-top: 24px; display: block; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  #snow { display: none; }
}
