:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-strong: #111827;
  --on-strong: #ffffff;
  --on-accent: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dee9;
  --line-strong: #bcc8d8;
  --accent: #2457c5;
  --accent-hover: #1c469d;
  --accent-soft: #e8efff;
  --teal: #0f766e;
  --teal-soft: #e2f4f1;
  --amber: #b45309;
  --amber-soft: #fff4db;
  --good: #15803d;
  --good-soft: #e8f7ee;
  --bad: #c2410c;
  --bad-soft: #fff0e8;
  --violet: #6d4cc2;
  --violet-soft: #f3efff;
  --page-bg:
    linear-gradient(180deg, rgba(238, 242, 247, 0.95), rgba(247, 249, 252, 1) 58%),
    linear-gradient(135deg, rgba(36, 87, 197, 0.10), rgba(15, 118, 110, 0.08) 48%, rgba(180, 83, 9, 0.08));
  --glass: rgba(255, 255, 255, 0.72);
  --tab-bg: rgba(255, 255, 255, 0.70);
  --hero-bg:
    linear-gradient(135deg, rgba(17, 24, 39, 0.96), rgba(28, 70, 157, 0.92)),
    linear-gradient(90deg, rgba(15, 118, 110, 0.28), transparent);
  --watermark: rgba(17, 24, 39, 0.26);
  --shadow: 0 18px 50px rgba(31, 42, 68, 0.10);
  --shadow-soft: 0 10px 28px rgba(31, 42, 68, 0.07);
}

:root[data-theme="dark"] {
  --bg: #111827;
  --surface: #172033;
  --surface-soft: #202b42;
  --surface-strong: #f8fafc;
  --on-strong: #111827;
  --on-accent: #111827;
  --ink: #f8fafc;
  --muted: #a7b2c7;
  --line: #334158;
  --line-strong: #4b5d78;
  --accent: #7aa2ff;
  --accent-hover: #9dbaff;
  --accent-soft: #22345d;
  --teal: #5fd4c9;
  --teal-soft: #163d3b;
  --amber: #f7b955;
  --amber-soft: #49351b;
  --good: #6ee7a0;
  --good-soft: #153d26;
  --bad: #ff9a73;
  --bad-soft: #4a2419;
  --violet: #c3b5ff;
  --violet-soft: #2b2445;
  --page-bg:
    linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(24, 34, 51, 1) 58%),
    linear-gradient(135deg, rgba(122, 162, 255, 0.14), rgba(95, 212, 201, 0.09) 48%, rgba(247, 185, 85, 0.08));
  --glass: rgba(23, 32, 51, 0.76);
  --tab-bg: rgba(23, 32, 51, 0.74);
  --hero-bg:
    linear-gradient(135deg, rgba(7, 12, 24, 0.96), rgba(32, 52, 93, 0.94)),
    linear-gradient(90deg, rgba(95, 212, 201, 0.18), transparent);
  --watermark: rgba(248, 250, 252, 0.22);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.18);
}

:root[data-theme="ocean"] {
  --bg: #eaf7fb;
  --surface-soft: #f1fbfd;
  --surface-strong: #063e52;
  --accent: #0b6fa4;
  --accent-hover: #07577f;
  --accent-soft: #dff4fb;
  --teal: #087f8c;
  --teal-soft: #ddf6f6;
  --amber: #9a6713;
  --amber-soft: #fff5db;
  --page-bg:
    linear-gradient(180deg, rgba(234, 247, 251, 0.96), rgba(246, 252, 253, 1) 58%),
    linear-gradient(135deg, rgba(11, 111, 164, 0.13), rgba(8, 127, 140, 0.10) 48%, rgba(154, 103, 19, 0.08));
  --hero-bg:
    linear-gradient(135deg, rgba(6, 62, 82, 0.96), rgba(11, 111, 164, 0.92)),
    linear-gradient(90deg, rgba(8, 127, 140, 0.25), transparent);
}

:root[data-theme="forest"] {
  --bg: #eef6f0;
  --surface-soft: #f6fbf7;
  --surface-strong: #183b2a;
  --accent: #2f6f4e;
  --accent-hover: #24583d;
  --accent-soft: #e1f2e8;
  --teal: #17766e;
  --teal-soft: #e0f3ee;
  --amber: #946514;
  --amber-soft: #fff4d8;
  --page-bg:
    linear-gradient(180deg, rgba(238, 246, 240, 0.96), rgba(248, 252, 249, 1) 58%),
    linear-gradient(135deg, rgba(47, 111, 78, 0.13), rgba(23, 118, 110, 0.09) 48%, rgba(148, 101, 20, 0.08));
  --hero-bg:
    linear-gradient(135deg, rgba(24, 59, 42, 0.96), rgba(47, 111, 78, 0.92)),
    linear-gradient(90deg, rgba(23, 118, 110, 0.22), transparent);
}

:root[data-theme="sunset"] {
  --bg: #fbf2ee;
  --surface-soft: #fff8f4;
  --surface-strong: #4b2b2f;
  --accent: #9f3d50;
  --accent-hover: #7f2f3f;
  --accent-soft: #fde8ee;
  --teal: #0d766f;
  --teal-soft: #e0f4f1;
  --amber: #b05d1d;
  --amber-soft: #fff0dc;
  --violet: #7d4f8f;
  --violet-soft: #f8ecfb;
  --page-bg:
    linear-gradient(180deg, rgba(251, 242, 238, 0.96), rgba(255, 249, 246, 1) 58%),
    linear-gradient(135deg, rgba(159, 61, 80, 0.12), rgba(13, 118, 111, 0.08) 48%, rgba(176, 93, 29, 0.09));
  --hero-bg:
    linear-gradient(135deg, rgba(75, 43, 47, 0.96), rgba(159, 61, 80, 0.92)),
    linear-gradient(90deg, rgba(13, 118, 111, 0.22), transparent);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  min-height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: -webkit-fill-available;
  color: var(--ink);
  background: var(--page-bg);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body::after {
  content: "licenta.rffa.eu";
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 9999;
  pointer-events: none;
  color: var(--watermark);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 8px;
  padding: 5px 8px;
  box-shadow: var(--shadow-soft);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 0 max(42px, env(safe-area-inset-bottom));
}

.boot {
  margin: 16vh auto 0;
  width: min(430px, 100%);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.app-topbar {
  background: var(--glass);
  border: 1px solid rgba(215, 222, 233, 0.9);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.brand-title {
  margin: 0;
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
  min-width: 210px;
}

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

.theme-picker {
  display: inline-grid;
  gap: 4px;
  min-width: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
  box-shadow: var(--shadow-soft);
}

.theme-picker span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.theme-picker select {
  width: 100%;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  outline: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--surface-strong);
  color: var(--on-strong);
  font-weight: 900;
  flex: none;
}

.chip-meta {
  min-width: 0;
}

.chip-meta strong,
.chip-meta span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chip-meta span {
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 7px;
  margin: 0 0 18px;
  padding: 5px;
  overflow-x: auto;
  background: var(--tab-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 13px;
  border-radius: 7px;
  font-weight: 850;
  white-space: nowrap;
}

.tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 3px 14px rgba(31, 42, 68, 0.08);
}

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

.grid.two {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

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

.panel {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.panel.tight {
  padding: 14px;
}

.panel h2,
.panel h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

.panel h2 {
  font-size: 19px;
}

.panel h3 {
  font-size: 15px;
}

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

.small {
  font-size: 12px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin: 0 0 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  min-height: 44px;
}

.field input:focus,
.field select:focus,
.code-input:focus {
  outline: 3px solid rgba(36, 87, 197, 0.15);
  border-color: var(--accent);
}

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

.row.between {
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 900;
  padding: 10px 14px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 9px 22px rgba(36, 87, 197, 0.18);
}

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

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn.secondary:hover {
  background: var(--surface-soft);
  box-shadow: none;
}

.btn.danger {
  background: var(--surface);
  color: #a33a18;
  border-color: #f1c6b3;
}

.btn.danger:hover {
  background: var(--bad-soft);
  box-shadow: none;
}

.btn.good {
  background: var(--teal);
}

.btn.good:hover {
  background: #0c625c;
}

.btn:disabled,
.action-card:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-weight: 900;
  color: var(--muted);
  white-space: nowrap;
}

.segmented button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 5px rgba(31, 42, 68, 0.10);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  background: var(--hero-bg);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.hero-panel .eyebrow,
.hero-panel .brand-sub {
  color: #c9f2eb;
}

.hero-panel h2 {
  margin: 0;
  max-width: 700px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.entry-message {
  width: fit-content;
  max-width: 100%;
  margin: 8px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.35;
}

.entry-message.compact {
  width: 100%;
  color: var(--ink);
  background: var(--amber-soft);
  border-color: #f2d59b;
  margin: 14px 0 12px;
}

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

.quick-grid,
.result-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.mini-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px;
}

.result-panel .mini-metric {
  background: var(--surface-soft);
  border-color: var(--line);
}

.mini-metric span {
  color: inherit;
  opacity: 0.76;
  font-size: 12px;
  font-weight: 800;
}

.mini-metric strong {
  font-size: 22px;
  line-height: 1;
}

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

.action-card {
  display: grid;
  gap: 5px;
  min-height: 92px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 900;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.action-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.action-card strong {
  font-size: 15px;
}

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

.plan-list {
  display: grid;
  gap: 9px;
}

.plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px;
}

.plan-row strong,
.plan-row span {
  display: block;
}

.plan-row strong {
  overflow-wrap: anywhere;
}

.plan-row span {
  color: var(--muted);
  font-size: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(31, 42, 68, 0.05);
}

.stat .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .v {
  margin-top: 4px;
  font-size: 26px;
  font-weight: 950;
}

.stat .s {
  color: var(--muted);
  font-size: 12px;
}

.login-wrap {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(450px, 100%);
}

.auth-panel {
  padding: 24px;
}

.auth-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--on-strong);
  font-weight: 950;
  letter-spacing: 0.04em;
}

.code-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 14px 13px;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.error,
.success {
  border-radius: 8px;
  padding: 11px 12px;
  margin-top: 12px;
}

.error {
  color: #8a2f12;
  background: var(--bad-soft);
  border: 1px solid #f1c6b3;
}

.success {
  color: #0c5d2c;
  background: var(--good-soft);
  border: 1px solid #bde5c9;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.test-panel,
.study-card {
  max-width: 930px;
  margin: 0 auto;
}

.test-head {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  gap: 12px;
}

.progress {
  height: 9px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-soft);
}

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

.question-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.question-text {
  margin: 8px 0 12px;
  font-size: 22px;
  line-height: 1.42;
  font-weight: 900;
}

.hint {
  display: inline-flex;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #b8ddd8;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 12px;
}

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

.option {
  display: grid;
  grid-template-columns: 22px 28px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 13px;
  cursor: pointer;
}

.option:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.letter {
  font-weight: 950;
  color: var(--muted);
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option.correct {
  border-color: #8ed4a5;
  background: var(--good-soft);
}

.option.wrong {
  border-color: #efb18d;
  background: var(--bad-soft);
}

.option.missed {
  border-color: #8ed4a5;
  background: var(--good-soft);
  border-style: dashed;
}

.status-mark {
  font-weight: 950;
}

.correct .status-mark,
.missed .status-mark {
  color: var(--good);
}

.wrong .status-mark {
  color: var(--bad);
}

.bookmark-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 7px 11px;
}

.bookmark-btn.on {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #a7d8d1;
}

.feedback {
  margin-top: 14px;
  border-radius: 8px;
  padding: 12px;
  font-weight: 900;
}

.feedback.ok {
  background: var(--good-soft);
  color: var(--good);
}

.feedback.no {
  background: var(--bad-soft);
  color: var(--bad);
}

.question-map {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.qdot {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.qdot:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.qdot.current {
  border-color: var(--accent);
  color: var(--on-accent);
  background: var(--accent);
}

.qdot.done {
  border-color: color-mix(in srgb, var(--good) 55%, var(--line));
  color: var(--good);
  background: var(--good-soft);
}

.qdot.wrong {
  border-color: color-mix(in srgb, var(--bad) 55%, var(--line));
  color: var(--bad);
  background: var(--bad-soft);
}

.qdot.touched {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.qdot.flagged {
  box-shadow: inset 0 -4px 0 var(--amber);
}

.qdot.saved {
  box-shadow: inset 0 4px 0 var(--teal);
}

.explain {
  margin-top: 12px;
  border: 1px solid #d9cef7;
  background: var(--violet-soft);
  border-radius: 8px;
  padding: 12px;
}

.explain strong {
  display: block;
  margin-bottom: 6px;
  color: var(--violet);
}

.quote {
  margin: 8px 0 0;
  white-space: pre-wrap;
  background: var(--surface);
  border-left: 3px solid var(--violet);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  color: var(--ink);
  max-height: 270px;
  overflow: auto;
}

.answer-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.answer-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
}

.answer-row.correct {
  border-color: #8ed4a5;
  background: var(--good-soft);
}

.result-panel {
  text-align: center;
}

.result-score {
  font-size: 58px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.result-score small {
  color: var(--muted);
  font-size: 20px;
}

.result-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

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

.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.search-item strong {
  overflow-wrap: anywhere;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.good {
  color: var(--good);
  background: var(--good-soft);
}

.tag.bad {
  color: var(--bad);
  background: var(--bad-soft);
}

.tag.neutral {
  color: var(--muted);
  background: var(--surface-soft);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--on-strong);
  font-weight: 950;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 0.4fr) minmax(170px, 0.35fr);
  gap: 12px;
  align-items: end;
}

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

.subject-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, 0.38fr) 48px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
}

.subject-row strong,
.subject-row span {
  display: block;
}

.subject-row span {
  color: var(--muted);
  font-size: 12px;
}

.metric-bar {
  height: 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.metric-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bad), var(--amber), var(--good));
}

.library-list {
  display: grid;
  gap: 9px;
}

.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.library-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.admin-code {
  display: inline-flex;
  border-radius: 8px;
  border: 1px solid #acd5cb;
  background: #eefaf7;
  color: #0b4c45;
  padding: 9px 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.mini-input {
  width: 92px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 8px;
}

@media (max-width: 980px) {
  .grid.two,
  .grid.three,
  .hero-panel,
  .search-row {
    grid-template-columns: 1fr;
  }

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

  .topbar-actions {
    justify-content: stretch;
  }

  .theme-picker {
    flex: 1 1 132px;
  }

  .user-chip {
    flex: 1 1 210px;
    width: auto;
  }

  .hero-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 16px, 1220px);
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .panel,
  .hero-panel,
  .app-topbar {
    padding: 14px;
  }

  .brand-title {
    font-size: 22px;
  }

  .hero-panel h2 {
    font-size: 23px;
  }

  .quick-grid,
  .result-strip,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    z-index: 10;
    scroll-snap-type: x mandatory;
  }

  .tab {
    min-height: 44px;
    scroll-snap-align: start;
  }

  .btn,
  .action-card,
  .field input,
  .field select,
  .code-input {
    min-height: 48px;
  }

  .question-text {
    font-size: 18px;
  }

  .option {
    grid-template-columns: 22px 24px minmax(0, 1fr);
  }

  .option .status-mark {
    grid-column: 3;
  }

  .progress-meta,
  .question-tools,
  .plan-row,
  .subject-row {
    grid-template-columns: 1fr;
  }

  .subject-row {
    display: grid;
  }

  .result-score {
    font-size: 42px;
  }

  .entry-message {
    width: 100%;
    font-size: 15px;
  }

  .question-map {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .qdot {
    width: 100%;
  }
}
