:root {
  --orange: #ff7518;
  --green: #a8ff3e;
  --bg: #090b09;
  --header: #0c0f0c;
  --panel: #151915;
  --surface: #111510;
  --input-bg: #090c09;
  --text: #f7f8f4;
  --muted: #c3cabf;
  --line: #3a4336;
  --input-border: #8a9682;
  --focus: #ffd23f;
  --error: #ff9b8a;
  --chip: #252b22;
}

/* Alto contraste: preto, branco e amarelo, com contornos sempre visíveis */
html.high-contrast {
  --orange: #ffd23f;
  --green: #ffffff;
  --bg: #000;
  --header: #000;
  --panel: #000;
  --surface: #000;
  --input-bg: #000;
  --text: #fff;
  --muted: #fff;
  --line: #fff;
  --input-border: #fff;
  --focus: #00e5ff;
  --error: #ffb3a7;
  --chip: #000;
}
html.high-contrast .hero { background: #000; }
html.high-contrast .btn,
html.high-contrast .a11y-toggle,
html.high-contrast nav a { border-color: #fff; }
html.high-contrast .btn-primary,
html.high-contrast .btn-green { background: #ffd23f; color: #000; }
html.high-contrast .btn-dark { background: #000; color: #fff; }
html.high-contrast .notice { background: #000; color: #fff; border: 2px solid #fff; }
html.high-contrast .bar { background: #000; border: 1px solid #fff; }
html.high-contrast .bar-fill { background: #ffd23f; }
html.high-contrast .moon { box-shadow: none; animation: none; }
html.high-contrast .hero { border-bottom-color: #fff; }
html.high-contrast .hero-title span { background: none; -webkit-text-fill-color: currentColor; filter: none; }
html.high-contrast .time-badge { background: #ffd23f; color: #000; box-shadow: none; animation: none; border: 2px solid #fff; }
html.high-contrast .btn-big { box-shadow: none; }
html.high-contrast .highlight { background: #000; border: 2px solid #fff; }

html.large-text { font-size: 125%; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 7rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}
button, input { font: inherit; }
p { margin: 0 0 1rem; }

/* Foco sempre visível para quem navega com o teclado */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -100px;
  z-index: 20;
  padding: .75rem 1rem;
  background: var(--focus);
  color: #000;
  font-weight: 800;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.a11y-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 7%;
  background: #000;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.a11y-title { color: var(--muted); font-weight: 700; margin-right: 4px; }
.a11y-toggle {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.a11y-toggle[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #000;
}
.a11y-toggle[aria-pressed="true"]::after { content: " ✓"; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 18px 7%;
  border-bottom: 1px solid var(--line);
  background: var(--header);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 900; letter-spacing: 1px; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand .accent { color: var(--orange); }
nav ul { display: flex; gap: 10px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 2px solid transparent;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
nav a:hover { background: var(--chip); color: var(--green); }
nav a[aria-current="page"] {
  background: var(--chip);
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 3px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 9px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: transform .2s, filter .2s;
}
.btn-primary { background: var(--orange); color: #130b04; }
.btn-green { background: var(--green); color: #10160b; }
.btn-dark { background: var(--chip); color: var(--text); border-color: #5a6653; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn[aria-disabled="true"] { cursor: progress; opacity: .85; }

main { min-height: 78vh; }
main:focus { outline: none; }
.page { display: none; }
.page.active { display: block; }

.hero {
  min-height: 650px;
  padding: 80px 7%;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 35px;
  align-items: center;
  overflow: hidden;
  position: relative;
  /* Céu de fim de tarde: pôr do sol laranja a desvanecer para roxo escuro */
  background:
    radial-gradient(ellipse at 78% 48%, #5a2a0a 0%, transparent 42%),
    radial-gradient(ellipse at 50% 120%, #7a2d0c 0%, transparent 55%),
    linear-gradient(180deg, #120a1c 0%, #1d0f20 45%, #2a1308 100%);
  border-bottom: 3px solid var(--orange);
}
.eyebrow { color: var(--green); font-weight: 900; letter-spacing: 3px; text-transform: uppercase; font-size: .8rem; margin: 0 0 .5rem; }
.hero-title { font-size: clamp(3rem, 8vw, 7rem); line-height: .95; margin: 20px 0; text-transform: uppercase; letter-spacing: -3px; }
.hero-title span {
  color: var(--orange);
  display: block;
  background: linear-gradient(90deg, #ffb347, var(--orange) 45%, #ff4d1a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px #ff751866);
}
.lead strong { color: var(--text); }
.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 1.25rem;
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--orange);
  color: #130b04;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  box-shadow: 0 0 0 4px #ff751833, 0 0 28px #ff751866;
  animation: glow 2.4s ease-in-out infinite alternate;
}
.btn-big { font-size: 1.1rem; padding: 14px 22px; box-shadow: 0 0 24px #ff751855; }
.lead { color: var(--muted); font-size: 1.1rem; line-height: 1.7; max-width: 570px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.ghost-art { display: grid; place-items: center; min-height: 360px; position: relative; }
.moon {
  width: min(310px, 70vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 80px #ff751833;
  position: relative;
  display: grid;
  place-items: center;
}
.moon::before, .moon::after { content: ""; position: absolute; background: #111; border-radius: 50%; width: 24px; height: 42px; top: 36%; }
.moon::before { left: 30%; }
.moon::after { right: 30%; }
.mouth { position: absolute; top: 57%; width: 90px; height: 42px; border-radius: 10px 10px 45px 45px; background: #111; clip-path: polygon(0 0, 100% 0, 85% 100%, 15% 100%); }
.float { position: absolute; font-size: 2rem; color: var(--green); animation: drift 4s ease-in-out infinite alternate; }
.f1 { top: 10%; right: 15%; }
.f2 { bottom: 10%; left: 12%; animation-delay: 1.5s; }
@keyframes drift { to { transform: translateY(-12px); } }
.moon { animation: pulse 3s ease-in-out infinite alternate; }
.bat { color: initial; font-size: 2.2rem; filter: drop-shadow(0 0 6px #000); }
.b1 { top: 4%; left: 14%; animation-duration: 3s; }
.b2 { bottom: 18%; right: 6%; font-size: 1.6rem; animation-delay: .8s; }
@keyframes pulse { to { box-shadow: 0 0 140px #ff7518aa; } }
@keyframes glow { to { box-shadow: 0 0 0 6px #ff751844, 0 0 40px #ff7518aa; } }

.highlights { list-style: none; padding: 0; margin: 28px 0 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.highlight {
  background: linear-gradient(160deg, #2a1608, var(--panel) 60%);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: 16px;
  padding: 22px;
  transition: transform .2s;
}
.highlight:hover { transform: translateY(-3px); }
.highlight-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.highlight h3 { margin: 0 0 6px; font-size: 1.2rem; color: var(--orange); }
.highlight p { color: var(--muted); margin: 0; }

.section { padding: 55px 7%; max-width: 1100px; margin: auto; }
.section h1 { font-size: 2.3rem; line-height: 1.15; margin: 0 0 12px; }
.section h2 { font-size: 2.2rem; line-height: 1.2; margin: 0 0 10px; }
.section h2.small-heading { font-size: 1.4rem; margin-top: 2rem; }
.section > p { color: var(--muted); line-height: 1.6; max-width: 70ch; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 25px; margin-top: 25px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 750; font-size: 1rem; }
.req { font-weight: 500; color: var(--muted); font-size: .9rem; }
.field input {
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  color: var(--text);
  border-radius: 9px;
  padding: 12px;
  min-height: 48px;
}
.field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--green); }
.field input[aria-invalid="true"] { border-color: var(--error); }
.hint { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0; }
.error { color: var(--error); font-weight: 700; font-size: .95rem; margin: 0; }
.error::before { content: "⚠ "; }
.notice { padding: 13px 15px; border-radius: 10px; background: #20271b; color: #e2f8cf; margin: 20px 0; line-height: 1.5; }

.list-region { margin-top: 20px; }
.participant-list, .results { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.participant {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.person { display: flex; align-items: center; gap: 13px; min-width: 0; }
.avatar { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; background: #2b1b0f; display: grid; place-items: center; font-size: 1.25rem; }
.person h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.person p { color: var(--muted); margin: 4px 0 0; overflow-wrap: anywhere; }
.participant .btn { white-space: nowrap; }
.voted { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: 9px; border: 2px solid var(--line); color: var(--green); font-weight: 800; white-space: nowrap; }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 2px dashed #5a6653; border-radius: 12px; }
.empty p:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 25px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.stat dt { color: var(--muted); font-size: .9rem; }
.stat dd { margin: 8px 0 0; font-size: 2rem; font-weight: 800; color: var(--green); }
.stat dd.stat-text { font-size: 1.15rem; overflow-wrap: anywhere; }

.result-row { background: var(--surface); padding: 17px; border: 1px solid var(--line); border-radius: 12px; }
.result-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.result-head h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.result-head p { margin: 2px 0 0; }
.result-count { color: var(--muted); margin: 0; }
.result-count strong { color: var(--text); }
.bar { height: 14px; background: #30362c; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--green)); border-radius: 99px; transition: width .35s; }

.footer {
  padding: 25px 7%;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  font-size: .9rem;
}
.footer p { margin: 0; }
.footer strong { color: var(--orange); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 40px);
  padding: 13px 18px;
  background: var(--green);
  color: #111;
  border-radius: 10px;
  font-weight: 800;
  z-index: 10;
  box-shadow: 0 8px 30px #0008;
}
.toast.error { background: #ffd0c8; color: #3a0b03; }
.toast:empty { padding: 0; box-shadow: none; }

@media (max-width: 750px) {
  html { scroll-padding-top: 1rem; }
  .topbar { position: static; align-items: flex-start; flex-direction: column; }
  .hero { grid-template-columns: 1fr; padding-top: 55px; min-height: 0; }
  .ghost-art { min-height: 260px; }
  .moon { width: 220px; }
  .hero-title { letter-spacing: -2px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .stats { grid-template-columns: 1fr; }
  .highlights { grid-template-columns: 1fr; }
  .participant { flex-direction: column; align-items: stretch; }
  .section { padding: 40px 5%; }
}

/* Respeita a preferência do sistema e a opção "Reduzir animações" */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
html.reduce-motion { scroll-behavior: auto; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }
html.reduce-motion .btn:hover,
html.reduce-motion .highlight:hover { transform: none; }

/* Modo de cores forçadas do Windows */
@media (forced-colors: active) {
  .bar { border: 1px solid CanvasText; }
  .bar-fill { background: Highlight; forced-color-adjust: none; }
  .toast:not(:empty) { border: 2px solid CanvasText; }
  .hero-title span { -webkit-text-fill-color: currentColor; background: none; }
  .time-badge { border: 2px solid CanvasText; }
}

.home-photo { margin: 1.5rem auto; max-width: 900px; padding: 0 1rem; }
.home-photo img { display: block; width: 100%; height: auto; border-radius: 16px; }

/* ---------- Administração ---------- */
.section.narrow { max-width: 560px; }
.section.narrow .panel { display: grid; gap: 18px; }
.session-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); }
.session-bar strong { color: var(--text); }
.panel-title { font-size: 1.5rem !important; margin: 0 0 12px !important; }
.panel h3 { font-size: 1.15rem; margin: 0 0 4px; overflow-wrap: anywhere; }
.btn-danger { background: #3a0f0a; color: #ffd0c8; border-color: var(--error); }
html.high-contrast .btn-danger { background: #000; color: #fff; border-color: #ffb3a7; }
.state-chip { display: inline-block; padding: 2px 12px; border-radius: 99px; background: var(--green); color: #10160b; }
.state-chip.closed { background: var(--error); color: #3a0b03; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.participant.editing { display: block; }
.participant.editing .row-actions { margin-top: 14px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.admin-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.admin-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
#newAdminForm h3 { margin-bottom: 12px; }
#newAdminForm .btn, #accountForm .btn { margin-top: 18px; }
@media (max-width: 750px) {
  .form-grid.three { grid-template-columns: 1fr; }
}
