/* =========================================================================
   DEUTSCH COACH - DESIGN SYSTEM
   Professional, SaaS-grade UI tokens
   ========================================================================= */

:root {
  /* Core Colors */
  --color-primary: #2563eb;       /* Blue-600 */
  --color-primary-hover: #1d4ed8; /* Blue-700 */
  
  --color-secondary: #475569;     /* Slate-600 */
  --color-success: #16a34a;       /* Green-600 */
  --color-warning: #d97706;       /* Amber-600 */
  --color-error: #dc2626;         /* Red-600 */
  
  /* Gender Memory Anchor Colors */
  --color-der: #2563eb;       /* Masculine (Blue) */
  --color-die: #dc2626;         /* Feminine (Red) */
  --color-das: #16a34a;       /* Neutral (Green) */
  --color-der-bg: rgba(37, 99, 235, 0.1);
  --color-die-bg: rgba(220, 38, 38, 0.1);
  --color-das-bg: rgba(22, 163, 74, 0.1);
  
  /* Neutral / Layout Colors */
  --color-bg: #f8fafc;            /* Slate-50 - App Background */
  --color-surface: #ffffff;       /* Card Background */
  --color-ink: #0f172a;           /* Slate-900 - Main Text */
  --color-ink-soft: #64748b;      /* Slate-500 - Secondary Text */
  --color-border: #e2e8f0;        /* Slate-200 - Lines/Borders */
  
  /* Module Specific Accents */
  --accent-vocab: #3b82f6;        /* Blue */
  --accent-grammar: #8b5cf6;      /* Purple */
  --accent-speak: #10b981;        /* Emerald */
  --accent-write: #f59e0b;        /* Amber */
  --accent-exam: #ef4444;         /* Red */

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Fonts */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Dimensions */
  --sidebar-width: 260px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-ink: #f8fafc;
  --color-ink-soft: #94a3b8;
  --color-border: #334155;
  --color-primary: #3b82f6;
  /* Brighter gender colours: the light-mode blue/red/green are unreadable on dark cards and badges */
  --color-der: #60a5fa;
  --color-die: #f87171;
  --color-das: #4ade80;
  --color-der-bg: rgba(96, 165, 250, 0.16);
  --color-die-bg: rgba(248, 113, 113, 0.16);
  --color-das-bg: rgba(74, 222, 128, 0.16);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.5);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
}

body[data-theme="dark"], [data-theme="dark"] body {
  background: var(--color-bg) radial-gradient(circle at top right, #1e293b, #0f172a 70%);
  background-attachment: fixed;
}

/* Base Reset */
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================================
   APP SHELL (Global Layout)
   ========================================================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.app-sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 18px;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) 0;
}

.nav-group {
  margin-bottom: var(--space-lg);
}

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-ink-soft);
  font-weight: 600;
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  color: var(--color-ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background-color: var(--color-bg);
  color: var(--color-primary);
}

.nav-link.active {
  background-color: rgba(37, 99, 235, 0.05);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.nav-link:hover .nav-icon, .nav-link.active .nav-icon {
  opacity: 1;
}

/* View switch for merged pages (js/app-shell.js, DC_SITEMAP views) */
.dc-views { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 1200px; margin: 0 auto 12px; }
.dc-views-t { font-size: 12.5px; color: var(--color-ink-soft); font-weight: 600; margin-right: 2px; }
.dc-views a { font-size: 13.5px; font-weight: 600; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--color-border); background: var(--color-surface); color: var(--color-ink); text-decoration: none; }
.dc-views a.on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.dc-views a:hover:not(.on) { border-color: var(--color-primary); color: var(--color-primary); }

/* "Mehr in diesem Bereich" footer (js/app-shell.js) */
.dc-more { margin: 32px auto 8px; max-width: 980px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.dc-more-t { font-size: 13px; color: var(--color-ink-soft); margin-bottom: 8px; }
.dc-more-l { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-more-l a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-ink); text-decoration: none; }
.dc-more-l a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.dc-more-l svg { width: 15px; height: 15px; opacity: .75; }

/* Grouped menu from DC_SITEMAP (js/app-shell.js) */
.dc-nav-search {
  display: block; width: calc(100% - 2 * var(--space-lg)); margin: 0 var(--space-lg) var(--space-sm); box-sizing: border-box;
  font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-ink);
}
.dc-nav-grp > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-sm);
  padding: 8px var(--space-lg); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--color-ink-soft);
}
.dc-nav-grp > summary::-webkit-details-marker { display: none; }
.dc-nav-grp > summary::after { content: '▸'; margin-left: auto; transition: transform .15s; }
.dc-nav-grp[open] > summary::after { transform: rotate(90deg); }
.dc-nav-grp > summary:hover { color: var(--color-primary); }
.dc-nav-n { font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: var(--color-bg); border: 1px solid var(--color-border); }
.dc-nav-grp .nav-link { font-size: 13.5px; padding-left: calc(var(--space-lg) + 8px); }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;   /* flex items default to min-width:auto: one wide child (table, tab row) stretched the whole page on phones */
}

.app-header {
  height: var(--header-height);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-content {
  padding: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* =========================================================================
   COMPONENTS
   ========================================================================= */

/* Typography */
h1, h2, h3, h4, h5 { font-family: var(--font-display); margin: 0 0 var(--space-sm) 0; color: var(--color-ink); }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -1px; }
h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0 0 var(--space-md) 0; color: var(--color-ink-soft); }

/* Buttons */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-family: var(--font-body);
}

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

.ds-btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
}
.ds-btn-secondary:hover { background-color: var(--color-bg); }\n.ds-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Cards */
.ds-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Remove crazy emojis and huge badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-ink-soft);
}

/* Forms */
.ds-input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.ds-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive */
.ds-mobile-menu-btn { display: none; }
@media (max-width: 768px) {
  .ds-mobile-menu-btn { display: inline-flex; }
  .app-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .app-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .app-main { margin-left: 0; }
  .app-content { padding: var(--space-md); }
}


/* Legacy Button Migration */
.actbtn, .backbtn, .hub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-body);
}
.actbtn:hover, .backbtn:hover {
  background-color: var(--color-bg);
}
.actbtn.check {
  background-color: var(--color-primary);
  color: white;
  border-color: var(--color-primary-hover);
}
.actbtn.check:hover {
  background-color: var(--color-primary-hover);
}

/* =========================================================================
   NEW DASHBOARD COMPONENTS
   ========================================================================= */

/* Progress Bars */
.level-progress-container {
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-md);
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-ink-soft);
  margin-bottom: var(--space-xs);
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #60a5fa);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* Header SRS Metrics */
.header-srs-metrics {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}
.srs-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.srs-val {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-ink);
}
.srs-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  font-weight: 600;
  margin-top: 2px;
}
.srs-metric.due .srs-val { color: var(--color-warning); }
.srs-metric.hard .srs-val { color: var(--color-error); }
.srs-metric.new .srs-val { color: var(--color-primary); }
.srs-metric.mastered .srs-val { color: var(--color-success); }

/* Details Drawer */
.details-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background-color: var(--color-surface);
  box-shadow: -4px 0 15px rgba(0,0,0,0.05);
  border-left: 1px solid var(--color-border);
  z-index: 200;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.details-drawer.open {
  right: 0;
}
.drawer-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-content {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}
.close-drawer-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-ink-soft);
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.close-drawer-btn:hover {
  background-color: var(--color-bg);
  color: var(--color-ink);
}
.keyboard-hint {
  font-size: 12px;
  color: var(--color-ink-soft);
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  margin-left: 8px;
}

/* Mobile Specific Header Classes */
.header-title.mobile-only {
  display: none;
}
#startReviewBtn .btn-short { display: none; }   /* desktop shows the long label */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 900; /* below drawer (1000) but above everything else */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive adjustments for header, drawer, and layout */
@media (max-width: 768px) {
  .ds-mobile-menu-btn { display: inline-flex; }
  
  .app-sidebar { 
    transform: translateX(-100%); 
    transition: transform 0.3s ease; 
    width: 280px; 
    z-index: 1000;
  }
  .app-sidebar.open { 
    transform: translateX(0); 
  }
  .app-main { margin-left: 0; }
  .app-content { padding: var(--space-md); }
  
  /* Restructure Header for Mobile using Flex Order */
  .app-header {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
    /* By default app-header is display: flex, justify-content: space-between, align-items: center */
  }
  
  .ds-mobile-menu-btn { order: 1; }
  
  .header-title.mobile-only {
    display: block;
    order: 2;
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    margin: 0 var(--space-sm);
  }
  
  #startReviewBtn { order: 3; padding: 8px 12px; gap: 4px; }
  #startReviewBtn .btn-text { display: none; } /* the long label does not fit on a phone … */
  #startReviewBtn .btn-short { display: inline; font-size: 13px; font-weight: 700; } /* … a short one does: "Üben" / "Review" */

  /* one compact row of four (was a 2×2 grid of cards that took a quarter of a phone screen on every page) */
  .header-srs-metrics {
    order: 4;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 0; /* Reset previous margin */
  }
  
  .srs-metric {
    padding: 3px 2px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    width: 100%;
  }
  .srs-val { font-size: 14px; }
  .srs-label { font-size: 8.5px; letter-spacing: 0; }

  /* True Off-Canvas Drawer */
  .details-drawer {
    width: 85%;
    right: -100%;
    z-index: 1000; /* Ensure drawer is on top */
  }
  .details-drawer.open {
    right: 0;
  }

  /* Hide Keyboard Shortcuts on Mobile */
  .keyboard-shortcuts {
    display: none !important;
  }
  
  /* Card Spacing */
  .module-card, .ds-card, .exercisecard {
    width: 100%;
    margin-bottom: var(--space-md);
  }
  
  body {
    overflow-x: hidden; /* Prevent horizontal scrolling */
  }
}



/* Hide AI Features if API Key not configured */
body:not(.ai-enabled) .ai-feature {
    display: none !important;
}

/* --- Gender Memory Anchor Classes --- */
.gender-der { color: var(--color-der) !important; }
.gender-die { color: var(--color-die) !important; }
.gender-das { color: var(--color-das) !important; }
.gender-bg-der { background-color: var(--color-der-bg) !important; border-color: var(--color-der) !important; color: var(--color-der) !important; }
.gender-bg-die { background-color: var(--color-die-bg) !important; border-color: var(--color-die) !important; color: var(--color-die) !important; }
.gender-bg-das { background-color: var(--color-das-bg) !important; border-color: var(--color-das) !important; color: var(--color-das) !important; }

/* ==========================================================================
   SIMPLE MODE (ZEN UI)
   Hides advanced tools and bloat for an easier, less intimidating experience
   ========================================================================== */
body.simple-mode .quick-tool-btn,
body.simple-mode .advanced-filter,
body.simple-mode .diagram,
body.simple-mode .subtext,
body.simple-mode .peek-translation-box,
body.simple-mode .rule-hint,
body.simple-mode .qlabel,
body.simple-mode .srs-metric.hard,
body.simple-mode .srs-metric.new {
  display: none !important;
}

body.simple-mode .bigbtn {
  padding: 24px 16px !important;
  font-size: 20px !important;
  border-radius: 12px !important;
}

body.simple-mode .word {
  font-size: 32px !important;
  margin: 12px 0 !important;
}

body.simple-mode .actbtn {
  padding: 16px 8px !important;
  font-size: 16px !important;
}

body.simple-mode .thinkbtn {
  padding: 20px 8px !important;
  font-size: 18px !important;
}

/* Flashcard auto-audio switch (js/app-shell.js dcAudioToggleHTML) */
.dc-audio-toggle {
  font: 600 12px/1.2 inherit; font-family: inherit;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--color-border, #cbd5e1);
  background: transparent; color: var(--color-ink-soft, #64748b);
}
.dc-audio-toggle.on { border-color: #16a34a; color: #15803d; background: rgba(22, 163, 74, 0.08); }
[data-theme="dark"] .dc-audio-toggle.on { color: #4ade80; border-color: #4ade80; background: rgba(74, 222, 128, 0.12); }

/* ==========================================================================
   ANIMATED PICTURES (Task 67) — every word picture / icon pops in and then moves in a way that matches its meaning.
   js/app-shell.js (dcAnimatePics) sets class .dc-anim and data-anim = move | fly | spin | pulse | shake | flicker |
   bounce | fall | breathe | wave | float on .wpic, .wz-pic, .wordicon, .verb-icon, .module-icon, [data-pic] …
   Off for "reduce motion" in the OS, and with the switch in Einstellungen / Bild-Grammatik (html.dc-no-anim).
   ========================================================================== */
@keyframes dcPop { 0% { transform: scale(.3) rotate(-8deg); opacity: 0; } 65% { transform: scale(1.14) rotate(3deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes dcFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes dcMove { 0%, 100% { transform: translateX(-5px) rotate(-2deg); } 50% { transform: translateX(5px) rotate(2deg); } }
@keyframes dcFly { 0%, 100% { transform: translate(0, 0) rotate(-4deg); } 25% { transform: translate(4px, -6px) rotate(3deg); } 75% { transform: translate(-4px, -3px) rotate(-2deg); } }
@keyframes dcSpin { to { transform: rotate(360deg); } }
@keyframes dcPulse { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(.96); } 45% { transform: scale(1.1); } }
@keyframes dcShake { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-9deg); } 20%, 40% { transform: rotate(9deg); } }
@keyframes dcFlicker { 0%, 100% { transform: scale(1, 1); opacity: 1; } 25% { transform: scale(.94, 1.08); opacity: .85; } 50% { transform: scale(1.05, .95); } 75% { transform: scale(.97, 1.05); opacity: .9; } }
@keyframes dcBounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-9px) scale(.96, 1.04); } 55% { transform: translateY(0) scale(1.08, .92); } 70% { transform: translateY(-3px); } }
@keyframes dcFall { 0% { transform: translateY(-6px); opacity: .2; } 30% { opacity: 1; } 100% { transform: translateY(6px); opacity: .2; } }
@keyframes dcBreathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.07); opacity: .8; } }
@keyframes dcWave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(12deg); } 75% { transform: rotate(-8deg); } }
@keyframes dcWiggle { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-10deg) scale(1.15); } 50% { transform: rotate(8deg) scale(1.15); } 75% { transform: rotate(-4deg) scale(1.08); } }
.dc-anim { display: inline-block; transform-origin: 50% 60%; will-change: transform; animation: dcPop .55s cubic-bezier(.2, .9, .3, 1.3) both; }
.dc-anim[data-anim="float"]   { animation: dcPop .55s both, dcFloat 3.2s ease-in-out .55s infinite; }
.dc-anim[data-anim="move"]    { animation: dcPop .55s both, dcMove 1.6s ease-in-out .55s infinite; }
.dc-anim[data-anim="fly"]     { animation: dcPop .55s both, dcFly 2.6s ease-in-out .55s infinite; }
.dc-anim[data-anim="spin"]    { animation: dcPop .55s both, dcSpin 6s linear .55s infinite; }
.dc-anim[data-anim="pulse"]   { animation: dcPop .55s both, dcPulse 1.8s ease-in-out .55s infinite; }
.dc-anim[data-anim="shake"]   { animation: dcPop .55s both, dcShake 2.4s ease-in-out .55s infinite; }
.dc-anim[data-anim="flicker"] { animation: dcPop .55s both, dcFlicker .9s ease-in-out .55s infinite; transform-origin: 50% 100%; }
.dc-anim[data-anim="bounce"]  { animation: dcPop .55s both, dcBounce 1.4s ease-in-out .55s infinite; transform-origin: 50% 100%; }
.dc-anim[data-anim="fall"]    { animation: dcPop .55s both, dcFall 1.5s ease-in .55s infinite; }
.dc-anim[data-anim="breathe"] { animation: dcPop .55s both, dcBreathe 3.6s ease-in-out .55s infinite; }
.dc-anim[data-anim="wave"]    { animation: dcPop .55s both, dcWave 2.2s ease-in-out .55s infinite; transform-origin: 50% 100%; }
.dc-anim[data-anim="once"]    { animation: dcPop .55s both; }
.dc-anim:hover, .dc-anim:active, a:hover > .dc-anim, .module-card:hover .dc-anim { animation: dcWiggle .6s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .dc-anim, .dc-anim:hover, .module-card:hover .dc-anim, a:hover > .dc-anim { animation: none !important; } }
html.dc-no-anim .dc-anim, html.dc-no-anim .dc-anim:hover, html.dc-no-anim .module-card:hover .dc-anim { animation: none !important; }
/* topic tile for a word without its own picture (Task 105, js/icon-svgs.js wordTileHTML) */
.wpic.wtile { display: inline-flex; align-items: center; justify-content: center; width: 1.55em; height: 1.55em; font-size: 1.7em !important;
  line-height: 1; border-radius: 28%; background: linear-gradient(145deg, rgba(37, 99, 235, .10), rgba(217, 119, 6, .10));
  border: 1px solid rgba(100, 116, 139, .28); box-shadow: 0 2px 6px rgba(15, 23, 42, .08); }
.wpic.wtile.dc-anim { display: inline-flex; }
.thema-icon.dc-anim, .scene-icon.dc-anim, .avatar.dc-anim { display: block; }   /* boxes keep their layout (margin auto) */

/* Narrow phones (Task 86): the 🌐 button is wider since "· அ" / "· HI" — let the title wrap instead of pushing ▷ down */
@media (max-width: 420px) {
  .app-header .header-title { flex: 1 1 0; min-width: 0; text-align: center; }
  #dcLangBtn { padding: 6px 7px !important; font-size: 12px !important; }
  .header-title.mobile-only { margin: 0; }   /* "Deutsch" must fit next to the Üben button */
  #startReviewBtn { padding: 8px 10px; }
  #startReviewBtn svg, #startReviewBtn i { display: none; }   /* the word says it; the ▷ alone was unclear */
}

/* second views of a menu entry (e.g. 📊 Tabelle (Excel)) as sub-links (Task 87) */
.nav-link.nav-sub { padding-left: 2.2em; font-size: .92em; opacity: .9; }

/* Bigger touch area for small icon buttons on phones (Task 110): an invisible ring around 🔊 / ▶ / 🌐 / 🎙️ —
   the layout does not change, only the area that reacts to a finger (≈ 34–40 px instead of 11–25 px). */
@media (pointer: coarse) {
  .audio-btn-mini, .row-play, .speaker-btn, .audio-btn, .rec-btn, a.dc-tx-link { position: relative; }
  .audio-btn-mini::after, .row-play::after, .speaker-btn::after, .audio-btn::after, .rec-btn::after, a.dc-tx-link::after { content: ''; position: absolute; inset: -8px; }
  .rec-btn { min-width: 40px; min-height: 40px; }
}

/* Narrow phones (Task 113 review): the header got the 🔊 Auto-Vorlesen button — the page-own streak badge
   (e.g. Hörverstehen "🌟 Lvl 1") no longer fits; the same info is in the menu (streak, levels). */
@media (max-width: 460px) { .app-header .streakbox { display: none !important; } }

/* =========================================================================
   Task 255: 4 tabs instead of the ☰ menu — 🏠 Lernen · 🏋️ Üben · 📈 Fortschritt · 👤 Profil
   phone: a bar at the bottom · wide screen: the same 4 in the sidebar. The header keeps only the page name, 🌐 and 🔊.
   ========================================================================= */
:root { --dc-tabs-h: 0px; }
.dc-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--color-surface); border-top: 1px solid var(--color-border); padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 14px rgb(0 0 0 / .05); }
.dc-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 8px; min-height: 52px; justify-content: center;
  font-size: 11.5px; font-weight: 600; color: var(--color-ink-soft); text-decoration: none; }
.dc-tab .ic { font-size: 21px; line-height: 1; filter: grayscale(.7); opacity: .8; }
.dc-tab[aria-current="page"] { color: var(--color-primary); }
.dc-tab[aria-current="page"] .ic { filter: none; opacity: 1; }
.dc-tab:focus-visible, .dc-stab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -3px; }
html.dc-tabs #menuBtn, html.dc-tabs #themeToggleBtn, html.dc-tabs .header-srs-metrics, html.dc-tabs #startReviewBtn,
html.dc-tabs .dc-more, html.dc-tabs .ds-mobile-menu-btn { display: none !important; }
html.dc-tabs .app-header .header-title { display: block; flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 16px; color: var(--color-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
html.dc-tabs .app-header .header-title .dc-up { color: var(--color-primary); font-size: 20px; line-height: 1; }
.dc-side-tabs { display: flex; flex-direction: column; gap: 4px; padding: 12px; }
.dc-stab { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--color-ink); text-decoration: none; }
.dc-stab .ic { font-size: 20px; }
.dc-stab:hover { background: var(--color-bg); }
.dc-stab[aria-current="page"] { background: color-mix(in srgb, var(--color-primary) 12%, transparent); color: var(--color-primary); }
@media (max-width: 768px) {
  :root { --dc-tabs-h: calc(53px + env(safe-area-inset-bottom, 0px)); }
  html.dc-tabs body { padding-bottom: var(--dc-tabs-h); }
  html.dc-tabs .app-sidebar { display: none; }
  html.dc-tabs .app-header { flex-wrap: nowrap; }
  html.dc-tabs .app-header .header-title { order: 0; text-align: left; margin: 0; }
  /* things pinned to the bottom of the screen sit above the tab bar */
  html.dc-tabs #dcRepBtn, html.dc-tabs .dc-mini, html.dc-tabs #dcWtTip, html.dc-tabs #dcRecBar, html.dc-tabs #dcMfSheet { margin-bottom: var(--dc-tabs-h); }
}
@media (min-width: 769px) { .dc-tabbar { display: none; } }
/* 🔁 one review entry (Lernen + Üben) */
.dc-review { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.dc-review-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 16px; }
.dc-streak { font-size: 13.5px; font-weight: 700; color: #c2410c; }
.dc-review-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-review-btn { flex: 1 1 160px; text-align: center; padding: 12px 14px; border-radius: 12px; background: var(--color-primary); color: #fff; font-weight: 700; text-decoration: none; }
.dc-review-btn + .dc-review-btn { background: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface)); color: var(--color-ink); }
.dc-review-none { font-size: 14px; color: var(--color-ink-soft); }
/* 🏠 Lernen: the one review line (Task 275) and the Learn library */
.dc-review-line { display: block; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-ink); text-decoration: none; font-size: 14.5px; }
.dc-review-line b { color: var(--color-primary); }
.dc-lib { display: flex; flex-direction: column; gap: 14px; margin: 18px 0 8px; }
.dc-lib h2.lib-h { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--color-ink-soft); margin: 0; }
.dc-lib .sk { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 12px 14px 6px; }
.dc-lib .sk h3 { font-size: 16.5px; margin: 2px 0 6px; color: var(--color-ink); }
.dc-lib .tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 2px; border-top: 1px solid var(--color-border); text-decoration: none; color: var(--color-ink); }
.dc-lib .sk h3 + .tr { border-top: 0; }
.dc-lib .tr b { font-size: 15.5px; } .dc-lib .tr .d { grid-column: 1; font-size: 13px; color: var(--color-ink-soft); line-height: 1.4; }
.dc-lib .tr .go { grid-row: 1 / span 2; grid-column: 2; color: var(--color-primary); font-size: 20px; }
.dc-lib .tr .lv { font-size: 11.5px; font-weight: 700; color: var(--color-primary); margin-left: 6px; white-space: nowrap; }
.dc-lib .xtra { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 10px; }
/* new learners: the library folded into one line (Task 276) */
.dc-lib details.lib-fold { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 14px; padding: 4px 14px; }
.dc-lib details.lib-fold > summary { cursor: pointer; padding: 12px 0; color: var(--color-ink); font-size: 16px; list-style-position: inside; }
.dc-lib details.lib-fold .lib-n { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--color-bg); color: var(--color-ink-soft); margin-left: 4px; }
.dc-lib details.lib-fold .lib-sum { display: block; font-size: 13.5px; color: var(--color-ink-soft); margin: 4px 0 0 20px; line-height: 1.4; }
.dc-lib details.lib-fold .lib-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 14px; }
.dc-lib .xtra a { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--color-border); color: var(--color-ink); text-decoration: none; background: var(--color-bg); }
/* Lernen tab: only the next step and the review card (Task 255) — the old "Also today", "More" and "all areas" lists go;
   every exercise is on the Üben tab now */
html.dc-tabs #todayCard, html.dc-tabs #homeMore, html.dc-tabs #areas, html.dc-tabs [data-lp-mode], html.dc-tabs .lp-row:has(> [data-lp-mode]) { display: none !important; }
html.dc-tabs #heute .today-grid { display: block !important; }
/* header: the page name first, 🌐 and 🔊 on the right (Task 255) */
html.dc-tabs .app-header { justify-content: flex-start; gap: 8px; }
html.dc-tabs .app-header > .header-title { order: 1; }
html.dc-tabs .app-header > div:first-child { order: 2; margin-left: auto; }
/* Task 255 phase 2: ⚙️ Anpassen panel, "Mehr anzeigen" pager, two-line intros */
details.dc-adjust { margin: 10px 0 14px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); }
details.dc-adjust > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 14.5px; color: var(--color-ink); list-style-position: inside; }
details.dc-adjust[open] > summary { border-bottom: 1px solid var(--color-border); }
details.dc-adjust .dc-adjust-b { padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.dc-pager-hide { display: none !important; }
.dc-pager-more { display: block; width: 100%; margin: 12px 0; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--color-border); background: var(--color-surface); color: var(--color-primary); font: inherit; font-weight: 700; cursor: pointer; }
.dc-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-clamp-btn { margin: 2px 0 8px; padding: 0; border: 0; background: none; color: var(--color-primary); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.dc-ai-notice { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, #f59e0b 14%, var(--color-surface)); border: 1px solid color-mix(in srgb, #f59e0b 45%, var(--color-border)); color: var(--color-ink); font-size: 14px; line-height: 1.5; }
/* Grammatik-Regeln: the three big mode buttons in one row (they took 166 px stacked) */
.wrap > .ds-tabs { display: flex !important; flex-wrap: wrap; gap: 6px; }
.wrap > .ds-tabs > .ds-tab { flex: 1 1 auto; padding: 8px 10px !important; font-size: 13.5px !important; text-align: center; }
