:root {
  --bg: #eef3f9;
  --bg-alt: #e3ebf6;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #f3f7fe;
  --text: #15263f;
  --text-muted: #5e6f8e;
  --line: #cfdbed;
  --line-strong: #adc1dd;
  --primary: #1f3f73;
  --primary-accent: #3f71c8;
  --primary-accent-dark: #2c5baa;
  --success: #0f9f62;
  --warning: #d97706;
  --danger: #d92d20;
  --radius: 24px;
  --radius-lg: 28px;
  --shadow: 0 16px 44px rgba(10, 21, 38, 0.08);
  --shadow-strong: 0 34px 90px rgba(10, 21, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 14%, rgba(79, 124, 207, 0.16), transparent 28%),
    radial-gradient(circle at 88% 10%, rgba(31, 63, 115, 0.14), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(125, 182, 243, 0.12), transparent 32%),
    linear-gradient(180deg, #f7fafe 0%, var(--bg) 38%, var(--bg-alt) 100%);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(58px);
  opacity: 0.32;
}

.orb-1 {
  width: 420px;
  height: 420px;
  right: -120px;
  top: -160px;
  background: #7f9fe4;
}

.orb-2 {
  width: 360px;
  height: 360px;
  left: -120px;
  bottom: -150px;
  background: #8cbdf1;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 20px auto;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(191, 208, 232, 0.8);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-strong);
  padding: 18px 22px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(99, 91, 255, 0.95), rgba(10, 37, 64, 0.98));
  box-shadow: 0 12px 30px rgba(10, 37, 64, 0.26);
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
}

.brand-title small {
  font-size: 0.77rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover,
.brand-link:focus-visible {
  color: var(--primary-accent);
  text-decoration: none;
}

.brand-title strong {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0a1526;
}

.brand-version {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-muted);
  vertical-align: middle;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 0.8em;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.15;
}

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

.main-grid {
  margin-top: 18px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1.06fr 0.94fr;
}

.main-grid-centered {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
}

.panel {
  border: 1px solid rgba(217, 227, 240, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
  padding: 24px;
  backdrop-filter: blur(16px);
}

.auth-panel-centered {
  width: min(100%, 560px);
  margin: 0 auto;
}

.panel-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(99, 91, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 250, 255, 0.96) 100%);
}

.panel-hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -34% auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(99, 91, 255, 0.18) 0%, rgba(99, 91, 255, 0) 70%);
  pointer-events: none;
}

.panel h1,
.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

.panel p {
  margin: 0 0 12px;
}

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

.auth-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #eef3fb;
  padding: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.auth-tabs button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 9px 16px;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(10, 21, 38, 0.08);
}

.auth-tabs button:hover {
  color: var(--text);
}

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

label {
  font-size: 0.88rem;
  font-weight: 650;
  color: #23344f;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  font: inherit;
  outline: none;
  background: #fff;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(99, 91, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.14);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

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

.btn-primary {
  background: linear-gradient(135deg, #1d3a69 0%, #315fab 62%, #4f82d2 100%);
  color: #fff;
  box-shadow: 0 18px 36px rgba(10, 37, 64, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 20px 40px rgba(10, 37, 64, 0.22);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.btn-danger {
  background: linear-gradient(135deg, #d92d20 0%, #ff5a5f 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(217, 45, 32, 0.16);
}

.flash {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-weight: 600;
  border: 1px solid;
}

.flash-success {
  background: #ecfff6;
  border-color: #9ddabf;
  color: #0c6b40;
}

.flash-error {
  background: #fff2f0;
  border-color: #f3b7b0;
  color: #9f1f14;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(10, 37, 64, 0.06);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 750;
}

.question-card {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fcfdff 0%, #f5f8fd 100%);
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.hero-grid {
  display: grid;
  gap: 14px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  border: 1px solid rgba(99, 91, 255, 0.14);
  border-radius: 999px;
  background: rgba(99, 91, 255, 0.08);
  color: #27325c;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin: 2px 0 0;
}

.hero-copy {
  max-width: 58ch;
  font-size: 1rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.test-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.setting-card {
  display: grid;
  gap: 8px;
  padding: 14px 15px;
  border: 1px solid rgba(217, 227, 240, 0.95);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 250, 255, 0.96) 100%);
  box-shadow: 0 10px 28px rgba(10, 21, 38, 0.05);
}

.setting-label {
  color: #22324d;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.setting-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 46px;
  border: 1px solid rgba(191, 208, 232, 0.9);
  border-radius: 14px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #62708a 50%),
    linear-gradient(135deg, #62708a 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 16px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding: 12px 42px 12px 14px;
  font-weight: 650;
  color: #122238;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-align: center;
  text-align-last: center;
}

.setting-select:focus {
  border-color: rgba(99, 91, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.14);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  border: 1px solid rgba(217, 227, 240, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px 14px;
}

.metric strong {
  display: block;
  font-size: 1.1rem;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

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

.answer-item {
  border: 1px solid rgba(217, 227, 240, 0.95);
  border-radius: 16px;
  background: #fff;
  padding: 12px 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.answer-item:hover {
  border-color: rgba(99, 91, 255, 0.35);
  box-shadow: 0 12px 28px rgba(10, 21, 38, 0.06);
  transform: translateY(-1px);
}

.answer-item:has(input:checked) {
  border-color: rgba(99, 91, 255, 0.5);
  box-shadow: 0 16px 34px rgba(10, 21, 38, 0.08);
  background: linear-gradient(180deg, rgba(99, 91, 255, 0.08) 0%, #fff 100%);
}

.answer-item label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  color: #18335e;
}

.answer-item input {
  width: auto;
  margin-top: 3px;
}

.test-question-card {
  padding-bottom: 18px;
}

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

.progress {
  margin: 10px 0 4px;
  color: #20314c;
  font-weight: 750;
}

.timer-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid rgba(191, 208, 232, 0.9);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99, 91, 255, 0.09), rgba(255, 255, 255, 0.92));
  color: var(--text);
}

.timer-box strong {
  color: #2a3350;
}

#countdown {
  font-weight: 850;
  letter-spacing: 0.06em;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  border-bottom: 1px solid #e8effa;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.table th {
  color: #22324d;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-layout {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: 0.92fr 1.08fr;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.admin-shell {
  border: 1px solid rgba(217, 227, 240, 0.9);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 255, 0.96) 100%);
  box-shadow: var(--shadow-strong);
}

.admin-hero {
  display: grid;
  gap: 8px;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.admin-hero h1,
.admin-hero h2 {
  margin-bottom: 0;
}

.admin-hero p {
  margin-bottom: 0;
}

.table-wrap {
  border: 1px solid rgba(217, 227, 240, 0.75);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.table {
  overflow: hidden;
}

.table tr:hover td {
  background: rgba(99, 91, 255, 0.04);
}

.promo-banner {
  margin: 18px auto 14px;
  width: min(1180px, calc(100% - 32px));
  border-radius: 22px;
  border: 1px solid rgba(109, 156, 231, 0.34);
  background: linear-gradient(100deg, #173768 0%, #2a5699 58%, #3c6cb9 100%);
  box-shadow: 0 18px 44px rgba(19, 47, 91, 0.22);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.promo-banner-center {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

.promo-icon {
  width: 84px;
  height: 84px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 18%, #ffffff 0 5px, #85c3ff 6px 10px, transparent 11px),
    linear-gradient(180deg, transparent 24px, rgba(214, 233, 255, 0.9) 24px 30px, transparent 30px),
    linear-gradient(155deg, #9dd1ff 0%, #3c6fc0 55%, #203d71 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.promo-content {
  color: #eff6ff;
}

.promo-content-center {
  max-width: 780px;
  margin: 0 auto;
}

.promo-label {
  margin: 0 0 4px;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
  color: rgba(229, 241, 255, 0.76);
  text-transform: uppercase;
}

.promo-content h3 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  line-height: 1.04;
  color: #ffffff;
}

.promo-content p {
  margin: 0;
  max-width: 760px;
  font-size: 0.96rem;
  line-height: 1.4;
  color: rgba(236, 245, 255, 0.88);
}

.promo-content-center p {
  max-width: 100%;
}

.promo-cta {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(233, 243, 255, 0.4);
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 8px 20px rgba(15, 39, 79, 0.28);
  backdrop-filter: blur(4px);
}

.promo-cta:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.24);
}

.footer {
  margin: auto auto 8px;
  width: min(1180px, calc(100% - 32px));
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}

.footer-left,
.footer-donate {
  display: grid;
  gap: 6px;
}

.footer-title {
  font-weight: 800;
  color: var(--text);
}

.footer-title a {
  color: inherit;
  text-decoration: none;
}

.footer-title a:hover {
  color: var(--primary-accent);
  text-decoration: underline;
}

.footer-credit {
  color: #35465f;
}

.footer-links {
  display: flex;
  gap: 14px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.footer-title,
.footer-credit,
.footer p {
  text-align: left;
}

.footer a {
  color: var(--primary-accent);
  text-decoration: none;
}

.footer-donate {
  justify-items: end;
  text-align: right;
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid rgba(217, 227, 240, 0.9);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.footer-donate img {
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 18px;
  border: 1px solid rgba(217, 227, 240, 0.95);
  background: #fff;
  box-shadow: 0 14px 36px rgba(10, 21, 38, 0.12);
  object-fit: cover;
  flex-shrink: 0;
}

.footer-donate a {
  font-weight: 750;
}

.footer-left p,
.footer-donate p {
  margin: 0;
}

.footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .main-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .main-grid-centered {
    grid-template-columns: 1fr;
  }

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

  .panel {
    padding: 18px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .test-settings-grid {
    grid-template-columns: 1fr;
  }

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

  .promo-banner {
    grid-template-columns: auto 1fr;
  }

  .promo-cta {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .footer-donate {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .container {
    width: min(100% - 18px, 100%);
    margin: 10px auto;
  }

  .topbar {
    padding: 14px 14px;
    border-radius: 18px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-title strong {
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
  }

  .brand-title small {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .btn,
  .top-actions .badge {
    width: 100%;
    justify-content: center;
  }

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

  .panel-hero::after {
    width: 150px;
    height: 150px;
    inset: auto -40px -52px auto;
  }

  .hero-title {
    font-size: 1.8rem;
    line-height: 1.02;
  }

  .hero-copy {
    font-size: 0.95rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .test-settings-grid {
    gap: 10px;
  }

  .setting-card {
    padding: 12px;
  }

  .setting-label {
    font-size: 0.76rem;
  }

  .setting-select {
    min-height: 44px;
    padding-right: 38px;
    font-size: 0.95rem;
  }

  .auth-tabs {
    width: 100%;
  }

  .auth-tabs button {
    flex: 1 1 0;
    padding: 10px 12px;
  }

  .table {
    font-size: 0.85rem;
  }

  .table th,
  .table td {
    padding: 8px 6px;
  }

  .footer {
    width: min(100% - 18px, 100%);
    gap: 14px;
    margin-top: 16px;
  }

  .promo-banner {
    width: min(100% - 18px, 100%);
    border-radius: 18px;
    padding: 14px;
    gap: 12px;
    grid-template-columns: 1fr;
  }

  .promo-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .promo-content h3 {
    font-size: 1.16rem;
  }

  .promo-content p {
    font-size: 0.9rem;
  }

  .promo-cta {
    width: 100%;
    justify-content: center;
  }

  .footer-donate img {
    width: 108px;
    height: 108px;
  }

  .test-question-card {
    padding: 14px;
  }

  .progress {
    font-size: 0.92rem;
  }

  .timer-box {
    width: 100%;
    justify-content: center;
    border-radius: 18px;
    padding: 10px 12px;
  }

  .question-card h2 {
    font-size: 1.12rem;
    line-height: 1.32;
  }

  .answer-list {
    gap: 10px;
  }

  .answer-item {
    padding: 14px 14px;
    border-radius: 18px;
  }

  .answer-item label {
    gap: 10px;
    font-size: 0.98rem;
    line-height: 1.35;
  }

  .answer-item input {
    margin-top: 2px;
    transform: scale(1.08);
  }

  .test-actions {
    position: sticky;
    bottom: 10px;
    z-index: 2;
    padding-top: 10px;
    margin-top: 16px;
    background: linear-gradient(180deg, rgba(247, 250, 255, 0), rgba(247, 250, 255, 0.96) 28%);
  }

  .test-actions .btn {
    width: 100%;
    min-height: 48px;
  }

  .test-actions .btn:first-child {
    order: 2;
  }

  .test-actions .btn:nth-child(2) {
    order: 1;
  }

  .test-actions .btn:last-child {
    order: 3;
  }
}

@media (max-width: 420px) {
  .brand {
    width: 100%;
  }

  .brand-title strong {
    font-size: 0.75rem;
  }

  .hero-title {
    font-size: 1.55rem;
  }

  .badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .footer-links {
    gap: 10px;
  }

  .footer-donate img {
    width: 96px;
    height: 96px;
  }

  .test-actions {
    bottom: 8px;
  }
}
