:root {
  --bg: #0b1220;
  --bg-soft: #131c2e;
  --card: #1a2540;
  --card-2: #223057;
  --fg: #f4f7ff;
  --muted: #8da0c8;
  --accent: #4cc9f0;
  --accent-strong: #4361ee;
  --success: #06d6a0;
  --warn: #ffd166;
  --danger: #ef476f;
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --shadow: 0 0.625rem 2.5rem rgba(0, 0, 0, 0.35);
  --gap: 1.25rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 20% 0%, #1a2553 0%, var(--bg) 60%) fixed;
  color: var(--fg);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.4;
}

a {
  color: var(--accent);
}

.container {
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.brand-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 1.25rem var(--accent);
}

.brand-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-soft) 100%);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 2rem);
  box-shadow: var(--shadow);
  border: 0.0625rem solid rgba(255, 255, 255, 0.06);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

label {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  color: var(--fg);
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.1875rem rgba(76, 201, 240, 0.18);
}

button {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.5rem;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s;
}

button:active {
  transform: translateY(0.0625rem);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  box-shadow: 0 0.5rem 1.5rem rgba(67, 97, 238, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-warn {
  background: var(--warn);
  color: #1a1a1a;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.alert {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-weight: 500;
}

.alert-success {
  background: rgba(6, 214, 160, 0.15);
  color: var(--success);
  border: 0.0625rem solid rgba(6, 214, 160, 0.35);
}

.alert-error {
  background: rgba(239, 71, 111, 0.15);
  color: var(--danger);
  border: 0.0625rem solid rgba(239, 71, 111, 0.35);
}

.muted {
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  font-size: 0.875rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 0.0625rem dashed rgba(255, 255, 255, 0.15);
}

.nav-links a:hover {
  color: var(--accent);
}

/* ----- Ticket result (after registration) ----- */

.ticket-result {
  text-align: center;
  padding: clamp(1.5rem, 4vw, 3rem) 1.5rem;
}

.ticket-number {
  font-size: clamp(4rem, 14vw, 8rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0.5rem 0 1rem;
}

.ticket-label {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-size: 0.8125rem;
}

.ticket-meta {
  color: var(--muted);
  margin: 0.5rem 0 1.5rem;
}

/* ----- Display page (full-screen window) ----- */

body.display-page {
  background: radial-gradient(circle at 30% 10%, #1f2a55 0%, #060a18 70%) fixed;
  overflow: hidden;
}

.display-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.display-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.display-clock {
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  color: var(--fg);
}

.display-main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  align-items: stretch;
  margin: clamp(1rem, 3vw, 2rem) 0;
}

@media (max-width: 880px) {
  .display-main {
    grid-template-columns: 1fr;
  }
}

.current-card {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.35), rgba(76, 201, 240, 0.15));
  border: 0.0625rem solid rgba(76, 201, 240, 0.35);
  border-radius: 2rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.current-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(76, 201, 240, 0.25), transparent 60%);
  pointer-events: none;
}

.current-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: clamp(0.875rem, 1.5vw, 1.125rem);
}

.current-number {
  font-size: clamp(8rem, 22vw, 18rem);
  font-weight: 900;
  line-height: 0.95;
  margin: 0.5rem 0;
  background: linear-gradient(180deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 4rem rgba(76, 201, 240, 0.35);
}

.current-number.empty {
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--muted);
  background: none;
  -webkit-text-fill-color: var(--muted);
}

.current-fio {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 600;
  margin-top: 0.5rem;
}

.current-group {
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  margin-top: 0.25rem;
}

.next-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  border-radius: 2rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
}

.next-title {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.next-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.next-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius);
  border-left: 0.25rem solid var(--accent);
}

.next-num {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--accent);
  min-width: 3rem;
}

.next-meta {
  text-align: right;
  flex: 1;
}

.next-meta-fio {
  font-weight: 500;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
}

.next-meta-group {
  color: var(--muted);
  font-size: 0.875rem;
}

.next-empty {
  color: var(--muted);
  text-align: center;
  padding: 1rem;
  font-style: italic;
}

.display-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.875rem;
  padding-top: 1rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.06);
}

.tts-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.tts-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.connection-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0.75rem var(--success);
}

.connection-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0.75rem var(--danger);
}

/* ----- Admin ----- */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625rem solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.admin-current {
  background: rgba(67, 97, 238, 0.15);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  border: 0.0625rem solid rgba(67, 97, 238, 0.35);
}

.admin-current .num {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
