:root {
  color-scheme: light;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
  background: #f7f5ef;
  color: #1f2933;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f7f5ef;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
}
button, select, textarea { font: inherit; }
button, select, input, textarea { min-height: 44px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 22px 12px;
  background: rgba(247, 245, 239, 0.96);
  border-bottom: 1px solid #e3dfd4;
  backdrop-filter: blur(10px);
}

.brand { display: grid; gap: 2px; }
.brand strong { font-size: 22px; }
.brand span { color: #687782; font-size: 13px; }

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

.language-toggle,
.user-badge {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: white;
  padding: 9px 12px;
  color: #52616b;
  font-size: 13px;
}

.language-toggle {
  cursor: pointer;
  font-weight: 900;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
}

.tabs button {
  min-height: 38px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: #1f2933;
  cursor: pointer;
  white-space: nowrap;
}

.tabs button.active {
  background: #1b6b68;
  color: white;
  border-color: #1b6b68;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px max(20px, env(safe-area-inset-right)) 20px max(20px, env(safe-area-inset-left));
}

.status {
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid #e3dfd4;
  border-radius: 8px;
  background: white;
  color: #52616b;
  margin-bottom: 16px;
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  align-items: end;
  padding: 16px 0 22px;
}

.landing {
  min-height: clamp(420px, 62vh, 620px);
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: clamp(26px, 6vw, 56px);
  margin-bottom: 18px;
  color: white;
  background:
    linear-gradient(90deg, rgba(20, 61, 59, 0.92), rgba(20, 61, 59, 0.58)),
    url("https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.landing .kicker,
.landing .lead {
  color: white;
}

.landing h1 {
  max-width: 760px;
}

.landing .lead {
  max-width: 700px;
}

.kicker { margin: 0 0 8px; color: #1b6b68; font-weight: 900; }
h1, h2 { margin: 0; line-height: 1.12; }
h1 { font-size: clamp(34px, 6vw, 62px); }
h2 { font-size: clamp(24px, 4vw, 36px); }
.lead { max-width: 650px; color: #52616b; font-size: 18px; line-height: 1.65; }

.metrics, .grid, .cards, .pricing {
  display: grid;
  gap: 12px;
}

.metrics { grid-template-columns: repeat(3, 1fr); }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.cards { grid-template-columns: repeat(5, 1fr); }
.pricing { grid-template-columns: repeat(2, 1fr); margin-top: 14px; }

.metrics div, .panel, .question, .feature, .vocab-card, .pricing div, .result {
  background: white;
  border: 1px solid #e3dfd4;
  border-radius: 8px;
}

.metrics div, .feature, .vocab-card, .pricing div { padding: 16px; }
.metrics strong { display: block; font-size: 26px; }
.metrics span, .feature span, .vocab-card span, .pricing span { color: #687782; line-height: 1.45; }

.feature, .vocab-card {
  min-height: 120px;
  text-align: right;
  cursor: pointer;
}

.feature strong, .vocab-card strong, .pricing strong {
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}

.vocab-card small {
  display: block;
  margin-top: 8px;
  color: #1b6b68;
  line-height: 1.45;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-head, .exam-bar, .exam-controls, .actions, .essay-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-inline-start: auto;
}

.panel-meta span,
.question-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #edf6f3;
  color: #1b6b68;
  font-size: 13px;
  font-weight: 900;
}

select, textarea {
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: white;
  color: #1f2933;
}

select { min-height: 42px; padding: 0 12px; }
textarea { width: 100%; margin-top: 14px; padding: 14px; resize: vertical; line-height: 1.7; }

.questions { display: grid; gap: 14px; }
.question {
  padding: 18px;
  box-shadow: 0 10px 26px rgba(31, 41, 51, 0.06);
}

.question-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #1b6b68;
  font-weight: 900;
}

.question-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.passage {
  margin: 12px 0;
  padding: 14px;
  border-radius: 8px;
  background: #f1f7f6;
  border: 1px solid #d8ebe8;
  line-height: 1.8;
}
.prompt { font-size: 19px; font-weight: 900; line-height: 1.55; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }

.option {
  min-height: 52px;
  border: 1px solid #d6d1c4;
  border-radius: 8px;
  background: white;
  padding: 12px 14px;
  text-align: right;
  cursor: pointer;
  color: #1f2933;
}

.option:focus-visible,
.tabs button:focus-visible,
.actions button:focus-visible,
.language-toggle:focus-visible {
  outline: 3px solid #c77d3a;
  outline-offset: 2px;
}

.option.selected { border-color: #1b6b68; background: #e8f4f2; font-weight: 900; }
.option.correct { border-color: #2d8a4e; background: #e9f8ee; }
.option.wrong { border-color: #b94c4c; background: #fff0ef; }

.explanation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.explanation-item {
  padding: 12px;
  border-radius: 8px;
  border-inline-start: 4px solid #c77d3a;
  background: #fff8ef;
  line-height: 1.65;
}

.explanation-item strong {
  display: block;
  color: #9a561c;
  margin-bottom: 4px;
}

.explanation-item p {
  margin: 0;
}

.explanation-item.arabic {
  direction: rtl;
  text-align: right;
  border-inline-start-color: #1b6b68;
  background: #f1f7f6;
}

.explanation-item.arabic strong {
  color: #1b6b68;
}

.actions { justify-content: flex-start; margin: 18px 0; }
.actions button, .exam-controls button, .essay-tools button, .admin-toolbar button, .admin-row-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: #1b6b68;
  color: white;
  font-weight: 900;
  cursor: pointer;
}

button.secondary { background: #1f2933; }
button.danger { background: #b94c4c; }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.timer { min-width: 72px; text-align: center; font-size: 22px; }
.result { padding: 18px; background: #1f2933; color: white; }

.practice-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e3dfd4;
}

.practice-tools span {
  color: #52616b;
  font-weight: 800;
}

.practice-tools button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.prompt-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.prompt-chip {
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
}

.checklist {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: #f1f7f6;
}

table { width: 100%; border-collapse: collapse; margin-top: 12px; background: white; }
th, td { padding: 12px; border-bottom: 1px solid #e3dfd4; text-align: right; }
th { color: #1b6b68; }

.progress-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.progress-summary div {
  border: 1px solid #e3dfd4;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.progress-summary strong {
  display: block;
  font-size: 24px;
}

.progress-summary span {
  color: #687782;
}

.premium-screen p { color: #52616b; line-height: 1.7; max-width: 760px; }

.auth-panel {
  max-width: 720px;
  margin-inline: auto;
}

.muted {
  color: #687782;
  line-height: 1.6;
}

.auth-toggle {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.auth-toggle button {
  min-height: 44px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.auth-toggle button.active {
  background: #1b6b68;
  color: white;
  border-color: #1b6b68;
}

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

.auth-form label {
  display: grid;
  gap: 6px;
  color: #52616b;
  font-weight: 800;
}

.auth-form input {
  min-height: 48px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  padding: 0 12px;
  direction: ltr;
  text-align: left;
}

.auth-form button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: #1b6b68;
  color: white;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.auth-form button:disabled {
  cursor: wait;
  opacity: 0.82;
}

.link-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #1b6b68;
  font-weight: 900;
  text-decoration: underline;
  cursor: pointer;
}

.account-box {
  display: grid;
  gap: 6px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  background: #f1f7f6;
}

.account-box span {
  color: #52616b;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  border-top: 1px solid #e3dfd4;
  padding-top: 14px;
}

.admin-tabs button {
  min-height: 48px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: white;
  color: #1f2933;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
}

.admin-tabs button.active {
  background: #1b6b68;
  color: white;
  border-color: #1b6b68;
}

.admin-toolbar input,
.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  background: white;
  color: #1f2933;
}

.admin-toolbar input,
.admin-form input {
  min-height: 46px;
  padding: 0 12px;
}

.admin-search {
  min-height: 42px;
  border: 1px solid #d8d2c4;
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: #1f2933;
  min-width: min(320px, 100%);
}

.admin-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-toolbar input {
  flex: 1 1 260px;
  direction: ltr;
  text-align: left;
}

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

.admin-form label {
  display: grid;
  gap: 6px;
  color: #52616b;
  font-weight: 800;
}

.form-row,
.admin-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

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

.check-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}

.check-line input {
  width: auto;
  min-height: auto;
}

.admin-list {
  max-height: 860px;
  overflow: auto;
}

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

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e3dfd4;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

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

.admin-row span {
  margin-top: 4px;
  color: #687782;
  line-height: 1.45;
}

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

.admin-row.issue {
  border-color: #efd2a8;
  background: #fff8ef;
}

.admin-metrics {
  grid-template-columns: repeat(6, 1fr);
}

.quality-box {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
  border: 1px solid #e3dfd4;
}

.quality-box.ok {
  background: #e9f8ee;
  border-color: #b9e4c5;
}

.quality-box.warn {
  background: #fff8ef;
  border-color: #efd2a8;
}

.quality-box span {
  color: #687782;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 920px) {
  .topbar, .top-actions { align-items: flex-start; flex-direction: column; }
  .hero, .grid.two, .metrics, .cards, .pricing, .options, .explanation, .progress-summary, .admin-grid, .form-row, .admin-options, .admin-settings-grid, .admin-row, .admin-metrics { grid-template-columns: 1fr; }
  .panel-head, .exam-bar, .exam-controls, .essay-tools, .practice-tools, .admin-toolbar, .admin-row-actions, .admin-tabs, .admin-filters { align-items: stretch; flex-direction: column; }
  .actions { flex-direction: column; }
  .actions button, .admin-toolbar button, .admin-row-actions button, .admin-tabs button { width: 100%; }
}

/* Product UI refresh */
:root {
  --ink: #17252b;
  --muted: #64747c;
  --surface: #ffffff;
  --canvas: #f4f6f3;
  --line: #dfe5df;
  --brand: #126b64;
  --brand-strong: #0b514c;
  --brand-soft: #e7f4f1;
  --accent: #e56a45;
  --accent-soft: #fff0eb;
  --gold: #d9a62e;
  --success: #21834f;
  --danger: #c14646;
  --shadow: 0 12px 30px rgba(23, 37, 43, 0.08);
}

html { scroll-behavior: smooth; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100dvh; background: var(--canvas); color: var(--ink); overscroll-behavior-y: none; }
button, select, input, textarea { min-height: 48px; touch-action: manipulation; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
h1 { font-size: 52px; }
h2 { font-size: 34px; }
p, span, strong, button, label, td, th { overflow-wrap: anywhere; }
button { transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease; }
button:not(:disabled):active { transform: scale(0.98); }

[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 100; top: 8px; right: 8px; transform: translateY(-140%); padding: 12px 16px; border-radius: 8px; background: var(--ink); color: white; font-weight: 900; }
.skip-link:focus { transform: none; }
.mobile-more-toggle, .mobile-more { display: none !important; }
.icon-button { display: inline-grid; place-items: center; width: 48px; min-width: 48px; padding: 0; border: 0; border-radius: 50%; background: #eef3ef; color: var(--ink); cursor: pointer; }
.app-footer { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; padding: 24px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); color: var(--muted); font-size: 13px; }
.app-footer a { min-width: 48px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; color: var(--brand-strong); font-weight: 800; }

.topbar {
  min-height: 74px;
  padding-inline: max(22px, calc((100vw - 1320px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-color: var(--line);
  box-shadow: 0 6px 24px rgba(23, 37, 43, 0.05);
}
.brand strong { color: var(--brand-strong); font-size: 24px; }
.brand span { color: var(--muted); }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-color: transparent;
  background: transparent;
  color: #53636b;
  font-weight: 800;
}
.tabs button svg { width: 18px; height: 18px; }
.tabs button:hover { background: #eef3ef; color: var(--ink); }
.tabs button.active { background: var(--brand); box-shadow: 0 7px 18px rgba(18, 107, 100, 0.22); }

.language-toggle, .user-badge { border-color: var(--line); background: #f9fbf9; }
.language-toggle:hover { border-color: var(--brand); color: var(--brand); }
.shell { width: min(1240px, 100%); padding-top: 24px; }
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 36px;
  padding: 8px 12px;
  border-color: var(--line);
  box-shadow: 0 4px 14px rgba(23, 37, 43, 0.04);
  font-size: 13px;
  font-weight: 800;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px #e4f4e9; }

.landing {
  min-height: clamp(390px, 58vh, 570px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(11, 81, 76, 0.2);
  background-position: center 45%;
}
.landing::after { content: ""; position: absolute; inset: auto 0 0; height: 5px; background: var(--accent); }
.landing > div { position: relative; z-index: 1; max-width: 790px; }
.landing h1 { text-wrap: balance; }
.landing .actions button:first-child { background: var(--accent); }
.landing .actions button.secondary { background: #fff; color: var(--brand-strong); }

.hero { padding: 34px 4px; align-items: center; }
.hero h2 { max-width: 650px; }
.metrics div, .progress-summary div {
  position: relative;
  overflow: hidden;
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(23, 37, 43, 0.05);
}
.metrics div::before, .progress-summary div::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--brand); }
.metrics div:nth-child(2)::before, .progress-summary div:nth-child(2)::before { background: var(--accent); }
.metrics div:nth-child(3)::before, .progress-summary div:nth-child(3)::before { background: var(--gold); }
.metrics strong, .progress-summary strong { color: var(--ink); }

.feature {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  min-height: 150px;
  border-color: var(--line);
  box-shadow: 0 7px 22px rgba(23, 37, 43, 0.05);
}
.feature > svg { grid-row: 1 / 3; width: 28px; height: 28px; padding: 10px; box-sizing: content-box; border-radius: 8px; color: var(--brand); background: var(--brand-soft); }
.feature strong, .feature span { grid-column: 2; margin: 0; }
.feature b { grid-column: 3; grid-row: 1 / 3; color: var(--brand); }
.feature b svg { width: 22px; }
.feature:hover { transform: translateY(-3px); border-color: #bcd8d3; box-shadow: var(--shadow); }

.panel { border-color: var(--line); box-shadow: 0 8px 26px rgba(23, 37, 43, 0.05); padding: 22px; }
.panel-head { align-items: flex-end; }
.panel-head h2 { font-size: clamp(23px, 3vw, 32px); }
.kicker { color: var(--brand); font-size: 13px; }
.panel-meta span, .question-tags span { border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); }

select, textarea, input { outline: none; transition: border-color 160ms ease, box-shadow 160ms ease; }
select:focus, textarea:focus, input:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 4px rgba(18, 107, 100, 0.12); }

.question { position: relative; border-color: var(--line); box-shadow: 0 8px 26px rgba(23, 37, 43, 0.06); transition: border-color 180ms ease, box-shadow 180ms ease; }
.question:hover { border-color: #cbd8d2; box-shadow: var(--shadow); }
.question.answered-correct { border-inline-start: 5px solid var(--success); }
.question.answered-wrong { border-inline-start: 5px solid var(--danger); }
.prompt { font-size: 20px; }
.passage { background: #f0f7f5; border-color: #cfe5e0; }
.option { display: flex; align-items: center; gap: 12px; border-color: #d7dfda; font-weight: 700; }
.option:hover { border-color: var(--brand); background: #f5faf8; transform: translateY(-1px); }
.option-marker { flex: 0 0 30px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #eef2ef; color: var(--muted); font-size: 12px; }
.option.selected .option-marker { background: var(--brand); color: #fff; }
.option.correct .option-marker { background: var(--success); color: #fff; }
.option.wrong .option-marker { background: var(--danger); color: #fff; }
.answer-banner { display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 11px 13px; border-radius: 8px; }
.answer-banner svg { width: 20px; }
.answer-banner.success { color: #16693d; background: #e7f6ec; }
.answer-banner.error { color: #a23838; background: #fff0ef; }
.explanation-item { border-radius: 8px; }

.exam-bar { position: sticky; top: 86px; z-index: 5; background: rgba(255,255,255,0.96); backdrop-filter: blur(12px); }
.timer { padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-variant-numeric: tabular-nums; }
.result { position: sticky; bottom: 20px; z-index: 6; border: 0; box-shadow: 0 18px 50px rgba(23,37,43,.26); }

.vocab-card { min-height: 190px; position: relative; overflow: hidden; border-color: var(--line); box-shadow: 0 7px 20px rgba(23,37,43,.05); }
.vocab-card:hover { transform: translateY(-3px); border-color: #b9d8d2; box-shadow: var(--shadow); }
.vocab-front, .vocab-back { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 18px; transition: opacity 180ms ease, transform 180ms ease; backface-visibility: hidden; }
.vocab-front { align-items: center; text-align: center; }
.vocab-front small { color: var(--brand); font-weight: 900; }
.vocab-front em { color: var(--muted); font-size: 12px; font-style: normal; }
.vocab-back { opacity: 0; transform: rotateY(12deg) scale(.96); background: var(--brand-soft); }
.vocab-card.flipped .vocab-front { opacity: 0; transform: rotateY(-12deg) scale(.96); }
.vocab-card.flipped .vocab-back { opacity: 1; transform: none; }

.essay-progress { display: grid; gap: 9px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fafcfb; }
.essay-progress > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e4eae5; }
.progress-track span, .progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width 220ms ease; }
.checklist { background: #f7faf8; }
.checklist label { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.checklist input { width: 44px; height: 44px; flex: 0 0 44px; accent-color: var(--brand); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.prompt-chip:hover { border-color: var(--accent); background: var(--accent-soft); }

.skill-progress { display: grid; grid-template-columns: 42px minmax(100px, 1fr); gap: 10px; align-items: center; }
.skill-progress span { font-weight: 900; color: var(--brand); }
table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
tbody tr:hover { background: #f5f8f5; }

.auth-panel { max-width: 620px; padding: clamp(24px, 5vw, 44px); border-top: 5px solid var(--brand); }
.auth-toggle { padding: 4px; border-radius: 8px; background: #eef2ef; }
.auth-toggle button { border: 0; background: transparent; }
.auth-toggle button.active { box-shadow: 0 5px 14px rgba(18,107,100,.2); }
.auth-form button:hover, .actions button:hover, .admin-toolbar button:hover { filter: brightness(.96); box-shadow: 0 8px 18px rgba(23,37,43,.14); }
.account-settings { display: grid; gap: 14px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.account-settings > div:first-child { display: grid; gap: 4px; }
.account-settings span { color: var(--muted); line-height: 1.6; }
.account-setting-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.account-setting-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 8px; font-weight: 900; cursor: pointer; }
.account-setting-actions svg { width: 19px; }
.danger-outline { border: 1px solid #e0aaaa; background: #fff7f6; color: var(--danger); }
.modal-layer { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: rgba(15, 25, 29, .62); }
.confirm-dialog { width: min(480px, 100%); max-height: calc(100dvh - 40px); overflow: auto; padding: 26px; border-radius: 8px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.confirm-dialog h3 { margin: 12px 0 8px; font-size: 24px; }
.confirm-dialog p { color: var(--muted); line-height: 1.65; }
.danger-icon { width: 34px; height: 34px; color: var(--danger); }
.delete-confirm-label { display: grid; gap: 7px; margin-top: 18px; color: var(--ink); }
.delete-confirm-label input { width: 100%; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }

.legal-screen { max-width: 860px; margin-inline: auto; }
.legal-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 20px 0; padding: 5px; border-radius: 8px; background: #edf2ee; }
.legal-tabs button { border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 900; cursor: pointer; }
.legal-tabs button.active { background: white; color: var(--brand-strong); box-shadow: 0 5px 16px rgba(23,37,43,.08); }
.legal-copy { line-height: 1.75; }
.legal-copy h3 { margin: 24px 0 5px; font-size: 20px; }
.legal-copy p { color: #4f6068; }
.legal-updated { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.premium-screen { border-top: 5px solid var(--gold); }
.premium-heading, .subscription-summary, .plan-card, .plan-purchase, .purchase-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.premium-heading h2, .plan-card h3 { margin-block: 0 6px; }
.entitlement-badge, .plan-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf1f0;
  color: #52616b;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.entitlement-badge.active { background: #dff4e8; color: #17643c; }
.subscription-summary {
  margin-block: 18px;
  padding: 14px 16px;
  border-inline-start: 4px solid #269d67;
  background: #f1faf5;
}
.subscription-summary span { color: #52616b; }
.pricing-plans { display: grid; gap: 10px; margin-top: 20px; }
.plan-card {
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.plan-card.featured { border: 2px solid var(--brand); background: var(--brand-soft); }
.plan-card p { margin: 0; }
.plan-purchase { flex: 0 0 auto; }
.plan-purchase strong { font-size: 20px; white-space: nowrap; }
.purchase-actions { justify-content: flex-start; margin-top: 16px; }
.purchase-status { min-height: 28px; margin-block: 12px 4px; font-weight: 800; }
.billing-disclosure { font-size: 13px; }
.empty-state { display: grid; justify-items: start; gap: 10px; padding: 24px; border: 1px dashed var(--line); border-radius: 8px; }

@media (max-width: 680px) {
  .premium-heading, .plan-card, .plan-purchase, .subscription-summary { align-items: stretch; flex-direction: column; }
  .plan-purchase button, .purchase-actions button { width: 100%; }
  .purchase-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
}

.admin-tabs { position: sticky; top: 82px; z-index: 4; padding-bottom: 10px; background: white; }
.admin-row { border-color: var(--line); transition: border-color 160ms ease, background 160ms ease; }
.admin-row:hover { border-color: #bfd6d1; background: #fbfdfc; }
.admin-list { scrollbar-color: #b7c7c1 transparent; }
.quality-box.ok { border-inline-start: 5px solid var(--success); }
.quality-box.warn { border-inline-start: 5px solid var(--gold); }

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 920px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  h1 { font-size: 36px; }
  h2 { font-size: 28px; }
  .topbar { position: relative; min-height: 68px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; flex-direction: row; align-items: center; backdrop-filter: none; }
  .brand span { display: none; }
  .top-actions { margin-inline-start: auto; flex-direction: row; align-items: center; }
  .user-badge { display: none; }
  .tabs {
    position: fixed;
    z-index: 30;
    inset: auto 0 0;
    order: initial;
    width: 100%;
    justify-content: stretch;
    gap: 2px;
    padding: 5px max(6px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 26px rgba(23,37,43,.09);
  }
  .tabs .secondary-nav { display: none !important; }
  .tabs .mobile-more-toggle { display: inline-flex; }
  .tabs button { flex: 1 1 20%; min-width: 0; min-height: 58px; flex-direction: column; gap: 3px; padding: 5px 3px; font-size: 11px; }
  .tabs button svg { width: 20px; height: 20px; }
  .tabs button.active { box-shadow: none; }
  .shell { padding: 14px 14px 24px; }
  .status { margin-bottom: 12px; }
  .landing { min-height: 440px; padding: 28px 22px; background-position: 58% center; }
  .landing h1 { font-size: 36px; }
  .hero { padding: 24px 0; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature { grid-template-columns: 44px 1fr auto; min-height: 130px; }
  .panel { padding: 17px; }
  .exam-bar { position: relative; top: auto; }
  .options { grid-template-columns: 1fr; }
  .option { min-height: 58px; }
  .vocab-card { min-height: 180px; }
  .admin-tabs { position: relative; top: auto; display: grid; grid-template-columns: repeat(2, 1fr); }
  .admin-tabs button:last-child { grid-column: 1 / -1; }
  .admin-toolbar input { flex: none; min-height: 48px; }
  table { display: block; overflow-x: auto; }
  .app-footer { padding-bottom: calc(94px + env(safe-area-inset-bottom)); gap: 10px 16px; }
  .mobile-more { display: block; position: fixed; z-index: 60; inset: 0; }
  .mobile-more-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(15,25,29,.5); }
  .mobile-more-sheet { position: absolute; inset: auto 0 0; max-height: min(72dvh, 620px); overflow: auto; padding: 16px max(16px, env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); border-radius: 16px 16px 0 0; background: white; box-shadow: 0 -18px 50px rgba(23,37,43,.2); }
  .mobile-more-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
  .mobile-more-head strong { font-size: 20px; }
  .mobile-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mobile-more-grid button { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafcfb; color: var(--ink); text-align: right; font-weight: 900; cursor: pointer; }
  .mobile-more-grid svg { flex: 0 0 22px; width: 22px; color: var(--brand); }
  .menu-open { overflow: hidden; }
  .account-setting-actions { flex-direction: column; }
  .account-setting-actions button { width: 100%; }
  .legal-tabs { grid-template-columns: 1fr; }
}

@media (max-width: 470px) {
  .cards { grid-template-columns: 1fr; }
  .landing .actions { align-items: stretch; }
  .landing .actions button { width: 100%; }
  .question { padding: 15px; }
  .question-top { align-items: flex-start; }
  .essay-progress > div:first-child { flex-direction: column; gap: 3px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 56px; padding-block: 6px; }
  .tabs button { min-height: 50px; flex-direction: row; font-size: 12px; }
  .landing { min-height: 330px; }
  .mobile-more-sheet { max-height: 88dvh; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .mobile-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (forced-colors: active) {
  .tabs button.active, .auth-toggle button.active, .legal-tabs button.active { outline: 2px solid ButtonText; }
  .option.selected, .option.correct, .option.wrong { outline: 3px solid ButtonText; }
}

/* Keep navigation in the top bar on every device so bottom AdMob banners never cover it. */
body {
  padding-bottom: env(safe-area-inset-bottom) !important;
}

.topbar {
  position: sticky !important;
  top: 0;
  z-index: 40;
}

.tabs {
  position: static !important;
  inset: auto !important;
  order: 3;
  width: 100%;
  justify-content: flex-start;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.tabs .secondary-nav,
.tabs [data-screen] {
  display: inline-flex !important;
}

.tabs .mobile-more-toggle,
.mobile-more {
  display: none !important;
}

.app-footer {
  padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
}

@media (max-width: 920px) {
  .topbar {
    flex-wrap: wrap;
    align-items: center;
  }

  .tabs {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 6px;
  }

  .tabs button {
    flex: 0 0 auto;
    min-width: 82px;
    min-height: 48px;
    flex-direction: row;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .shell {
    padding-bottom: 24px !important;
  }
}

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

/* Store-grade visual pass */
:root {
  --radius: 8px;
  --button-shadow: 0 10px 20px rgba(18, 107, 100, 0.16);
}

body {
  background:
    linear-gradient(180deg, #f8faf6 0%, #eef4ef 42%, #f7f5ef 100%);
}

.topbar {
  border-bottom: 1px solid rgba(223, 229, 223, 0.78);
}

.brand strong {
  letter-spacing: 0;
}

.brand::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--brand);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12), 0 10px 22px rgba(18, 107, 100, 0.22);
}

.brand {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
}

.brand span {
  grid-column: 2;
}

.tabs button,
.language-toggle,
.user-badge,
.panel,
.question,
.feature,
.metrics div,
.progress-summary div,
.vocab-card,
.plan-card,
.account-box,
.status {
  border-radius: var(--radius);
}

.tabs button {
  min-width: 72px;
}

.tabs button.active {
  background: #0f6e69;
}

.shell {
  padding-bottom: 36px;
}

.landing {
  min-height: clamp(520px, 72vh, 680px);
  align-items: center;
  isolation: isolate;
  margin-bottom: 28px;
  padding: clamp(28px, 6vw, 68px);
  background:
    linear-gradient(90deg, rgba(9, 48, 47, 0.96), rgba(18, 82, 78, 0.74) 45%, rgba(21, 74, 70, 0.52)),
    url("https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1800&q=82") center/cover;
}

.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.25)),
    radial-gradient(circle at 18% 12%, rgba(229, 106, 69, 0.26), transparent 34%);
  z-index: 0;
}

.landing::after {
  height: 7px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--brand));
}

.landing-copy {
  width: min(820px, 100%);
  display: grid;
  gap: 16px;
}

.landing .kicker {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(10px);
}

.landing h1 {
  max-width: 900px;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 1.02;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
}

.landing .arabic-line {
  margin: -4px 0 0;
  color: #f9e7d8;
  font-size: clamp(24px, 3.7vw, 42px);
  font-weight: 900;
  line-height: 1.18;
}

.landing .lead {
  margin: 0;
  max-width: 760px;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.55;
}

.landing .arabic-lead {
  color: #f3fbf8;
  font-size: clamp(16px, 1.7vw, 20px);
}

.landing-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.landing-stats span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-weight: 800;
}

.landing-stats strong {
  color: #ffd37b;
  font-size: 19px;
}

.landing .actions {
  gap: 10px;
  margin: 8px 0 0;
}

.landing .actions button,
.auth-form button,
.actions button,
.exam-controls button,
.essay-tools button,
.admin-toolbar button,
.admin-row-actions button,
.plan-purchase button {
  box-shadow: var(--button-shadow);
}

.landing .actions button {
  min-width: min(260px, 100%);
  min-height: 56px;
  font-size: 17px;
}

.hero {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  padding: 14px 0 24px;
}

.metrics,
.progress-summary {
  gap: 10px;
}

.metrics div,
.progress-summary div {
  min-height: 116px;
  display: grid;
  align-content: center;
}

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

.feature {
  text-align: start;
  border: 1px solid rgba(223, 229, 223, 0.92);
  background:
    linear-gradient(180deg, #ffffff, #fbfdfb);
}

.feature span {
  max-width: 42ch;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 254, 252, 0.98));
}

.panel-head {
  gap: 16px;
}

.panel-head select,
.panel-head .admin-filters {
  flex: 0 0 auto;
}

.practice-tools,
.essay-tools,
.exam-controls,
.admin-toolbar {
  border-radius: var(--radius);
}

.practice-tools {
  background: #f7faf8;
  border: 1px solid var(--line);
  padding: 12px;
}

.question {
  padding: clamp(16px, 2.2vw, 24px);
}

.question-top {
  margin-bottom: 10px;
}

.prompt {
  margin-block: 12px;
}

.option {
  justify-content: flex-start;
  min-height: 62px;
}

.explanation {
  align-items: stretch;
}

.explanation-item {
  min-height: 120px;
}

.vocab-card {
  border: 0;
  background:
    linear-gradient(180deg, #ffffff 0%, #f6faf8 100%);
}

.vocab-front strong {
  font-size: clamp(21px, 3vw, 30px);
}

.auth-panel,
.premium-screen,
.legal-screen {
  margin-top: min(3vh, 28px);
}

.admin-grid {
  gap: 18px;
}

.admin-row {
  background: #fff;
}

.admin-form {
  position: sticky;
  top: 98px;
}

@media (max-width: 1100px) {
  .grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 920px) {
  .brand::before {
    width: 30px;
    height: 30px;
  }

  .landing {
    min-height: calc(100dvh - 166px);
    padding: 28px 20px;
    background-position: 56% center;
  }

  .landing h1 {
    font-size: clamp(36px, 12vw, 52px);
  }

  .landing .arabic-line {
    font-size: clamp(22px, 7vw, 30px);
  }

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

  .grid.two,
  .metrics,
  .progress-summary {
    grid-template-columns: 1fr;
  }

  .feature {
    min-height: 112px;
  }

  .admin-form {
    position: static;
  }
}

@media (max-width: 470px) {
  .landing {
    border-radius: 0;
    margin-inline: -14px;
    margin-top: -14px;
    min-height: calc(100dvh - 132px);
  }

  .landing .kicker {
    font-size: 12px;
  }

  .landing .actions button {
    min-width: 0;
  }

  .panel-head {
    align-items: stretch;
  }
}

/* Bilingual accessibility and app-quality pass */
:root {
  --focus: #b95f31;
  --surface-2: #f8fbf9;
  --surface-3: #eef6f3;
}

html[lang="ar"],
html[lang="he"] {
  direction: rtl;
}

body[data-ui-lang="ar"] {
  font-family: Arial, "Noto Sans Arabic", "Noto Sans Hebrew", sans-serif;
}

body[data-ui-lang="ar"] .arabic-line,
body[data-ui-lang="ar"] .arabic-lead,
body[data-ui-lang="ar"] .explanation-item.arabic,
body[data-ui-lang="ar"] .legal-copy [lang="ar"] {
  letter-spacing: 0;
}

.landing::before {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.25));
}

.shell {
  min-height: calc(100dvh - 170px);
}

#app:focus {
  outline: none;
}

.topbar,
.mobile-more-sheet,
.tabs {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.brand {
  min-width: 0;
}

.brand strong,
.brand span,
.user-badge,
.language-toggle {
  overflow-wrap: normal;
}

.tabs button {
  min-height: 44px;
  min-width: 78px;
}

.tabs button,
.mobile-more-grid button,
.feature,
.vocab-card,
.option,
.prompt-chip,
.legal-tabs button,
.auth-toggle button,
.admin-tabs button {
  user-select: none;
}

.tabs button:focus-visible,
.mobile-more-grid button:focus-visible,
.option:focus-visible,
.feature:focus-visible,
.vocab-card:focus-visible,
.prompt-chip:focus-visible,
.legal-tabs button:focus-visible,
.auth-toggle button:focus-visible,
.admin-tabs button:focus-visible,
.icon-button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.landing,
.panel,
.question,
.feature,
.vocab-card,
.metric,
.result {
  contain: layout paint;
}

.landing .actions,
.actions,
.exam-controls,
.essay-tools,
.admin-toolbar,
.admin-row-actions,
.purchase-actions {
  flex-wrap: wrap;
}

.actions button,
.exam-controls button,
.essay-tools button,
.admin-toolbar button,
.admin-row-actions button,
.plan-purchase button,
.empty-state button,
.auth-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  text-align: center;
  line-height: 1.2;
}

.panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.panel-head > div:first-child {
  min-width: 0;
}

.panel-head .kicker,
.panel-head h2,
.premium-heading h2,
.legal-screen h2,
.admin-form h2 {
  text-wrap: balance;
}

.panel-meta {
  justify-content: flex-start;
}

.panel-meta span,
.question-tags span,
.entitlement-badge,
.plan-type {
  line-height: 1.25;
}

.question {
  scroll-margin-top: 112px;
}

.question-top {
  align-items: flex-start;
}

.question-top > span:last-child {
  white-space: nowrap;
}

.passage,
.prompt,
.explanation-item,
.legal-copy,
.muted,
.premium-screen p,
.billing-disclosure {
  line-height: 1.75;
}

.passage,
.prompt,
.option span:last-child,
.explanation-item p {
  unicode-bidi: plaintext;
}

.options {
  align-items: stretch;
}

.option {
  width: 100%;
  text-align: start;
}

.option span:last-child {
  flex: 1 1 auto;
}

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

.explanation-item {
  display: grid;
  align-content: start;
}

.answer-banner {
  line-height: 1.35;
}

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

.vocab-card {
  width: 100%;
}

.vocab-front,
.vocab-back {
  gap: 8px;
}

.vocab-back small {
  font-size: 14px;
}

.prompt-list {
  align-items: stretch;
}

.prompt-chip {
  flex: 1 1 260px;
  min-height: 54px;
  text-align: start;
  line-height: 1.45;
}

textarea#essay-text {
  min-height: min(44dvh, 420px);
}

.checklist label,
.check-line {
  line-height: 1.4;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.table-scroll table {
  margin-top: 0;
  border: 0;
  min-width: 620px;
}

.table-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

th {
  background: var(--surface-3);
  white-space: nowrap;
}

td {
  vertical-align: top;
}

.skill-progress {
  min-width: 210px;
}

.auth-form label,
.admin-form label {
  align-content: start;
}

.ltr-field,
input[type="email"],
input[type="password"],
input[id*="token"],
input[id*="id"] {
  direction: ltr;
  text-align: left;
}

.auth-toggle,
.legal-tabs,
.admin-tabs {
  isolation: isolate;
}

.legal-screen {
  width: min(920px, 100%);
}

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

.legal-copy {
  padding: clamp(4px, 1vw, 8px);
}

.legal-copy a {
  color: var(--brand-strong);
  font-weight: 900;
}

.premium-heading,
.plan-card,
.subscription-summary {
  align-items: flex-start;
}

.plan-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.plan-card p {
  line-height: 1.55;
  color: var(--muted);
}

.admin-grid {
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.08fr);
}

.admin-list {
  max-height: min(860px, calc(100dvh - 150px));
}

.admin-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-row > div:first-child {
  min-width: 0;
}

.admin-row strong,
.admin-row span {
  overflow-wrap: anywhere;
}

.admin-row-actions button {
  min-width: 94px;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, auto);
}

.admin-search {
  min-width: 0;
}

.admin-settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.status {
  max-width: 100%;
}

@media (min-width: 921px) {
  .tabs .mobile-more-toggle {
    display: none !important;
  }
}

@media (max-width: 920px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 35;
  }

  .language-toggle {
    min-width: 92px;
  }

  .shell {
    min-height: calc(100dvh - 160px);
  }

  .status {
    width: 100%;
  }

  .panel-head,
  .panel-head .admin-filters,
  .admin-grid,
  .admin-row,
  .plan-card,
  .premium-heading,
  .subscription-summary {
    grid-template-columns: 1fr;
  }

  .panel-head select,
  .panel-head input,
  .panel-head .admin-filters,
  .exam-controls select,
  .exam-controls button {
    width: 100%;
  }

  .panel-meta {
    margin-inline-start: 0;
  }

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

  .admin-list {
    max-height: none;
  }

  .admin-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .admin-row-actions button.danger {
    grid-column: 1 / -1;
  }

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

  .table-scroll table {
    min-width: 560px;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
  }

  .brand strong {
    font-size: 21px;
  }

  .language-toggle {
    max-width: 112px;
    padding-inline: 10px;
  }

  .tabs button {
    min-height: 62px;
  }

  .tabs button span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .landing {
    justify-content: flex-start;
  }

  .landing-copy {
    gap: 13px;
  }

  .landing-stats span {
    justify-content: space-between;
  }

  .feature {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .feature b {
    display: none;
  }

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

  .option {
    gap: 10px;
    padding-inline: 10px;
  }

  .option-marker {
    flex-basis: 28px;
    width: 28px;
    height: 28px;
  }

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

  .legal-tabs {
    grid-template-columns: 1fr;
  }

  .app-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    text-align: center;
  }

  .app-footer span {
    grid-column: 1 / -1;
  }
}
