*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a0908;
  --text: #e8e2d8;
  --muted: #7a7570;
  --vot: #c4a574;
  --vot-glow: rgba(196, 165, 116, 0.32);
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Verdana, Geneva, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-base {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 60% at 50% 110%, #161412 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% -10%, #121110 0%, transparent 50%),
    linear-gradient(180deg, #0a0908 0%, #0e0c0b 50%, #0a0908 100%);
}

.stage-light {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 55%;
  background: radial-gradient(ellipse at 50% 0%, rgba(226, 230, 234, 0.06) 0%, transparent 65%);
}

.spot {
  position: absolute;
  top: -5%;
  width: 28vw;
  max-width: 380px;
  height: 70vh;
  filter: blur(40px);
  opacity: 0.48;
  animation: spot-pulse 8s ease-in-out infinite;
}

.spot-left {
  left: 12%;
  background: radial-gradient(ellipse at 50% 0%, rgba(226, 230, 234, 0.16) 0%, transparent 70%);
  animation-delay: 0s;
}

.spot-main {
  left: 50%;
  transform: translateX(-50%);
  width: 36vw;
  max-width: 460px;
  background: radial-gradient(ellipse at 50% 0%, var(--vot-glow) 0%, transparent 70%);
  animation-delay: -2s;
}

.spot-right {
  right: 12%;
  background: radial-gradient(ellipse at 50% 0%, rgba(154, 120, 168, 0.18) 0%, transparent 70%);
  animation-delay: -4s;
}

.mesh {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 60%, rgba(100, 95, 90, 0.04) 0%, transparent 60%);
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, black 20%, transparent 75%);
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 85% at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.7) 100%);
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

@keyframes spot-pulse {
  0%, 100% { opacity: 0.38; }
  50% { opacity: 0.58; }
}

.page {
  position: relative;
  z-index: 1;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 2.5rem) max(0.75rem, env(safe-area-inset-bottom));
  width: 100%;
  overflow: auto;
}

.marks {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: clamp(1rem, 2.4vw, 2rem);
  width: 100%;
}

.marks[hidden],
#admin-boards[hidden] {
  display: none !important;
}

#admin-boards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  width: 100%;
}

.mark {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 min(20rem, 92vw);
  width: min(20rem, 92vw);
  animation: fade-up 0.7s ease 0.12s both;
}

.mark:nth-child(2) {
  animation-delay: 0.22s;
}

.mark:nth-child(3) {
  animation-delay: 0.32s;
}

.mark-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  height: 100%;
  min-height: 22.5rem;
  padding: 1.6rem 1.35rem 1.4rem;
  border-radius: 2rem;
  background: rgba(12, 10, 14, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
  box-shadow: 0 20px 60px -10px var(--vot-glow), inset 0 1px 0 rgba(196, 165, 116, 0.16);
}

.header {
  position: fixed;
  top: max(1.25rem, env(safe-area-inset-top));
  right: clamp(1.25rem, 4vw, 2.5rem);
  left: clamp(1.25rem, 4vw, 2.5rem);
  z-index: 2;
  text-align: right;
  animation: fade-up 0.7s ease both;
  pointer-events: none;
  overflow: visible;
  padding-bottom: 0.35em;
}

.title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  overflow: visible;
}

.title-brand {
  display: block;
  font-size: clamp(2rem, 5.5vw, 4.95rem);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 40px rgba(226, 230, 234, 0.1);
}

.title-tagline {
  display: block;
  font-size: clamp(1rem, 2.75vw, 2.475rem);
  font-weight: 400;
  line-height: 1.2;
  margin-top: -0.05em;
  color: var(--muted);
  opacity: 0.85;
  padding: 0 0.05em 0.22em 0;
}

.admin-out {
  pointer-events: auto;
  appearance: none;
  display: block;
  margin: 0.15rem 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.admin-out:hover,
.admin-out:focus-visible {
  outline: none;
  color: var(--vot);
}

.admin-out[hidden] {
  display: none !important;
}

.mark-panel::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 10%;
  right: 10%;
  height: 45%;
  border-radius: 0 0 50% 50%;
  background: radial-gradient(ellipse at 50% 0%, var(--vot-glow) 0%, transparent 70%);
  opacity: 0.45;
  pointer-events: none;
}

.mark-panel > * {
  position: relative;
  z-index: 1;
}

.quiz-progress {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.quiz-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.quiz-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(232, 226, 216, 0.18);
}

.quiz-dot.is-on {
  background: var(--vot);
  box-shadow: 0 0 8px var(--vot-glow);
}

.quiz-dot.is-done {
  background: rgba(196, 165, 116, 0.55);
}

.quiz-step {
  display: none;
}

.quiz-q {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.quiz-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(232, 226, 216, 0.78);
  text-align: center;
}

.quiz-submit {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.quiz-submit:hover,
.quiz-submit:focus-visible {
  outline: none;
  border-color: rgba(196, 165, 116, 0.5);
  background: rgba(196, 165, 116, 0.1);
  color: var(--vot);
}

.quiz-final {
  display: grid;
  gap: 0.55rem;
}

.quiz-final-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.quiz-input {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  text-align: center;
  padding: 0.7rem 0.8rem;
  border-radius: 0.85rem;
  outline: none;
}

.quiz-input:focus {
  border-color: rgba(196, 165, 116, 0.55);
}

.quiz-msg {
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-line;
  color: var(--vot);
}

.mark-panel.is-done {
  border-color: rgba(196, 165, 116, 0.4);
}

.mark-panel.is-done .quiz-submit,
.mark-panel.is-done .quiz-input,
.mark-panel.is-done .quiz-final-label {
  display: none;
}

.mark-panel.is-ok .quiz-q,
.mark-panel.is-ok .quiz-copy {
  display: none;
}

#site-panel {
  min-height: 0;
}

#admin-boards .mark-panel {
  justify-content: flex-start;
}

#admin-stats .mark-panel {
  min-height: 16rem;
}

.admin-quiz {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-again {
  display: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.85rem;
  cursor: pointer;
}

.quiz-again:hover,
.quiz-again:focus-visible {
  outline: none;
  border-color: rgba(196, 165, 116, 0.5);
  background: rgba(196, 165, 116, 0.1);
  color: var(--vot);
}

.mark-panel.is-done .quiz-again:not([hidden]) {
  display: block;
}

.quiz-wait {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  place-items: center;
  font-size: 3rem;
  font-weight: 700;
  color: rgba(232, 226, 216, 0.28);
  pointer-events: none;
}

.mark-panel.is-locked {
  opacity: 0.55;
}

.mark-panel.is-locked .quiz-q,
.mark-panel.is-locked .quiz-text,
.mark-panel.is-locked .quiz-final {
  visibility: hidden;
}

.mark-panel.is-locked .quiz-wait {
  display: grid;
}

.quiz-login,
.quiz-roster {
  display: none;
}

.quiz-login {
  grid-gap: 0.55rem;
}

.quiz-login-msg {
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  font-size: 0.85rem;
  color: var(--vot);
}

.quiz-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.quiz-person.is-in {
  color: var(--vot);
}

.mark-panel.is-gate .quiz-login,
.mark-panel.is-gate .quiz-roster {
  display: grid;
}

.mark-panel.is-gate .quiz-final,
.mark-panel.is-gate .quiz-progress,
.mark-panel.is-gate .quiz-q,
.mark-panel.is-gate .quiz-text {
  display: none;
}

.mark-panel.is-play .quiz-login {
  display: none;
}

.mark-panel.is-play .quiz-roster {
  display: grid;
}

.mark-panel.is-wait .quiz-login,
.mark-panel.is-wait .quiz-final,
.mark-panel.is-wait .quiz-q,
.mark-panel.is-wait .quiz-text,
.mark-panel.is-open .quiz-login,
.mark-panel.is-open .quiz-final,
.mark-panel.is-open .quiz-q,
.mark-panel.is-open .quiz-text {
  display: none;
}

.quiz-note {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(232, 226, 216, 0.72);
}

.mark-panel.is-open .quiz-note {
  display: none;
}

.quiz-hold {
  display: none;
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--vot);
}

.mark-panel.is-wait .quiz-hold,
.mark-panel.is-open .quiz-hold {
  display: block;
}

.mark-panel.is-wait .quiz-roster,
.mark-panel.is-open .quiz-roster {
  display: grid;
}

.mark-panel.is-wait,
.mark-panel.is-open {
  border-color: rgba(196, 165, 116, 0.4);
}

.mark-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s ease;
}

.mark:hover .mark-label,
.mark:focus-within .mark-label {
  color: var(--vot);
}

.footer {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: clamp(0.68rem, 1.5vh, 0.75rem);
  color: rgba(242, 236, 228, 0.25);
  letter-spacing: 0.12em;
  animation: fade-up 0.7s ease 0.35s both;
  pointer-events: none;
}

.footer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--vot);
  box-shadow: 0 0 8px var(--vot-glow);
  animation: pulse 3s ease infinite;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.35; }
}

@media (max-width: 1280px) {
  .marks {
    padding: 5.5rem 0 3rem;
  }

  #admin-boards {
    padding: 5.5rem 0 3rem;
  }

  #admin-boards .marks {
    padding: 0;
  }

  .page {
    justify-content: flex-start;
  }
}

@media (max-width: 960px) {
  .marks {
    flex-wrap: wrap;
    padding: 5.5rem 0 3rem;
  }

  #admin-boards .marks {
    padding: 0;
  }

  .page {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  .spot {
    width: 60vw;
    height: 40vh;
  }

  .spot-left { left: 5%; }
  .spot-main { left: 50%; }
  .spot-right { right: 5%; }

  .mark {
    flex-basis: min(22rem, 90vw);
    width: min(22rem, 90vw);
  }

  .mark-panel {
    width: 100%;
    min-height: 22.5rem;
    padding: 1.25rem 1rem 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spot,
  .mark,
  .header,
  .footer,
  .footer-dot {
    animation: none;
  }
}
