/* =====================================================
   FILE: assets/css/styles.css
   ===================================================== */

:root {
  /* =========================
     DESIGN SYSTEM TOKENS
  ========================= */

  /* App background */
  --bg: #f3f5f9;
  --bg-top: #f8fafc;
  --bg-bottom: #eef2f7;

  /* Surfaces */
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --surface-muted: #f5f8fc;
  --surface-blue-soft: #eef4fb;
  --surface-blue-light: #f5f9ff;

  /* Borders */
  --border: #d8e0ea;
  --border-soft: #edf2f7;
  --border-strong: #b8c8db;
  --border-focus: #2563eb;

  /* Text */
  --text: #17212b;
  --text-soft: #52606d;
  --text-muted: #6b7785;
  --text-inverse: #ffffff;

  /* Accent */
  --accent: #2563eb;
  --accent-hover: #1e4fd1;
  --accent-soft: #dbeafe;
  --accent-soft-subtle: rgba(37, 99, 235, 0.05);
  --accent-border-soft: #bfd1ea;

  /* Success */
  --success-bg: #e8f7ee;
  --success-border: #b7e1c1;
  --success-text: #1e6b3a;
  --success-highlight: #ebffed;
  --success-highlight-bar: #2bf73f;

  /* Warning */
  --warning-bg: #fff3cd;
  --warning-border: #ffe08a;
  --warning-text: #7a5d00;
  --warning-soft-bg: #fff4e5;
  --warning-soft-border: #f0c36d;
  --warning-soft-text: #7a4b00;

  /* Danger */
  --danger-bg: #fff5f5;
  --danger-bg-soft: #fff8f8;
  --danger-bg-subtle: #fffafa;
  --danger-hover-bg: #ffecec;
  --danger-border: #e2b4b4;
  --danger-border-soft: #e6caca;
  --danger-border-strong: #dd8888;
  --danger-text: #8a1f1f;
  --danger-text-soft: #7a3a3a;

  /* Shadows */
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.045);

  /* Radius */
  --radius: 14px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 28px;

  /* Interactive surfaces */
  --surface-hover-top: var(--surface-blue-light);
  --surface-hover-bottom: var(--accent-soft);
}

/* =========================
   COLOR SCHEMES
   Layout, spacing, typography, and component structure
   should not change between schemes.
========================= */

/* Default: VerbCompass Classic
   Uses the :root values above.
*/

/* Notebook Green */
/* body.scheme-green {
  --bg: #f2f7f2;
  --bg-top: #f8fbf7;
  --bg-bottom: #eaf2ea;

  --panel: #ffffff;
  --panel-soft: #f6faf6;
  --surface-muted: #f1f7f1;
  --surface-blue-soft: #e8f3ec;
  --surface-blue-light: #f4faf6;

  --border: #d4e2d4;
  --border-soft: #e8f0e8;
  --border-strong: #aebfad;
  --border-focus: #2f7d50;

  --text: #17241b;
  --text-soft: #506356;
  --text-muted: #69796d;
  --text-inverse: #ffffff;

  --accent: #2f7d50;
  --accent-hover: #256640;
  --accent-soft: #dcefe3;
  --accent-soft-subtle: rgba(47, 125, 80, 0.05);
  --accent-border-soft: #b9d3c2;

  --shadow: 0 10px 30px rgba(20, 47, 31, 0.07);
  --shadow-soft: 0 8px 22px rgba(20, 47, 31, 0.05);
} */

/* Notebook Green */
body.scheme-green {
  --bg: #edf6ee;
  --bg-top: #f5faf5;
  --bg-bottom: #e3efe4;

  --panel: #fbfefb;
  --panel-soft: #f4faf4;
  --surface-muted: #eef7ef;
  --surface-blue-soft: #e4f1e8;
  --surface-blue-light: #f1f8f3;

  --border: #cfdfd1;
  --border-soft: #e2ece3;
  --border-strong: #a8beac;
  --border-focus: #34905b;

  --text: #17241b;
  --text-soft: #506356;
  --text-muted: #69796d;
  --text-inverse: #ffffff;

  --accent: #34905b;
  --accent-hover: #2a774a;
  --accent-soft: #d8ecdf;
  --accent-soft-subtle: rgba(52, 144, 91, 0.07);
  --accent-border-soft: #b4d1be;

  --shadow: 0 10px 30px rgba(20, 47, 31, 0.07);
  --shadow-soft: 0 8px 22px rgba(20, 47, 31, 0.05);

  --surface-hover-top: #edf7f0;
  --surface-hover-bottom: #dcefe3;
}

/* Warm Scholar */
body.scheme-scholar {
  --bg: #f7f1e6;
  --bg-top: #fbf7ef;
  --bg-bottom: #efe4d3;

  --panel: #fffdf8;
  --panel-soft: #fbf5ea;
  --surface-muted: #f8efdf;
  --surface-blue-soft: #f4e2c8;
  --surface-blue-light: #fbf3e5;

  --border: #e1cfb4;
  --border-soft: #efe2cf;
  --border-strong: #c9aa7e;
  --border-focus: #9a4f13;

  --text: #24180f;
  --text-soft: #684b34;
  --text-muted: #806851;
  --text-inverse: #ffffff;

  --accent: #9a4f13;
  --accent-hover: #7c3f0f;
  --accent-soft: #f2dfc6;
  --accent-soft-subtle: rgba(154, 79, 19, 0.06);
  --accent-border-soft: #d3ae7f;

  --shadow: 0 10px 30px rgba(82, 50, 18, 0.08);
  --shadow-soft: 0 8px 22px rgba(82, 50, 18, 0.055);

  --surface-hover-top: #fbf4e6;
  --surface-hover-bottom: #f2e3be;
}

/* Modern Violet */
body.scheme-violet {
  --bg: #f4f2f8;
  --bg-top: #faf8ff;
  --bg-bottom: #ece7f4;

  --panel: #ffffff;
  --panel-soft: #f8f5fc;
  --surface-muted: #f3eef8;
  --surface-blue-soft: #eee6f8;
  --surface-blue-light: #f8f4ff;

  --border: #ddd3eb;
  --border-soft: #eee7f5;
  --border-strong: #bca8d8;
  --border-focus: #6d4bb5;

  --text: #1f1829;
  --text-soft: #5d506b;
  --text-muted: #756984;
  --text-inverse: #ffffff;

  --accent: #6d4bb5;
  --accent-hover: #573896;
  --accent-soft: #e9ddfb;
  --accent-soft-subtle: rgba(109, 75, 181, 0.055);
  --accent-border-soft: #c9b8e6;

  --shadow: 0 10px 30px rgba(49, 34, 82, 0.075);
  --shadow-soft: 0 8px 22px rgba(49, 34, 82, 0.052);

  --surface-hover-top: #f1edff;
  --surface-hover-bottom: #e2d8ff;
}

/* Night Study */
body.scheme-night {
  --bg: #111827;
  --bg-top: #182232;
  --bg-bottom: #0f1724;

  --panel: #1b2535;
  --panel-soft: #223044;
  --surface-muted: #26364c;
  --surface-blue-soft: #24374d;
  --surface-blue-light: #2a3e57;

  --border: #34465f;
  --border-soft: #2d3d54;
  --border-strong: #4b6284;
  --border-focus: #60a5fa;

  --text: #edf3fb;
  --text-soft: #c4d0df;
  --text-muted: #9fb0c4;
  --text-inverse: #ffffff;

  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-soft: #1f3b63;
  --danger-bg: #3a1f24;
  --danger-bg-soft: #2f1b20;
  --danger-bg-subtle: #27181c;
  --danger-hover-bg: #4a252c;
  --danger-border: #8f4b55;
  --danger-border-soft: #6f3c44;
  --danger-border-strong: #b85c68;
  --danger-text: #ffd6dc;
  --danger-text-soft: #f2aeb8;
  --accent-soft-subtle: rgba(96, 165, 250, 0.08);
  --accent-border-soft: #466ea3;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.25);
  --surface-hover-top: #24374d;
  --surface-hover-bottom: #304867;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.15;
}

h3 {
  font-size: 1.1rem;
  line-height: 1.2;
}

.section-kicker {
  margin: 0 0 var(--space-xs);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--text);
  line-height: 1.45;
}

button,
select,
input,
textarea {
  font: inherit;
}

input,
select,
textarea {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* .app::before {
  content: "Spanish Verb Companion";
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
} */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  margin-bottom: var(--space-md);
}

.sidebar,
.main-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select,
.inline-reference-search-wrap input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
}

.inline-reference-search-wrap input:focus,
select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}

button {
  padding: 11px 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--panel-soft);
  border-color: var(--accent-border-soft);
  box-shadow: var(--shadow-soft);
}

button:active {
  transform: translateY(1px);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.quiz-panel-header {
  align-items: center;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.quiz-card-meta {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
  text-align: right;
}

.quiz-verb-transition-message {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  margin: 0;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(219, 234, 254, 0.9);
  border: 1px solid var(--accent-border-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  pointer-events: none;
}

.quiz-card-verb-progress-wrap {
  margin-bottom: 12px;
}

.quiz-card-verb-progress-bar {
  width: 100%;
  height: 10px;
  background: var(--surface-blue-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.quiz-card-verb-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.quiz-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-actions button {
  flex: 1 1 100%;
}

.quiz-primary-actions {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.quiz-primary-actions button {
  flex: 1 1 0;
  min-height: 52px;
  font-weight: 700;
}

#addCurrentVerbButton {
  padding: 0;
  min-width: 52px;
  min-height: 48px;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quiz-panel {
  padding: 28px;
}

.quiz-detail-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.quiz-detail-link-button:hover {
  text-decoration: underline;
  background: transparent;
  border-color: transparent;
}

.feedback-panel-hidden {
  display: none;
}

.feedback-panel-visible {
  display: block;
  margin-bottom: 14px;
}

#feedbackMessage {
  min-height: 0;
  font-weight: 600;
}

.feedback-success,
.feedback-warning {
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.feedback-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.feedback-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.feedback-hidden {
  display: none;
}

#quizCardContent {
  flex: 0 0 auto;
  overflow: visible;
}

#quizCardPoolFeedback {
  margin-top: 0;
}

.quiz-card-main {
  position: relative;
  display: block;
  border-radius: var(--radius-xl);
  padding: 28px;
  min-height: 340px;
  height: 340px;
  overflow: hidden;
}

.quiz-card-hidden-state {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 55%,
    var(--surface-blue-soft) 100%
  );
  border: 1px solid var(--accent-border-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
}

.quiz-card-revealed-state {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 55%,
    var(--surface-blue-soft) 100%
  );
  border: 1px solid var(--accent-border-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
}

.quiz-card-topline,
.revealed-topline {
  width: 100%;
  height: 100%;
}

.quiz-card-hidden-state .quiz-surface-form,
.quiz-card-revealed-state .quiz-surface-form {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 3.6rem);
  line-height: 1.02;
  text-align: center;
  letter-spacing: -0.045em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.quiz-form-meaning {
  margin-top: var(--space-lg);
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  width: min(90%, 28ch);
}

.quiz-form-meaning {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  /* box-shadow:
    inset 0 2px 4px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7); */
  color: var(--accent);
  font-weight: 600;
}

#quizCardDetails {
  margin-top: 14px;
}

.revealed-answer-block {
  padding: 16px;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.compact-details-block {
  margin-top: 0;
}

.quiz-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md) var(--space-lg);
}

.quiz-detail-item {
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.quiz-detail-item strong {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.78rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.revealed-answer-actions {
  margin-top: 16px;
}

.revealed-reference-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-reference-search-wrap {
  flex: 1 1 220px;
  min-width: 180px;
}

.review-status-line {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-weight: 600;
}

.review-status-line.review-due {
  color: var(--success-text);
}

.review-status-line.review-recent {
  color: #b26a00;
}

.review-status-line.review-not-due {
  color: var(--text-soft);
}

/* Sidebar info panels */
#modeDescription,
#dueReviewCounter {
  color: var(--text-soft);
}

.sidebar-mini-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.compact-info-panel {
  padding: 10px 12px;
}

.compact-info-panel h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.mini-stats-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  font-size: 0.88rem;
  line-height: 1.2;
}

.mini-stats-grid div {
  min-width: 0;
}

#resetPanel {
  margin-top: auto;
}

/* Reference panel */
.section-toggle-button {
  width: 100%;
  text-align: left;
  font-weight: 700;
  background: var(--panel-soft);
  border: 1px solid var(--border);
}

.reference-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.reference-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  margin-bottom: 26px;
}

.reference-view-panel {
  padding: 24px;
}

.reference-verb-header {
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.reference-verb-title {
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  letter-spacing: -0.04em;
  margin: 0;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.2;
}

.reference-verb-translation {
  font-size: 1.5rem; /* ~0.1rem smaller than title */
  font-weight: 500;
  color: var(--text-soft);
  opacity: 0.72;
  line-height: 1.2;
}

.reference-chip-row {
  margin-top: 0;
  margin-bottom: 22px;
}

.reference-chip {
  border-color: var(--accent-border-soft);
  background: var(--surface-blue-light);
  color: var(--text-soft);
  border-radius: var(--radius-pill);
}

.reference-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-sm);
  background: var(--accent-soft-subtle);
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
}

.reference-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.reference-support-item {
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.reference-support-item strong {
  display: block;
  margin-bottom: var(--space-xs);
  font-size: 0.78rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reference-notes-section {
  margin: 20px 0 18px;
  margin-top: 24px;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-color: var(--accent-border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );
}

.reference-notes-section h3 {
  margin: 0 0 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.reference-notes-section ul {
  margin: 0;
  padding-left: 18px;
}

.reference-notes-section li {
  margin-bottom: 4px;
  line-height: 1.4;
}

.reference-meta-item {
  padding: 10px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.reference-support-grid,
.reference-meta-grid {
  gap: 14px;
  margin-bottom: 24px;
}

.reference-support-item,
.reference-meta-item {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
}

.reference-support-item strong,
.reference-meta-item strong {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.reference-meta-item strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.reference-meta-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.reference-meta-item:nth-last-child(4),
.reference-meta-item:nth-last-child(3) {
  background: var(--surface-muted);
  padding: 8px;
  border-radius: 8px;
}

.reference-verb-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.reference-meta-help {
  margin-bottom: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--text-soft);
  background: var(--panel-soft);
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-md);
}

.reference-meta-help-hidden {
  display: none;
}

.tense-section {
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  background: #fbfcfe;
  border: 1px solid #e3eaf2;
}

.tense-section-active {
  border: 1px solid #b8c8db;
  background: #f5f9ff;
}

.tense-group-section {
  margin-top: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px;
  border-color: var(--border-soft);
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 2px 8px rgba(15, 23, 42, 0.03);
}

.tense-group-toggle-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 14px 20px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.tense-group-toggle-button:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
}

.tense-group-toggle-button[aria-expanded="true"] {
  border-color: transparent;
  box-shadow: none;
  color: var(--accent);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.tense-group-toggle-button[aria-expanded="true"]:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
}

.tense-group-body {
  margin-top: 12px;
}

.tense-toggle-button {
  width: 100%;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.tense-toggle-button:hover {
  background: var(--surface-blue-light);
}

.tense-section-body {
  margin-top: 12px;
  overflow-x: auto;
}

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

/* Tables */
table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  margin-top: 12px;
  background: var(--panel);
}

.reference-view-panel table {
  border-collapse: separate;
  border-spacing: 0;
  /* border: 1px solid rgba(0, 0, 0, 0.05); */
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
}

.reference-view-panel th,
.reference-view-panel td {
  border-left: 0;
  border-right: 0;
  border-color: var(--border-soft);
  padding: 11px 12px;
}

.reference-view-panel th {
  background: var(--surface-blue-light);
  color: var(--text-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reference-view-panel tr:last-child td {
  border-bottom: 0;
}

.reference-view-panel td:nth-child(2) {
  font-size: 1.02rem;
}

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

th {
  background: var(--surface-muted);
}

.quiz-pool-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-blue-light);
}

.quiz-pool-group-row td {
  background: #eef4fb;
  font-weight: 700;
}

.quiz-pool-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

#quizPoolSearchInput {
  flex: 1 1 320px;
  min-width: 240px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
}

#quizPoolSearchInput:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}

#quizPoolSearchInput.quiz-pool-search-no-match {
  border-color: #d88;
  background: #fff5f5;
}

.quiz-pool-search-hit td {
  background: #ebffed;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.quiz-pool-search-hit td:first-child {
  box-shadow: inset 4px 0 0 #2bf73f;
}

.quiz-pool-toolbar button {
  flex: 0 0 auto;
}

/* Reference view visibility */
.reference-view-hidden {
  display: none;
}

.reference-view-visible {
  display: block;
}

.reference-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-lg);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.reference-view-header h2 {
  margin: 0;
}

.mobile-reference-hidden {
  display: none;
}

.mobile-reference-visible {
  display: block;
}

.reference-view-panel {
  margin-top: 20px;
  padding-top: 4px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.reference-view-panel > *:first-child {
  margin-top: 0;
}

.reference-view-panel th,
.reference-view-panel td {
  padding: 8px 10px;
}

.reference-view-panel td {
  line-height: 1.3;
}

.reference-view-panel table {
  margin-top: 8px;
}

.reference-search-panel {
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-xl);
  padding: 24px;
}

.reference-search-panel .reference-search-wrap {
  margin-bottom: 0;
}

.reference-search-panel label:first-child {
  display: block;
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.reference-search-wrap {
  margin-bottom: var(--space-xl);
}

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

#mobileReferenceViewSection .reference-search-wrap {
  margin-bottom: var(--space-lg);
  padding: 18px;
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-xl);

  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );

  box-shadow: var(--shadow-soft);
}

#mobileReferenceViewSection .reference-search-wrap > label:first-child {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

#referenceSearchInputMobile {
  min-height: 50px;
  padding: 0 16px;
  font-size: 1.05rem;
  border: 2px solid var(--accent-border-soft);
  border-radius: 14px;
  background: var(--panel);
}

#referenceSearchInputDesktop:focus,
#referenceSearchInputMobile:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

#referenceSearchInputDesktop {
  min-height: 56px;
  padding: 0 18px;
  font-size: 1.05rem;
  border: 2px solid var(--accent-border-soft);
  border-radius: 16px;
  background: var(--panel);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.reference-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}

.reference-search-results {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  max-height: 320px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.reference-search-results-hidden {
  display: none;
}

.reference-search-result {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  background: var(--panel);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reference-search-result:last-child {
  border-bottom: 0;
}

.reference-search-result:hover,
.reference-search-result-active {
  background: var(--accent-soft);
  transition: background 0.15s ease;
  background: linear-gradient(
    90deg,
    var(--accent-soft) 0%,
    var(--surface-blue-light) 100%
  );
}

.reference-search-result-main {
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.reference-search-result-locked-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--text);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.reference-search-lock-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--text-muted);
}

.reference-search-result-locked {
  cursor: pointer;
}

.reference-search-result-locked .reference-search-result-sub {
  padding-left: 23px;
}

.reference-search-result-sub {
  font-size: 0.87rem;
  color: var(--text-muted);
}

.reference-search-result-english {
  font-size: 0.84rem;
  color: var(--accent);
  font-weight: 600;
}

.reference-search-empty {
  padding: 12px;
  color: var(--text-soft);
}

.reference-row-active td,
.reference-row-search-hit td {
  background: var(--accent-soft);
  font-weight: 600;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

#mobileReferenceViewPanel tr.reference-row-active,
#mobileReferenceViewPanel tr.reference-row-search-hit {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow-soft);
  transform: translateY(-1px);
}

.reference-row-active td:first-child,
.reference-row-search-hit td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.reference-row-search-hit {
  animation: referenceRowFlash 1s ease;
}

@keyframes referenceRowFlash {
  0% {
    transform: translateY(1px);
  }
  50% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
}

.inline-feedback-hidden {
  display: none;
}

.inline-feedback-success,
.inline-feedback-warning {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
}

.inline-feedback-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.inline-feedback-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.settings-view-hidden {
  display: none;
}

.settings-view-visible {
  display: block;
}

.settings-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.settings-view-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.settings-view-header {
  width: calc(50% - 9px);
  margin-left: auto;
  padding: 0 0 8px;
  border-bottom: 0;
}

#applySettingsButton {
  width: 100%;
  max-width: 100%;
}

.settings-subtitle {
  margin: 6px 0 0 0;
  color: var(--text-soft);
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-section-header h3 {
  margin-bottom: 0;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.settings-group {
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 8px rgba(15, 23, 42, 0.03);
}

.settings-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.settings-group-header strong {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
}

.settings-group-content {
  margin-top: 10px;
}

.custom-pool-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 8px;
}

.custom-pool-selected-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-soft) 0%, var(--panel) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.custom-pool-selected-list::-webkit-scrollbar {
  width: 8px;
}

.custom-pool-selected-list::-webkit-scrollbar-thumb {
  background: #c9d4e3;
  border-radius: 999px;
}

.custom-pool-empty {
  margin: 0;
  color: var(--text-soft);
}

.custom-pool-selected-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.custom-pool-selected-item:hover {
  background: var(--accent-soft);
}

.custom-pool-selected-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.custom-pool-selected-main {
  font-weight: 700;
}

.custom-pool-selected-sub {
  font-size: 0.87rem;
  color: var(--text-soft);
}

.remove-custom-pool-verb-button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  border-color: var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--panel-soft);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.remove-custom-pool-verb-button:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.free-reference-access-count {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

.free-reference-access-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-soft) 0%, var(--panel) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.free-reference-access-list::-webkit-scrollbar {
  width: 8px;
}

.free-reference-access-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

.free-reference-access-empty {
  margin: 0;
  color: var(--text-soft);
}

.free-reference-access-item {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 0;

  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  overflow: hidden;
}

.free-reference-access-item + .free-reference-access-item {
  margin-top: 6px;
}

.free-reference-access-open-button {
  flex: 1 1 auto;
  min-width: 0;

  display: flex;
  align-items: center;

  padding: 7px 8px;
  text-align: left;

  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.free-reference-access-open-button:hover {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
}

.free-reference-access-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.free-reference-access-main {
  font-weight: 700;
  color: var(--text);
}

.free-reference-access-sub {
  font-size: 0.87rem;
  color: var(--text-soft);
}

.free-reference-access-action-button {
  flex: 0 0 auto;
  align-self: center;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 34px;
  height: 30px;
  min-width: 34px;
  margin-right: 8px;
  padding: 0;

  border: 1px solid var(--accent-border-soft);
  border-radius: 10px;

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);

  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.free-reference-access-action-button:not(:disabled):hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );

  border-color: var(--accent-border-soft);
}

.free-reference-access-action-button:disabled {
  cursor: default;
  opacity: 1;

  color: var(--text);
  border-color: var(--accent-border-soft);

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.free-reference-access-open-button:focus-visible,
.free-reference-access-action-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.settings-group-access-restricted .settings-checkbox-list label {
  color: var(--text-muted);
}

.settings-group-access-restricted .settings-checkbox-list input:disabled {
  cursor: not-allowed;
}

.settings-group-access-restricted #cefrA1:disabled {
  opacity: 1;
}

.settings-group-disabled {
  opacity: 0.5;
}

.settings-group-disabled input,
.settings-group-disabled button {
  pointer-events: none;
}

.settings-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 800;
  color: var(--text);
}

.settings-checkbox-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.settings-checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  font-size: 0.95rem;
  color: var(--text);
  transition: color 0.15s ease;
}

#cefrGroup .settings-checkbox-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

#cefrGroup .settings-checkbox-list label {
  justify-content: center;
  min-height: 36px;
  margin-bottom: 0;
  padding: 4px 6px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  font-weight: 700;
}

.settings-warning-hidden {
  display: none;
}

.settings-warning-visible {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft-bg);
  border: 1px solid var(--warning-soft-border);
  color: var(--warning-soft-text);
  font-size: 0.95rem;
}

.nested-options {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--accent-border-soft);
}

.nested-options label {
  font-weight: 500;
  color: var(--text-soft);
}

.help-toggle-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent-border-soft);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.meta-help-toggle-button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent-border-soft);
  border-radius: 999px;
  padding: 0;
  font-size: 0.8rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.help-toggle-button:hover,
.meta-help-toggle-button:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
}

.settings-help-text {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--text-soft);
  background: var(--panel-soft);
  border: 1px solid var(--accent-border-soft);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}

.settings-help-text,
.settings-confirm-row {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease, margin-top 0.18s ease,
    max-height 0.18s ease, padding-top 0.18s ease, padding-bottom 0.18s ease;
}

.settings-help-hidden,
.settings-confirm-hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  border-width: 0;
  pointer-events: none;
}

/* Visible state */
.settings-confirm-row:not(.settings-confirm-hidden) {
  max-height: 120px; /* enough to fit content */
  opacity: 1;
  transform: translateY(0);
  margin-top: 8px;
  padding: 10px 12px;
  border-width: 1px;
}

.settings-reset-item button.active-reset {
  background: var(--danger-bg);
  border-color: var(--danger-border-strong);
}

.settings-reset-panel {
  margin-top: auto;
}

.settings-reset-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-reset-item {
  display: flex;
  flex-direction: column;
}

.settings-confirm-row {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 0.25s ease, opacity 0.18s ease, transform 0.18s ease,
    padding 0.18s ease, margin-top 0.18s ease, border-width 0.18s ease;
}

.settings-confirm-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.settings-confirm-actions button {
  flex: 0 0 auto;
}

.settings-view-header h2 {
  margin-bottom: 0;
}

.settings-subtitle {
  margin-top: var(--space-xs);
  font-size: 0.92rem;
  color: var(--text-soft);
}

.settings-reset-list button {
  border-color: var(--danger-border);
  background: var(--panel);
}

.settings-reset-list button:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border-strong);
}

.settings-confirm-row {
  background: var(--danger-bg-soft);
  border-color: var(--danger-border-soft);
}

#applySettingsButton {
  min-height: 54px;
  background: linear-gradient(
    180deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: #fff;
  border-color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), var(--shadow-soft);
}

#applySettingsButton:hover {
  background: linear-gradient(
    180deg,
    var(--accent-hover) 0%,
    var(--accent) 100%
  );
}

.settings-group {
  margin-bottom: 14px;
}

.settings-section {
  padding: 18px;
  border-color: var(--border-soft);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-muted) 100%
  );
}

.settings-layout {
  gap: 18px;
}

.settings-admin-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-admin-section .settings-section-header {
  margin-bottom: 0;
}

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

.custom-range-readout {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
}

.custom-range-readout {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-soft);
}

.section-hidden {
  display: none;
}

.tense-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.tense-header-row .tense-group-toggle-button {
  width: 100%;
  min-width: 0;
}

.tense-details-toggle {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

.tense-header-row .tense-toggle-button,
.tense-header-row .tense-group-toggle-button {
  flex: 1 1 auto;
  margin: 0;
}

.tense-group-toggle-button[aria-expanded="true"] {
  color: var(--text);
  background: transparent;
}

.tense-group-body {
  margin-top: 14px;
}

.tense-details-toggle {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  border-color: var(--accent-border-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tense-details-toggle:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
}

.hidden {
  display: none;
}

/* =========================
   VIEW SYSTEM
========================= */

.hidden {
  display: none !important;
}

.home-view-visible {
  display: block;
}

#infoView {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.info-screen-active #infoView {
  display: block;
}

.info-view-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.info-view-header h2 {
  margin-bottom: 6px;
}

.info-view-subtitle {
  margin: 0;
  color: var(--text-soft);
}

.info-placeholder-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

/* =========================
   HOME SCREEN
========================= */

.home-panel {
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 32px;
  text-align: center;
}

.home-subtitle {
  color: var(--text-soft);
  margin-bottom: 20px;
}

.home-actions {
  display: grid;
  gap: var(--space-lg);
  margin: 32px 0;
}

.home-card {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 12px;
  min-height: 72px;
  padding: 16px 20px;

  border-color: var(--accent-border-soft);
  border-radius: var(--radius-xl);

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
}

.home-card:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.home-card:active {
  transform: translateY(0);
}

.home-card:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent);
}

.home-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.home-card-icon svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-summary {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-soft);
  opacity: 0.9;
}

.home-summary-text {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.home-summary-flow {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.home-summary-flow span {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-summary-flow > span:not(.flow-arrow) {
  color: var(--accent);
}

.flow-arrow {
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 600;
}

.home-panel h2 {
  font-size: 1.9rem;
  margin-bottom: var(--space-xs);
}

.home-subtitle {
  font-size: 1rem;
  color: var(--text-soft);
  margin-bottom: var(--space-2xl);
  line-height: 1.5;
}

.home-summary {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.home-summary .home-summary-title {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 0.78rem;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-summary-item {
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  text-align: left;
}

.home-summary-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-summary-item strong {
  display: block;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.25;
}
/* Home polish override — action cards and guidance */
.home-actions {
  gap: 14px;
  margin: 30px 0 28px;
}

.home-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  gap: 12px;
  min-height: 72px;
  padding: 16px 20px;

  border-color: var(--accent-border-soft);
  border-radius: var(--radius-xl);

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
}

.home-card:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
  transform: translateY(-1px);
}

.home-card .screen-nav-icon {
  color: var(--accent);
}

.home-card .screen-nav-icon svg {
  width: 24px;
  height: 24px;
}

.home-card-label {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.home-summary {
  margin-top: 24px;
  padding: 18px 18px 0;
  border-top: 1px solid var(--border-soft);
}

.home-summary-text {
  max-width: 42ch;
  margin: 0 auto;
}

.home-summary-flow {
  margin-top: 18px;
}

#homeView {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 40px);
  padding-top: 24px;
}

#studyView {
  width: 100%;
  min-width: 0;
}

#studyView {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#studyView.hidden {
  display: none !important;
}

.main-column {
  min-width: 0;
}

#studyView .panel {
  width: 100%;
}

#quizCardPanel {
  scroll-margin-top: var(--space-xl);
}

.sidebar {
  min-width: 0;
}

.sidebar .panel h2 {
  font-size: 1.3rem;
  text-transform: uppercase;
}

.study-screen-toolbar {
  padding: 16px 18px;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-muted) 100%
  );
}

#studyScreenToolbar .section-toggle-button {
  margin-bottom: 0;
}

#studyScreenToolbarContent.section-hidden {
  display: none;
}

#studyScreenToolbarContent:not(.section-hidden) {
  margin-top: 14px;
}

.study-screen-active .sidebar {
  display: none;
}

.study-screen-toolbar {
  padding: 14px 16px;
  background: var(--panel);
}

.study-toolbar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.study-toolbar-actions button {
  width: 100%;
}

.study-toolbar-description,
.study-toolbar-due,
#studyScreenModeIndicator {
  font-size: 0.92rem;
  line-height: 1.45;
}

.study-toolbar-block h2 {
  margin-bottom: var(--space-sm);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.study-toolbar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: var(--space-sm);
}

.study-toolbar-description,
.study-toolbar-due,
#studyScreenModeIndicator {
  color: var(--text-soft);
}

.study-toolbar-due {
  margin: 0;
  font-size: 0.9rem;
  text-align: right;
}

#referenceToolsPanel .quiz-card-actions,
#modePanel .quiz-card-actions {
  gap: 8px;
}

.study-toolbar-divider {
  margin: var(--space-lg) 0;
  height: 1px;
  background: var(--border);
  opacity: 0.5;
}

.study-status-panel {
  padding: 14px 16px;
  background: var(--panel);
}

.study-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

#studyStatusPanel .section-toggle-button {
  margin-bottom: 0;
}

#studyStatusContent:not(.section-hidden) {
  margin-top: 12px;
}

#closeReferenceViewButton {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#closeReferenceViewButton:hover {
  background: var(--accent-hover);
}

.study-toolbar-reset-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.study-toolbar-reset-group .settings-confirm-row {
  background: #fff8f8;
  border-color: #e6caca;
}

.settings-bottom-reset-list {
  gap: 14px;
}

.screen-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 10px 24px rgba(15, 23, 42, 0.055);
  backdrop-filter: blur(10px);
}

.app-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.app-brand-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.app-brand-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.app-brand-divider {
  color: var(--border-strong);
  font-weight: 400;
}

.home-brand-rule {
  width: 72px;
  height: 3px;
  margin: 12px auto 14px auto;
  border-radius: 999px;
  background: var(--accent);
}

.home-brand-icon {
  width: 120px;
  height: auto;
  display: block;
  margin: 0 auto;
  margin-bottom: 20px;
}

.verbcompass-icon {
  display: block;
  color: var(--accent);
}

.verbcompass-bg,
.verbcompass-dot {
  fill: currentColor;
}

.verbcompass-star {
  fill: var(--panel);
}

.screen-nav-button {
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  box-shadow: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.screen-nav-button:hover {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  border-color: var(--accent-border-soft);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.screen-nav-active {
  cursor: default;
  color: var(--accent);
  border-color: var(--accent-border-soft);
  background: linear-gradient(180deg, var(--panel) 0%, var(--accent-soft) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), var(--shadow-soft);
}

.screen-nav-active:hover {
  color: var(--accent);
  border-color: var(--accent-border-soft);
  background: linear-gradient(180deg, var(--panel) 0%, var(--accent-soft) 100%);
}

.screen-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1em;
  font-size: 1rem;
  line-height: 1;
}
.screen-nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screen-nav-active .screen-nav-icon {
  opacity: 1;
}

.screen-nav-label {
  line-height: 1;
}

.screen-nav-active .screen-nav-icon,
.screen-nav-active .screen-nav-label {
  color: var(--accent);
}

.home-card-icon {
  font-size: 1.65rem;
  width: 32px;
  text-align: center;
}

.danger-zone-section {
  border-color: var(--border-soft);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--danger-bg-subtle) 100%
  );
}

.danger-zone-toggle {
  color: var(--text);
  font-weight: 800;
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--danger-bg-soft) 100%
  );
  border-color: var(--danger-border-soft);
}

.danger-zone-toggle[aria-expanded="true"] {
  color: var(--danger-text);
}

.danger-zone-toggle:hover {
  background: var(--danger-hover-bg);
  border-color: var(--danger-border);
}

.danger-zone-description {
  margin: 10px 14px;
  color: var(--danger-text-soft);
  font-size: 0.95rem;
}

.danger-zone-list button {
  border-color: var(--danger-border);
  background: var(--panel);
}

.danger-zone-list button:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border-strong);
}

.danger-zone-list .settings-confirm-row {
  background: var(--danger-bg-soft);
  border-color: var(--danger-border-soft);
}

.danger-reset-description {
  margin: 4px 10px;
  font-size: 0.88rem;
  color: var(--danger-text-soft);
  line-height: 1.35;
}

.settings-section-toggle {
  min-height: 52px;
  padding: 14px 16px;
  border-color: var(--accent-border-soft);
  border-radius: var(--radius-lg);

  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );

  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.settings-section-toggle:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
}

.settings-section-toggle[aria-expanded="false"] {
  color: var(--text-soft);
  border-color: var(--border-soft);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-muted) 100%
  );
}

.settings-section-toggle[aria-expanded="true"] {
  /* color: var(--accent); */
  border-color: var(--accent-border-soft);
}

.settings-verb-selection,
.settings-form-selection,
.settings-grammar-scope {
  align-self: start;
}

.settings-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--panel);
}

.settings-group + .settings-group {
  margin-top: 18px;
}

#verbSelectionContent,
#formSelectionContent,
#grammarScopeContent,
#dangerZoneContent {
  padding-top: 14px;
}

.settings-section > .settings-help-text {
  margin-bottom: 16px;
}

.common-usage-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.common-usage-stepper button {
  flex: 0 0 44px;
  min-height: 38px;
  padding: 6px 10px;
}

.common-usage-stepper span {
  flex: 1 1 auto;
  text-align: center;
}

#customVerbPoolSearchInput {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--accent-border-soft);
  border-radius: var(--radius-md);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#customVerbPoolSearchInput:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.reference-search-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.reference-search-row input[type="text"] {
  flex: 1;
}

.reference-search-toggle {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--text);
}

.reference-search-toggle:hover {
  border-color: var(--accent-border-soft);
  background: var(--surface-blue-light);
}

.reference-search-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.reference-add-pool-wrap {
  margin-top: 8px;
}

.add-reference-verb-to-custom-pool {
  padding: 6px 9px;
  font-size: 0.82rem;
  font-weight: 700;
}

.reference-toast {
  position: fixed;

  left: 50%;
  bottom: 20px;

  transform: translateX(-50%);

  background: #17395d;

  color: white;

  padding: 10px 16px;

  border-radius: 999px;

  font-size: 0.92rem;

  font-weight: 700;

  z-index: 9999;

  opacity: 1;

  transition: opacity 180ms ease, transform 180ms ease;
}

.reference-toast-hidden {
  opacity: 0;

  transform: translateX(-50%) translateY(8px);

  pointer-events: none;
}

.reference-add-pool-wrap {
  display: inline-flex;
  margin-left: 6px;
  margin-top: 0;
  vertical-align: middle;
}

.add-reference-verb-to-custom-pool.custom-pool-check-button {
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reference-header-pool-button {
  width: 34px;
  height: 30px;
  min-width: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  vertical-align: middle;
  border-color: var(--accent-border-soft);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.reference-header-pool-button.custom-pool-check-button {
  width: 34px;
  height: 30px;
  min-width: 34px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  vertical-align: middle;
  border-color: var(--accent-border-soft);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.reference-header-pool-button:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
}

.tense-section {
  padding: 0;
  background: transparent;
  border: 0;
}

.tense-section-active {
  background: transparent;
  border: 0;
}

.tense-section-body {
  margin-top: var(--space-md);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.tense-section {
  margin-top: 12px;
}

.tense-toggle-button {
  min-height: 46px;
  border-color: var(--border-soft);
  background: var(--panel);
  border-radius: var(--radius-lg);
  font-weight: 700;
}

.tense-toggle-button:hover {
  background: var(--surface-blue-light);
  border-color: var(--accent-border-soft);
}

.tense-toggle-button {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.tense-toggle-button:hover {
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--accent-soft) 100%
  );
}

.tense-group-toggle-button,
.tense-toggle-button {
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  border-color: var(--accent-border-soft);
}

.tense-group-toggle-button:hover,
.tense-toggle-button:hover {
  background: linear-gradient(
    180deg,
    var(--surface-hover-top) 0%,
    var(--surface-hover-bottom) 100%
  );
  border-color: var(--accent-border-soft);
}

.tense-section-body {
  margin-top: 10px;
  padding: 12px 0 0;
  border: 0;
  background: transparent;
}

.tense-expanded-reference {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );
  border: 1px solid var(--accent-border-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: var(--text-soft);
}

.tense-expanded-reference strong {
  color: var(--text);
}

.custom-pool-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.custom-pool-header-row strong {
  min-width: 0;
}

#clearCustomVerbPoolButton {
  width: auto;
  min-width: 112px;
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
  border-color: var(--border-soft);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

#clearCustomPoolConfirmRow {
  grid-column: 1 / -1;
  margin-top: 8px;
}

body.app-loading .sidebar,
body.app-loading #studyView,
body.app-loading #referenceView,
body.app-loading #mobileReferenceViewSection,
body.app-loading #settingsView {
  display: none !important;
}

.quiz-card-topline-with-arrows {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  justify-items: center;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

.quiz-verb-jump-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  padding: 0;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  background: var(--panel);
}

.quiz-surface-form-stack {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

.quiz-card-topline-with-arrows .quiz-surface-form {
  width: 100%;
  padding: 0 8px;
  white-space: normal;
}

.quiz-card-topline-with-arrows > :last-child {
  justify-self: center;
}

.quiz-card-topline-with-arrows > :first-child {
  justify-self: center;
}

.quiz-card-revealed-state .quiz-card-topline-with-arrows {
  grid-template-columns: 56px minmax(0, 1fr) 56px;
}

.quiz-card-revealed-state .quiz-surface-form-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-width: 0;
  width: 100%;
}

.quiz-card-revealed-state .quiz-surface-form {
  position: static;
  transform: none;

  margin: 0 0 14px;
  width: 100%;
  max-width: 100%;

  text-align: center;
}

.quiz-card-revealed-state .quiz-form-meaning {
  position: static;
  transform: none;
  margin: 0;
  width: min(90%, 30ch);
  text-align: center;
}

/* Study Card micro-feedback */

.study-action-feedback {
  animation: studyActionPress 120ms ease-out;
}

@keyframes studyActionPress {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.97);
  }

  100% {
    transform: scale(1);
  }
}

.quiz-card-main.study-card-feedback-known {
  animation: studyCardKnownFeedback 220ms ease-out;
}

.quiz-card-main.study-card-feedback-unknown {
  animation: studyCardUnknownFeedback 220ms ease-out;
}

.quiz-card-main.study-card-feedback-reveal {
  animation: studyCardRevealFeedback 240ms ease-out;
}

@keyframes studyCardKnownFeedback {
  0% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
  }

  45% {
    box-shadow: inset 4px 0 0 var(--success-highlight-bar), var(--shadow-soft);
  }

  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
  }
}

@keyframes studyCardUnknownFeedback {
  0% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
  }

  45% {
    box-shadow: inset 4px 0 0 var(--warning-border), var(--shadow-soft);
  }

  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
  }
}

@keyframes studyCardRevealFeedback {
  0% {
    filter: brightness(1);
  }

  45% {
    filter: brightness(1.035);
  }

  100% {
    filter: brightness(1);
  }
}

.revealed-answer-block,
.quiz-form-meaning {
  animation: answerRevealSoft 180ms ease-out;
}

@keyframes answerRevealSoft {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-card-verb-progress-fill.progress-feedback-known {
  animation: progressKnownPulse 260ms ease-out;
}

.quiz-card-verb-progress-fill.progress-feedback-unknown {
  animation: progressUnknownPulse 260ms ease-out;
}

@keyframes progressKnownPulse {
  45% {
    filter: brightness(1.15);
  }
}

@keyframes progressUnknownPulse {
  45% {
    background: var(--warning-border);
    filter: brightness(1.08);
  }
}

#mobileStudyCardNavSlot {
  display: block;
}

body.reference-screen-active .screen-nav,
body.settings-screen-active .screen-nav,
body.study-screen-active .screen-nav,
body.info-screen-active .screen-nav,
body.mobile-reference-active .screen-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 0 0 14px;
  padding: 8px;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

body.app-header-hidden .screen-nav,
body.app-header-hidden .app-brand {
  /* transform: translateY(-120%); */
  transform: translateY(-140%);
  opacity: 0;
  pointer-events: none;
}

/* Unified app header bar */
/* body.study-screen-active .app-brand,
body.reference-screen-active .app-brand,
body.settings-screen-active .app-brand,
body.info-screen-active .app-brand,
body.mobile-reference-active .app-brand {
  position: sticky;
  top: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 66px;
  margin: 0 0 -66px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
} */

/* Unified app header bar */
body.study-screen-active .app-brand,
body.reference-screen-active .app-brand,
body.settings-screen-active .app-brand,
body.info-screen-active .app-brand,
body.mobile-reference-active .app-brand {
  position: sticky;
  top: 0;
  z-index: 230;
  display: flex;
  align-items: center;
  width: max-content;
  min-height: 66px;
  margin: 0 0 -66px;
  padding: 0 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

/* body.reference-screen-active .screen-nav,
body.settings-screen-active .screen-nav,
body.study-screen-active .screen-nav,
body.info-screen-active .screen-nav,
body.mobile-reference-active .screen-nav {
  position: sticky;
  top: 0;
  z-index: 220;
  min-height: 66px;
  margin: 0 0 14px;
  padding: 8px 12px 8px 90px;
  width: 100%;
  max-width: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    var(--shadow-soft);
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
} */

body.reference-screen-active .screen-nav,
body.settings-screen-active .screen-nav,
body.study-screen-active .screen-nav,
body.info-screen-active .screen-nav,
body.mobile-reference-active .screen-nav {
  position: sticky;
  top: 0;
  z-index: 220;
  min-height: 66px;
  margin: 0 0 14px;
  padding: 8px 12px 8px 110px;
  width: 100%;
  max-width: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

body:not(.home-screen-active) .screen-nav {
  max-width: none;
}

#referenceViewPanel td:nth-child(2),
#mobileReferenceViewPanel td:nth-child(2) {
  font-weight: 600;
}

#referenceViewPanel td:nth-child(3),
#mobileReferenceViewPanel td:nth-child(3) {
  color: var(--text-soft);
}

.quiz-meta-infinitive {
  text-transform: uppercase;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.study-chunk-control {
  margin: 10px 0 12px;
}

.study-chunk-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 14px 16px;
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.study-chunk-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  color: var(--text-soft);
  font-size: 0.92rem;
}

.study-chunk-text strong {
  color: var(--text);
}

.study-chunk-actions {
  display: flex;
  gap: 10px;
}

.study-chunk-actions button {
  min-width: 58px;
  min-height: 42px;
  padding: 8px 12px;
  font-weight: 700;
  background: var(--panel);
  border-radius: var(--radius-md);
}

.study-chunk-size-control {
  margin-top: 14px;
}

.study-chunk-size-control select {
  width: 100%;
}

.testing-sequence-primary-slot {
  display: none;
  width: 100%;
}

.quiz-primary-actions-complete > button,
.quiz-primary-actions-complete #addCurrentVerbButton {
  display: none;
}

.quiz-primary-actions-complete .testing-sequence-primary-slot {
  display: block;
  flex: 1 1 100%;
}

.testing-sequence-end-notice {
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 14px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--accent) 0%,
    var(--accent-hover) 100%
  );
  color: var(--text-inverse);
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 0.98rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.testing-sequence-end-notice strong,
.testing-sequence-end-notice span {
  color: var(--text-inverse);
  margin: 0;
  line-height: 1.25;
}

.testing-sequence-end-notice:hover {
  background: linear-gradient(
    180deg,
    var(--accent-hover) 0%,
    var(--accent) 100%
  );
}

.active-retest-exit-bar {
  min-height: 52px;
  margin-top: 10px;
  padding: 14px 18px;
}

.active-retest-exit-bar strong {
  display: block;
  width: 100%;
}

.quiz-primary-actions.quiz-primary-actions-complete
  > :not(.testing-sequence-primary-slot) {
  display: none !important;
}

.quiz-primary-actions-complete .testing-sequence-primary-slot {
  display: block;
  flex: 1 1 100%;
  width: 100%;
  grid-column: 1 / -1;
}

.quiz-primary-actions-complete .testing-sequence-primary-slot {
  display: block;
  flex: 1 1 100%;
  width: 100%;
  grid-column: 1 / -1;
}

.quiz-primary-actions.quiz-primary-actions-complete
  > :not(.testing-sequence-primary-slot) {
  display: none !important;
}

.testing-results-panel {
  padding: 18px;
  background: var(--panel);
}

.testing-results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.testing-result-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.testing-result-main,
.testing-result-score {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.testing-result-main span,
.testing-result-score span {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.testing-result-score {
  text-align: right;
}

.testing-result-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.testing-result-actions button {
  flex: 1 1 140px;
}

.testing-sequence-complete-card {
  padding: 16px;
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--surface-blue-light) 0%,
    var(--panel) 100%
  );
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.testing-sequence-complete-card strong {
  color: var(--accent);
}

.testing-sequence-complete-card span {
  color: var(--text-soft);
}

.pronoun-help-list .settings-checkbox-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.pronoun-help-list .settings-help-text {
  margin: 2px 0 6px;
  background: var(--panel);
}

#helpVerbTypes,
#helpPronouns,
#helpPronounYo,
#helpPronounTu,
#helpPronounUsted,
#helpPronounNosotros,
#helpPronounVosotros,
#helpPronounUstedes {
  border-color: var(--border-soft);
  background: var(--panel-soft);
}

body.home-screen-active {
  display: none;
}

/* Keep header navigation ordered consistently:
   Home → Reference → Study → Settings → Info */
.screen-nav-button {
  order: 99;
}

#navToHomeFromStudy,
#navToHomeFromReference,
#navToHomeFromSettings,
#navToHomeFromMobileReference,
#navToHomeFromInfo {
  order: 1;
}

#navToReferenceFromStudy,
#navToReferenceFromSettings,
#navToReferenceFromInfo,
.reference-screen-active .screen-nav-active,
.mobile-reference-active .screen-nav-active {
  order: 2;
}

#navToStudyFromReference,
#navToStudyFromSettings,
#navToStudyFromMobileReference,
#navToStudyFromInfo,
.study-screen-active .screen-nav-active {
  order: 3;
}

#navToSettingsFromStudy,
#navToSettingsFromReference,
#navToSettingsFromMobileReference,
#navToSettingsFromInfo,
.settings-screen-active .screen-nav-active {
  order: 4;
}

#navToInfoFromStudy,
#navToInfoFromReference,
#navToInfoFromSettings,
#navToInfoFromMobileReference,
.info-screen-active .screen-nav-active {
  order: 5;
}

/* Keep Home screen action cards as icon + label on mobile */
.home-card .screen-nav-icon {
  display: inline-flex !important;
}

.home-card .home-card-label {
  display: inline;
}

.quiz-form-meaning,
.mobile-study-meaning {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 14px auto 0;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid var(--accent-border-soft);
  border-radius: var(--radius-lg);
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  box-shadow: var(--shadow-soft);
}

/* Reference support layout:
   Alternate translations full width;
   Gerund + Past Participle side by side from 721px up */
.reference-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.reference-support-item:nth-child(1) {
  grid-column: 1 / -1;
}

.reference-support-item:nth-child(2) {
  grid-column: 1;
}

.reference-support-item:nth-child(3) {
  grid-column: 2;
}

.return-to-study-from-reference-button {
  margin-left: 8px;
  width: 30px;
  height: 28px;
  min-width: 30px;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: var(--radius-md);
  border-color: var(--accent-border-soft);
  background: var(--panel);
  color: var(--accent);

  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.return-to-study-from-reference-button:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border-soft);
}

.custom-pool-empty-notice {
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.info-view-visible {
  display: block;
}

.info-view-header {
  margin-bottom: 24px;
}

.info-view-subtitle {
  color: var(--text-soft);
  margin-top: 6px;
}

.info-view-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-placeholder-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
}

.info-overview-card h3,
.info-feature-card h3 {
  margin-bottom: 8px;
}

.info-overview-card p:last-child,
.info-feature-card p:last-child {
  margin-bottom: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

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

.info-getting-started {
  margin-top: 10px;
}

.info-getting-started h3 {
  margin-bottom: 18px;
}

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

.info-path-card h4 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.info-path-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.info-path-list {
  margin: 0 0 14px;
  padding-left: 18px;
}

.info-path-list li {
  margin-bottom: 4px;
}

.info-panel {
  padding: 0;
  overflow: hidden;
}

.info-view-content {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-section-group {
  border-bottom: 1px solid var(--border);
}

.info-section-group:last-child {
  border-bottom: 0;
}

.info-section-toggle {
  min-height: 52px;
  padding: 14px 18px;
  border: 0;
  border-radius: 0;
  /* background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  ); */
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: none;
}

.info-section-toggle:hover {
  background: var(--panel);
  box-shadow: none;
}

.info-section-content {
  padding: 0 18px 18px;
}

.info-overview-card,
.info-feature-card,
.info-path-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
}

.info-feature-grid,
.info-path-grid {
  margin-top: 14px;
}

.info-faq-item + .info-faq-item {
  margin-top: 12px;
}

.info-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow-soft);
  overflow: hidden;
}

.info-faq-item + .info-faq-item {
  margin-top: 12px;
}

.info-faq-question {
  width: 100%;
  min-height: 52px;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-weight: 800;
  text-align: left;
}

.info-faq-question:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.info-faq-question[aria-expanded="true"] {
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
}

.info-faq-answer {
  padding: 16px 18px 18px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  line-height: 1.55;
}

.info-faq-answer p {
  margin-bottom: 10px;
}

.info-faq-answer p:last-child {
  margin-bottom: 0;
}

.info-faq-question {
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    180deg,
    var(--panel) 0%,
    var(--surface-blue-light) 100%
  );
  color: var(--text);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.info-faq-question[aria-expanded="true"] {
  border-bottom: 1px solid var(--border-soft);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.info-footer {
  margin-top: 10px;
  padding: 24px 0 12px;
  border-top: 1px solid var(--border);
}

.info-footer-content {
  text-align: center;
}

.info-footer-content h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.info-footer-content p {
  margin: 6px 0 14px;
  color: var(--text-soft);
}

.info-footer-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* ===================================================== */
/* =====================    980    ===================== */
/* ===================================================== */

/* Desktop */
@media (min-width: 980px) {
  body.study-screen-active .screen-nav-icon,
  body.reference-screen-active .screen-nav-icon,
  body.settings-screen-active .screen-nav-icon {
    display: inline-flex;
    opacity: 1;
  }

  .app {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(760px, 1fr);
    gap: 20px;
    align-items: start;
  }

  body.study-screen-active .app {
    display: block;
    max-width: 920px;
    margin: 0 auto;
  }

  body.study-screen-active #studyView {
    width: 100%;
    max-width: none;
  }

  body.reference-screen-active .app,
  body.settings-screen-active .app,
  body.info-screen-active .app {
    display: block;
    max-width: 980px;
    margin: 0 auto;
  }

  body.reference-screen-active #referenceView,
  body.settings-screen-active #settingsView,
  body.info-screen-active #infoView {
    width: 100%;
    max-width: none;
  }

  body:not(.home-screen-active) .screen-nav {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  body:not(.home-screen-active) .screen-nav-button {
    min-height: 50px;
    font-size: 0.92rem;
  }

  #homeView {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  #homeView .home-panel {
    width: 100%;
    max-width: 520px;
    margin: 40px auto;
  }

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

  .settings-stats-grid {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 18px;
  }

  .sidebar {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding-right: 4px;
  }

  .mobile-reference-visible,
  .mobile-reference-hidden {
    display: none !important;
  }

  .study-status-grid {
    grid-template-columns: 1fr 1fr;
  }

  #referenceView,
  #settingsView {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
  }

  .settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .settings-verb-selection {
    grid-column: 1;
  }

  .settings-form-selection {
    grid-column: 2;
  }

  .settings-grammar-scope {
    grid-column: 1;
  }

  .settings-admin-section {
    grid-column: 2;
  }

  .reference-search-wrap {
    display: flex;
    flex-direction: column;
  }

  .reference-search-wrap > label:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .reference-search-wrap > div {
    order: -1;
    align-self: flex-end;
    margin-bottom: 8px;
  }

  .reference-search-wrap > input,
  .reference-search-wrap > .reference-search-input-wrap {
    order: 2;
  }

  .reference-search-wrap {
    display: block;
  }

  .reference-search-wrap > label:first-child {
    display: block;
    margin-bottom: 8px;
  }

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

  .reference-search-row input[type="text"] {
    flex: 1 1 auto;
    width: auto;
  }

  .reference-search-toggle {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
  }

  .reference-search-results {
    width: 100%;
  }
}

/* ===================================================== */
/* =====================    979    ===================== */
/* ===================================================== */

@media (max-width: 979px) {
  .app {
    display: flex;
    flex-direction: column;
  }

  body:not(.study-screen-active):not(.mobile-reference-active):not(
      .settings-screen-active
    ):not(.info-screen-active)
    .app {
    padding: 0;
  }

  #homeView {
    padding: 0;
    min-height: 100vh;
  }

  #homeView .home-panel {
    max-width: 560px;
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 28px 18px;
  }

  .quiz-card-main {
    min-height: 300px;
    height: 300px;
  }

  .main-column {
    order: 2;
  }

  .sidebar {
    order: 3;
    margin-top: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
  }

  #referenceView {
    order: 4;
  }

  #settingsView {
    order: 5;
  }

  .sidebar-mini-grid {
    grid-template-columns: 1fr 1fr;
  }

  .reference-view-visible,
  .reference-view-hidden {
    display: none !important;
  }

  .settings-layout {
    display: contents;
  }

  .settings-column {
    display: contents;
  }

  .settings-section {
    width: 100%;
    margin-bottom: 12px;
  }

  .settings-section:last-of-type {
    margin-bottom: 12px;
  }

  .main-column {
    gap: 12px;
  }

  .sidebar {
    gap: 12px;
  }

  .quiz-panel {
    padding: 16px;
  }

  #modePanel,
  #referenceToolsPanel,
  #sessionStatsPanel,
  #poolSummaryPanel,
  #resetPanel {
    padding: 14px;
  }

  .quiz-primary-actions {
    gap: 8px;
  }

  .quiz-primary-actions button {
    min-height: 42px;
  }

  body.mobile-reference-active #modePanel,
  body.mobile-reference-active #referenceToolsPanel {
    display: none;
  }

  body.mobile-reference-active .app {
    display: block;
    max-width: 980px;
    margin: 0 auto;
  }

  body.mobile-reference-active .sidebar {
    display: block;
    margin: 0;
    padding: 0;
    gap: 0;
  }

  body.mobile-reference-active #mobileReferenceViewSection {
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
  }

  #customVerbPoolSearchInput {
    min-height: 32px;
    padding: 0 12px;
    font-size: 1.3rem;
  }

  #mobileReferenceViewPanel .add-reference-verb-to-custom-pool {
    width: 66px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 10px;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .reference-search-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label toggle"
      "input input"
      "results results";
    align-items: center;
    gap: 8px 10px;
  }

  .reference-search-wrap > label:first-child {
    grid-area: label;
    margin-bottom: 0;
  }

  .reference-search-row {
    display: contents;
  }

  .reference-search-row input[type="text"] {
    grid-area: input;
    width: 100%;
  }

  .reference-search-toggle {
    grid-area: toggle;
    margin: 0;
    justify-self: end;
  }

  .reference-search-results {
    grid-area: results;
  }

  body.study-screen-active .screen-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  body:not(.home-screen-active) .screen-nav-button {
    min-height: 46px;
    padding: 8px 4px;
    border-radius: var(--radius-md);
  }

  body:not(.home-screen-active) .screen-nav-icon {
    display: none;
  }

  body:not(.home-screen-active) .screen-nav-label {
    display: inline;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.055rem;
    text-transform: uppercase;
  }

  body:not(.home-screen-active) .screen-nav {
    padding: 7px;
    gap: 7px;
    border-radius: var(--radius-lg);
  }

  body:not(.home-screen-active) .screen-nav-active {
    border-radius: var(--radius-md);
  }

  body.study-screen-active #quizCardPanel {
    padding: 12px;
  }

  body.study-screen-active .quiz-panel-header {
    margin-bottom: 8px;
  }

  body.study-screen-active .quiz-panel-header h2 {
    font-size: 1.15rem;
    margin-bottom: 0;
  }

  body.study-screen-active .quiz-card-meta {
    white-space: normal;
    text-align: right;
    line-height: 1.05;
    max-width: 240px;
  }

  .mobile-study-progress-wrap {
    margin-bottom: 10px;
  }

  .mobile-study-word-window {
    position: relative;
    min-height: 230px;
    border: 1px solid var(--accent-border-soft);
    border-radius: 16px;
    background: linear-gradient(
      180deg,
      var(--panel) 0%,
      var(--surface-blue-light) 55%,
      var(--surface-blue-soft) 100%
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 240ms ease-out;
  }

  .mobile-study-word-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  .mobile-study-surface-form {
    margin: 0;
    width: 100%;
    text-align: center;
    font-size: clamp(2rem, 10vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  .mobile-study-meaning {
    margin: 0;
    width: min(92%, 28ch);
    text-align: center;
    color: var(--accent);
    font-size: clamp(1.1rem, 5vw, 1.55rem);
    line-height: 1.2;
    font-weight: 700;
  }

  body.study-screen-active .quiz-primary-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
    padding-top: 0;
    border-top: 0;
  }

  body.study-screen-active .quiz-primary-actions button {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 8px 6px;
    font-size: 0.88rem;
    font-weight: 700;
  }

  body.study-screen-active #knowItButton {
    order: 1;
  }

  body.study-screen-active #showAnswerButton {
    order: 2;
  }

  body.study-screen-active #dontKnowItButton {
    order: 3;
  }

  .mobile-study-card-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .active-retest-exit-bar {
    min-height: 48px;
    margin-top: 8px;
    padding: 8px 12px;
  }

  .mobile-study-control-button {
    min-width: 0;
    min-height: 50px;
    padding: 0;
    border-radius: 12px;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel);
  }

  body.study-screen-active #navToReferenceFromStudy {
    order: 2;
  }

  body.study-screen-active .screen-nav-active {
    order: 3;
  }

  body.study-screen-active #navToSettingsFromStudy {
    order: 4;
  }

  body.study-screen-active #previousItemButton,
  body.study-screen-active #nextItemButton {
    display: none;
  }

  body.study-screen-active #addCurrentVerbButton {
    display: none;
  }

  #mobileStudyCardNavSlot {
    display: block;
  }

  .mobile-study-word-window.mobile-swipe-left {
    transform: translateX(-110%);
    opacity: 0;
  }

  .mobile-study-word-window.mobile-swipe-right {
    transform: translateX(110%);
    opacity: 0;
  }

  .screen-nav,
  .reference-view-header {
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .reference-view-header {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
  }

  #studyView,
  #referenceView,
  #settingsView,
  #mobileReferenceViewSection {
    position: relative;
  }

  .screen-nav-button {
    order: 99;
  }

  #navToHomeFromStudy,
  #navToHomeFromReference,
  #navToHomeFromSettings,
  #navToHomeFromMobileReference {
    order: 1;
  }

  #navToReferenceFromStudy,
  #navToReferenceFromSettings,
  #navToReferenceFromHome,
  .reference-screen-active .screen-nav-active,
  .mobile-reference-active .screen-nav-active {
    order: 2;
  }

  #navToStudyFromHome,
  #navToStudyFromReference,
  #navToStudyFromSettings,
  #navToStudyFromMobileReference,
  .study-screen-active .screen-nav-active {
    order: 3;
  }

  #navToSettingsFromStudy,
  #navToSettingsFromReference,
  #navToSettingsFromHome,
  #navToSettingsFromMobileReference,
  .settings-screen-active .screen-nav-active {
    order: 4;
  }

  .settings-view-header {
    width: 100%;
  }

  .settings-view-actions {
    width: 100%;
  }

  #applySettingsButton {
    width: 100%;
    max-width: 100%;
  }

  body.study-screen-active .app-brand,
  body.reference-screen-active .app-brand,
  body.settings-screen-active .app-brand,
  body.info-screen-active .app-brand,
  body.mobile-reference-active .app-brand {
    display: none;
  }

  body.study-screen-active .screen-nav,
  body.reference-screen-active .screen-nav,
  body.settings-screen-active .screen-nav,
  body.info-screen-active .screen-nav,
  body.mobile-reference-active .screen-nav {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .reference-support-grid {
    display: grid;
    gap: 12px;
  }

  .reference-support-item:nth-child(2),
  .reference-support-item:nth-child(3) {
    min-width: 0;
  }
}

/* ===================================================== */
/* =====================    721    ===================== */
/* ===================================================== */

@media (min-width: 721px) {
  #resetPanel .settings-reset-list {
    gap: 14px;
  }

  #resetPanel .settings-confirm-row:not(.settings-confirm-hidden) {
    max-height: 180px;
    margin-top: 10px;
    padding: 12px;
  }
}

/* ===================================================== */
/* =====================    720    ===================== */
/* ===================================================== */

@media (max-width: 720px) {
  .common-usage-all-row {
    display: none;
  }

  .app {
    padding: var(--space-md);
  }

  .panel,
  .quiz-panel {
    padding: 14px;
  }

  .sidebar-mini-grid {
    grid-template-columns: 1fr;
  }

  .quiz-card-meta {
    max-width: 180px;
  }

  .compact-actions button {
    flex: 1 1 100%;
    width: 100%;
  }

  .quiz-primary-actions button {
    flex: 1 1 0;
    width: auto;
  }

  .quiz-detail-grid {
    grid-template-columns: 1fr;
  }

  .reference-meta-grid {
    grid-template-columns: 1fr;
  }

  .reference-support-grid {
    grid-template-columns: 1fr;
  }

  .revealed-reference-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-reference-search-wrap {
    width: 100%;
  }

  .reference-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .reference-search-row input[type="text"] {
    flex: 0 0 auto;
    width: 100%;
  }

  .reference-search-toggle {
    width: 100%;
  }

  .quiz-card-hidden-state .quiz-surface-form,
  .quiz-card-revealed-state .quiz-surface-form {
    font-size: 2.35rem;
  }

  .quiz-form-meaning {
    font-size: 1.2rem;
    width: min(92%, 24ch);
  }

  table {
    min-width: 560px;
  }

  .settings-view-header {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-view-actions {
    width: 100%;
  }

  .settings-view-actions button {
    flex: 1 1 100%;
  }

  .quiz-pool-toolbar button {
    flex: 1 1 100%;
  }

  .screen-nav {
    gap: 8px;
    margin-bottom: 14px;
  }

  .screen-nav-button {
    flex: 1 1 calc(50% - 8px);
  }

  .screen-nav-button {
    gap: 6px;
    padding: 10px 12px;
  }

  .screen-nav-icon {
    font-size: 0.95rem;
  }

  .screen-nav-label {
    font-size: 0.92rem;
  }

  .reference-search-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    /* padding: 6px 2px; */
  }

  .reference-search-toggle input[type="checkbox"] {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
  }

  #mobileReferenceViewPanel .tense-section-body {
    overflow-x: visible;
  }

  #mobileReferenceViewPanel .tense-section-body thead {
    display: none;
  }

  /* #mobileReferenceViewPanel .tense-section-body tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    overflow: hidden;
    background: linear-gradient(
      180deg,
      var(--panel) 0%,
      var(--surface-blue-light) 100%
    );
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.8),
      var(--shadow-soft);
  } */

  @media (max-width: 720px) {
    #mobileReferenceViewPanel .tense-section-body tr {
      display: grid;
      grid-template-columns: 1fr 1fr;
      margin-bottom: 14px;
      border: 1px solid var(--border-strong);
      border-radius: 14px;
      overflow: hidden;
      background: var(--panel);
      box-shadow: var(--shadow-soft);
      transition: box-shadow 0.15s ease, border-color 0.15s ease;
    }
  }

  #mobileReferenceViewPanel .tense-section-body td {
    border: 0;
    padding: 8px 10px;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(1)::before {
    content: "Pronoun";
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 2px;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(2)::before {
    content: "Form";
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 2px;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(3)::before {
    content: "English";
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 2px;
  }

  #mobileReferenceViewPanel .tense-section-body {
    overflow-x: visible;
  }

  #mobileReferenceViewPanel .tense-section-body table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent;
    margin-top: var(--space-sm);
  }

  #mobileReferenceViewPanel .tense-section-body thead {
    display: table-header-group;
  }

  #mobileReferenceViewPanel .tense-section-body thead tr {
    display: grid;

    grid-template-columns: 1fr 1fr;

    border: 0;

    background: transparent;

    margin-bottom: 8px;
  }

  #mobileReferenceViewPanel .tense-section-body thead th {
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: left;
    border: 0;
  }

  #mobileReferenceViewPanel .tense-section-body thead th:nth-child(3) {
    display: none;
  }

  #mobileReferenceViewPanel .tense-section-body td {
    border: 0;
    padding: 10px 12px;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(1) {
    border-right: 1px solid var(--border-strong);
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(2) {
    border-right: 0;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(3) {
    background: transparent;
    padding-top: 12px;
    padding-bottom: 12px;
    color: var(--accent);
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1.35;
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-strong);
    background: var(--surface-blue-light);
    text-align: center;
  }

  #mobileReferenceViewPanel .tense-section-body td::before {
    content: none !important;
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(2) {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
  }

  #mobileReferenceViewPanel .tense-section-body td:nth-child(1) {
    color: var(--text-soft);
    font-weight: 500;
  }

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

  .testing-result-score {
    text-align: left;
  }

  #homeView .home-panel {
    max-width: none;
  }

  .reference-support-grid {
    grid-template-columns: 1fr;
  }

  .reference-support-item:nth-child(1),
  .reference-support-item:nth-child(2),
  .reference-support-item:nth-child(3) {
    grid-column: 1;
  }

  .info-feature-grid {
    grid-template-columns: 1fr;
  }

  .info-path-grid {
    grid-template-columns: 1fr;
  }
}

/* At very narrow phone widths, app header nav becomes icon-only */
@media (max-width: 515px) {
  body.study-screen-active .screen-nav-icon,
  body.reference-screen-active .screen-nav-icon,
  body.settings-screen-active .screen-nav-icon,
  body.info-screen-active .screen-nav-icon,
  body.mobile-reference-active .screen-nav-icon {
    display: inline-flex;
  }

  body.study-screen-active .screen-nav-label,
  body.reference-screen-active .screen-nav-label,
  body.settings-screen-active .screen-nav-label,
  body.info-screen-active .screen-nav-label,
  body.mobile-reference-active .screen-nav-label {
    display: none;
  }

  body.study-screen-active .screen-nav-button,
  body.reference-screen-active .screen-nav-button,
  body.settings-screen-active .screen-nav-button,
  body.info-screen-active .screen-nav-button,
  body.mobile-reference-active .screen-nav-button {
    min-height: 46px;
    padding: 8px 4px;
  }

  body.study-screen-active .screen-nav-icon svg,
  body.reference-screen-active .screen-nav-icon svg,
  body.settings-screen-active .screen-nav-icon svg,
  body.info-screen-active .screen-nav-icon svg,
  body.mobile-reference-active .screen-nav-icon svg {
    width: 20px;
    height: 20px;
  }

  body:not(.home-screen-active) .screen-nav-icon {
    display: inline-flex;
  }

  body:not(.home-screen-active) .screen-nav-label {
    display: none;
  }

  body:not(.home-screen-active) .screen-nav-button {
    min-height: 46px;
    padding: 8px 4px;
  }

  body:not(.home-screen-active) .screen-nav-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* ===================================================== */
/* =====================    480    ===================== */
/* ===================================================== */

@media (max-width: 480px) {
  .quiz-panel-header {
    align-items: flex-start;
  }

  .quiz-card-main {
    min-height: 280px;
    height: 280px;
    padding: 16px;
  }

  .quiz-card-hidden-state .quiz-surface-form,
  .quiz-card-revealed-state .quiz-surface-form {
    font-size: 1.95rem;
  }

  .quiz-form-meaning {
    font-size: 1.05rem;
    width: min(94%, 22ch);
  }

  #cefrGroup .settings-checkbox-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  #cefrGroup .settings-checkbox-list label {
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 8px;
  }

  .testing-sequence-end-notice {
    flex-direction: column;
    padding: 13px 12px;
    gap: 4px;
    font-size: 0.92rem;
  }

  .testing-sequence-end-notice strong,
  .testing-sequence-end-notice span {
    display: block;
    width: 100%;
  }
}
