/* AvtoMaktab UI - liquid glass dark minimal */
:root {
  --bg-0: #0b0c0f;
  --bg-1: #0f1216;
  --bg-2: #131820;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --stroke: rgba(255, 255, 255, 0.16);
  --text: #f1f3f7;
  --muted: #a6afbe;
  --accent: #9ff5c3;
  --accent-2: #7cc7ff;
  --danger: #ff6b6b;
  --success: #6ee7b7;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --glow-1: #2b3a49;
  --glow-2: #1f2a3a;
}

html[data-theme="light"] {
  --bg-0: #f3f5f8;
  --bg-1: #e9edf3;
  --bg-2: #dee4ee;
  --glass: rgba(18, 28, 45, 0.06);
  --glass-strong: rgba(18, 28, 45, 0.12);
  --stroke: rgba(12, 16, 24, 0.12);
  --text: #111827;
  --muted: #4b5563;
  --accent: #2dbb7f;
  --accent-2: #3b82f6;
  --danger: #e34949;
  --success: #16a34a;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  --glow-1: #c3d3e6;
  --glow-2: #d8e3f2;
}

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

html,
body {
  height: 100%;
}

html {
  background: var(--bg-0);
  transition: background 0.6s ease;
}

body {
  margin: 0;
  font-family: "Bahnschrift", "Trebuchet MS", "Candara", "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg-0);
  background: radial-gradient(circle at 15% 20%, var(--glow-1) 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, var(--glow-2) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100svh;
  transition: background 0.6s ease, color 0.4s ease;
}

body.menu-open {
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  z-index: -1;
}

body::before {
  background: var(--glow-1);
  top: -120px;
  left: -120px;
  animation: float 18s ease-in-out infinite;
}

body::after {
  background: var(--glow-2);
  bottom: -140px;
  right: -80px;
  animation: float 22s ease-in-out infinite reverse;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  border-radius: 20px;
  display: block;
}

.glass {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transition: background 0.6s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.btn,
.topbar,
.bottom-nav,
.menu-card,
.ticket-card,
.topic-card,
.admin-panel,
.online-indicator {
  transition: background 0.6s ease, border-color 0.4s ease, color 0.4s ease,
    box-shadow 0.4s ease;
}

.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 35%);
  opacity: 0.6;
  z-index: 0;
}

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

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px calc(90px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  margin: 12px;
  border-radius: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-decoration: none;
  color: inherit;
}

.logo svg {
  width: 26px;
  height: 26px;
}

.top-nav {
  display: flex;
  gap: 18px;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  justify-content: center;
  letter-spacing: 0.2px;
}

.top-nav a {
  opacity: 0.8;
  transition: opacity 0.2s ease;
  padding: 8px 10px;
}

.top-nav a.active,
.top-nav a:hover {
  opacity: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (min-width: 981px) {
  .topbar {
    margin: 0;
    border-radius: 0;
    padding: 12px 28px;
    width: 100%;
  }

  .top-nav {
    flex: 1;
    justify-content: center;
  }

  .header-actions {
    margin-left: auto;
  }
}

.burger {
  display: none;
  width: 42px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  padding: 6px 8px;
  gap: 4px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.lang-toggle {
  display: flex;
  gap: 8px;
}

.lang-toggle button {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-toggle button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(159, 245, 195, 0.3);
}

.utility-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.theme-icon {
  width: 20px;
  height: 20px;
  display: block;
  background: center/contain no-repeat;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  transition: transform 0.4s ease, filter 0.4s ease;
}

html[data-theme="light"] .theme-icon {
  background-image: url("/assets/moon.svg");
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.18));
}

html[data-theme="dark"] .theme-icon {
  background-image: url("/assets/sun.svg");
  transform: rotate(-15deg);
}

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

html[data-theme="light"] .theme-toggle {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.18);
}
.online-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.online-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px rgba(110, 231, 183, 0.8);
}

.mobile-panel {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 30;
}

html[data-theme="light"] .mobile-panel {
  background: rgba(235, 241, 248, 0.7);
}

.mobile-panel-inner {
  position: absolute;
  top: calc(72px + env(safe-area-inset-top));
  right: 16px;
  left: 16px;
  padding: 18px;
  border-radius: 20px;
  display: grid;
  gap: 16px;
  transform: translateY(-10px);
  transition: transform 0.25s ease;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.mobile-nav {
  display: grid;
  gap: 12px;
  text-align: center;
}

.mobile-actions {
  display: grid;
  gap: 12px;
}

.mobile-actions .header-actions {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}

.mobile-actions .lang-toggle,
.mobile-actions .utility-row,
.mobile-actions .cta-row {
  justify-content: center;
  flex-wrap: wrap;
}

body.menu-open .mobile-panel {
  opacity: 1;
  pointer-events: auto;
}

body.menu-open .mobile-panel-inner {
  transform: translateY(0);
}

body.telegram-ready .topbar {
  margin-top: calc(6px + env(safe-area-inset-top));
  padding: 8px 16px;
}

body.telegram-ready .mobile-panel-inner {
  top: calc(64px + env(safe-area-inset-top));
}

body.telegram-ready .burger {
  width: 38px;
  height: 34px;
}

body.menu-open .bottom-nav {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.btn {
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(120deg, rgba(159, 245, 195, 0.3), rgba(124, 199, 255, 0.2));
  border-color: rgba(159, 245, 195, 0.4);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.15);
}

.btn.success {
  border-color: rgba(110, 231, 183, 0.4);
  background: rgba(110, 231, 183, 0.18);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
  padding: 28px;
  border-radius: 26px;
  position: relative;
  overflow: hidden;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow {
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: 36px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-image {
  padding: 12px;
  border-radius: 22px;
  position: relative;
}

.hero-image img {
  width: 100%;
  height: auto;
  opacity: 0.9;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 18px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 32px 0 18px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.menu-card {
  padding: 18px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-card:hover {
  transform: translateY(-4px);
  transition: transform 0.2s ease;
}

.menu-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.menu-card p {
  margin: 0;
  color: var(--muted);
}

.admin-teaser {
  margin-top: 28px;
  padding: 22px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

.footer {
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.footer-copy {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.page-hero {
  padding: 24px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 16px;
}

.ticket-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.ticket-card {
  padding: 16px;
  border-radius: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.topic-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.topic-card {
  padding: 18px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.topic-card span {
  color: var(--muted);
  font-size: 13px;
}

.quiz-toolbar {
  margin-top: 20px;
  padding: 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.quiz-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.question-list {
  margin-top: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.quiz-timer {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.quiz-summary {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  display: none;
}

.quiz-summary.active {
  display: block;
}

.quiz-pager {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quiz-page {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  min-width: 34px;
  text-align: center;
}

.quiz-page.active {
  border-color: rgba(159, 245, 195, 0.5);
  background: rgba(159, 245, 195, 0.16);
}

.quiz-page.done {
  background: rgba(255, 255, 255, 0.12);
}

.quiz-page.correct {
  border-color: rgba(110, 231, 183, 0.6);
}

.quiz-page.wrong {
  border-color: rgba(255, 107, 107, 0.6);
}

.question-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 12px;
}

.question-card img {
  border-radius: 16px;
}

.question-title {
  font-weight: 600;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.answer-btn.correct {
  border-color: rgba(110, 231, 183, 0.5);
  background: rgba(110, 231, 183, 0.16);
}

.answer-btn.wrong {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.16);
}

.quiz-empty {
  margin-top: 24px;
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--muted);
  display: none;
}

.quiz-empty.active {
  display: block;
}

.form-status {
  font-size: 12px;
  color: var(--muted);
}

.form-status.success {
  color: var(--success);
}

.form-status.error {
  color: var(--danger);
}

.upload-preview {
  display: grid;
  gap: 10px;
}

.upload-preview img {
  max-width: 240px;
  border-radius: 16px;
}

.reveal {
  opacity: 1;
}

body.loading #preloader {
  opacity: 1;
  visibility: visible;
}

body.loading .reveal,
body.loading .menu-grid .menu-card {
  opacity: 0;
  transform: translateY(18px);
}

body.loaded .reveal {
  animation: reveal 0.7s ease forwards;
}

body.loaded .menu-grid .menu-card {
  animation: reveal 0.6s ease forwards;
}

body.loaded .menu-grid .menu-card:nth-child(1) {
  animation-delay: 0.05s;
}

body.loaded .menu-grid .menu-card:nth-child(2) {
  animation-delay: 0.1s;
}

body.loaded .menu-grid .menu-card:nth-child(3) {
  animation-delay: 0.15s;
}

body.loaded .menu-grid .menu-card:nth-child(4) {
  animation-delay: 0.2s;
}

body.loaded .menu-grid .menu-card:nth-child(5) {
  animation-delay: 0.25s;
}

body.loaded .menu-grid .menu-card:nth-child(6) {
  animation-delay: 0.3s;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
}

.admin-nav {
  padding: 18px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 90px;
}

.admin-nav a {
  opacity: 0.75;
}

.admin-nav a.active {
  opacity: 1;
}

.admin-cards {
  display: grid;
  gap: 18px;
}

.admin-dashboard {
  padding: 22px;
  border-radius: 24px;
  display: grid;
  gap: 18px;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
}

.metric-card strong {
  font-size: 24px;
}

.metric-sub {
  font-size: 12px;
  color: var(--muted);
}

.metric-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.metric-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(120deg, rgba(113, 212, 167, 0.9), rgba(131, 186, 247, 0.9));
  transition: width 0.4s ease;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.admin-panel {
  padding: 20px;
  border-radius: 20px;
}

.admin-panel table .btn {
  padding: 6px 10px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.auth-verify {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.form-grid label {
  font-size: 13px;
  color: var(--muted);
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.form-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(113, 212, 167, 0.6);
  box-shadow: 0 0 0 3px rgba(113, 212, 167, 0.18);
}

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.04) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: none;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s ease;
}

.progress.active {
  display: block;
}

.form-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

td {
  vertical-align: top;
  word-break: break-word;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.status.banned {
  background: rgba(255, 107, 107, 0.2);
}

.auth-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px calc(90px + env(safe-area-inset-bottom));
}

.auth-card {
  padding: 28px;
  border-radius: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.telegram-card,
.profile-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.telegram-widget {
  display: grid;
  justify-items: start;
}

.telegram-fallback {
  display: none;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

body.telegram-ready .telegram-widget,
body.telegram-ready .telegram-fallback {
  display: none;
}

body.telegram-ready [data-telegram-login-card] {
  display: none;
}

body.telegram-ready [data-telegram-hide] {
  display: none;
}

.profile-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  color: var(--muted);
  align-items: center;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  grid-row: 1 / span 3;
}

.img-loading {
  filter: blur(10px);
  opacity: 0.7;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(10, 15, 25, 0.65);
  backdrop-filter: blur(12px);
  z-index: 9999;
}

.lightbox.active {
  display: grid;
}

.lightbox-inner {
  max-width: min(90vw, 960px);
  max-height: 86vh;
  padding: 18px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  position: relative;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 18px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(113, 212, 167, 0.9);
  animation: spin 1s linear infinite;
  position: absolute;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.profile-editor {
  display: grid;
  gap: 12px;
}

.profile-avatar-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.profile-avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  object-fit: cover;
  border: 1px solid var(--stroke);
}

.profile-avatar-actions {
  display: grid;
  gap: 8px;
}

.profile-meta {
  font-size: 13px;
  color: var(--muted);
}

.profile-row strong {
  color: var(--text);
}

.profile-box .profile-row {
  grid-column: 2;
}

.bottom-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 15;
  display: none;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-radius: 22px;
  background: rgba(12, 15, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bottom-nav a {
  display: grid;
  gap: 4px;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 4px;
  border-radius: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}

.bottom-nav a .icon {
  font-size: 16px;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav a.active {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  position: relative;
}

.bottom-nav a.active::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  display: block;
  margin-top: 4px;
}

html[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(15, 23, 42, 0.12);
}

.auth-tabs {
  display: flex;
  gap: 10px;
}

.auth-tabs button {
  flex: 1;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: grid;
  gap: 12px;
}

#preloader {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 11, 0.8);
  display: grid;
  place-items: center;
  z-index: 99;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  opacity: 0;
  visibility: hidden;
}

.preloader-card {
  padding: 24px 28px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
}

.loader-orb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(159, 245, 195, 0.9), rgba(124, 199, 255, 0.2));
  box-shadow: 0 0 30px rgba(159, 245, 195, 0.4);
  animation: pulse 1.6s ease-in-out infinite;
}

body.loaded #preloader {
  opacity: 0;
  visibility: hidden;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(18px);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes reveal {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .page-hero,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .top-nav,
  .header-actions {
    display: none;
  }

  .burger {
    display: flex;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: static;
  }

  .bottom-nav {
    display: grid;
  }

  .question-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell,
  .auth-shell {
    padding: 22px 16px calc(120px + env(safe-area-inset-bottom));
  }

  .profile-avatar-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-avatar-actions {
    width: 100%;
  }

  .topbar {
    padding: 8px 12px;
    margin: 8px;
    border-radius: 16px;
  }

  .logo span {
    font-size: 14px;
  }

  .burger {
    width: 38px;
    height: 34px;
  }

  .hero,
  .page-hero {
    padding: 20px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .ticket-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .dashboard-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

.result-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 15, 0.6);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.result-modal.active {
  display: flex;
}

.result-modal-card {
  width: min(420px, 92vw);
  padding: 22px;
  text-align: center;
  display: grid;
  gap: 18px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.result-stats strong {
  display: block;
  font-size: 20px;
  color: var(--text);
}

.news-grid {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.news-card {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.news-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
}

.news-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.news-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.news-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
}

.news-reactions {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.news-detail {
  margin-top: 24px;
  padding: 24px;
}

.news-detail img {
  margin-top: 16px;
  border-radius: 18px;
}

.nav-news {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4757;
  box-shadow: 0 0 10px rgba(255, 71, 87, 0.7);
  display: none;
}

.nav-badge.active {
  display: inline-block;
}

@media (max-width: 900px) {
  .news-card {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }
}

/* ---- Extended UI blocks ---- */

.theme-icon {
  background-image: url("/assets/sun.svg");
}

[data-admin-section] {
  display: none;
}

[data-admin-section].active {
  display: block;
}

.admin-nav a.active {
  opacity: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 8px 10px;
}

.ticket-card.locked,
.menu-card.locked,
.top-nav a.locked,
.bottom-nav a.locked {
  position: relative;
  filter: saturate(0.8) blur(0.2px);
}

.ticket-card.locked::after,
.menu-card.locked::after,
.top-nav a.locked::after,
.bottom-nav a.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(7, 11, 18, 0.35);
}

.lock {
  margin-left: 8px;
  font-size: 12px;
}

.pro-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 15, 0.65);
  backdrop-filter: blur(8px);
  z-index: 70;
}

.pro-modal.active {
  display: flex;
}

.pro-modal-card {
  width: min(460px, 92vw);
  border-radius: 22px;
  padding: 22px;
  display: grid;
  gap: 14px;
}

.pro-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pro-card {
  margin-top: 22px;
  border-radius: 24px;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.pro-prices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.price-card {
  border-radius: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 6px;
}

.price-card strong {
  font-size: 22px;
}

.pro-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.pro-status {
  min-height: 24px;
  color: var(--text);
}

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

.answers-panel {
  margin-top: 22px;
  border-radius: 22px;
  padding: 20px;
  display: grid;
  gap: 14px;
}

.answers-controls {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: end;
  gap: 10px;
}

.answers-list {
  display: grid;
  gap: 12px;
}

.answer-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.answer-head {
  font-weight: 700;
}

.answer-image img,
.answer-image {
  border-radius: 16px;
}

.answer-correct {
  color: var(--success);
  font-weight: 600;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.reaction-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reaction-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.reaction-option input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-user-actions select {
  width: auto;
  min-width: 72px;
}

.topic-image img,
.topic-image {
  border-radius: 14px;
}

.exam-history {
  margin-top: 18px;
}

.exam-bars {
  display: grid;
  gap: 8px;
}

.exam-bar {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  align-items: center;
  gap: 10px;
}

.exam-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.exam-bar-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(120deg, rgba(113, 212, 167, 0.9), rgba(131, 186, 247, 0.9));
}

.exam-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.exam-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.04);
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 30px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  transition: 0.25s;
}

.switch .slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: 0.25s;
}

.switch input:checked + .slider {
  background: rgba(113, 212, 167, 0.6);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.news-card {
  border-radius: 22px;
  cursor: pointer;
}

.news-image img {
  border-radius: 18px;
}

@media (max-width: 900px) {
  .answers-controls {
    grid-template-columns: 1fr;
  }

  .news-card {
    grid-template-columns: 1fr;
  }

  .news-card .news-image {
    display: none;
  }
}
