/* Haunted Ballot — styles ported from the design. No inline styles (strict CSP). */
:root {
  --accent: #FF7A1A;
  --accent-ink: #1C0A00;
  --bg: #0C0710;
  --bg-deep: #08050B;
  --band: #120A17;
  --panel: #1A1020;
  --card: #150D1B;
  --line: #2E1F38;
  --line-soft: #24172D;
  --line-input: #3A2848;
  --text: #F4EEF7;
  --text-soft: #D9CDE2;
  --muted: #B7A6C4;
  --muted-2: #9C8AAA;
  --violet: #CDB6FF;
  --ok: #9FD38A;
  --bad: #FF8FA3;
  --danger: #E8475F;
  --display: Cinzel, Georgia, serif;
  --sans: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: #FF8E3C; }
a:hover { color: #FFB27A; }
h1, h2, h3, p { margin: 0; }
button, input, select { font-family: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #FFC38F; outline-offset: 2px; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: #fff; color: #111; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 12px; }

.page { min-height: 100vh; position: relative; overflow: hidden; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.stack-40 { display: flex; flex-direction: column; gap: 40px; }
.stack-28 { display: flex; flex-direction: column; gap: 28px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.board { display: flex; flex-direction: column; gap: 16px; }
.accent { color: var(--accent); }
.muted-lg { margin-top: 8px; color: var(--muted); font-size: 17px; }

h2 { font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 1.15; }
@media (max-width: 560px) { h2 { font-size: 34px; } }

/* ---------- atmosphere ---------- */
.grain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; opacity: .06; mix-blend-mode: overlay; }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 39; background: radial-gradient(ellipse at 50% 40%, rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%); }

.scene { position: relative; background: linear-gradient(180deg, #07040A 0%, #170B24 42%, #2C1539 76%, #0C0710 100%); }
.stars { position: absolute; inset: 0; background-image:
  radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.7), transparent), radial-gradient(1px 1px at 28% 8%, rgba(255,255,255,.5), transparent),
  radial-gradient(1.5px 1.5px at 46% 22%, rgba(255,255,255,.55), transparent), radial-gradient(1px 1px at 63% 12%, rgba(255,255,255,.45), transparent),
  radial-gradient(1px 1px at 88% 30%, rgba(255,255,255,.5), transparent), radial-gradient(1px 1px at 7% 40%, rgba(255,255,255,.35), transparent),
  radial-gradient(1.5px 1.5px at 38% 36%, rgba(255,255,255,.4), transparent), radial-gradient(1px 1px at 55% 4%, rgba(255,255,255,.55), transparent); }
.moon { position: absolute; top: 80px; right: 8%; width: 220px; height: 220px; border-radius: 50%; box-shadow: 0 0 70px 18px rgba(255,214,170,.24), 0 0 220px 90px rgba(181,140,255,.14); }
.clouds { position: absolute; top: 0; left: 0; width: 100%; height: 520px; overflow: hidden; z-index: 1; opacity: .5; }
.clouds svg, .fog svg { display: block; }
.bat { position: absolute; left: 0; z-index: 2; }
.bat-1 { top: 150px; }
.bat-2 { top: 250px; }
.graveyard { position: absolute; left: 0; bottom: 0; width: 100%; height: 340px; z-index: 2; }
.fog { position: absolute; left: 0; bottom: 0; width: 100%; height: 300px; overflow: hidden; z-index: 3; -webkit-mask-image: linear-gradient(to top, #000 45%, transparent); mask-image: linear-gradient(to top, #000 45%, transparent); }
.fog svg { opacity: .5; }

.pan { animation: pan 160s linear infinite; }
.pan2 { animation: pan 90s linear infinite reverse; }
.flap { animation: flap 16s linear infinite; }
.flap2 { animation: flap 23s linear infinite; animation-delay: -9s; }
.flicker { animation: flicker 5s infinite; }
@keyframes pan { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes flap { 0% { transform: translate(-80px,0) scale(.8); } 50% { transform: translate(50vw,-50px) scale(1); } 100% { transform: translate(110vw,20px) scale(.7); } }
@keyframes flicker { 0%,100% { opacity: 1; } 43% { opacity: .9; } 46% { opacity: .72; } 49% { opacity: .96; } }
@media (prefers-reduced-motion: reduce) {
  .pan, .pan2, .flap, .flap2, .flicker { animation: none; }
  html { scroll-behavior: auto; }
}
@media (max-width: 760px) { .moon { width: 140px; height: 140px; top: 90px; right: 6%; } .moon svg { width: 140px; height: 140px; } }

/* ---------- buttons ---------- */
.btn { min-height: 44px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 999px; border: 1px solid transparent; font: 700 15px var(--sans); text-decoration: none; cursor: pointer; transition: transform .12s, filter .12s, background .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 34px rgba(255,122,26,.35); }
.btn-primary:hover { color: var(--accent-ink); }
.btn-ghost { border-color: rgba(244,238,247,.3); color: var(--text); background: rgba(12,7,16,.4); font-weight: 600; }
.btn-ghost:hover { color: var(--text); }
.btn-outline { border-color: rgba(255,122,26,.55); background: rgba(12,7,16,.55); color: var(--text); font-weight: 600; backdrop-filter: blur(6px); }
.btn-outline:hover { color: var(--text); }
.btn-quiet { background: #2E1F38; color: var(--text); font-weight: 500; font-size: 13px; min-height: 36px; padding: 0 14px; }
.btn-danger-outline { border-color: #7A2A3A; background: transparent; color: #FFA9B8; font-weight: 600; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--text); background: #24172D; }

/* ---------- nav ---------- */
.nav { position: relative; z-index: 5; max-width: 1240px; margin: 0 auto; padding: 22px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: 1.5px; }
.brand:hover { color: var(--text); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nav-links > a { padding: 12px 14px; text-decoration: none; color: var(--text-soft); font-weight: 500; }
.nav-links > a:hover { color: #fff; }
.nav-links > a.nav-admin { color: var(--accent); font-weight: 700; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 6px; border-radius: 999px; border: 1px solid var(--line-input); background: rgba(12,7,16,.7); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #3E2552; color: var(--text); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.userchip-text { font-size: 14px; line-height: 1.2; display: flex; flex-direction: column; min-width: 0; }
.userchip-text strong { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip-text span { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.userchip-text .ok { color: var(--ok); }
@media (max-width: 560px) { .userchip-text strong { max-width: 100px; } }

/* ---------- hero ---------- */
.hero { position: relative; z-index: 4; max-width: 1240px; margin: 0 auto; padding: 48px 24px 210px; display: flex; flex-wrap: wrap; align-items: center; gap: 56px; }
.hero-copy { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.eyebrow { align-self: flex-start; padding: 6px 14px; border-radius: 999px; background: rgba(181,140,255,.14); color: var(--violet); font-size: 13px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 5.4vw, 76px); line-height: 1.05; letter-spacing: .5px; text-shadow: 0 4px 30px rgba(0,0,0,.8); }
.lede { max-width: 520px; font-size: 18px; line-height: 1.7; color: var(--text-soft); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stats { margin: 0; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 36px; }
.stats > div { display: flex; flex-direction: column-reverse; }
.stat-num { margin: 0; font-family: var(--display); font-weight: 700; font-size: 34px; }
.stat-label { color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.is-open { color: var(--ok); }
.is-closed { color: var(--bad); }

.hero-fan { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.fan { position: relative; width: 100%; max-width: 460px; height: 380px; }
.fan-card { position: absolute; top: 20px; left: 50%; width: 210px; margin-left: -105px; text-decoration: none; color: var(--text); border-radius: 14px; background: var(--panel); padding: 8px; border: 1px solid var(--line-input); box-shadow: 0 30px 60px rgba(0,0,0,.6); transition: transform .25s ease; }
.fan-card:hover { color: var(--text); }
.fan-name { padding: 12px 6px 6px; font-family: var(--display); font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fan-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 24px; }
.fan-link { font-weight: 600; text-decoration: none; }

/* portraits */
.portrait-box { position: relative; border-radius: 10px; overflow: hidden; background: #140A18; }
.fan-card .portrait-box { height: 250px; }
.card .portrait-box { height: 240px; }
.portrait-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, var(--tint) 0%, #140A18 78%); filter: sepia(.35) contrast(1.08) brightness(.85); }
.portrait-sil { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 88%; }
.portrait-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: sepia(.18) contrast(1.05) brightness(.92); }
.no-tag { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(12,7,16,.8); font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--text); }
.card .no-tag { top: 12px; left: 12px; padding: 4px 10px; font-size: 14px; }
.photo-ph { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; color: rgba(244,238,247,.62); font-size: 12px; letter-spacing: 1px; }

/* ---------- sections ---------- */
.band { position: relative; z-index: 2; background: var(--band); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.band-top { border-bottom: 0; }
.band > .wrap { padding-top: 88px; padding-bottom: 88px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.step { padding: 30px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.step-no { font-family: var(--display); font-weight: 800; font-size: 40px; color: var(--accent); line-height: 1; }
.step h3 { font-size: 20px; font-weight: 700; }
.step p { color: var(--muted); line-height: 1.7; }

.vote { position: relative; z-index: 2; padding-top: 96px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 30px; }
.vote-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.banner { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: 14px; background: #1F1208; border: 1px solid #6A3A12; color: #FFDCC0; font-size: 16px; }
.banner.info { background: #170F24; border-color: #4A3470; color: #E6D8FF; }
.banner .btn { margin-left: auto; }
.banner svg { flex: none; }
@media (max-width: 560px) { .banner { flex-wrap: wrap; } .banner .btn { margin-left: 0; width: 100%; } }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.card { border-radius: 16px; background: var(--card); padding: 10px; border: 1px solid var(--line); box-shadow: 0 20px 40px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.card.mine { border-color: var(--accent); }
.card-body { padding: 18px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { font-family: var(--display); font-weight: 700; font-size: 21px; overflow-wrap: anywhere; }
.card-costume { color: var(--muted); min-height: 1.4em; overflow-wrap: anywhere; }
.card .btn { margin-top: 14px; min-height: 48px; font-size: 15px; }
.vote-btn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.vote-btn:hover { color: var(--accent-ink); }
.vote-btn:disabled { background: #20142A; color: var(--muted-2); border-color: var(--line-input); }
.vote-btn.is-mine:disabled { background: #3E2552; color: #E6D8FF; border-color: #B58CFF; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line-input); border-radius: 16px; grid-column: 1 / -1; }

/* ---------- admin ---------- */
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.kicker { color: var(--violet); font-size: 12px; font-weight: 700; letter-spacing: 2.5px; }
.admin-head h2 { margin-top: 4px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.tile { padding: 22px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.tile-label { color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.tile-num { font-family: var(--display); font-weight: 700; font-size: 42px; }
.tile-text { font-family: var(--display); font-weight: 700; font-size: 24px; padding-top: 12px; overflow-wrap: anywhere; }
.admin-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.panel { padding: 24px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h3 { font-size: 18px; font-weight: 700; }
.panel-main { flex: 999 1 560px; }
.panel-side { flex: 1 1 320px; display: flex; flex-direction: column; gap: 20px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.55; }
.board-row { display: flex; align-items: center; gap: 12px; }
.board-rank { width: 28px; color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 20px; flex: none; }
.board-main { flex: 1; min-width: 0; }
.board-line { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; margin-bottom: 6px; }
.board-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-line span:last-child { color: var(--muted); flex: none; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.bar > i { display: block; height: 8px; border-radius: 4px; width: var(--w, 0%); background: #6A4E86; transition: width .4s ease; }
.bar > i.lead { background: var(--accent); }
.board-actions { display: flex; gap: 6px; flex: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--text-soft); font-size: 14px; font-weight: 600; }
.field .opt { color: var(--muted-2); font-weight: 400; }
.input { min-height: 46px; width: 100%; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-input); background: var(--bg); color: var(--text); font: 500 15px var(--sans); }
.input::placeholder { color: #8A7898; }
.input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.field-help { color: var(--muted-2); font-size: 13px; line-height: 1.45; }
.form-error { color: #FFB3C0; background: #2A0F18; border: 1px solid #6A2A3A; border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.5; }
.import-result { font-size: 14px; line-height: 1.55; color: var(--text-soft); }
.import-result ul { margin: 6px 0 0; padding-left: 18px; color: var(--bad); }
.file-input { color: var(--muted); font-size: 14px; max-width: 100%; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(6,3,9,.8); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 440px; margin: auto; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-input); box-shadow: 0 40px 120px rgba(0,0,0,.8); padding: 34px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.modal h2 { font-size: 30px; padding-right: 36px; }
.modal p { color: var(--text-soft); line-height: 1.7; }
.modal .close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 999px; border: none; background: var(--line); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal .close:hover { background: #3E2552; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.modal-note { color: var(--muted-2); font-size: 13px; line-height: 1.5; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted-2); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-input); }
.check-badge { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 12px; border-radius: 999px; background: rgba(159,211,138,.12); color: var(--ok); font-size: 13px; font-weight: 700; }

/* ---------- footer / toast ---------- */
.footer { position: relative; z-index: 2; border-top: 1px solid var(--line-soft); background: var(--bg-deep); }
.footer-row { padding-top: 40px; padding-bottom: 40px; display: grid; grid-template-columns: 1fr; gap: 28px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.footer-brand strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.footer-contact:empty { display: none; }
.footer-title { color: var(--text-soft); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-input); color: var(--text); text-decoration: none; font-weight: 600; transition: border-color .15s, color .15s; }
.footer-links a:hover, .footer-links a:focus-visible { border-color: var(--accent); color: var(--accent); }
.footer-note { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted-2); }
@media (min-width: 720px) { .footer-row { grid-template-columns: 1fr auto; align-items: start; } .footer-contact { text-align: right; } .footer-links { justify-content: flex-end; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 24px); z-index: 60; max-width: min(92vw, 460px); padding: 14px 20px; border-radius: 14px; background: #241530; border: 1px solid #5B3E7A; color: var(--text); font-size: 15px; line-height: 1.5; box-shadow: 0 20px 50px rgba(0,0,0,.6); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #2A0F18; border-color: #8A3347; color: #FFD3DB; }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; z-index: 70; margin: 0; padding: 14px; background: #2A0F18; color: #FFD3DB; text-align: center; }
