/* Quiz mode grid */
.quiz-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.quiz-mode-btn {
  text-align: left;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 140ms ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quiz-mode-btn strong {
  font-size: 15px;
}

.quiz-mode-btn span {
  color: var(--muted);
  font-size: 13px;
}

.quiz-mode-btn:hover,
.quiz-mode-btn:focus-visible {
  border-color: rgba(21, 94, 86, 0.5);
  box-shadow: var(--shadow-md);
  outline: none;
  transform: translateY(-1px);
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
}

.link-btn:hover,
.link-btn:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Next random button */
.next-rand-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.next-rand-btn:hover,
.next-rand-btn:focus-visible {
  background: var(--primary-light);
  border-color: rgba(21, 94, 86, 0.4);
  outline: none;
}

.next-rand-btn:active {
  transform: scale(0.98);
}

.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  vertical-align: middle;
  transition: all 120ms ease;
  padding: 0;
}

.speak-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.speak-btn:hover,
.speak-btn:focus-visible {
  color: var(--primary);
  border-color: rgba(21, 94, 86, 0.4);
  background: var(--primary-light);
  outline: none;
}

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

.word-title .speak-btn {
  width: 32px;
  height: 32px;
  margin-left: 8px;
}

.word-title .speak-btn svg {
  width: 18px;
  height: 18px;
}

.form-box .value .speak-btn {
  width: 24px;
  height: 24px;
}

.form-box .value .speak-btn svg {
  width: 14px;
  height: 14px;
}

.sv-highlight .speak-btn {
  margin-left: 8px;
}
:root {
  --primary: #155e56;
  --primary-hover: #104842;
  --primary-light: #e6f5f1;
  --on-primary: #ffffff;
  --tint: #a7f3d0;
  
  --en-color: #0d9488;
  --en-bg: #ccfbf1;
  --ett-color: #d97706;
  --ett-bg: #fef3c7;

  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #f7fbf9;
  --surface-3: #e9f3ef;
  --line: #d7e6e0;
  --line-light: #e8f1ed;
  
  --fg: #0f1f1b;
  --muted: #546b64;
  --accent-text: #115e54;
  --focus: #14b8a6;
  
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --warn-fg: #92400e;
  
  --shadow-sm: 0 1px 2px rgba(10, 45, 38, 0.02), 0 1px 3px rgba(10, 45, 38, 0.04);
  --shadow-md: 0 4px 14px rgba(10, 45, 38, 0.06);
  --shadow-lg: 0 18px 40px rgba(10, 45, 38, 0.08);
  --shadow-hover: 0 20px 44px rgba(10, 45, 38, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #3fb9a3;
    --primary-hover: #4dd4bd;
    --primary-light: rgba(63, 185, 163, 0.16);
    --on-primary: #0f1614;
    --tint: rgba(77, 212, 189, 0.22);
    
    --en-color: #5eead4;
    --en-bg: rgba(94, 234, 212, 0.18);
    --ett-color: #fbbf24;
    --ett-bg: rgba(251, 191, 36, 0.2);

    --bg: #0f1614;
    --surface: #18221f;
    --surface-2: #1d2824;
    --surface-3: #24312d;
    --line: #2a3833;
    --line-light: #23302b;
    
    --fg: #e6f1ed;
    --muted: #9bb3aa;
    --accent-text: #5eead4;
    --focus: #4dd4bd;
    
    --warn-bg: rgba(251, 191, 36, 0.18);
    --warn-line: rgba(251, 191, 36, 0.4);
    --warn-fg: #fbbf24;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 16px 40px rgba(63, 185, 163, 0.18);
    
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #195b53;
    --primary-hover: #226f65;
    --primary-light: #16332e;
    --on-primary: #e6f8f3;
    --tint: #6ee7b7;
    
    --en-color: #2dd4bf;
    --en-bg: #133935;
    --ett-color: #fbbf24;
    --ett-bg: #3d2f14;

    --bg: #0d1716;
    --surface: #142321;
    --surface-2: #1b2f2c;
    --surface-3: #223c38;
    --line: #26433e;
    --line-light: #1d332f;
    
    --fg: #e6f4f0;
    --muted: #95b3ac;
    --accent-text: #5eead4;
    --focus: #2dd4bf;
    
    --warn-bg: #2a2211;
    --warn-line: #524018;
    --warn-fg: #fde68a;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1400px 900px at 50% 0%, rgba(21, 94, 86, 0.05), transparent 65%), var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 70px; /* Safe padding for bottom navigation */
}

button, input, select {
  font: inherit;
}

.band {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.inner {
  max-width: 980px;
  margin: 0 auto;
}

/* Header & Masthead */
header.band {
  background: linear-gradient(145deg, var(--primary) 0%, #0d463f 100%);
  color: var(--on-primary);
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: 50px;
  position: relative;
  overflow: hidden;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tint);
}

.brand-dot {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px #34d399;
}

.badge-tag {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 6px 0 8px;
}

h1 span {
  color: var(--tint);
}

.subtitle {
  font-size: 15px;
  opacity: 0.9;
  margin: 0;
  max-width: 40rem;
}

/* Main Container overlapping masthead */
main.band {
  margin-top: -34px;
  position: relative;
  z-index: 10;
}

/* Topic navigation */
.topic-navigation {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-bottom: 20px;
}

.nav-bar {
  display: flex;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 6px;
  gap: 6px;
  box-shadow: var(--shadow-md);
}

.nav-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-label {
  min-width: 0;
}

.nav-tab:hover {
  background: var(--surface-2);
  color: var(--fg);
}

.nav-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 3px 10px rgba(21, 94, 86, 0.25);
}

.nav-more {
  min-height: 52px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nav-more:hover,
.nav-more[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--fg);
}

.nav-more:active {
  transform: scale(0.98);
}

.nav-more.active {
  color: var(--primary);
  border-color: var(--primary);
}

.nav-more-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  right: 0;
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.nav-more-menu[hidden] {
  display: none;
}

.nav-more-menu .nav-tab {
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
}

.tab-icon {
  font-size: 16px;
}

/* Search Card */
.search-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.search-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.searchline {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.field {
  position: relative;
  flex: 1;
  min-width: 0;
}

input[type="search"] {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="search"]:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.2);
}

.go-btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 0 22px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.15s ease;
}

.go-btn:hover {
  background: var(--primary-hover);
}

.go-btn:active {
  transform: scale(0.98);
}

/* Autocomplete Suggestion Dropdown */
.sugg {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 100;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sugg li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}

.sugg li[aria-selected="true"],
.sugg li:hover {
  background: var(--surface-2);
}

.sugg .sv {
  font-weight: 700;
  color: var(--fg);
}

.sugg .meta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 2px 0;
}

/* Chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: var(--radius-full);
  padding: 8px 14px;
  cursor: pointer;
  min-height: 38px;
  font-size: 13px;
  font-weight: 600;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--focus);
  background: var(--surface-3);
}

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

/* Searchable, progressive word discovery */
.browse-panel {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.browse-panel[hidden],
.browse-filters[hidden],
.browse-list[hidden],
.browse-more[hidden] {
  display: none;
}

.browse-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.browse-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

.browse-count {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.browse-toggle,
.browse-more {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.browse-toggle:hover,
.browse-more:hover {
  border-color: var(--focus);
  background: var(--surface-3);
}

.browse-filters {
  display: flex;
  gap: 8px;
  margin: 16px 0 12px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.browse-filter {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.browse-filter.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.browse-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}

.browse-word {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.browse-word:hover {
  border-color: var(--focus);
  background: var(--surface-2);
}

.browse-word:active {
  transform: scale(0.99);
}

.browse-word-name {
  font-weight: 700;
}

.browse-word-meaning {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-more {
  display: block;
  margin: 14px auto 0;
  background: var(--surface);
}

/* Results Display Area */
#result {
  margin-top: 18px;
  scroll-margin-top: 16px;
}

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

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-text);
}

.word-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 2px 0 4px;
  overflow-wrap: anywhere;
}

.word-meaning {
  color: var(--muted);
  font-size: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.pill.en {
  background: var(--en-bg);
  color: var(--en-color);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.pill.ett {
  background: var(--ett-bg);
  color: var(--ett-color);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

/* Grid Layout for Forms */
.forms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.form-box .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-box .value {
  font-size: clamp(1.2rem, 3.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
  overflow-wrap: anywhere;
  color: var(--fg);
}

.form-box .desc {
  font-size: 12px;
  color: var(--muted);
}

/* Panels for Examples & Notes */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.panel {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel h3 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.panel p {
  margin: 0;
  font-size: 15px;
}

.panel .sv-highlight {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-text);
  line-height: 1.35;
}

/* Notice & Alert Boxes */
.notice {
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--fg);
}

.empty-state {
  padding: 22px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-md);
  color: var(--warn-fg);
}

/* Thematic Vocab Explorer Styles */
.theme-selector {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  margin-bottom: 16px;
}

.theme-card-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: var(--fg);
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.theme-card-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.vocab-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.vocab-sv {
  font-size: 17px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 4px;
}

.vocab-en {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.vocab-ex {
  font-size: 13px;
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  font-style: italic;
}

/* Grammar and reference lessons */
.learning-intro,
.learning-section {
  margin: 0 0 20px;
}

.learning-intro h2 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.learning-intro p,
.learning-section > p {
  margin: 0 0 14px;
  color: var(--muted);
}

.learning-section > h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.learning-grid,
.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.learning-card,
.learning-section,
.example-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.learning-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.learning-card-heading h3,
.learning-card h4 {
  margin: 0;
  font-size: 1.1rem;
}

.learning-card-heading span,
.learning-card > span {
  color: var(--muted);
  font-size: 13px;
}

.forms-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.forms-list > div {
  padding: 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.forms-list dt,
.slot-row span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.forms-list dd {
  margin: 2px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.learning-example,
.combination-list {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.learning-example b {
  color: var(--accent-text);
}

.learning-card h4 {
  margin: 14px 0 6px;
  font-size: 13px;
}

.learning-list,
.example-list {
  margin: 8px 0;
  padding-left: 20px;
}

.learning-list li {
  margin: 6px 0;
}

.example-list {
  list-style: none;
  padding: 0;
}

.example-list li,
.conjunction-list li {
  display: grid;
  gap: 3px;
  margin: 8px 0;
}

.example-list span,
.conjunction-list span,
.example-card span,
.example-card em {
  color: var(--muted);
  font-size: 13px;
}

.example-card p {
  margin: 0 0 6px;
}

.wrong-example {
  color: var(--warn-fg);
}

.correct-example {
  color: var(--primary);
  font-weight: 700;
}

.conjunction-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.slot-row > div,
.pair-card {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.grammar-note {
  grid-column: 1 / -1;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--accent-text);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.learning-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  text-align: left;
}

.learning-table th,
.learning-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-light);
  white-space: nowrap;
}

.learning-table th {
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-2);
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  margin-bottom: 12px;
}

.pair-card b {
  color: var(--accent-text);
}

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

.phrase-pattern {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent-text);
  font-size: 13px;
}

.phrase-example {
  padding-top: 10px;
  border-top: 1px solid var(--line-light);
}

.phrase-example p {
  margin: 4px 0;
  font-size: 14px;
}

.phrase-example .sv-highlight {
  color: var(--fg);
  font-weight: 700;
}

.phrase-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.order-practice {
  border-color: var(--primary);
  background: var(--surface-2);
}

.order-practice-header {
  display: grid;
  gap: 8px;
}

.order-practice-header h3 {
  margin: 4px 0;
}

.order-practice-header p {
  margin: 4px 0;
  color: var(--muted);
}

.order-practice-focus {
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
}

.order-answer,
.order-token-list,
.order-practice-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.order-answer {
  min-height: 54px;
  margin: 16px 0 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.order-placeholder {
  color: var(--muted);
  font-size: 14px;
}

.order-token,
.order-answer-token {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.order-token:hover,
.order-answer-token:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.order-token:focus-visible,
.order-answer-token:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.order-answer-token:disabled {
  cursor: default;
}

.order-practice-controls {
  margin-top: 14px;
}

.order-practice-controls .go-btn,
.order-practice-controls .link-btn {
  margin: 0;
}

.order-feedback {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--accent-text);
  font-weight: 600;
}

.mistake-card .mistake-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mistake-card .wrong-example,
.mistake-card .correct-example,
.mistake-card .mistake-explanation,
.mistake-card .mistake-translation {
  margin: 4px 0 12px;
}

.mistake-card .correct-example {
  color: var(--accent-text);
  font-weight: 700;
}

.mistake-card .mistake-explanation,
.mistake-card .mistake-translation {
  color: var(--muted);
  font-size: 14px;
}

/* Quick Interactive Quiz Feature */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.quiz-question {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.quiz-word {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  margin: 10px 0 16px;
  color: var(--fg);
}

.quiz-options {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 18px 0;
}

.quiz-btn {
  min-width: 120px;
  padding: 14px 20px;
  font-size: 18px;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
}

.quiz-btn.en-opt {
  color: var(--en-color);
  border-color: var(--en-color);
}
.quiz-btn.ett-opt {
  color: var(--ett-color);
  border-color: var(--ett-color);
}

.quiz-btn:active {
  transform: scale(0.96);
}

.quiz-feedback {
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

/* Footer */
footer.band {
  margin-top: 40px;
  padding-bottom: 30px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .panels-grid {
    grid-template-columns: 1fr;
  }
  .search-card {
    padding: 14px;
  }
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .topic-navigation {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -4px 18px rgba(10, 45, 38, 0.1);
  }

  .nav-bar {
    display: contents;
  }

  .nav-tab,
  .nav-more {
    min-height: 52px;
    padding: 5px 2px;
    flex-direction: column;
    gap: 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
  }

  .nav-tab .tab-icon,
  .nav-more .tab-icon {
    font-size: 17px;
    line-height: 1;
  }

  .nav-tab .nav-label,
  .nav-more .nav-label {
    flex: 0 1 100%;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    font-size: 9px;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .nav-tab.active,
  .nav-more.active {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: none;
  }

  .nav-more {
    min-width: 0;
    min-height: 52px;
    border: 0;
  }

  .nav-more[aria-expanded="true"] {
    background: var(--surface-2);
  }

  .nav-more-menu {
    position: absolute;
    top: auto;
    right: 8px;
    bottom: calc(100% + 8px);
    left: 8px;
    width: auto;
    max-height: min(60vh, 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-more-menu .nav-tab {
    min-height: 48px;
    padding: 10px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    border: 1px solid var(--line-light);
    background: var(--surface);
    font-size: 13px;
    text-align: left;
    white-space: normal;
  }

  .nav-more-menu .nav-tab.active {
    border-color: var(--primary);
    background: var(--primary-light);
  }
}

@media (max-width: 380px) {
  .forms-grid {
    grid-template-columns: 1fr;
  }
}

/* Learner-language dropdown (flag + native language name) */
.lang-select {
  appearance: auto;
  min-height: 40px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lang-select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Learner-language switcher (flag + native language name, pill version) */
.lang-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.lang-btn:hover {
  border-color: var(--accent-text);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.lang-btn.active {
  border-color: var(--accent-text);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-text);
}

.lang-flag {
  font-size: 15px;
  line-height: 1;
}

/* Arabic (right-to-left) layout tweaks */
[dir="rtl"] .search-label,
[dir="rtl"] .hint,
[dir="rtl"] .word-meaning {
  text-align: right;
}
