:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --card-bg: rgba(30, 41, 59, 0.85);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #0ea5e9;
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1.25rem 2rem;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-badge {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: white;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.logo-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Control Bar */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  margin-bottom: 1.5rem;
}

.filters-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.filter-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.label-short {
  display: none;
}

.filter-select {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.conjugate-option {
  position: relative;
  cursor: pointer;
  display: inline-flex;
}

.conjugate-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.conjugate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.conjugate-option input:checked + .conjugate-btn {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Trainer Difficulty Radio Selector */
.difficulty-selector {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  user-select: none;
}

.diff-option {
  position: relative;
  cursor: pointer;
  display: inline-flex;
}

.diff-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.diff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.8rem;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.diff-option:hover .diff-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.diff-option input[type="radio"]:checked + .diff-btn {
  color: #fff;
}

.diff-option input[type="radio"]:checked + .diff-easy {
  background: #059669;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

.diff-option input[type="radio"]:checked + .diff-medium {
  background: #d97706;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4);
}

.diff-option input[type="radio"]:checked + .diff-hard {
  background: #dc2626;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
}

.stats-pill {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-num {
  font-weight: 700;
  color: #fff;
}

/* Anki Card Container */
.card-wrapper {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  padding: 2.25rem;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  position: relative;
  margin-bottom: 1.5rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-category-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.card-difficulty-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.card-difficulty-badge.diff-easy {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}
.card-difficulty-badge.diff-medium {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.4);
}
.card-difficulty-badge.diff-hard {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.card-level-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.level-1 { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.level-2 { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.level-3 { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }

.card-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  transition: width 0.3s ease;
}

/* Prompt Box */
.prompt-box {
  text-align: center;
  padding: 1.25rem 0 2rem;
}

.prompt-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.prompt-english {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Input Fields Section */
.typing-grid {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.input-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.label-hints {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.letter-hint-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.letter-hint-badge:empty {
  display: none;
}

.hint-pill {
  font-weight: 400;
  font-size: 0.78rem;
  color: #64748b;
}

.input-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pronoun-prefix {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: #a5b4fc;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  user-select: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 46px;
  line-height: 1.1;
}

.pronoun-gloss {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.2px;
}

.pronoun-gloss:empty {
  display: none;
}

/* Aux Radio Buttons (habe / bin) */
.aux-selector {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  user-select: none;
}

.aux-option {
  position: relative;
  cursor: pointer;
  display: inline-flex;
}

.aux-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.aux-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.aux-option input[type="radio"]:checked + .aux-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.aux-selector.correct {
  border-color: var(--success);
}
.aux-selector.incorrect {
  border-color: var(--danger);
}

.aux-selector.is-off,
.aux-input.is-off {
  display: none !important;
}

.input-field-wrap > .verb-input {
  width: auto;
  flex: 1 1 160px;
  min-width: 0;
}

.input-field-wrap > .verb-input.aux-input {
  flex: 0 0 8.5rem;
  width: 8.5rem;
  max-width: 100%;
}

.verb-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  color: #fff;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
  overflow: hidden;
}

/* Samsung Internet ignores placeholder color unless this is a plain input::placeholder
   rule, and it keeps the text bright unless opacity is lowered. */
input::placeholder {
  color: #64748b;
  opacity: 0.45;
}

input::-webkit-input-placeholder {
  color: #64748b;
  opacity: 0.45;
}

.verb-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.verb-input.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.verb-input.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.feedback-text {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: none;
}
.feedback-text.show {
  display: block;
}
.feedback-text.correct { color: #34d399; }
.feedback-text.incorrect { color: #f87171; }

/* Umlaut Toolbar */
.umlaut-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.umlaut-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--card-border);
  color: #e2e8f0;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.umlaut-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.umlaut-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(0);
}

/* Actions */
.card-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  padding: 0.75rem 1.75rem;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-shortcut {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-left: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  color: #e2e8f0;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Anki Rating Buttons Bar */
.anki-ratings {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
}

.anki-ratings.show {
  display: grid;
}

.rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.rating-btn .time {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 0.2rem;
}

.rating-btn .label {
  font-size: 0.95rem;
  font-weight: 700;
}

.rate-again {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.rate-again:hover {
  background: rgba(239, 68, 68, 0.25);
  transform: translateY(-2px);
}

.rate-hard {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.rate-hard:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-2px);
}

.rate-good {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.rate-good:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-2px);
}

.rate-easy {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
  color: #38bdf8;
}
.rate-easy:hover {
  background: rgba(14, 165, 233, 0.25);
  transform: translateY(-2px);
}

/* Selected state for keyboard navigation */
.rating-btn.selected {
  transform: translateY(-3px) scale(1.04);
}

.rate-again.selected {
  border-color: #f87171 !important;
  background: rgba(239, 68, 68, 0.35) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.55);
}

.rate-hard.selected {
  border-color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.35) !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.55);
}

.rate-good.selected {
  border-color: #34d399 !important;
  background: rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.55);
}

.rate-easy.selected {
  border-color: #38bdf8 !important;
  background: rgba(14, 165, 233, 0.35) !important;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.55);
}

/* Examples Section */
.examples-section {
  display: none;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 14px;
  border: 1px solid var(--card-border);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.examples-section.show {
  display: block;
}

.examples-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: #818cf8;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.example-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.example-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.example-text-wrap {
  flex: 1;
}

.example-de {
  font-size: 0.98rem;
  font-weight: 500;
  color: #f1f5f9;
  line-height: 1.4;
}

.example-de mark {
  background: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-weight: 600;
}

.example-en {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.speak-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  font-size: 1rem;
  transition: color 0.15s ease;
}

.speak-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Dictionary / Table View */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-input {
  flex: 1;
  min-width: 240px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

.table-wrapper {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  /* ensure the inner table can be wider than this container */
}

.verbs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.verbs-table th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.6rem 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
}

.verbs-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* English column (4th) can wrap if very long */
.verbs-table td:nth-child(4) {
  max-width: 160px;
  word-break: break-word;
}

/* Keep the Practice + 🔊 buttons on a single line so rows stay compact */
.verbs-table td:last-child {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Compact Pattern column */
.verbs-table th:nth-child(5),
.verbs-table td:nth-child(5) {
  white-space: nowrap;
  width: 1%;
  min-width: 65px;
}

.verbs-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.verbs-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.verbs-table th.sortable:hover {
  color: #fff;
}

.grid-fam-cell {
  white-space: nowrap;
}

.fam-badge {
  display: inline-block;
  min-width: 3.2rem;
  text-align: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-right: 0.45rem;
  vertical-align: middle;
}

/* Compact badges inside the dictionary table */
.verbs-table .fam-badge {
  font-size: 0.68rem;
  min-width: auto;
  padding: 0.08rem 0.35rem;
  margin-right: 0;
}

.fam-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.fam-new { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.fam-fast { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.fam-solid { background: rgba(99, 102, 241, 0.18); color: #c7d2fe; }
.fam-slow { background: rgba(245, 158, 11, 0.18); color: #fcd34d; }
.fam-weak { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.fam-strong { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.fam-mixed { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }

.grid-toggle {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  font-size: 14px;
  font-weight: bold;
  user-select: none;
  transition: all 0.15s ease;
}
.grid-toggle.included {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid #10b981;
}

/* ========================================
   STRONG VERBS ARTICLE (dark app style)
   ======================================== */
.strong-verbs-article {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0.25rem;
  line-height: 1.65;
  font-size: 0.95rem;
}

.sv-header {
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.sv-header .chapter {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #818cf8;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.strong-verbs-article h1 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: #f1e7ff;
}

.sv-header .subtitle {
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
  font-size: 0.95rem;
}

.strong-verbs-article h2 {
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
  color: #c7d2fe;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.35rem;
}

.strong-verbs-article h3 {
  font-size: 1.0rem;
  margin: 1.35rem 0 0.5rem;
  color: #a5b4fc;
}

.strong-verbs-article p {
  color: #cbd5e1;
  margin: 0 0 0.85rem;
}

.lead {
  font-size: 1.02rem;
  color: #e0e7ff;
}

.pattern {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.verb-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 6px;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
}

.verb-row.in-deck {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.verb-row .v-inf { min-width: 6.5rem; }
.verb-row .arrow { color: #64748b; }
.verb-row .v-part { font-weight: 600; color: #6ee7b7; }
.verb-row .pres { font-size: 0.8rem; color: #94a3b8; margin-left: 0.35rem; }

.in-deck-badge {
  margin-left: auto;
  font-size: 0.65rem;
  background: #10b981;
  color: #052e16;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
}

.verb-table {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
  margin: 0.6rem 0 1rem;
}

.verb-table.mixed .verb-row {
  background: rgba(245, 158, 11, 0.08);
}

.note-box, .merke-box {
  background: rgba(99, 102, 241, 0.1);
  border-left: 4px solid #6366f1;
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  border-radius: 0 8px 8px 0;
  color: #c7d2fe;
  font-size: 0.9rem;
}

.merke-box {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
  color: #fcd34d;
}

.summary {
  font-size: 0.9rem;
}

.weak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.35rem 0.7rem;
  font-size: 0.82rem;
  margin: 0.6rem 0;
}

.weak-item {
  display: flex;
  gap: 0.35rem;
  color: #94a3b8;
}

.weak-arrow { color: #475569; }
.weak-part { color: #6ee7b7; font-weight: 500; }

.weak-notes {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.rules {
  padding-left: 1.1rem;
}

.rules li {
  margin-bottom: 0.45rem;
  color: #cbd5e1;
}

.small-note {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.3rem;
}

.family-block {
  margin-bottom: 0.6rem;
}

.family-title {
  font-weight: 400;
  color: #94a3b8;
}

.sv-footer {
  margin-top: 2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.78rem;
  color: #475569;
  text-align: center;
}

@media (max-width: 640px) {
  .weak-grid {
    grid-template-columns: 1fr 1fr;
  }
  .verb-row {
    font-size: 0.82rem;
  }
}

.table-verb-action {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}
.table-verb-action:hover {
  background: var(--primary);
  color: #fff;
}

/* Perfekt Translation Trainer */
.perfekt-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.perfekt-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.4rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
}

.perfekt-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 720px;
}

.perfekt-prompt {
  margin-bottom: 1rem;
}

.perfekt-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perfekt-english {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  color: #f1f5f9;
}

.perfekt-input-wrap {
  margin: 1.25rem 0;
}

.perfekt-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--card-border);
  color: #fff;
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  outline: none;
}

.perfekt-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.perfekt-feedback {
  margin-top: 0.5rem;
  min-height: 1.4em;
  font-size: 0.95rem;
}

.perfekt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.perfekt-solution {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  border-left: 3px solid #6366f1;
}

.solution-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.solution-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #c7d2fe;
  white-space: pre-line;
}

.solution-note {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Conjunctions practice */
.conj-grammar {
  margin-bottom: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.conj-grammar summary {
  cursor: pointer;
  font-weight: 650;
  color: #c7d2fe;
}

.conj-grammar ul {
  margin: 0.65rem 0 0.15rem 1.15rem;
  color: #cbd5e1;
  font-size: 0.92rem;
}

.conj-grammar li + li {
  margin-top: 0.28rem;
}

.conj-card {
  max-width: 760px;
}

.conj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.conj-chip {
  background: rgba(99, 102, 241, 0.18);
  color: #e0e7ff;
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.conj-chip.is-pinned {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.conj-ask {
  margin-top: 0.45rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.4;
}

.conj-feedback {
  margin-top: 0.85rem;
}

.conj-feedback.is-ok,
.conj-feedback.is-bad,
.conj-feedback.is-close,
.conj-feedback.is-hint {
  padding: 0.85rem 1rem;
  border-radius: 10px;
}

.conj-feedback.is-ok {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.conj-feedback.is-bad {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.conj-feedback.is-close {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.conj-feedback.is-hint {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.conj-fb-title {
  font-weight: 750;
  margin-bottom: 0.25rem;
}

.conj-feedback.is-ok .conj-fb-title { color: #6ee7b7; }
.conj-feedback.is-bad .conj-fb-title { color: #fca5a5; }
.conj-feedback.is-close .conj-fb-title { color: #fcd34d; }
.conj-feedback.is-hint .conj-fb-title { color: #c7d2fe; }

.conj-fb-detail {
  color: #e2e8f0;
  line-height: 1.45;
}

.conj-fb-detail + .conj-fb-detail {
  margin-top: 0.35rem;
}

.conj-fb-sentence {
  margin-top: 0.5rem;
  font-weight: 650;
  color: #fff;
}

.conj-fb-also {
  margin-top: 0.3rem;
  color: #a5b4fc;
  font-size: 0.92rem;
}

.conj-next-note {
  margin-top: 0.45rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

.conj-diff-link {
  display: inline-block;
  margin-top: 0.55rem;
  background: none;
  border: none;
  color: #c7d2fe;
  cursor: pointer;
  padding: 0;
  font-weight: 650;
  text-decoration: underline;
  font-size: 0.92rem;
}

.conj-diff:not([hidden]) {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  line-height: 1.9;
}

.conj-tok {
  border-radius: 6px;
  padding: 0.02rem 0.35rem;
}

.conj-tok-ok { color: #6ee7b7; }
.conj-tok-extra { color: #fca5a5; text-decoration: line-through; }
.conj-tok-miss {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  border: 1px dashed rgba(148, 163, 184, 0.45);
}

/* Mini-Game: Grid Match Game */
.game-control-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.game-score-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
}

.game-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  white-space: nowrap;
}

.stat-label {
  color: var(--text-muted);
}

.stat-val {
  font-weight: 700;
  color: #fff;
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}
#gameScore { min-width: 42px; text-align: right; }
#gameProgress { min-width: 48px; text-align: right; }
#gameMistakes { min-width: 20px; text-align: right; }
#gameTime { min-width: 2.8rem; text-align: right; }

.btn-game-restart {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-game-restart:hover {
  background: var(--primary);
  color: #fff;
}

/* Game Prompt Box */
.game-prompt-container {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.game-prompt-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #ec4899);
}

.game-prompt-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #818cf8;
  margin-bottom: 0.4rem;
}

.game-prompt-target {
  font-size: 2.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Optional Quick-Type Filter Bar */
.game-type-wrap {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-type-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.7);
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  padding: 0.4rem 0.8rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.game-type-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 4px 14px rgba(0, 0, 0, 0.3);
  background: rgba(15, 23, 42, 0.9);
}

.game-type-icon {
  font-size: 1rem;
  margin-right: 0.5rem;
  opacity: 0.75;
  user-select: none;
}

.grid-type-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: #fff;
  font-family: inherit;
  min-width: 0;
}

.grid-type-input::placeholder {
  color: #64748b;
  font-size: 0.85rem;
}

.grid-type-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  margin-left: 0.4rem;
  white-space: nowrap;
  user-select: none;
  display: none;
}

.grid-type-badge:not(:empty) {
  display: inline-block;
}

.grid-type-badge.exact {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.grid-type-badge.no-match {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.grid-type-badge.ambiguous {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.grid-type-badge.shake {
  animation: badgeShake 0.28s ease;
}

@keyframes badgeShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.grid-type-clear-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  margin-left: 0.25rem;
  border-radius: 6px;
  font-size: 0.8rem;
  display: none;
  transition: all 0.15s ease;
}

.grid-type-clear-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Grid Cards */
.grid-cards-wrapper {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.grid-cards-wrapper.grid-4x4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-cards-wrapper.grid-5x5 {
  grid-template-columns: repeat(5, 1fr);
}

.grid-cards-wrapper.grid-6x3 {
  grid-template-columns: repeat(6, 1fr);
}

.grid-card {
  position: relative;
  background: rgba(30, 41, 59, 0.8);
  border: 1.5px solid var(--card-border);
  border-radius: 14px;
  padding: 1.25rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  min-height: 80px;
  font-family: inherit;
  transition: background 3s ease, border-color 3s ease, color 3s ease, transform 0.15s ease, opacity 0.25s ease, box-shadow 0.2s ease;
}

.grid-card:hover:not(.card-correct) {
  border-color: var(--primary);
  background: rgba(49, 46, 129, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Card container in filtering state */
.grid-cards-wrapper.has-filter .grid-card:not(.card-lit):not(.card-correct) {
  opacity: 0.3;
  filter: grayscale(40%);
  transform: scale(0.97);
}

/* Card Lit Up State (Matches search query) */
.grid-card.card-lit:not(.card-correct) {
  background: rgba(99, 102, 241, 0.22) !important;
  border-color: rgba(165, 180, 252, 0.6) !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.grid-card.card-lit:not(.card-correct) .card-main {
  color: #ffffff;
}

/* Card Selected State (First of the matching lit cards, or actively selected) */
.grid-card.card-selected:not(.card-correct) {
  background: rgba(99, 102, 241, 0.45) !important;
  border-color: #818cf8 !important;
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.7), 0 4px 14px rgba(0, 0, 0, 0.45) !important;
  transform: translateY(-3px) scale(1.03) !important;
  z-index: 2;
}

.grid-card.card-selected:not(.card-correct) .card-main {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.grid-card.card-selected:not(.card-correct)::after {
  content: '↵ Enter';
  position: absolute;
  bottom: 5px;
  right: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #e0e7ff;
  background: rgba(15, 23, 42, 0.85);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(129, 140, 248, 0.6);
  pointer-events: none;
}

.grid-card .card-german,
.grid-card .card-main {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
}

.grid-card .card-english-sub,
.grid-card .card-sub {
  font-size: 0.78rem;
  color: #94a3b8;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-3px);
  transition: all 0.35s ease;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
}

/* Correct state */
.grid-card.card-correct {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  cursor: default;
  transform: scale(0.98);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
  animation: cardPop 0.35s ease;
}

.grid-card.card-correct .card-german,
.grid-card.card-correct .card-main {
  color: #6ee7b7;
}

.grid-card.card-correct .card-english-sub,
.grid-card.card-correct .card-sub {
  opacity: 1;
  max-height: 36px;
  transform: translateY(0);
  color: #94a3b8; /* muted translation underneath */
}

/* Incorrect state: shakes and turns red with 3s fade */
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes cardPop {
  0% { transform: scale(0.94); }
  50% { transform: scale(1.05); }
  100% { transform: scale(0.98); }
}

.grid-card.card-incorrect {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: #ef4444 !important;
  animation: cardShake 0.4s ease;
  transition: none; /* instant trigger, then fades over 3s */
}

.grid-card.card-incorrect .card-german,
.grid-card.card-incorrect .card-main {
  color: #fca5a5 !important;
}

/* Win Overlay */
.game-win-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.game-win-overlay.show {
  display: flex;
}

.win-modal {
  position: relative;
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.win-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.win-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
  border-color: #ef4444;
}

.win-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.win-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 1.5rem;
}

.win-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.win-stat-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 1rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}

.win-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  color: #6ee7b7;
}

.win-stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* Responsiveness */
@media (max-width: 640px) {
  /* Hide type verb text input on mobile */
  .game-type-wrap {
    display: none !important;
  }

  .grid-cards-wrapper.grid-4x4,
  .grid-cards-wrapper.grid-5x5,
  .grid-cards-wrapper.grid-6x3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
  }

  .grid-card {
    padding: 0.85rem 0.4rem;
    min-height: 64px;
    border-radius: 12px;
  }

  .grid-card .card-german,
  .grid-card .card-main {
    font-size: 0.95rem;
  }
}

/* Responsiveness */
@media (max-width: 640px) {
  header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    padding: 0.4rem 0.55rem;
    padding-top: max(0.4rem, env(safe-area-inset-top));
  }

  .logo-wrap {
    gap: 0.4rem;
    min-width: 0;
  }

  .logo-badge {
    font-size: 0.72rem;
    padding: 0.22rem 0.4rem;
    border-radius: 7px;
  }

  .logo-title {
    font-size: 0.92rem;
    white-space: nowrap;
  }

  .logo-sub {
    display: none;
  }

  .header-nav {
    width: 100%;
    justify-content: stretch;
    gap: 0.2rem;
    padding: 0.15rem;
    border-radius: 9px;
  }

  .nav-btn {
    flex: 1;
    padding: 0.32rem 0.2rem;
    font-size: 0.75rem;
    text-align: center;
  }

  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }

  main {
    padding: 0.5rem 0.55rem 1rem;
  }

  .control-bar {
    padding: 0.4rem 0.45rem;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
  }

  .filters-group {
    width: 100%;
    gap: 0.3rem;
  }

  .filters-group > div {
    min-width: 0;
  }

  .filters-group > div:has(.filter-select) {
    flex: 1 1 auto;
  }

  .filter-caption {
    display: none !important;
  }

  .filter-select {
    width: 100%;
    padding: 0.32rem 0.4rem;
    font-size: 0.78rem;
  }

  .diff-btn,
  .conjugate-btn {
    padding: 0.32rem 0.5rem;
    font-size: 0.75rem;
  }

  .stats-pill {
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
    font-size: 0.72rem;
  }

  .card-wrapper {
    padding: 0.85rem 0.7rem 1rem;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    overflow-x: clip;
  }

  .card-top {
    margin-bottom: 0.45rem;
  }

  .prompt-box {
    padding: 0.15rem 0 0.7rem;
  }

  .prompt-subtitle {
    font-size: 0.68rem;
    margin-bottom: 0.15rem;
  }

  .prompt-english {
    font-size: 1.45rem;
    color: #f8fafc;
    background: none;
    -webkit-text-fill-color: #f8fafc;
  }

  .card-wrapper,
  .input-block,
  .input-field-wrap {
    max-width: 100%;
    min-width: 0;
  }

  .input-field-wrap {
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .pronoun-prefix {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 3.6rem;
    min-height: 0;
    height: 2.55rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.82rem;
  }

  .verb-input {
    height: 2.55rem;
    padding: 0 0.45rem;
    font-size: 0.92rem;
  }

  .input-field-wrap > .verb-input {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    max-width: 100%;
  }

  .input-field-wrap > .verb-input.aux-input {
    flex: 0 0 6.2rem;
    width: 6.2rem;
    min-width: 6.2rem;
    max-width: 6.2rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .aux-selector {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 46%;
    height: 2.55rem;
    align-items: center;
  }

  .aux-btn {
    padding: 0.4rem 0.45rem;
    font-size: 0.8rem;
  }

  .btn-shortcut {
    display: none;
  }

  .typing-grid {
    gap: 0.7rem;
    margin-bottom: 0.75rem;
  }

  .hint-pill {
    display: none;
  }

  .anki-ratings {
    grid-template-columns: repeat(2, 1fr);
  }

  .game-control-bar .filters-group {
    flex: 1 1 auto;
  }

  .game-score-wrap {
    width: 100%;
    gap: 0.35rem 0.55rem;
    padding: 0.28rem 0.4rem;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .game-stat,
  .stat-val,
  .btn-game-restart {
    font-size: 0.72rem;
  }

  .btn-game-restart {
    padding: 0.28rem 0.45rem;
  }

  .game-prompt-container {
    padding: 0.7rem 0.6rem;
    margin-bottom: 0.55rem;
    border-radius: 12px;
  }

  .game-prompt-label {
    font-size: 0.68rem;
    margin-bottom: 0.15rem;
  }

  .game-prompt-target {
    font-size: 1.45rem;
  }

  /* Dictionary table on small screens */
  .verbs-table {
    font-size: 0.78rem;
  }
  .verbs-table th,
  .verbs-table td {
    padding: 0.45rem 0.35rem;
  }
  .grid-toggle {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }
  .fam-badge {
    font-size: 0.65rem;
    min-width: 2.4rem;
    padding: 0.1rem 0.35rem;
    margin-right: 0.2rem;
  }
  .table-verb-action {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
}

/* ========================================
   ABLAUT PATTERNS / FAMILIES REFERENCE
   ======================================== */

.patterns-intro {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.patterns-intro h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: #c7d2fe;
}

.patterns-intro p {
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.patterns-tip {
  background: rgba(99, 102, 241, 0.1);
  border-left: 4px solid var(--primary);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #e0e7ff;
}

.patterns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.family-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.family-card .family-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.family-card .family-vowels {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(15, 23, 42, 0.6);
  color: #a5b4fc;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.family-card .family-name {
  font-weight: 600;
  font-size: 1.02rem;
  color: #f1e7ff;
}

.family-card .family-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.family-verbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.family-verb {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.family-verb.in-app {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #6ee7b7;
  font-weight: 500;
}

.family-verb.in-app::after {
  content: " ✓";
  font-size: 0.7em;
}

.patterns-mixed, .patterns-exceptions, .patterns-why {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.patterns-mixed h3, .patterns-exceptions h3, .patterns-why h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: #ddd6fe;
}

.family-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.family-list .family-verb {
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
}

.patterns-exceptions ul {
  columns: 2;
  font-size: 0.9rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.patterns-exceptions li {
  margin-bottom: 0.2rem;
}

@media (max-width: 640px) {
  .patterns-grid {
    grid-template-columns: 1fr;
  }
  .patterns-exceptions ul {
    columns: 1;
  }
}

.pwa-install-bar {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem 0.7rem 1rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font-size: 0.9rem;
  max-width: calc(100vw - 1.5rem);
}

.pwa-install-bar[hidden] {
  display: none;
}

.pwa-install-actions {
  display: flex;
  gap: 0.4rem;
}

.pwa-install-actions .btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: var(--primary);
  color: #fff;
}

.pwa-install-actions .btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

@media (display-mode: standalone) {
  header {
    padding-top: max(1.25rem, env(safe-area-inset-top));
  }
}

@media (display-mode: standalone) and (max-width: 640px) {
  header {
    padding-top: max(0.4rem, env(safe-area-inset-top));
  }
}
