/* Retora v2 production UI — clean mock-aligned stylesheet.
   Uses only tokens from public/css/tokens.css and approved white-on-indigo CTA text. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--ind); outline-offset: 2px; }

#app { min-height: 100vh; }
.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: calc(var(--sp-5) + env(safe-area-inset-top)) var(--sp-5) calc(var(--sp-7) + env(safe-area-inset-bottom));
}
.center, .login-screen, .onboarding-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-5);
}

/* Shared controls */
.btn, .btn-primary, .btn-outline, .btn-ghost {
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border-radius: 14px;
  padding: 0 var(--sp-5);
  font-weight: 700;
}
.btn-primary, .btn.btn-primary { background: var(--ind); color: #fff; box-shadow: var(--shadow-glow); width: 100%; transition: transform 0.1s ease, opacity 0.1s ease; }
.btn-secondary { background: var(--cop); color: #fff; width: 100%; transition: transform 0.1s ease, opacity 0.1s ease; }
.btn-primary:active, .btn-secondary:active { transform: scale(0.96); opacity: 0.88; }
.btn-outline { background: var(--sur); color: var(--text); border: 1px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-danger { background: var(--uri); color: #fff; width: 100%; transition: transform 0.1s ease, opacity 0.1s ease; }
.btn-danger:active { transform: scale(0.96); opacity: 0.88; }
.btn-sm { min-height: var(--touch); padding: 0 var(--sp-4); font-size: var(--fs-label); }
.icon-btn, .washi-btn, .settings-close, .nav-btn, .home-icon-btn {
  min-width: var(--touch);
  min-height: var(--touch);
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: var(--sur);
  border: 1px solid var(--border);
  color: var(--ind-text);
  box-shadow: var(--sh-btn);
}
.header-actions { display: flex; gap: var(--sp-2); align-items: center; }
.topbar, .learn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.topbar.compact { justify-content: flex-start; }
.topbar-title { flex: 1; min-width: 0; }
.brand-word, .sheet-kicker, .hero-kicker, .section-meta, .sec-label {
  color: var(--cop-text);
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page-title, .home-title, .login-title, .lang-title {
  color: var(--text);
  font-size: var(--fs-h1);
  line-height: 1.15;
  font-weight: 700;
}
.error-msg.visible, .error-inline { color: var(--uri); font-size: var(--fs-label); margin-top: var(--sp-3); }

/* ── SVG icon system ──────────────────────────────────────────────────────── */
/* Washi-tile container: rounded square with gradient bg, no border by default */
.home-picto, .jp-icon, .set-icon, .retora-chapter-icon {
  width: 36px; height: 36px; border-radius: 13px;
  display: inline-grid; place-items: center;
  background: linear-gradient(145deg, #ECE8DF, #CBC4B8);
  border: 1px solid transparent;
  color: var(--ind);
  flex-shrink: 0;
}
/* Accent color variants — per-element tinted backgrounds */
.home-picto.ind { background: linear-gradient(145deg, #E7EDF1, #BFD0DC); color: var(--ind); }
.home-picto.tea { background: linear-gradient(145deg, #E0EEEE, #BDD5D5); color: var(--tea); }
.home-picto.och { background: linear-gradient(145deg, #F6EAC8, #E0C778); color: #7C631C; }
.home-picto.cop { background: linear-gradient(145deg, #F0E2D2, #D3B89C); color: #7B5837; }
.home-picto.uri { background: linear-gradient(145deg, #F0D8D2, #D7A096); color: var(--uri); }
.home-picto.ros { background: linear-gradient(145deg, #EFE2E8, #D4B8C8); color: var(--ros); }
.home-picto.sla { background: linear-gradient(145deg, #ECE8DF, #CBC4B8); color: var(--sla); }
/* Dark mode: all tiles use the same dark gradient */
[data-theme="dark"] .toggle-slider::after { background: #cdd4da; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .toggle-slider::after { background: #cdd4da; } }
[data-theme="dark"] .home-picto, [data-theme="dark"] .jp-icon { background: linear-gradient(145deg, #334050, #222A35); }
[data-theme="dark"] .home-picto.ind { color: #A0B8CC; } [data-theme="dark"] .home-picto.tea { color: #7DBDBD; } [data-theme="dark"] .home-picto.och { color: #DDB84D; } [data-theme="dark"] .home-picto.cop { color: #C8A07A; } [data-theme="dark"] .home-picto.uri { color: #C4665A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .home-picto, :root:not([data-theme]) .jp-icon { background: linear-gradient(145deg, #334050, #222A35); }
  :root:not([data-theme]) .home-picto.ind { color: #A0B8CC; } :root:not([data-theme]) .home-picto.tea { color: #7DBDBD; } :root:not([data-theme]) .home-picto.och { color: #DDB84D; } :root:not([data-theme]) .home-picto.cop { color: #C8A07A; } :root:not([data-theme]) .home-picto.uri { color: #C4665A; }
}
/* SVG inside any tile */
.home-picto .ico, .jp-icon .ico, .set-icon .ico, .retora-chapter-icon .ico {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  display: block; overflow: visible;
}
/* Standalone icon (no tile wrapper) */
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; display: inline-block; vertical-align: middle; }
.ico-fill { fill: currentColor; stroke: none; }
/* Speaker icon in audio buttons: slightly larger */
.audio-btn .ico { width: 18px; height: 18px; }
/* Settings check icon */
.set-icon { border-color: transparent; background: transparent; width: 28px; height: 28px; }
.set-icon .ico { width: 18px; height: 18px; }

/* Login / onboarding */
.login-screen {
  background: #fff;
  justify-content: flex-start;
  padding: 0 0 calc(var(--sp-7) + env(safe-area-inset-bottom));
  align-items: stretch;
  max-width: 520px;
  margin: 0 auto;
}
.login-hero-panel {
  flex-shrink: 0;
  position: relative;
}
.login-hero-img {
  width: 100%;
  height: 50dvh;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}
.login-hero-panel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  text-align: center;
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
}
.login-wordmark {
  font-family: 'Lora', serif;
  font-size: 42px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1.1;
}
.login-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--sp-3);
  align-items: stretch;
  padding: var(--sp-5) var(--sp-5) var(--sp-8);
  flex: 1;
}
.btn-google {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: 'Google Sans', Roboto, sans-serif;
  font-weight: 500;
}
.btn-google:hover, .btn-google:active { background: #f8f9fa; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.btn-apple {
  background: #000;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.btn-apple:hover, .btn-apple:active { background: #222; }
.login-sub, .lang-sub {
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 28rem;
  font-size: var(--fs-label);
}
.login-actions .btn-primary {
  box-shadow: 0 6px 20px rgba(62, 92, 118, 0.28);
}
.google-button-wrap { display: flex; justify-content: center; }
.google-button-wrap + .btn-email { width: 280px; align-self: center; }
.guest-link { margin-top: var(--sp-2); background: transparent; color: var(--text-muted); text-decoration: underline; }
.btn-email { background: #fff; color: #3c4043; border: 1px solid #dadce0; box-shadow: 0 1px 3px rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-weight: 500; }
.btn-email:hover, .btn-email:active { background: #f8f9fa; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.email-form { display: flex; flex-direction: column; gap: var(--sp-3); width: 280px; align-self: center; margin-top: auto; }
.email-input { width: 100%; box-sizing: border-box; padding: 14px 16px; border: 1.5px solid #dadce0; border-radius: 14px; font-size: var(--fs-body); background: #fff; color: var(--text); outline: none; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.email-input:focus { border-color: var(--ind); box-shadow: 0 0 0 3px rgba(62,92,118,0.12); }
.email-sent-msg { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; padding: var(--sp-4) 0; margin-top: auto; }
.email-sent-msg p { font-size: var(--fs-body); color: var(--text); margin: 0; line-height: 1.5; }
.onboarding-brand { font-family: 'Lora', serif; font-size: 42px; font-weight: 700; color: var(--text); margin-bottom: var(--sp-3); }
.lang-cards { width: min(100%, 680px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.lang-card { min-height: 148px; padding: var(--sp-5); border-radius: 22px; background: var(--sur); border: 1.5px solid var(--border); box-shadow: var(--sh-card); color: var(--text); text-align: left; }
.lang-card:hover, .lang-card:focus-visible { border-color: var(--ind); transform: translateY(-2px); }
.lang-card-en { display: block; color: var(--text-muted); font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.lang-card-native { display: block; margin-top: var(--sp-2); font-size: var(--fs-h1); font-weight: 700; }
.lang-chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; margin-top: var(--sp-4); }
.lang-chip { min-height: var(--touch); padding: 0 var(--sp-4); border-radius: 999px; background: var(--sur); border: 1px solid var(--border); color: var(--text-muted); font-weight: 700; }

/* Onboarding — level picker */
.lang-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); margin-bottom: var(--sp-5); text-align: center; }
.ob-level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); width: min(100%, 400px); margin-bottom: var(--sp-3); }
.ob-level-row { display: flex; gap: var(--sp-3); width: min(100%, 400px); margin-bottom: var(--sp-5); }
.ob-level-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); padding: var(--sp-4) var(--sp-3); border-radius: 18px; background: var(--sur); border: 1.5px solid var(--border); box-shadow: var(--sh-card); color: var(--text); min-height: 88px; transition: border-color 0.15s, transform 0.12s; }
.ob-level-card:hover { border-color: var(--ind); transform: translateY(-2px); }
.ob-level-card.is-picked { border-color: var(--ind); background: rgba(62,92,118,0.08); }
.ob-level-code { font-size: var(--fs-h2); font-weight: 700; line-height: 1; }
.ob-level-name { font-size: var(--fs-meta); color: var(--text-muted); text-align: center; line-height: 1.3; }
.ob-cta { width: min(100%, 400px); }

/* Onboarding — goal picker */
.ob-goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); width: min(100%, 400px); margin-bottom: var(--sp-5); }
.ob-goal-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); padding: var(--sp-5) var(--sp-3); border-radius: 18px; background: var(--sur); border: 1.5px solid var(--border); box-shadow: var(--sh-card); color: var(--text); min-height: 100px; transition: border-color 0.15s, transform 0.12s; }
.ob-goal-card:hover { border-color: var(--ind); transform: translateY(-2px); }
.ob-goal-card.is-picked { border-color: var(--ind); background: rgba(62,92,118,0.08); }
.ob-goal-num { font-size: 36px; font-weight: 700; line-height: 1; color: var(--ind); }
.ob-goal-unit { font-size: var(--fs-meta); color: var(--text-muted); }

/* Custom Decks */
.custom-decks-header { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }
.page-title { font-size: var(--fs-h2); font-weight: 700; }
.custom-decks-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-7) var(--sp-5); }
.cde-icon { display: flex; justify-content: center; margin-bottom: var(--sp-5); }
.cde-icon .home-picto { width: 64px; height: 64px; font-size: 32px; }
.cde-title { font-size: var(--fs-h2); font-weight: 700; margin-bottom: var(--sp-2); }
.cde-sub { color: var(--text-muted); line-height: 1.55; max-width: 28rem; margin-bottom: var(--sp-6); }
.cde-cta { width: min(100%, 320px); }

/* Custom Decks — list, detail, forms */
.deck-list { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.deck-list-item { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); background: var(--sur); border: 1px solid var(--border); border-radius: 16px; text-align: left; color: var(--text); cursor: pointer; }
.deck-list-name { font-weight: 600; font-size: var(--fs-body); }
.deck-list-count { font-size: var(--fs-meta); color: var(--text-muted); }
.deck-new-btn { width: 100%; }
.deck-create-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; margin-top: var(--sp-3); }
.deck-create-row .deck-input { flex: 1 1 160px; }
.deck-input { width: 100%; padding: var(--sp-3) var(--sp-4); background: var(--sur); border: 1px solid var(--border); border-radius: 12px; font-size: var(--fs-body); color: var(--text); font-family: inherit; }
.deck-input:focus { outline: none; border-color: var(--ind); box-shadow: 0 0 0 3px var(--ind-tint); }
.deck-form { display: grid; gap: var(--sp-3); }
.deck-form-label { font-size: var(--fs-meta); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.deck-form-save { margin-top: var(--sp-2); }
.deck-empty-hint { color: var(--text-muted); text-align: center; padding: var(--sp-6) 0; }
.deck-card-list { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.deck-card-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: var(--sur); border: 1px solid var(--border); border-radius: 12px; }
.deck-card-german { font-weight: 600; font-size: var(--fs-body); flex: 1; }
.deck-card-translation { font-size: var(--fs-label); color: var(--text-muted); flex: 1; }
.deck-card-del { color: var(--text-muted); background: none; border: none; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; padding: var(--sp-1); }
.deck-card-del:hover, .deck-card-del:active { color: var(--uri); }
.deck-del-confirm { margin-left: auto; font-size: var(--fs-meta); color: var(--uri); background: none; border: 1px solid var(--uri); border-radius: 8px; padding: var(--sp-1) var(--sp-2); cursor: pointer; flex-shrink: 0; }
.deck-card-type-badge { font-size: 11px; font-weight: 600; color: var(--cop); background: rgba(166,129,93,0.12); border-radius: 8px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.deck-type-toggle { display: flex; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; margin-bottom: var(--sp-1); }
.deck-type-btn { flex: 1; padding: 8px 12px; font-size: var(--fs-meta); font-weight: 600; color: var(--text-muted); background: transparent; border: none; cursor: pointer; font-family: inherit; }
.deck-type-btn.active { background: var(--ind); color: #fff; }
.deck-detail-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.custom-decks-tile .ch-bar { visibility: hidden; }
.deck-add-card-btn { flex: 1; }
.deck-name-title { flex: 1; }
.deck-create-confirm { flex-shrink: 0; }

/* Home */
.retora-home-page { width: min(100%, 480px); height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-5) 0; overflow: hidden; margin: 0 auto; }
.retora-home-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: var(--sp-5); overscroll-behavior-y: contain; }
.retora-home-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.tab-page-header { display: flex; align-items: center; padding-bottom: var(--sp-3); }
.tab-page-title { font-size: var(--fs-h2); font-weight: 800; color: var(--text); margin: 0; }
.settings-page-body { display: flex; flex-direction: column; gap: 0; }
.home-greeting { color: var(--text); font-size: var(--fs-h1); font-weight: 700; line-height: 1.12; margin: 0 0 var(--sp-1); }
.home-sub { color: var(--text-muted); font-size: var(--fs-label); margin: 0; }
.retora-streak-card { background: var(--sur); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--sh-card); margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: 8px; }
.streak-row { display: flex; align-items: center; gap: var(--sp-3); }
.streak-count-inline { font-size: var(--fs-h2); font-weight: 700; color: var(--text); white-space: nowrap; line-height: 1; }
.streak-count-inline span { font-size: var(--fs-meta); font-weight: 400; color: var(--text-muted); margin-left: 3px; }
.streak-unlock-label { flex: 1; font-size: var(--fs-meta); color: var(--text-muted); text-align: right; line-height: 1.3; }
.streak-bar-track { height: 4px; border-radius: 99px; background: rgba(90, 139, 139, 0.12); overflow: hidden; }
.streak-bar-fill { height: 100%; border-radius: 99px; background: rgba(90, 139, 139, 0.5); transition: width 0.5s var(--ease-out); }
.streak-goal-icon { flex-shrink: 0; opacity: 0.58; }
.streak-goal-icon .home-picto { width: 28px; height: 28px; border-radius: 9px; }
.streak-goal-icon .home-picto .ico { width: 16px; height: 16px; }
.streak-badge { display: inline-block; font-size: 11px; color: var(--cop); margin-left: 4px; line-height: 1; vertical-align: middle; }
.streak-freeze-badge { font-size: 14px; margin-left: auto; opacity: 0.68; flex-shrink: 0; }
.retora-streak-card.is-frozen { border-color: rgba(90, 139, 139, 0.28); background: linear-gradient(180deg, rgba(90, 139, 139, 0.08), var(--sur) 68%); }
.retora-streak-card.is-frozen .streak-count-inline { color: var(--tea); }
.retora-streak-card.is-frozen .streak-bar-fill { background: rgba(90, 139, 139, 0.36); }
/* Milestone banner in session stats */
.milestone-banner { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); background: rgba(90,139,139,0.10); border: 1px solid rgba(90,139,139,0.25); border-radius: 16px; margin-bottom: var(--sp-4); }
.german-ui-banner { padding: var(--sp-4); background: rgba(62,92,118,0.08); border: 1px solid rgba(62,92,118,0.22); border-radius: 16px; margin-bottom: var(--sp-4); } .german-ui-banner-text { margin: 0 0 var(--sp-3); font-size: var(--fs-body); color: var(--text); } .german-ui-banner-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.milestone-icon .home-picto { width: 44px; height: 44px; border-radius: 15px; }
.milestone-icon .home-picto .ico { width: 24px; height: 24px; }
.milestone-title { font-weight: 700; color: var(--tea); font-size: var(--fs-label); }
.milestone-sub { color: var(--text-muted); font-size: var(--fs-meta); margin-top: 2px; }
.retora-due-banner { background: var(--ind); color: #fff; border-radius: 20px; padding: var(--sp-5); margin-bottom: var(--sp-4); box-shadow: var(--shadow-glow); cursor: pointer; }
.retora-due-banner .due-num { color: #fff; font-size: 56px; font-weight: 700; line-height: 1; margin: 0; }
.retora-due-banner .due-lbl { color: #fff; opacity: 0.78; font-size: var(--fs-label); margin-top: var(--sp-1); }
.retora-due-banner .due-meta { color: #fff; opacity: 0.62; font-size: var(--fs-meta); margin: var(--sp-1) 0 var(--sp-4); } .retora-due-banner .due-backlog { color: #fff; opacity: 0.5; font-size: var(--fs-meta); margin: calc(-1 * var(--sp-3)) 0 var(--sp-4); }
.due-actions { display: flex; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); }
.due-cta { flex: 1; min-height: var(--touch); border-radius: 16px; background: var(--sur); color: var(--ind-text); font-size: var(--fs-body); font-weight: 700; }
.start-here-banner { text-align: center; }
.start-here-icon { font-size: 32px; margin-bottom: var(--sp-2); opacity: 0.9; }
.start-here-title { font-size: var(--fs-h2); font-weight: 800; color: #fff; margin-bottom: var(--sp-1); }
.start-here-sub { font-size: var(--fs-label); color: rgba(255,255,255,0.75); margin-bottom: var(--sp-4); line-height: 1.4; }
.start-here-banner .due-actions { justify-content: center; }
.start-here-banner .due-cta { max-width: 240px; }
.start-here-tip { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid rgba(255,255,255,0.18); font-size: var(--fs-meta); color: rgba(255,255,255,0.72); line-height: 1.4; text-align: left; }
.start-here-tip-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.due-listen { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 14px; height: var(--touch); flex-shrink: 0; border-radius: 16px; background: rgba(255,255,255,0.18); color: #fff; } .due-listen .ico { width: 20px; height: 20px; } .due-listen-label { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.extra-practice-link { background: transparent; border: 0; color: rgba(255,255,255,0.65); font-size: var(--fs-meta); text-decoration: underline; cursor: pointer; margin-top: var(--sp-2); padding: 4px 0; align-self: center; }
.extra-practice-link:hover { color: #fff; }
.stats-exam-chip { margin-top: var(--sp-1); }
/* ── Home tab switch: Words / Phrases ────────────────────────────────────── */
.home-tab-switch { position: relative; display: flex; background: var(--sur2); border-radius: 14px; padding: 4px; margin-bottom: var(--sp-4); }
.htab-slider { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 11px; background: var(--ind); box-shadow: 0 2px 10px rgba(62,92,118,0.28); pointer-events: none; will-change: transform; }
.htab { position: relative; z-index: 1; flex: 1; min-height: 40px; border-radius: 11px; font-size: var(--fs-label); font-weight: 600; color: var(--text-muted); background: transparent; transition: color 0.22s; -webkit-tap-highlight-color: transparent; }
.htab.is-active { color: #fff; }
/* ── Tab content slide track ─────────────────────────────────────────────── */
.tab-content-wrap { overflow: hidden; }
.tab-track { display: flex; will-change: transform; }
.tab-pane { flex: 0 0 100%; min-width: 0; }
/* phrase lock state */
.ph-locked { opacity: 0.6; }
.ph-lock-ico { width: 12px; height: 12px; vertical-align: -1px; }
/* section header: clean label, no browse-link */
.retora-section-hd { display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.retora-section-hd .sec-label { flex: 1; }

/* category grid */
.retora-category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.retora-category-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tile-accent, var(--ind));
  border-radius: 16px;
  display: flex; flex-direction: row; align-items: stretch;
  color: var(--text); text-align: left;
  box-shadow: var(--sh-card);
  overflow: hidden;
  position: relative;
}
.retora-category-tile.accent-tea { --tile-accent: var(--tea); }
.retora-category-tile.accent-ind { --tile-accent: var(--ind); }
.retora-category-tile.accent-och { --tile-accent: var(--och); }
.retora-category-tile.accent-cop { --tile-accent: var(--cop); }
/* main tap target: fills the tile, starts learn fast path */
.ch-tile-main {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start;
  padding: 14px 10px 12px 13px; background: none; border: 0;
  cursor: pointer; text-align: left; min-width: 0;
  transition: transform 0.18s var(--ease-out);
}
.ch-tile-main:active { transform: scale(0.97); }
.ch-tile-main .ch-icon { margin-bottom: var(--sp-2); }
/* info chevron: opens detail sheet */
.ch-tile-info {
  width: 32px; flex-shrink: 0; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10px;
  background: none; border: 0; border-left: 1px solid var(--border);
  cursor: pointer;
}
.ch-tile-info .ico { width: 13px; height: 13px; color: var(--tile-accent, var(--ind)); opacity: 0.7; }
.ch-tile-info:active { background: color-mix(in srgb, var(--ind) 8%, transparent); }
/* legacy direct-button tile fallback (phrases tiles stay as full buttons) */
button.retora-category-tile { padding: 14px 13px 12px; flex-direction: column; }
button.retora-category-tile:active { transform: scale(0.97); box-shadow: var(--sh-btn); }
button.retora-category-tile .ch-icon { margin-bottom: var(--sp-2); }
.ch-name, .ch-due, .ch-bar { display: block; width: 100%; }
.ch-name { color: var(--text); font-size: var(--fs-label); font-weight: 700; line-height: 1.25; }
.ch-due { color: var(--text-muted); font-size: var(--fs-meta); margin-top: var(--sp-1); min-height: 16px; }
.ch-progress-meta { display: block; color: var(--text-muted); font-size: var(--fs-micro); margin-top: var(--sp-1); line-height: 1.3; }
.ch-bar { height: 3px; border-radius: 99px; background: var(--sur2); margin-top: var(--sp-3); overflow: hidden; }
.settings-lang-explainer { color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.45; margin: 0 0 var(--sp-4); padding: 0 var(--sp-1); }
.settings-section-hint { margin: var(--sp-1) 0 var(--sp-3); padding: 0 var(--sp-1); }
.confirm-sheet-message { color: var(--text-muted); font-size: var(--fs-label); line-height: 1.5; margin: 0 0 var(--sp-5); }
.confirm-sheet-actions { display: flex; flex-direction: column; gap: var(--sp-3); }
.sdb-workload-lines { display: flex; flex-direction: column; gap: var(--sp-2); }
.sdb-workload-line { font-size: var(--fs-label); color: var(--text); }
.sdb-workload-backlog { color: var(--cop-text); }
.ch-fill { display: block; height: 100%; border-radius: 99px; background: var(--tile-accent, var(--ind)); }

/* level selector — full-width button with expandable options panel */
.retora-level-strip { padding: var(--sp-2) 0 var(--sp-4); }
.level-full-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); background: var(--sur); border: 1px solid var(--border); border-radius: 14px; gap: var(--sp-3); min-height: var(--touch); transition: background 0.15s; }
.level-full-btn:active { background: var(--sur2); }
.level-btn-inner { display: flex; align-items: center; gap: var(--sp-3); flex: 1; min-width: 0; }
.level-btn-name { font-family: 'Lora', serif; font-size: var(--fs-h2); font-weight: 700; color: var(--ind); }
.level-btn-sub { font-size: var(--fs-meta); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-btn-arrow { color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.level-btn-arrow.open { transform: rotate(180deg); }
.level-options-panel { background: var(--sur); border: 1px solid var(--border); border-radius: 14px; margin-bottom: var(--sp-2); overflow: hidden; box-shadow: var(--sh-card); animation: fc-fadein 0.15s ease; }
.level-opt { width: 100%; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: transparent; border: none; border-bottom: 1px solid var(--border); cursor: pointer; text-align: left; min-height: var(--touch); transition: background 0.12s; }
.level-picker-sheet { padding-bottom: max(var(--sp-5), env(safe-area-inset-bottom)); }
.lvlsh-list { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.lvlsh-row { width: 100%; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); background: transparent; border: 1px solid transparent; border-radius: 12px; cursor: pointer; text-align: left; min-height: var(--touch); transition: background 0.12s; }
.lvlsh-row:active { background: var(--sur2); }
.lvlsh-row.is-active { background: color-mix(in srgb, var(--ind) 10%, transparent); border-color: var(--ind); }
.lvlsh-row.is-active svg { color: var(--ind); }
.lvlsh-label { font-family: 'Lora', serif; font-size: var(--fs-h3); font-weight: 700; color: var(--ind); min-width: 2.5rem; }
.lvlsh-tagline { flex: 1; font-size: var(--fs-body); color: var(--text-muted); text-align: left; }
.level-opt:last-child { border-bottom: none; }
.level-opt:active { background: var(--sur2); }
.level-opt strong { font-family: 'Lora', serif; font-size: var(--fs-h2); color: var(--ind); min-width: 4em; text-align: left; }
.level-opt span { font-size: var(--fs-meta); color: var(--text-muted); flex: 1; text-align: left; }
.level-opt.is-active { background: rgba(62,92,118,0.07); }
.level-opt.is-active strong { color: var(--ind); font-weight: 800; }
.bottom-nav { display: flex; gap: var(--sp-1); padding: var(--sp-2) var(--sp-2) calc(var(--sp-1) + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--sur2); }
.retora-bottom-nav { position: sticky; bottom: 0; margin: 0 calc(var(--sp-5) * -1); transform: translateZ(0); }
.bn-item { flex: 1; min-height: var(--touch); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; color: var(--text-muted); }
.bn-label { font-size: var(--fs-micro); font-weight: 600; }
.bn-icon .home-picto { width: 29px; height: 29px; border-radius: 11px; }
.bn-icon .home-picto .ico { width: 16px; height: 16px; }
.bn-active { color: var(--ind); }

/* Chapters */
.retora-chapters-page { width: min(100%, 920px); }
.retora-chapters-page .topbar { background: var(--sur); border: 1px solid var(--border); border-radius: 24px; padding: var(--sp-3) var(--sp-4); box-shadow: var(--sh-card); }
.retora-chapter-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-4); }
.retora-chapter-card { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: var(--sp-4); background: var(--sur); border: 1px solid var(--border); border-radius: 22px; padding: var(--sp-5); box-shadow: var(--sh-card); position: relative; overflow: hidden; }
.retora-chapter-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ch-color, var(--ind)); }
.retora-chapter-icon { width: 48px; height: 48px; color: var(--ch-color, var(--ind)); }
.retora-chapter-info { min-width: 0; } .retora-chapter-num { color: var(--cop-text); font-size: var(--fs-meta); font-weight: 700; letter-spacing: 0.08em; margin-bottom: var(--sp-1); }
.retora-chapter-title { color: var(--text); font-size: 18px; line-height: 1.25; margin: 0; } .retora-chapter-subtitle { color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.35; margin: var(--sp-1) 0 var(--sp-3); }
.retora-chapter-progress { height: 5px; background: var(--sur2); border-radius: 999px; overflow: hidden; margin-bottom: var(--sp-3); } .retora-chapter-progress span { display: block; height: 100%; background: var(--ch-color, var(--ind)); }
.retora-chapter-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); color: var(--text-muted); font-size: var(--fs-meta); } .retora-chapter-meta span { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 8px; }
.retora-chapter-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: var(--sp-2); margin-top: var(--sp-1); }
.retora-chapter-action { min-height: var(--touch); border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: var(--fs-label); font-weight: 700; padding: 8px 10px; }
.retora-chapter-action.primary { background: var(--ind); border-color: var(--ind); color: #fff; } .retora-chapter-action.exam { background: var(--cop-tint); border-color: var(--cop); color: var(--cop-text); }
.retora-chapter-mastered { grid-column: 1 / -1; min-height: var(--touch); display: grid; place-items: center; color: var(--tea); font-weight: 700; }

/* Learn shell — mock-aligned */
.learn-shell {
  padding: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden; /* prevent card translateX from shifting viewport */
}
.review-bar { display: flex; align-items: center; padding: calc(env(safe-area-inset-top) + 6px) 20px 2px; gap: 10px; flex-shrink: 0; }
.rbar-prog { flex: 1; height: 4px; background: var(--sur2); border-radius: 99px; overflow: hidden; }
.rbar-fill { height: 100%; border-radius: 99px; background: var(--cop); transition: width 0.4s; }
.rbar-cnt { font-size: var(--fs-meta); color: var(--sla); min-width: 36px; text-align: right; }
.back-btn { width: 48px; height: 48px; border: none; background: transparent; color: var(--ind); display: flex; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; cursor: pointer; }
.back-btn:hover { background: var(--sur2); }
.card-area { flex: 1; padding: 8px 18px 16px; display: flex; flex-direction: column; min-height: 0; }
.card-area .flashcard-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.card-area .card-scene { flex: 1; min-height: 380px; height: auto; }

/* Flashcards */
@keyframes fc-fadein { from { opacity: 0; } to { opacity: 1; } }
.flashcard-shell { width: min(100%, 430px); margin: 0 auto; animation: fc-fadein 150ms ease forwards; }
.review-btns-wrap { flex-shrink: 0; padding: 0 18px 14px; }
.review-btns-wrap-inner { display: flex; flex-direction: column; gap: 6px; }
.grade-hint-banner { display: flex; align-items: center; gap: 10px; background: var(--ind-tint); border: 1px solid color-mix(in srgb, var(--ind) 30%, transparent); border-radius: 12px; padding: 10px 12px; }
.grade-hint-text { flex: 1; font-size: var(--fs-small); color: var(--text); margin: 0; line-height: 1.4; }
.grade-hint-ok { flex-shrink: 0; font-size: var(--fs-small); font-weight: 700; color: var(--ind); background: none; border: none; padding: 4px 2px; cursor: pointer; }
.card-scene { height: 540px; perspective: 1000px; display: flex; flex-direction: column; position: relative; }
.card-scene::before, .card-scene::after { content: ''; position: absolute; inset: 0; border-radius: 24px; background: var(--sur); pointer-events: none; }
.card-scene::before { transform: translateY(7px) translateX(-4px) rotate(-1.8deg); opacity: 0.38; z-index: 0; }
.card-scene::after  { transform: translateY(4px) translateX(3px)  rotate(1.1deg);  opacity: 0.55; z-index: 0; }
.card-3d { flex: 1; width: 100%; min-height: 380px; position: relative; transform-style: preserve-3d; will-change: transform; transition: transform 0.38s cubic-bezier(0.25, 0, 0.2, 1); cursor: pointer; border-radius: 24px; contain: layout paint style; z-index: 1; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
@media (prefers-reduced-motion: reduce) {
  .card-scene::before { transform: translateY(7px) translateX(-4px); }
  .card-scene::after  { transform: translateY(4px) translateX(3px); }
}
.card-3d.flipped { transform: rotateY(180deg); }
.card-3d.swiping { transition: none; }
.card-3d.swipe-commit { transition: none; } /* duration set inline from swipe velocity */
.card-3d.swipe-commit-back .card-front { visibility: hidden; }
.card-surface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 24px; background: var(--sur); box-shadow: var(--sh-card); display: flex; flex-direction: column; align-items: center; overflow: hidden; transform: translateZ(0); -webkit-transform: translateZ(0); }
.card-front { transform: rotateY(0deg); }
.card-back { transform: rotateY(180deg); }
.cf-inner, .cb-inner { width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 22px 20px 18px; overflow: hidden; touch-action: pan-y; }
.subsection-badge { max-width: 100%; margin-bottom: var(--sp-2); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--ind-border); background: var(--ind-tint); color: var(--ind-text); font-size: var(--fs-micro); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-tag { display: none; }
.card-word-wrap { position: relative; padding-bottom: var(--sp-2); margin-bottom: var(--sp-2); border-bottom: 3px solid transparent; display: flex; flex-direction: column; align-items: center; }
.card-word-wrap.art-der { border-bottom-color: var(--tea); } .card-word-wrap.art-die { border-bottom-color: var(--ros); } .card-word-wrap.art-das { border-bottom-color: var(--och); }
.art-word-lbl { color: var(--text); font-size: var(--fs-meta); margin-bottom: var(--sp-1); }
.card-word { font-family: 'Lora', Georgia, serif; font-size: var(--fs-hero); font-weight: 700; color: var(--text); line-height: 1.1; text-align: center; overflow-wrap: anywhere; }
.card-ipa { color: var(--text-muted); font-size: var(--fs-label); margin-bottom: 4px; } .card-plural { min-height: 20px; color: var(--text-muted); font-size: var(--fs-meta); font-style: italic; margin-bottom: 14px; }
.grammar-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin: 4px 0 8px; }
.grammar-tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: 0.02em; background: var(--sur); color: var(--text-muted); border: 1px solid var(--border); }
.gt-verb { background: rgba(62,92,118,0.1); color: var(--ind); border-color: rgba(62,92,118,0.2); }
.gt-adjective, .gt-adverb { background: rgba(166,129,93,0.1); color: var(--cop); border-color: rgba(166,129,93,0.2); }
.gt-reflexive { background: rgba(102,140,122,0.1); color: #668C7A; border-color: rgba(102,140,122,0.25); }
.card-img { width: 100%; aspect-ratio: 16/10; border-radius: 16px; background: var(--sur2); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; overflow: hidden; position: relative; border: 1px solid var(--border); } .card-img img { width: 100%; height: 100%; display: block; object-fit: cover; position: relative; z-index: 2; } .card-img.missing img { display: none; } .card-img.missing::before { content: attr(data-fallback); width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; background: var(--bg); color: var(--ind-text); border: 1px solid var(--ind); font-family: 'Lora', serif; font-size: var(--fs-h1); font-weight: 700; } .card-img.missing::after { content: "Bild folgt"; position: absolute; bottom: var(--sp-3); color: var(--text-muted); font-size: var(--fs-meta); font-weight: 700; }
.audio-row { display: flex; gap: var(--sp-2); justify-content: center; margin-bottom: auto; }
.audio-btn { min-height: var(--touch); display: flex; align-items: center; gap: var(--sp-2); padding: 8px 16px; border-radius: 999px; background: var(--bg); border: 1.5px solid var(--border); color: var(--ind); font-size: var(--fs-meta); font-weight: 700; }
.audio-btn .jp-icon { width: 28px; height: 28px; border-radius: 9px; color: var(--ind-text); border-color: var(--ind-border); background: var(--ind-tint); }
.tap-hint { color: var(--text-muted); font-size: var(--fs-meta); margin-top: var(--sp-4); }
/* listen mode card front */
.card-front-listen .cf-inner { justify-content: center; gap: var(--sp-4); }
.listen-img { aspect-ratio: 4/3; margin-bottom: 0; }
.listen-play-btn { width: 80px; height: 80px; border-radius: 50%; background: var(--ind); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow-glow); flex-shrink: 0; }
.listen-play-ico { width: 36px; height: 36px; }
.card-word-sm { font-family: 'Lora', serif; color: var(--text-muted); font-size: var(--fs-label); margin-bottom: var(--sp-1); }
.card-trans-main { color: var(--text); font-size: 32px; font-weight: 700; text-align: center; line-height: 1.15; margin-bottom: var(--sp-2); }
.card-divider { width: 36px; height: 2px; border-radius: 999px; background: var(--sur2); margin-bottom: var(--sp-4); }
.example-sent { color: var(--text-muted); font-size: var(--fs-label); line-height: 1.55; text-align: center; margin-bottom: var(--sp-2); max-height: 92px; overflow: hidden; } .ex-hl { color: var(--ind-text); background: var(--ind-tint); border-radius: 5px; padding: 1px 4px; font-weight: 700; }
.example-trans { color: var(--text-muted); font-size: var(--fs-meta); font-style: italic; text-align: center; margin-bottom: var(--sp-4); max-height: 52px; overflow: hidden; }
.mnemonic-box { width: 100%; border: 1.5px dashed var(--och); border-radius: 14px; padding: 11px 13px; background: var(--cop-tint); margin-top: auto; }
.mn-header { display: flex; align-items: center; margin-bottom: var(--sp-1); }
.mn-lbl { color: var(--cop-text); font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; flex: 1; }
.mn-edit-btn { background: none; border: none; color: var(--cop-text); font-size: var(--fs-micro); font-weight: 700; text-decoration: underline; padding: 0; cursor: pointer; min-height: 0; }
.mn-text, .mn-empty { color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.5; } .mn-empty { font-style: italic; } .mn-user { color: var(--text); font-size: var(--fs-meta); line-height: 1.5; }
.mn-image { width: 100%; max-height: 140px; object-fit: contain; border-radius: 10px; margin-top: var(--sp-3); opacity: 0.92; }
.mn-textarea { width: 100%; resize: none; background: var(--bg); border: 1.5px solid var(--ind); border-radius: 10px; padding: var(--sp-2) var(--sp-3); font-family: inherit; font-size: var(--fs-meta); color: var(--text); min-height: 72px; margin-top: var(--sp-1); }
.mn-textarea:focus { outline: 2px solid var(--ind); outline-offset: 1px; }
.mn-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); justify-content: flex-end; }
.mn-save { background: var(--ind); color: #fff; border: none; border-radius: 10px; padding: 6px 14px; font-weight: 700; font-size: var(--fs-meta); min-height: 0; cursor: pointer; }
.mn-cancel { background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 6px 14px; color: var(--text-muted); font-size: var(--fs-meta); min-height: 0; cursor: pointer; }

/* Swipe gesture feedback — sibling of card-3d inside card-scene (doesn't move with card) */
.swipe-hint {
  position: absolute; top: 50%;
  min-width: 160px; padding: 12px 32px; border-radius: 10px; border-width: 4px; border-style: solid;
  pointer-events: none; z-index: 10; transition: opacity 0.06s;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
}
.swipe-hint-right { left: 50%; transform: translate(-50%, -50%) rotate(10deg);  background: rgba(53,92,125,0.12); color: var(--ind); border-color: var(--ind); }
.swipe-hint-left  { left: 50%; transform: translate(-50%, -50%) rotate(-10deg); background: rgba(155,58,42,0.10); color: var(--uri); border-color: var(--uri); }
.swipe-hint-icon { font-size: 1.5rem; font-weight: 900; line-height: 1; }
.swipe-hint-lbl  { font-size: 1.75rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; }
.swipe-guide { color: var(--text-muted); font-size: var(--fs-micro); text-align: center; margin-top: var(--sp-2); opacity: 0.6; letter-spacing: 0.04em; }

/* Dark mode: audio button bg should adapt */
@media (prefers-color-scheme: dark) {
  .audio-btn { background: var(--sur2); border-color: var(--border); }
}
[data-theme="dark"] .audio-btn { background: var(--sur2); border-color: var(--border); }

/* ── Premium UI — dark mode overrides ───────────────────────────────────────
   Elements with hardcoded rgba() values or indigo that needs lifting on dark. */
[data-theme="dark"] .premium-badge { box-shadow: 0 0 0 1px rgba(224,169,74,0.28); }
[data-theme="dark"] .settings-adv-premium-badge { border-color: rgba(212,164,112,0.4); }
[data-theme="dark"] .plan-card.pl-featured { background: #3E6E94; }
[data-theme="dark"] .freeze-badge-ready  { background: rgba(125,189,189,0.16); }
[data-theme="dark"] .freeze-badge-active { background: rgba(122,180,204,0.14); }
[data-theme="dark"] .freeze-badge-used   { background: rgba(212,164,112,0.14); }
[data-theme="dark"] .deck-card-type-badge { background: rgba(185,134,85,0.18); }
[data-theme="dark"] .weak-badge { background: rgba(155,58,42,0.18); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .premium-badge { box-shadow: 0 0 0 1px rgba(224,169,74,0.28); }
  :root:not([data-theme]) .settings-adv-premium-badge { border-color: rgba(212,164,112,0.4); }
  :root:not([data-theme]) .plan-card.pl-featured { background: #3E6E94; }
  :root:not([data-theme]) .freeze-badge-ready  { background: rgba(125,189,189,0.16); }
  :root:not([data-theme]) .freeze-badge-active { background: rgba(122,180,204,0.14); }
  :root:not([data-theme]) .freeze-badge-used   { background: rgba(212,164,112,0.14); }
  :root:not([data-theme]) .deck-card-type-badge { background: rgba(185,134,85,0.18); }
  :root:not([data-theme]) .weak-badge { background: rgba(155,58,42,0.18); }
}
.profile-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0 var(--sp-4); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.profile-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--ind); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 700; flex-shrink: 0; }
.profile-info { flex: 1; min-width: 0; }
.prof-name { font-weight: 700; font-size: var(--fs-body); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-email { font-size: var(--fs-meta); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-pill { font-size: var(--fs-micro); font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--ind-tint); color: var(--ind-text); flex-shrink: 0; }
.sync-pill.guest { background: var(--sur2); color: var(--text-muted); }
.review-btns, .grade-row { width: min(100%, 430px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin: var(--sp-3) auto 0; }
.rbtn, .grade-btn { min-height: var(--touch); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: var(--fs-label); font-weight: 700; transition: transform 0.4s var(--spring); } .rbtn:active, .grade-btn:active { transform: scale(0.82); } .rbtn .ri, .grade-btn-tip, .grade-btn-interval { font-size: var(--fs-micro); font-weight: 500; opacity: 0.72; }
.rb-again, .grade-btn.again { background: var(--uri-tint); color: var(--uri); } .rb-hard, .grade-btn.hard { background: var(--sur2); color: var(--sla); } .rb-good, .grade-btn.good { background: var(--cop-tint); color: var(--cop-text); } .rb-easy, .grade-btn.easy { background: var(--ind-tint); color: var(--ind-text); }
.rbtn[data-tip] { position: relative; } .rbtn[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%) translateY(3px); padding: 5px 8px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: var(--fs-micro); opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 30; } .rbtn[data-tip]:hover::after, .rbtn[data-tip]:focus-visible::after, .review-btns.show-kb-hints .rbtn[data-tip]::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.card-nav { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); margin-top: var(--sp-3); } .card-counter { min-width: 72px; text-align: center; color: var(--text-muted); font-weight: 700; } .shuffle-btn { min-height: var(--touch); padding: 0 var(--sp-4); border-radius: 999px; background: var(--sur); border: 1px solid var(--border); color: var(--text-muted); font-weight: 700; } .shuffle-btn.active { color: var(--ind-text); border-color: var(--ind); }

/* Choice / cloze / exam */
.choice-area, .cloze-area { width: min(100%, 620px); margin: 0 auto; }
.choice-prompt, .cloze-shell, .stats-block, .empty-state { background: var(--sur); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--sh-card); padding: var(--sp-5); }
.choice-prompt { text-align: center; margin-bottom: var(--sp-4); } .choice-word { font-family: 'Lora', serif; font-size: 34px; font-weight: 700; color: var(--text); } .choice-info { color: var(--text-muted); font-size: var(--fs-label); margin-top: var(--sp-1); }
.choice-options { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); } .choice-btn { min-height: var(--touch); border-radius: 16px; background: var(--sur); border: 2px solid var(--border); color: var(--text); padding: var(--sp-3); font-weight: 700; text-align: left; } .choice-btn.correct { border-color: var(--tea); background: var(--success-tint); color: var(--tea); } .choice-btn.wrong { border-color: var(--uri); background: var(--uri-tint); color: var(--uri); } .choice-btn-num { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: var(--sp-2); border-radius: 7px; background: var(--sur2); color: var(--text-muted); font-size: var(--fs-meta); }
.choice-actions, .stats-actions, .empty-actions { display: flex; justify-content: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.mark-learned-link { background: transparent; color: var(--text-muted); text-decoration: underline; min-height: var(--touch); padding: 0 var(--sp-3); }
.cloze-shell { text-align: center; margin-bottom: var(--sp-4); } .cloze-shell.correct { border-color: var(--tea); background: var(--success-tint); } .cloze-shell.wrong { border-color: var(--uri); background: var(--uri-tint); }
.cloze-label { color: var(--text-muted); font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-3); } .cloze-sentence { color: var(--text); font-size: var(--fs-h2); line-height: 1.6; } .cloze-blank { display: inline-flex; min-width: 8ch; min-height: 1.6em; border-bottom: 3px solid var(--ind); color: var(--uri); font-weight: 700; padding: 0 var(--sp-2); }
.cloze-translation { color: var(--text-muted); margin-top: var(--sp-4); } .cloze-input-row { display: flex; gap: var(--sp-3); } .cloze-input { flex: 1; min-width: 0; min-height: var(--touch); border-radius: 16px; background: var(--sur); border: 2px solid var(--border); color: var(--text); padding: 0 var(--sp-4); } .cloze-input:focus { border-color: var(--ind); } .cloze-feedback { text-align: center; margin-top: var(--sp-3); font-weight: 700; } .cloze-feedback.correct { color: var(--tea); } .cloze-feedback.wrong { color: var(--uri); }
.exam-header, .exam-progress-bar { width: min(100%, 620px); margin-left: auto; margin-right: auto; } .exam-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-2); } .exam-timer, .exam-progress { color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; } .exam-timer.urgent { color: var(--uri); } .exam-progress-bar { height: 5px; background: var(--sur2); border-radius: 99px; overflow: hidden; } .exam-progress-fill { height: 100%; background: var(--ind); }
.exam-results-list { display: grid; gap: var(--sp-2); margin: var(--sp-5) 0; max-height: 42vh; overflow: auto; } .exam-result-row { display: grid; grid-template-columns: minmax(90px,1fr) minmax(90px,1fr) auto; gap: var(--sp-2); align-items: center; padding: var(--sp-3); background: var(--sur); border: 1px solid var(--border); border-radius: 14px; } .exam-result-row.correct { border-left: 4px solid var(--tea); } .exam-result-row.wrong { border-left: 4px solid var(--uri); } .exam-result-word { font-family: 'Lora', serif; font-weight: 700; } .exam-result-answer { color: var(--text-muted); } .exam-result-correct { color: var(--tea); font-weight: 700; }

/* Stats/session, settings, paywall, guide */
.stats-page { width: min(100%, 620px); margin: 0 auto; text-align: center; } .stats-title, .empty-title { font-size: var(--fs-h1); color: var(--text); } .stats-sub, .empty-sub { color: var(--text-muted); margin-top: var(--sp-2); } .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); margin: var(--sp-5) 0; } .stats-block-val { color: var(--ind-text); font-size: var(--fs-h1); font-weight: 700; } .stats-block-lbl { color: var(--text-muted); font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.completion-stamp { display: inline-block; font-size: var(--fs-h2); font-weight: 800; color: var(--cop); border: 3px solid var(--cop); border-radius: 12px; padding: 4px 18px; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: var(--sp-4); opacity: 0; transform: scale(0.7) rotate(-4deg); transition: opacity 300ms ease, transform 350ms cubic-bezier(0.34,1.56,0.64,1); }
@media (prefers-reduced-motion: reduce) { .completion-stamp { transition: opacity 150ms ease; transform: none !important; } }
.completion-stamp.stamp-in { opacity: 1; transform: scale(1) rotate(-2deg); }
.audio-btn.is-playing, .jp-icon.is-playing { opacity: 0.6; } .listen-play-ico.is-playing { animation: audio-pulse 0.6s ease-in-out infinite alternate; }
@keyframes audio-pulse { from { opacity: 1; } to { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .listen-play-ico.is-playing { animation: none; } }
.settings-overlay, .pw-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); } .settings-panel, .pw-sheet { width: min(100%, 520px); max-height: 92dvh; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-bottom: 0; border-radius: 28px 28px 0 0; padding: var(--sp-6) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom)); box-shadow: var(--sh-sheet); }
.settings-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-5); } .settings-header h2, .pw-title { font-size: var(--fs-h2); color: var(--text); } .settings-close, .pw-close { width: var(--touch); height: var(--touch); border-radius: 999px; padding: 0; }
.settings-section { margin-bottom: var(--sp-5); } .theme-section { margin-bottom: var(--sp-6); } .settings-controls { display: grid; gap: var(--sp-2); margin-bottom: 0; } .settings-label { color: var(--text-muted); font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-2); } .settings-list { display: grid; gap: var(--sp-2); }
.settings-row { width: 100%; min-height: var(--touch); display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border-radius: 16px; background: var(--sur); border: 1px solid var(--border); color: var(--text); text-align: left; } .settings-row small { margin-left: auto; color: var(--text-muted); } .settings-row.selected { border-color: var(--ind); background: var(--ind-tint); } .settings-row.danger { color: var(--uri); }
.settings-info-row { cursor: default; pointer-events: none; align-items: flex-start; } .settings-info-label { flex: 1; } .settings-info-val { max-width: 54%; font-size: var(--fs-meta); color: var(--text-muted); text-align: right; line-height: 1.3; }
@media (max-width: 420px) { .settings-info-row { flex-direction: column; } .settings-info-val { max-width: none; text-align: left; } }
.settings-freeze-row { cursor: default; pointer-events: none; flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.freeze-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.freeze-label { font-weight: 600; font-size: var(--fs-body); }
.freeze-badge { font-size: var(--fs-meta); font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.freeze-badge-ready  { background: rgba(102,140,122,0.14); color: var(--tea); }
.freeze-badge-active { background: rgba(53,92,125,0.14);   color: var(--ind-text); }
.freeze-badge-used   { background: rgba(185,134,85,0.14);  color: var(--cop-text); }
.freeze-note { font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.45; margin: 0; }
.theme-row, .segmented { display: flex; gap: var(--sp-2); padding: 6px; background: var(--sur); border: 1px solid var(--border); border-radius: 18px; } .theme-btn { flex: 1; min-height: var(--touch); border-radius: 12px; background: transparent; color: var(--text-muted); font-weight: 700; } .theme-btn.active { background: var(--ind); color: #fff; }
.settings-version { text-align: center; font-size: 11px; color: var(--text-muted); opacity: 0.5; margin: var(--sp-2) 0 var(--sp-5); } .settings-toggle { justify-content: space-between; } .settings-hint { display: block; font-size: var(--fs-meta); color: var(--text-muted); margin-top: 1px; } .german-ui-label-group { display: flex; flex-direction: column; flex: 1; min-width: 0; } .toggle-switch { flex-shrink: 0; } .settings-row-disabled { opacity: 0.55; pointer-events: none; } .toggle-switch { position: relative; width: 42px; height: 24px; } .toggle-switch input { position: absolute; opacity: 0; } .toggle-slider { position: absolute; inset: 0; border-radius: 999px; background: var(--sur2); border: 1px solid var(--border); } .toggle-slider::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: var(--sla); transition: transform 0.2s; } .toggle-switch input:checked + .toggle-slider { background: var(--ind); border-color: var(--ind); } .toggle-switch input:checked + .toggle-slider::after { transform: translateX(18px); background: #fff; } .toggle-switch input:disabled + .toggle-slider { background: var(--sur2); border-color: var(--border); } .toggle-switch input:disabled:checked + .toggle-slider { background: var(--sla); border-color: var(--sla); } .toggle-switch input:disabled + .toggle-slider::after, .toggle-switch input:disabled:checked + .toggle-slider::after { background: var(--bg); }
/* Advanced settings */
.settings-advanced-section { padding: 0; margin-top: var(--sp-5); }
.settings-advanced-hdr { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-radius: 16px; background: var(--ind-tint); border: 1.5px solid var(--ind-border); font-weight: 700; color: var(--text); cursor: pointer; transition: background 0.15s; }
.settings-advanced-hdr:active { background: rgba(53,92,125,0.20); }
.settings-advanced-hdr-left { display: flex; align-items: center; gap: var(--sp-3); }
.settings-advanced-hdr-right { display: flex; align-items: center; gap: var(--sp-2); }
.settings-advanced-icon { font-size: 18px; line-height: 1; opacity: 0.8; }
.settings-advanced-title { font-size: var(--fs-body); color: var(--ind-text); }
.settings-advanced-chevron { color: var(--ind); opacity: 0.7; }
/* ── Premium badge — crown + label, warm gold gradient pill ── */
.premium-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; font-weight: 700; white-space: nowrap; vertical-align: middle; background: linear-gradient(120deg, #C88A3A 0%, #E0A94A 52%, #B97830 100%); color: #fff; line-height: 1; letter-spacing: 0.01em; }
.premium-badge-sm { font-size: 11px; padding: 3px 9px 3px 6px; }
.premium-badge-lg { font-size: 13px; padding: 5px 13px 5px 9px; }
.premium-badge-ico { width: 12px; height: 12px; flex-shrink: 0; opacity: 0.92; }
.premium-badge-lg .premium-badge-ico { width: 15px; height: 15px; }
.settings-adv-premium-badge { font-size: 11px; font-weight: 700; color: var(--cop-text); background: var(--cop-tint); border: 1px solid rgba(185,134,85,0.35); border-radius: 999px; padding: 3px 10px; }
.settings-advanced-body { margin-top: var(--sp-3); border: 1px solid var(--border); border-radius: 16px; background: var(--sur); overflow: hidden; }
.settings-adv-locked { opacity: 0.5; cursor: pointer; }
.settings-adv-locked * { pointer-events: none; }
.settings-adv-group { padding: var(--sp-4) var(--sp-4) var(--sp-3); }
.settings-adv-group + .settings-adv-group { border-top: 1px solid var(--border); }
.settings-adv-group-label { font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: var(--sp-3); }
.settings-adv-rows { display: grid; gap: var(--sp-2); }
.settings-segmented-row { justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.session-size-segmented { flex-shrink: 0; }
/* Paywall sheet */
.pw-close { position: absolute; top: var(--sp-4); right: var(--sp-4); } .pw-sheet { position: relative; }

/* Generic bottom sheet overlay (LockedContentSheet, ChapterBrowser) */
.sheet-overlay { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); animation: overlay-in 0.22s ease; }
@keyframes overlay-in { from { background: transparent; } }
.sheet-panel { position: relative; width: min(100%, 520px); max-height: 85dvh; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-bottom: 0; border-radius: 28px 28px 0 0; padding: var(--sp-6) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom)); box-shadow: var(--sh-sheet); display: flex; flex-direction: column; gap: var(--sp-4); animation: sheet-in 0.28s cubic-bezier(0.34, 1.1, 0.64, 1); }
@keyframes sheet-in { from { transform: translateY(100%); opacity: 0; } }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.sheet-header-title { font-size: var(--fs-body); font-weight: 600; color: var(--text); }
.sheet-close-btn { position: absolute; top: var(--sp-4); right: var(--sp-4); width: var(--touch); height: var(--touch); border-radius: 999px; padding: 0; display: flex; align-items: center; justify-content: center; }
.sheet-title { font-size: var(--fs-h2); color: var(--text); font-weight: 700; padding-right: var(--touch); }
.sheet-body { font-size: var(--fs-body); color: var(--text-muted); line-height: 1.5; }
.sheet-body-text { font-size: var(--fs-body); color: var(--text-muted); line-height: 1.5; margin: var(--sp-4) 0; }
.sheet-actions { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Locked content sheet */
.locked-sheet .sheet-actions { padding-top: var(--sp-2); }

/* Chapter detail sheet */
.chapter-detail-sheet { padding-top: calc(var(--sp-6) + 8px); gap: var(--sp-4); }
.cds-level-label { font-size: var(--fs-meta); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 2px; }
.cds-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); line-height: 1.2; }
.cds-stats-row { display: flex; gap: var(--sp-3); }
.cds-stat { flex: 1; text-align: center; }
.cds-stat-num { display: block; font-size: var(--fs-h2); font-weight: 700; color: var(--text); }
.cds-stat-lbl { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.cds-progress-bar { height: 6px; border-radius: 99px; background: var(--sur2); overflow: hidden; margin: 0; }
.cds-actions { display: flex; flex-direction: column; gap: var(--sp-3); }
.cds-listen-btn { display: flex; align-items: center; gap: var(--sp-2); }
.cds-listen-btn .ico { width: 18px; height: 18px; }
.cds-extra-link { color: var(--text-muted); background: transparent; border: 1.5px dashed var(--border); font-weight: 600; }
.cds-exam-row { display: flex; flex-direction: column; gap: var(--sp-1); }
.cds-exam-btn { position: relative; }
.cds-exam-locked { opacity: 0.45; }
.cds-exam-reason { font-size: var(--fs-meta); color: var(--text-muted); text-align: center; margin: 0; }
.cds-premium-badge { font-size: 10px; font-weight: 700; background: var(--cop); color: #fff; border-radius: 5px; padding: 1px 5px; margin-left: var(--sp-2); vertical-align: middle; }
/* ChapterBrowser detail chevron */
/* Chapter browser sheet */
.chapter-browser-sheet { padding-top: calc(var(--sp-6) + 8px); }
.ch-browser-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
/* each row: single full-width button → opens detail sheet */
.ch-browser-row {
  width: 100%; display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4); border-radius: 12px;
  background: var(--sur); border: 0; border-left: 3px solid var(--tile-accent, var(--ind));
  cursor: pointer; text-align: left;
  transition: background 0.12s;
}
.ch-browser-row:active { background: var(--sur2); }
.ch-browser-row.accent-tea { --tile-accent: var(--tea); }
.ch-browser-row.accent-ind { --tile-accent: var(--ind); }
.ch-browser-row.accent-och { --tile-accent: var(--och); }
.ch-browser-row.accent-cop { --tile-accent: var(--cop); }
.ch-browser-row.accent-ros { --tile-accent: var(--ros, var(--cop)); }
.ch-browser-row.accent-sla { --tile-accent: var(--sla, var(--ind)); }
.ch-br-icon { flex-shrink: 0; }
.ch-br-icon .home-picto { width: 36px; height: 36px; border-radius: 9px; }
.ch-br-icon .home-picto .ico { width: 20px; height: 20px; }
.ch-br-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ch-br-name { font-size: var(--fs-label); font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.ch-br-bar { height: 3px; border-radius: 99px; background: var(--sur2); overflow: hidden; }
.ch-br-fill { display: block; height: 100%; border-radius: 99px; background: var(--tile-accent, var(--ind)); }
.ch-br-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ch-br-due { font-size: 11px; font-weight: 700; color: var(--uri); line-height: 1; }
.ch-br-pct { font-size: 11px; color: var(--text-muted); line-height: 1; }
.ch-br-arrow { width: 14px; height: 14px; color: var(--text-muted); margin-top: 2px; }

/* Browse all chapters link */
.browse-all-link { display: block; width: 100%; padding: var(--sp-3) 0; text-align: center; font-size: 13px; color: var(--cop); font-weight: 600; background: none; border: none; cursor: pointer; }
.browse-all-link:hover { text-decoration: underline; }
/* Hero */
.pw-hero { text-align: center; margin-bottom: var(--sp-4); display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.pw-icon { display: flex; justify-content: center; margin-bottom: var(--sp-3); }
.pw-icon .home-picto { width: 54px; height: 54px; border-radius: 18px; }
.pw-icon .home-picto .ico { width: 30px; height: 30px; }
.pw-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); line-height: 1.2; margin-bottom: var(--sp-2); }
.pw-subtitle { color: var(--text-muted); font-size: var(--fs-label); line-height: 1.5; }
/* Plan grid */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--sp-4); }
.plan-card { background: var(--sur); border: 2.5px solid transparent; border-radius: 20px; padding: 16px 13px; position: relative; cursor: pointer; transition: transform 0.18s var(--ease-out); }
.plan-card:active { transform: scale(0.97); }
.plan-card.pl-featured { background: var(--ind); color: #fff; }
.pl-best { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--cop); color: #fff; font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.07em; padding: 3px 11px; border-radius: 99px; white-space: nowrap; text-transform: uppercase; }
.plan-type { font-size: var(--fs-micro); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; opacity: 0.7; }
.plan-price { font-size: var(--fs-h1); font-weight: 700; }
.plan-period { font-size: var(--fs-meta); opacity: 0.65; margin-top: 2px; }
.plan-note { font-size: var(--fs-meta); margin-top: 6px; opacity: 0.7; }
/* Features list */
.feat-list { margin-bottom: var(--sp-4); }
.feat-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: var(--fs-label); color: var(--text); border-bottom: 1px solid var(--border); }
.feat-item:last-child { border-bottom: none; }
.feat-check { font-size: var(--fs-body); color: var(--tea); flex-shrink: 0; font-weight: 700; }
/* Footer */
.pw-footer { text-align: center; margin-top: var(--sp-4); display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.pw-restore-link { min-height: var(--touch); display: inline-flex; align-items: center; background: transparent; color: var(--text-muted); text-decoration: underline; font-size: var(--fs-meta); }
.pw-legal { font-size: var(--fs-micro); color: var(--text-muted); opacity: 0.6; }
.guide-panel { max-height: 80vh; overflow: auto; } .guide-section { margin-bottom: var(--sp-4); } .guide-heading { color: var(--text); font-weight: 700; margin-bottom: var(--sp-1); } .guide-body { color: var(--text-muted); line-height: 1.6; }
.ad-slot { min-height: 88px; display: grid; place-items: center; margin: var(--sp-4) 0; border: 1px dashed var(--border); border-radius: 16px; background: var(--sur); color: var(--text-muted); } .ad-slot-label { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: 0.08em; }
.loader { color: var(--text-muted); text-align: center; padding: var(--sp-8) var(--sp-4); } .loader-spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--ind); border-radius: 50%; margin: 0 auto var(--sp-3); animation: spin 0.8s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .app-shell { padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-4) calc(var(--sp-7) + env(safe-area-inset-bottom)); }
  .learn-shell { padding: 0; }
  .retora-home-page { padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-5) 0; }
  .lang-cards, .choice-options, .retora-chapter-actions { grid-template-columns: 1fr; }
  .retora-category-grid { grid-template-columns: 1fr 1fr; }
  .retora-chapter-list { grid-template-columns: 1fr; }
  .retora-chapter-card { grid-template-columns: 48px minmax(0,1fr); padding: var(--sp-4); }
  .card-scene { height: 520px; }
  .card-area .card-scene { height: auto; }
  .cf-inner, .cb-inner { padding: 20px 18px 16px; }
  .card-word { font-size: 34px; }
  .choice-options { grid-template-columns: 1fr; }
  .cloze-input-row { flex-direction: column; }
  .plan-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) { .retora-category-grid { grid-template-columns: 1fr; } }
/* Tablet / wide — left nav rail + denser content (mock-aligned) */
@media (min-width: 768px) {
  .retora-home-page {
    width: min(100%, 960px);
    height: 100dvh;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    column-gap: var(--sp-5);
    grid-template-rows: auto 1fr;
    padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-5) 0 0;
    overflow: hidden;
  }

  .retora-bottom-nav {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    padding: var(--sp-4) 10px calc(var(--sp-3) + env(safe-area-inset-bottom));
    border-top: none;
    border-right: 1px solid var(--border);
    border-radius: 0 18px 18px 0;
    background: linear-gradient(180deg, var(--sur) 0%, color-mix(in srgb, var(--bg) 90%, var(--sur)) 100%);
    box-shadow: 2px 0 12px rgba(44, 44, 44, 0.04);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .retora-bottom-nav .bn-item {
    flex: 0 0 auto;
    min-height: 72px;
    padding: 10px 6px;
    border-radius: 14px;
    transition: background 0.15s var(--ease-out);
  }
  .retora-bottom-nav .bn-item:hover { background: color-mix(in srgb, var(--ind) 10%, transparent); }
  .retora-bottom-nav .bn-active {
    background: var(--ind-tint);
    color: var(--ind);
    box-shadow: inset 0 0 0 1px var(--ind-border);
  }
  .retora-bottom-nav .bn-icon .home-picto { width: 34px; height: 34px; border-radius: 12px; }
  .retora-bottom-nav .bn-icon .home-picto .ico { width: 18px; height: 18px; }
  .retora-bottom-nav .bn-label { font-size: 10px; line-height: 1.2; letter-spacing: 0.02em; }

  .retora-home-page > .tab-page-header {
    grid-column: 2;
    grid-row: 1;
    padding-bottom: var(--sp-2);
  }

  .retora-home-page > .retora-home-body {
    grid-column: 2;
    grid-row: 1 / -1;
    min-height: 0;
  }

  .retora-home-page:has(> .tab-page-header) > .retora-home-body {
    grid-row: 2;
  }

  /* Home: workload + streak side-by-side, denser chapter grid */
  .retora-home-page:has(.home-greeting) > .retora-home-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.9fr);
    gap: var(--sp-4);
    align-content: start;
    padding: var(--sp-4) 0 var(--sp-6);
  }
  .retora-home-page:has(.home-greeting) .retora-home-header,
  .retora-home-page:has(.home-greeting) .retora-home-section,
  .retora-home-page:has(.home-greeting) .retora-level-strip,
  .retora-home-page:has(.home-greeting) .ad-slot,
  .retora-home-page:has(.home-greeting) .start-here-banner {
    grid-column: 1 / -1;
  }
  .retora-home-page:has(.home-greeting) .retora-due-banner:not(.start-here-banner) {
    grid-column: 1;
    align-self: start;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    padding: var(--sp-6);
  }
  .retora-home-page:has(.home-greeting) .retora-due-banner .due-num { font-size: 40px; }
  .retora-home-page:has(.home-greeting) .retora-streak-card {
    grid-column: 2;
    align-self: start;
    margin-bottom: 0;
  }
  .retora-home-page:has(.home-greeting) .retora-category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  /* Stats: two-column sections */
  .retora-home-page:has(.sdb-streak-hero) > .retora-home-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
    align-content: start;
    padding-bottom: var(--sp-6);
  }
  .retora-home-page:has(.sdb-streak-hero) .sdb-streak-hero,
  .retora-home-page:has(.sdb-streak-hero) .sdb-weak-row,
  .retora-home-page:has(.sdb-streak-hero) .sdb-no-leeches,
  .retora-home-page:has(.sdb-streak-hero) .stats-dash-actions {
    grid-column: 1 / -1;
  }

  /* Settings: two-column sections, full-width profile + danger zone */
  .retora-home-page:has(.settings-page-body) > .retora-home-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3) var(--sp-4);
    align-content: start;
    padding-bottom: var(--sp-6);
  }
  .retora-home-page:has(.settings-page-body) .profile-card,
  .retora-home-page:has(.settings-page-body) .settings-lang-explainer,
  .retora-home-page:has(.settings-page-body) .settings-version,
  .retora-home-page:has(.settings-page-body) .settings-controls,
  .retora-home-page:has(.settings-page-body) .settings-section.theme-section,
  .retora-home-page:has(.settings-page-body) .settings-advanced-section {
    grid-column: 1 / -1;
  }
  .retora-home-page:has(.settings-page-body) .settings-section {
    margin-bottom: 0;
  }

  .retora-chapter-list { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
  .stats-dash-page { width: min(100%, 960px); }
  .cloze-input-row .btn-primary { width: auto; flex-shrink: 0; }
}

@media (min-width: 900px) {
  .retora-home-page:has(.home-greeting) .retora-category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .flashcard-shell { width: min(100%, 460px); }
  .card-scene { height: 590px; }
  .card-area .card-scene { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .card-3d { transform-style: flat; }
  .card-3d.flipped { transform: none; }
  .card-back { transform: none; opacity: 0; pointer-events: none; }
  .card-3d.flipped .card-front { opacity: 0; pointer-events: none; }
  .card-3d.flipped .card-back { opacity: 1; pointer-events: auto; }
}

/* ── Phrases page (standalone, unused after merge — kept for #phrases redirect) */
.retora-phrase-page { display: flex; flex-direction: column; min-height: 100%; }
.phrase-page-header { display: flex; align-items: center; gap: var(--sp-3); padding: calc(var(--sp-4) + env(safe-area-inset-top)) var(--sp-5) var(--sp-3); }
.phrase-back-btn, .phrase-settings-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--sur); border: 1px solid var(--border); color: var(--text); flex-shrink: 0; }
.phrase-back-btn .ico { transform: rotate(90deg); }
.phrase-header-title { flex: 1; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-h2); font-weight: 700; color: var(--text); }
.phrase-header-icon .ico { width: 22px; height: 22px; color: var(--ind); }
.phrase-subtitle { font-size: var(--fs-label); color: var(--text-muted); padding: 0 var(--sp-5) var(--sp-4); }
.phrase-cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); padding: 0 var(--sp-5) var(--sp-6); }
.phrase-cat-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-4); border-radius: 16px; border: none; cursor: pointer; text-align: left; min-height: 120px; transition: opacity 0.15s, filter 0.15s; }
.phrase-cat-tile.locked { filter: saturate(0.4); }
.phrase-cat-icon { width: 44px; height: 44px; }
.phrase-cat-icon .home-picto { width: 100%; height: 100%; border-radius: 10px; }
.phrase-cat-name { font-size: var(--fs-label); font-weight: 700; color: #fff; line-height: 1.3; }
.phrase-cat-count { font-size: var(--fs-micro); color: rgba(255,255,255,0.75); }
.phrase-cat-lock { position: absolute; top: var(--sp-2); right: var(--sp-2); width: 20px; height: 20px; color: rgba(255,255,255,0.8); }
.phrase-cat-bar { position: absolute; bottom: var(--sp-3); left: var(--sp-4); right: var(--sp-4); height: 3px; background: rgba(255,255,255,0.3); border-radius: 2px; }
.phrase-cat-fill { display: block; height: 100%; background: rgba(255,255,255,0.9); border-radius: 2px; transition: width 0.3s; }

/* Phrases tile accent backgrounds (matches CHAPTER_COLORS palette) */
.phrase-cat-tile.accent-ind { background: var(--ind); }
.phrase-cat-tile.accent-tea { background: var(--tea); }
.phrase-cat-tile.accent-cop { background: var(--cop); }
.phrase-cat-tile.accent-och { background: var(--och); }
.phrase-cat-tile.accent-ros { background: var(--ros); }
.phrase-cat-tile.accent-sla { background: var(--sla); }

/* Stats dashboard */
.stats-dash-shell { background: var(--bg); }
.stats-dash-page { width: min(100%, 520px); margin: 0 auto; padding: 0 0 calc(var(--sp-8) + env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 100dvh; }
.stats-dash-title { font-size: var(--fs-h2); font-weight: 700; color: var(--text); flex: 1; }
.sdb-content { padding: 0 var(--sp-5); }

/* Streak hero */
.sdb-streak-hero { background: var(--ind-tint); border: 1px solid var(--ind-border); border-radius: 20px; padding: var(--sp-5); margin-bottom: var(--sp-4); }
.sdb-streak-main { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.sdb-streak-num { font-size: 48px; font-weight: 800; color: var(--ind-text); line-height: 1; }
.sdb-streak-unit { font-size: var(--fs-body); font-weight: 600; color: var(--ind-text); opacity: 0.75; }
.sdb-freeze-chip { font-size: 12px; font-weight: 600; color: var(--ind-text); background: rgba(62,92,118,0.12); border-radius: 20px; padding: 2px 8px; margin-left: var(--sp-2); }
.sdb-streak-meta { margin-top: var(--sp-2); font-size: var(--fs-meta); color: var(--text-muted); }

/* Section layout */
.sdb-section { background: var(--sur); border: 1px solid var(--border); border-radius: 18px; padding: var(--sp-4); margin-bottom: var(--sp-3); }
.sdb-section-locked { opacity: 0.7; }
.sdb-section-title { font-size: var(--fs-meta); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--sp-3); display: flex; align-items: center; gap: var(--sp-2); }
.sdb-premium-tag { font-size: 11px; background: var(--cop); color: #fff; border-radius: 10px; padding: 1px 7px; text-transform: none; letter-spacing: 0; font-weight: 700; }
.sdb-retention-badge { font-size: 12px; font-weight: 700; color: var(--tea); text-transform: none; letter-spacing: 0; margin-left: auto; }

/* Mastery bars */
.sdb-mastery-row { display: grid; grid-template-columns: 32px 1fr 52px; align-items: center; gap: var(--sp-3); margin-bottom: 10px; }
.sdb-mastery-row:last-child { margin-bottom: 0; }
.sdb-mastery-label { font-size: var(--fs-meta); font-weight: 700; color: var(--text); }
.sdb-mastery-track { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.sdb-mastery-fill { height: 100%; background: var(--tea); border-radius: 4px; transition: width 0.4s ease; }
.sdb-mastery-count { font-size: 12px; color: var(--text-muted); text-align: right; }
.sdb-mastery-total { font-size: 0.85em; opacity: 0.6; }

/* Today's progress */
.sdb-today-row { display: flex; flex-direction: column; gap: var(--sp-2); }
.sdb-today-nums { display: flex; align-items: baseline; gap: 4px; }
.sdb-today-done { font-size: var(--fs-h2); font-weight: 800; color: var(--text); line-height: 1; }
.sdb-today-met { color: var(--tea); }
.sdb-today-sep { font-size: var(--fs-body); color: var(--text-muted); }
.sdb-today-goal { font-size: var(--fs-meta); color: var(--text-muted); }
.sdb-today-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.sdb-today-fill { height: 100%; background: var(--ind); border-radius: 4px; transition: width 0.4s ease; }
.sdb-today-fill-met { background: var(--tea); }

/* Activity heatmap */
.sdb-heatmap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.sdb-heatmap-blur { filter: blur(3px); pointer-events: none; user-select: none; }
.sdb-heat-cell { aspect-ratio: 1; border-radius: 4px; background: var(--border); }
.sdb-heat-cell[data-level="1"] { background: rgba(90,139,139,0.28); }
.sdb-heat-cell[data-level="2"] { background: rgba(90,139,139,0.58); }
.sdb-heat-cell[data-level="3"] { background: var(--tea); }

/* Weak words row */
.sdb-weak-row { display: flex; align-items: center; justify-content: space-between; background: rgba(155,58,42,0.06); border: 1px solid rgba(155,58,42,0.2); border-radius: 14px; padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); text-align: left; width: 100%; cursor: pointer; }
.sdb-weak-row:active { opacity: 0.75; }
.sdb-weak-text { display: flex; align-items: baseline; gap: var(--sp-2); }
.sdb-weak-count { font-size: var(--fs-h2); font-weight: 800; color: var(--uri); line-height: 1; }
.sdb-weak-lbl { font-size: var(--fs-meta); color: var(--text-muted); font-weight: 600; }
.sdb-weak-action { display: flex; align-items: center; gap: 4px; font-size: var(--fs-meta); color: var(--text-muted); font-weight: 600; }
.sdb-weak-arrow { width: 16px; height: 16px; }
.sdb-no-leeches { text-align: center; color: var(--text-muted); font-size: var(--fs-meta); padding: var(--sp-3) 0; }

.stats-dash-actions { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: auto; padding-top: var(--sp-4); }
.sdb-on-track { text-align: center; color: var(--text-muted); font-size: var(--fs-body); padding: var(--sp-4) 0; }

/* Memory health bar */
.sdb-health-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; gap: 2px; margin-bottom: var(--sp-3); }
.sdb-health-seg { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.sdb-health-fragile { background: rgba(155,58,42,0.65); }
.sdb-health-growing { background: rgba(166,129,93,0.75); }
.sdb-health-strong  { background: rgba(90,139,139,0.75); }
.sdb-health-mature  { background: var(--ind); }
.sdb-health-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.sdb-health-legend-item { display: flex; align-items: center; gap: 6px; }
.sdb-health-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.sdb-health-legend-label { font-size: 12px; color: var(--text-muted); flex: 1; }
.sdb-health-legend-count { font-size: 12px; font-weight: 700; color: var(--text); }

/* Review forecast */
.sdb-forecast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; align-items: end; }
.sdb-forecast-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sdb-forecast-bar-wrap { height: 64px; display: flex; align-items: flex-end; }
.sdb-forecast-bar { width: 100%; min-width: 18px; max-width: 36px; border-radius: 5px 5px 2px 2px; background: var(--border); transition: height 0.4s ease; }
.sdb-forecast-today { background: var(--ind); }
.sdb-forecast-count { font-size: 11px; font-weight: 700; color: var(--text-muted); min-height: 14px; }
.sdb-forecast-day { font-size: 10px; color: var(--text-muted); text-align: center; }
.sdb-forecast-day-today { color: var(--ind); font-weight: 700; }

/* Weak words screen */
.weak-empty { text-align: center; color: var(--text-muted); padding: var(--sp-8) var(--sp-4); font-size: var(--fs-body); }
.weak-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.weak-row { display: flex; align-items: center; gap: var(--sp-3); padding: 12px var(--sp-4); background: var(--sur); border-radius: 12px; }
.weak-german { flex: 1; font-weight: 700; font-size: var(--fs-body); color: var(--text); }
.weak-translation { flex: 1; font-size: var(--fs-label); color: var(--text-muted); }
.weak-badge { font-size: 12px; font-weight: 700; color: var(--uri); background: rgba(155,58,42,0.1); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }