:root {
  --night: #0c241c;
  --pine: #14382c;
  --pine-2: #1e5c42;
  --gold: #d4a24a;
  --gold-2: #f3d48a;
  --ivory: #f4efe4;
  --ink: #1c1915;
  --card: rgba(255, 252, 247, 0.94);
  --berry: #9d2b3a;
  --line: rgba(20, 56, 44, 0.1);
  --shadow: 0 16px 40px rgba(12, 36, 28, 0.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--ivory);
  font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", sans-serif;
  font-size: 1.125rem;
  line-height: 1.5;
}
body.player, body.focus {
  padding-bottom: calc(6.2rem + env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse 90% 42% at 50% -12%, rgba(212, 162, 74, 0.28), transparent 58%),
    radial-gradient(circle at 0% 100%, rgba(157, 43, 58, 0.06), transparent 34%),
    radial-gradient(circle at 100% 70%, rgba(20, 56, 44, 0.05), transparent 30%),
    linear-gradient(180deg, #f8f4ec 0%, #efe6d4 100%);
}
body.staff { background: #f3f0ea; }
a { color: var(--pine-2); }
h1 { font-size: 1.8rem; line-height: 1.25; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(0.85rem + env(safe-area-inset-top)) 1rem 0.85rem;
  background: var(--night);
  color: white;
  border-bottom: 3px solid var(--gold);
}
.brand { color: var(--gold-2); font-weight: 800; text-decoration: none; font-size: 1.15rem; letter-spacing: 0.01em; }
.session { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.who { color: rgba(255, 252, 247, 0.86); font-size: 0.95rem; max-width: 8.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out { margin: 0; }
.out button {
  width: auto;
  border: 1px solid rgba(243, 212, 138, 0.7);
  border-radius: 999px;
  background: transparent;
  color: var(--gold-2);
  font-weight: 800;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}
main { width: min(32rem, calc(100% - 1.6rem)); margin: 1.1rem auto 2rem; }
body.staff main { width: min(52rem, calc(100% - 1.5rem)); }
.hero, .sheet {
  background: var(--card);
  border: 1px solid rgba(212, 162, 74, 0.38);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
}
.hero { text-align: center; padding: 1.7rem 1.15rem 1.35rem; }
.hero::before {
  content: "";
  display: block;
  width: 4.5rem;
  height: 2px;
  margin: 0 auto 0.9rem;
  background: linear-gradient(90deg, transparent, var(--gold), var(--berry), var(--gold), transparent);
}
.hero h1 { font-size: 2.55rem; margin: 0.15rem 0 0.45rem; color: var(--night); }
.eyebrow { color: var(--berry); font-weight: 800; margin: 0; font-size: 0.98rem; }
.lead, .fine { color: #5e564c; }
.when { font-weight: 800; color: var(--pine); font-size: 1.05rem; margin: 0.35rem 0 0; }
.stamp { white-space: nowrap; }
.chip {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.9rem;
}
.panel, .trial, .mine, .stats li {
  background: var(--card);
  border-radius: 1.2rem;
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(20, 56, 44, 0.05);
}
.panel, .trial { margin: 1rem 0; }
.board, .people { list-style: none; margin: 0; padding: 0; }
.board li, .people li {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.75rem 0.2rem;
  border-bottom: 1px solid var(--line);
}
.rank {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--night);
  color: var(--gold-2);
  font-weight: 800;
}
.nick { flex: 1; font-weight: 700; }
.score { font-variant-numeric: tabular-nums; color: var(--berry); font-weight: 800; }
.cta, .ghost, .danger, .choice {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.cta {
  background: linear-gradient(180deg, #1b4d39 0%, var(--night) 100%);
  color: var(--gold-2);
  margin-top: 0.9rem;
  box-shadow: 0 10px 22px rgba(12, 36, 28, 0.2);
}
.ghost {
  background: transparent;
  color: var(--pine);
  border: 1.5px solid rgba(20, 56, 44, 0.28);
  margin-top: 0.7rem;
}
.danger { background: var(--berry); color: white; margin-top: 0.6rem; }
.choice {
  background: white;
  color: var(--ink);
  border: 1px solid rgba(20, 56, 44, 0.08);
  box-shadow: 0 8px 18px rgba(12, 36, 28, 0.05);
  min-height: 4.2rem;
}
.choice:active { border-color: var(--gold); transform: scale(0.99); }
.choices { display: grid; gap: 0.7rem; }
.stack { display: grid; gap: 0.75rem; }
label { display: grid; gap: 0.35rem; font-weight: 700; }
input, button { font: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"], input[type="datetime-local"], input:not([type]) {
  width: 100%;
  border: 1.5px solid var(--line);
  background: white;
  border-radius: 0.9rem;
  padding: 0.85rem 0.9rem;
  font-size: 1.05rem;
}
.phone { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.6rem; }
.pw { display: flex; gap: 0.4rem; }
.pw input { flex: 1; }
.pw button { width: auto; padding: 0 0.8rem; border-radius: 0.9rem; border: 1.5px solid var(--line); background: white; }
.check { font-weight: 600; grid-template-columns: auto 1fr; align-items: start; }
.check input { width: 1.3rem; height: 1.3rem; margin-top: 0.25rem; }
.banner { border-radius: 0.9rem; padding: 0.8rem 1rem; }
.banner.bad { background: #fde8e8; color: #7a1e1e; }
.banner.good { background: #e7f6ee; color: #145c3a; }
.textlink { display: block; margin: 0.8rem 0; font-weight: 700; }
.center { text-align: center; }
.tabs {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.55rem + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(20, 56, 44, 0.08);
  border-radius: 1.15rem;
  box-shadow: 0 12px 30px rgba(12, 36, 28, 0.12);
  z-index: 2;
}
.tabs a { text-align: center; text-decoration: none; color: #5e564c; padding: 0.85rem 0.2rem; font-weight: 700; }
.tabs a.on { color: var(--night); }
.sheet { padding: 1rem 0.95rem 1.1rem; margin-bottom: 0.4rem; }
.timer {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--night);
  margin: 0.15rem 0 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.timer.urgent { color: var(--berry); }
.category { margin: 0.7rem 0 0.15rem; color: var(--berry); font-weight: 800; text-align: center; }
.prompt { font-size: 1.45rem; margin: 0.2rem 0 0.9rem; text-align: center; }
.progress, .sheet .fine { color: #5e564c; margin: 0.35rem 0 0; text-align: center; }
.meters { margin: 0; }
.pills { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin: 0; padding: 0; }
.pills li { background: rgba(255, 252, 247, 0.8); border-radius: 0.8rem; padding: 0.35rem 0.2rem 0.3rem; text-align: center; }
.pills span { display: block; color: #6d645a; font-size: 0.72rem; font-weight: 700; }
.pills strong { font-size: 1.15rem; color: var(--night); }
.bar { height: 0.4rem; margin-top: 0.55rem; border-radius: 999px; background: rgba(157, 43, 58, 0.12); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--berry)); border-radius: inherit; }
.choice.reveal { opacity: 0.45; }
.choice.blink-green, .choice.blink-red, .choice.blink-white { opacity: 1; }
.choice.blink-green { animation: blink-green 0.7s ease-in-out 4; background: var(--pine-2); color: white; }
.choice.blink-red { animation: blink-red 0.7s ease-in-out 4; background: var(--berry); color: white; }
.choice.blink-white { animation: blink-white 0.7s ease-in-out 4; background: white; color: var(--ink); border: 2px solid var(--gold); }
.verdict { font-size: 1.45rem; font-weight: 800; text-align: center; margin: 0.35rem 0 0; }
.verdict.correct { color: var(--pine-2); }
.verdict.wrong, .verdict.empty { color: var(--berry); }
.stats { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.stats span { display: block; color: #5e564c; font-size: 0.9rem; }
.mine { margin: 1rem 0; }
.admin-nav { display: flex; gap: 0.4rem; overflow: auto; padding: 0.6rem 0.8rem; background: #081912; }
.admin-nav a { color: white; text-decoration: none; white-space: nowrap; background: rgba(255,255,255,0.08); border-radius: 999px; padding: 0.35rem 0.7rem; }
.row { display: grid; gap: 0.5rem; }
.qr { width: min(18rem, 100%); background: white; border-radius: 1rem; padding: 0.6rem; }
.hall-title { font-size: clamp(2rem, 6vw, 4rem); }
body:has(.hall-title) { background: var(--night); color: #f6f1e6; }
body:has(.hall-title) main { width: min(70rem, calc(100% - 2rem)); }
body:has(.hall-title) .board { font-size: clamp(1.3rem, 3vw, 2.2rem); }
body:has(.hall-title) .topbar { border-bottom-color: var(--gold); }
.people em { color: var(--berry); font-style: normal; font-size: 0.9rem; }
.people .mail { direction: ltr; unicode-bidi: isolate; font-weight: 600; }
.people form { margin: 0; }
.people .ghost { width: auto; margin: 0; padding: 0.35rem 0.8rem; }
@media (prefers-reduced-motion: no-preference) {
  .panel, .choice, .hero, .sheet { animation: rise 0.28s ease; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes blink-green {
  0%, 100% { background: white; color: var(--ink); }
  40%, 60% { background: var(--pine-2); color: white; }
}
@keyframes blink-red {
  0%, 100% { background: white; color: var(--ink); }
  40%, 60% { background: var(--berry); color: white; }
}
@keyframes blink-white {
  0%, 100% { background: #f3ecdf; color: var(--ink); }
  40%, 60% { background: white; color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
}
@media (prefers-reduced-motion: no-preference) {
  .choice.blink-green { animation: blink-green 0.75s ease-in-out 4; }
  .choice.blink-red { animation: blink-red 0.75s ease-in-out 4; }
  .choice.blink-white { animation: blink-white 0.75s ease-in-out 4; }
}
