/*  HiFun IELTS · EZ×Apple design system  */

:root {
  --theme: #355cc2;
  --theme-rgb: 53, 92, 194;
  --theme-soft: rgba(53, 92, 194, 0.08);
  --theme-soft-2: rgba(53, 92, 194, 0.14);

  --bg: #f5f7fa;
  --card: #ffffff;
  --card-rgb: 255, 255, 255;
  --card-hover: #ffffff;
  --line: #e8e8e8;
  --line-card: #d9dee7;
  --line-hover: rgba(53, 92, 194, 0.35);

  --ink: #1d1d1f;
  --text: #333333;
  --text-2: #666666;
  --text-3: #8e8e93;

  --ok: #00b42a;
  --ok-bg: #e8ffea;
  --warn: #ff7d00;
  --warn-bg: #fff7e8;
  --err: #f53f3f;
  --err-bg: #ffece8;
  --info: #165dff;
  --info-bg: #e8f3ff;
  --violet: #a747fe;
  --teal: #37dec9;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --pill: 999px;

  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.35, 0.5, 1);

  font: 400 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    system-ui, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: -0.374px;
}

html[data-theme="dark"] {
  --theme: #6b93f0;
  --theme-rgb: 107, 147, 240;
  --theme-soft: rgba(107, 147, 240, 0.12);
  --theme-soft-2: rgba(107, 147, 240, 0.2);

  --bg: #171a1d;
  --card: #1f2329;
  --card-rgb: 31, 35, 41;
  --card-hover: #232832;
  --line: rgba(255, 255, 255, 0.1);
  --line-card: rgba(255, 255, 255, 0.16);
  --line-hover: rgba(107, 147, 240, 0.45);

  --ink: rgba(255, 255, 255, 0.95);
  --text: rgba(255, 255, 255, 0.9);
  --text-2: rgba(255, 255, 255, 0.6);
  --text-3: rgba(255, 255, 255, 0.4);

  --ok-bg: rgba(0, 180, 42, 0.14);
  --warn-bg: rgba(255, 125, 0, 0.14);
  --err-bg: rgba(245, 63, 63, 0.14);
  --info-bg: rgba(22, 93, 255, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.022em;
}

p {
  margin: 0;
}

a {
  color: var(--theme);
  text-decoration: none;
}

strong {
  font-weight: 600;
}

::selection {
  background: rgba(var(--theme-rgb), 0.22);
}

button, input, textarea, select {
  font: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled, input:disabled, select:disabled, textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(142, 142, 147, 0.35);
}

/* ---------- floating gradient balls ---------- */

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

.ball {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.32;
  mix-blend-mode: multiply;
}

html[data-theme="dark"] .ball {
  mix-blend-mode: screen;
  opacity: 0.16;
}

.ball-1 {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle at 30% 30%, rgba(var(--theme-rgb), 0.5), rgba(var(--theme-rgb), 0.12) 68%, transparent);
  top: -12%;
  left: -8%;
  animation: drift1 26s ease-in-out infinite;
}

.ball-2 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle at 70% 70%, rgba(167, 71, 254, 0.4), rgba(167, 71, 254, 0.08) 70%, transparent);
  top: 34%;
  right: -8%;
  animation: drift2 32s ease-in-out infinite;
}

.ball-3 {
  width: 430px;
  height: 430px;
  background: radial-gradient(circle at 50% 50%, rgba(55, 222, 201, 0.36), rgba(55, 222, 201, 0.06) 70%, transparent);
  bottom: -12%;
  left: 22%;
  animation: drift3 38s ease-in-out infinite;
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(6%, 9%); }
}

@keyframes drift2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-7%, -6%); }
}

@keyframes drift3 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(5%, -7%); }
  66% { transform: translate(-5%, 4%); }
}

@media (prefers-reduced-motion: reduce) {
  .ball {
    animation: none;
  }
}

/* ---------- floating pill nav ---------- */

.nav-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
}

.nav-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: rgba(var(--card-rgb), 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: calc(100vw - 140px);
}

.nav-pill::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.22px;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.22s var(--ease), color 0.22s var(--ease), transform 0.18s var(--spring);
}

.nav-item .ico {
  display: inline-grid;
  place-items: center;
}

.nav-item .ico svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(var(--theme-rgb), 0.07);
}

.nav-item:active {
  transform: scale(0.94);
}

.nav-item.active {
  color: #ffffff;
  background: var(--theme);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(var(--card-rgb), 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.18s var(--spring);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  color: var(--theme);
  border-color: var(--line-hover);
}

.icon-btn:active {
  transform: scale(0.92);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 14px 0 6px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: rgba(var(--card-rgb), 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--theme), var(--violet));
  flex: 0 0 30px;
}

.user-meta {
  display: grid;
  line-height: 1.2;
}

.user-meta b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.user-meta span {
  color: var(--text-2);
  font-size: 11.5px;
}

/* ---------- page layout ---------- */

.page {
  position: relative;
  z-index: 1;
  width: min(1160px, 100% - 32px);
  margin: 0 auto;
  padding: 102px 0 56px;
}

.page-head {
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  border-radius: var(--pill);
  border: 1px solid var(--line-card);
  background: var(--card);
  color: var(--theme);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}

.page-head h1 {
  font-size: clamp(30px, 4.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.024em;
}

.page-head .sub {
  margin-top: 10px;
  max-width: 640px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.55;
}

.section {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.section-head .more {
  font-size: 14px;
  font-weight: 600;
  color: var(--theme);
}

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 26px 16px 34px;
  color: var(--text-3);
  font-size: 12px;
}

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.card.hoverable:hover {
  border-color: var(--line-hover);
  background: var(--card-hover);
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

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

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 34px 32px;
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--theme-rgb), 0.12), transparent 65%);
  pointer-events: none;
}

.hero-card h1 {
  position: relative;
  font-size: clamp(28px, 3.6vw, 40px);
  letter-spacing: -0.024em;
  line-height: 1.1;
}

.hero-card .sub {
  position: relative;
  margin-top: 10px;
  max-width: 620px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.6;
}

.hero-card .actions {
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* stat */

.stat-value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 6px;
}

.stat-value small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  margin-left: 3px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

/* module card */

.module-card {
  display: grid;
  align-content: start;
  gap: 0;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  background: var(--card);
  text-align: left;
  transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.module-card:hover {
  border-color: var(--line-hover);
  background: var(--card-hover);
  transform: translateY(-2px);
}

.module-card:active {
  transform: translateY(0) scale(0.985);
}

.mod-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--mod, var(--theme));
  background: rgba(var(--mod-rgb, var(--theme-rgb)), 0.1);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.mod-ico svg {
  width: 22px;
  height: 22px;
}

.module-card:hover .mod-ico {
  color: #ffffff;
  background: var(--mod, var(--theme));
}

.module-card h3 {
  margin-top: 16px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-card h3 small {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.module-card p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
}

.module-card .go {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--theme);
  font-size: 14px;
  font-weight: 600;
}

.module-card .go svg {
  width: 15px;
  height: 15px;
  transition: transform 0.25s var(--ease);
}

.module-card:hover .go svg {
  transform: translateX(3px);
}

.module-card.listening { --mod: #0e7490; --mod-rgb: 14, 116, 144; }
.module-card.reading { --mod: var(--theme); --mod-rgb: var(--theme-rgb); }
.module-card.writing { --mod: #d6455d; --mod-rgb: 214, 69, 93; }
.module-card.speaking { --mod: #7c5cf0; --mod-rgb: 124, 92, 240; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.22px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.16s var(--spring), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--theme);
  color: #ffffff;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--theme) 88%, #000000);
}

.btn-ghost {
  background: transparent;
  border-color: var(--theme);
  color: var(--theme);
}

.btn-ghost:hover {
  background: var(--theme-soft);
}

.btn-plain {
  background: var(--card);
  border-color: var(--line-card);
  color: var(--text);
}

.btn-plain:hover {
  border-color: var(--line-hover);
  color: var(--theme);
}

.btn-dark {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn-dark:hover {
  opacity: 0.88;
}

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

.btn-danger:hover {
  background: #d93838;
}

.btn-sm {
  min-height: 34px;
  padding: 0 15px;
  font-size: 13.5px;
}

.btn-text {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--theme);
  font-weight: 600;
  font-size: 14px;
}

.btn-text:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-text:active {
  transform: scale(0.95);
}

.btn-block {
  width: 100%;
}

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.badge.blue { color: var(--theme); background: var(--theme-soft); border-color: rgba(var(--theme-rgb), 0.2); }
.badge.green { color: var(--ok); background: var(--ok-bg); border-color: rgba(0, 180, 42, 0.25); }
.badge.orange { color: var(--warn); background: var(--warn-bg); border-color: rgba(255, 125, 0, 0.25); }
.badge.red { color: var(--err); background: var(--err-bg); border-color: rgba(245, 63, 63, 0.22); }
.badge.violet { color: #8b3df0; background: rgba(167, 71, 254, 0.1); border-color: rgba(167, 71, 254, 0.24); }
.badge.cyan { color: #0e7490; background: rgba(14, 116, 144, 0.09); border-color: rgba(14, 116, 144, 0.22); }

.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- chips ---------- */

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  min-height: 38px;
  padding: 0 17px;
  border-radius: var(--pill);
  border: 1px solid var(--line-card);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease, transform 0.16s var(--spring), box-shadow 0.18s ease;
}

.chip:hover {
  border-color: var(--line-hover);
  color: var(--theme);
}

.chip:active {
  transform: scale(0.95);
}

.chip.active {
  border-color: var(--theme);
  box-shadow: inset 0 0 0 1px var(--theme);
  color: var(--theme);
  background: var(--theme-soft);
}

/* segmented legacy */

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
  overflow-x: auto;
  padding: 2px;
}

.segmented button {
  min-height: 38px;
  padding: 0 17px;
  border-radius: var(--pill);
  border: 1px solid var(--line-card);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease, transform 0.16s var(--spring);
}

.segmented button:hover {
  border-color: var(--line-hover);
  color: var(--theme);
}

.segmented button:active {
  transform: scale(0.95);
}

.segmented button.active {
  border-color: var(--theme);
  box-shadow: inset 0 0 0 1px var(--theme);
  color: var(--theme);
  background: var(--theme-soft);
}

/* ---------- forms ---------- */

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

.field {
  display: grid;
  gap: 7px;
}

.field > span, .field > label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.15px;
}

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

.input, .textarea, .select {
  width: 100%;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: var(--pill);
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: var(--card);
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

html[data-theme="dark"] .input,
html[data-theme="dark"] .textarea,
html[data-theme="dark"] .select {
  border-color: rgba(255, 255, 255, 0.18);
}

.textarea {
  min-height: 126px;
  border-radius: 18px;
  resize: vertical;
  line-height: 1.6;
}

.textarea-compact { min-height: 86px; }
.textarea-tall { min-height: 300px; }
.textarea-90 { min-height: 90px; }
.textarea-160 { min-height: 160px; }
.textarea-180 { min-height: 180px; }
.textarea-220 { min-height: 220px; }
.textarea-320 { min-height: 320px; }

.input:hover, .textarea:hover, .select:hover {
  border-color: rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .input:hover,
html[data-theme="dark"] .textarea:hover,
html[data-theme="dark"] .select:hover {
  border-color: rgba(255, 255, 255, 0.32);
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--theme);
  box-shadow: 0 0 0 3.5px rgba(var(--theme-rgb), 0.16);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 15px;
  padding-right: 40px;
}

.input-code { max-width: 180px; }
.field-fixed-96 { width: 96px; }
.field-fixed-120 { width: 120px; }
.field-fixed-130 { width: 130px; }

.audio-full {
  width: 100%;
  border-radius: 12px;
}

.spacer { height: 16px; }

/* ---------- lists ---------- */

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

.row-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-md);
  transition: border-color 0.22s ease;
}

.row-card:hover {
  border-color: var(--line-hover);
}

.row-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
}

.row-sub {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 13px;
}

.row-side {
  text-align: right;
}

.score-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- exam cards ---------- */

.exam-card {
  display: grid;
  align-content: space-between;
  gap: 16px;
  min-height: 190px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.exam-card:hover {
  border-color: var(--line-hover);
  background: var(--card-hover);
  transform: translateY(-2px);
}

.exam-card h3 {
  margin: 12px 0 6px;
  font-size: 16px;
  line-height: 1.4;
}

.exam-card .desc {
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ---------- questions ---------- */

.questions {
  display: grid;
  gap: 12px;
}

.qcard {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  transition: border-color 0.2s ease;
}

.qcard:focus-within {
  border-color: var(--line-hover);
}

.qtitle {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 13px;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.2px;
}

.qnum {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--theme-soft-2);
  color: var(--theme);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.opt-list {
  display: grid;
  gap: 8px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--pill);
  border: 1px solid var(--line-card);
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.opt.auto {
  width: auto;
  align-self: flex-start;
  min-height: 36px;
  padding: 5px 15px;
}

.opt:hover {
  border-color: var(--line-hover);
}

.opt:has(input:checked) {
  border-color: var(--theme);
  box-shadow: inset 0 0 0 1px var(--theme);
  background: var(--theme-soft);
  color: var(--theme);
  font-weight: 600;
}

.opt input {
  accent-color: var(--theme);
  width: 16px;
  height: 16px;
  margin: 0;
}

.question {
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
}

.question ul {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  color: var(--text-2);
}

.question-title {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.5;
}

/* ---------- exam bar ---------- */

.exambar {
  position: sticky;
  top: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 20px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: rgba(var(--card-rgb), 0.75);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.09);
  margin-bottom: 20px;
}

.exambar h1 {
  font-size: 19px;
  margin-top: 6px;
}

.timer {
  flex: 0 0 auto;
  min-width: 108px;
  height: 44px;
  padding: 0 20px;
  display: grid;
  place-items: center;
  border-radius: var(--pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.passage {
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 10px;
  color: var(--text);
  line-height: 1.8;
  font-size: 15.5px;
  letter-spacing: 0;
}

.passage h1, .passage h2, .passage h3 {
  line-height: 1.3;
}

.source-exam-panel {
  padding: 0;
  overflow: hidden;
}

.source-exam-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 170px);
  min-height: 700px;
  border: 0;
  border-radius: inherit;
  background: var(--card);
}

.source-file-only {
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 30px;
  text-align: center;
}

/* ---------- results ---------- */

.result {
  padding: 26px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(0, 180, 42, 0.3);
  background: var(--ok-bg);
  display: grid;
  gap: 8px;
}

.result .score-num {
  font-size: 44px;
}

/* ---------- split & admin ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-item {
  width: 100%;
  padding: 14px 16px;
  display: grid;
  gap: 9px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-md);
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.16s var(--spring);
}

.admin-item strong {
  color: var(--ink);
  font-size: 14.5px;
}

.admin-item:hover {
  border-color: var(--line-hover);
}

.admin-item:active {
  transform: scale(0.985);
}

.admin-item.active {
  border-color: var(--theme);
  box-shadow: inset 0 0 0 1px var(--theme);
}

.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

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

.config-title {
  margin: 0 0 14px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-lg);
  padding: 22px;
}

.welcome {
  margin-bottom: 26px;
}

.welcome h1 {
  font-size: clamp(28px, 3.6vw, 38px);
  letter-spacing: -0.024em;
}

.welcome .sub {
  margin-top: 10px;
  max-width: 640px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.55;
}

/* ---------- status ---------- */

.muted { color: var(--text-2); }
.error { color: var(--err); }
.ok { color: var(--ok); }

.status {
  min-height: 22px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}

.empty {
  padding: 30px 22px;
  border: 1.5px dashed var(--line-card);
  border-radius: var(--r-lg);
  color: var(--text-3);
  text-align: center;
  font-weight: 500;
}

.section-heading { margin: 0; }

/* ---------- auth ---------- */

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 110px 18px 48px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 36px 34px;
  background: var(--card);
  border: 1px solid var(--line-card);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 70px -30px rgba(0, 0, 0, 0.25);
}

.auth-card h1 {
  margin: 14px 0 6px;
  font-size: 28px;
  letter-spacing: -0.024em;
}

.auth-sub {
  margin-bottom: 26px;
  color: var(--text-2);
  font-size: 15px;
}

.auth-foot {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  justify-items: center;
  color: var(--text-2);
  font-size: 13.5px;
  text-align: center;
}

.demo-note {
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.7;
}

.auth-toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .admin-grid { grid-template-columns: 1fr; }
  .passage { max-height: none; }
}

@media (max-width: 760px) {
  .page { padding-top: 132px; }

  .nav-wrap {
    left: 12px;
    right: 12px;
    transform: none;
    justify-content: space-between;
    gap: 8px;
  }

  .nav-pill {
    max-width: calc(100vw - 150px);
  }

  .nav-item span {
    display: none;
  }

  .nav-item {
    padding: 0 13px;
  }

  .user-meta { display: none; }

  .user-chip { padding: 0 10px 0 6px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .exambar {
    top: 8px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .row-card { grid-template-columns: 1fr; }
  .row-side { text-align: left; }

  .two-cols { grid-template-columns: 1fr; }

  .hero-card { padding: 26px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
