﻿/* ===================== FONT STACK (no Google Fonts) ===================== */
/* Syne → font geometrico display, Literata → serif elegante */
@font-face {
  font-family: 'Syne';
  src: local('Syne'), local('Trebuchet MS'), local('Gill Sans MT'), local('Century Gothic');
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: local('Literata'), local('Georgia'), local('Cambria'), local('Times New Roman');
  font-display: swap;
}

/* ===================== THEME VARIABLES ===================== */
:root {
  --font-display: 'Syne', 'Trebuchet MS', 'Gill Sans MT', 'Century Gothic', Arial, sans-serif;
  --font-body: 'Literata', 'Georgia', 'Cambria', 'Times New Roman', serif;
  --bg: #f4f0e6;
  --surface: #fdfaf3;
  --surface2: #f0ebde;
  --ink: #1a1714;
  --ink2: #4a4540;
  --ink3: #8a8070;
  --border: rgba(26,23,20,0.1);
  --border2: rgba(26,23,20,0.06);
  --gold: #c8860a;
  --gold-light: #f0b429;
  --gold-bg: rgba(200,134,10,0.1);
  --green: #1e6b47;
  --green-light: #3daa74;
  --green-bg: rgba(61,170,116,0.12);
  --red: #b83215;
  --red-bg: rgba(184,50,21,0.1);
  --blue: #1a4e8a;
  --blue-light: #4a8fd6;
  --blue-bg: rgba(74,143,214,0.1);
  --shadow-sm: 0 2px 8px rgba(26,23,20,0.06);
  --shadow: 0 4px 20px rgba(26,23,20,0.08);
  --shadow-lg: 0 8px 40px rgba(26,23,20,0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg: #111009;
  --surface: #1c1a14;
  --surface2: #252218;
  --ink: #f4f0e6;
  --ink2: #c4bfb0;
  --ink3: #706a5a;
  --border: rgba(244,240,230,0.1);
  --border2: rgba(244,240,230,0.05);
  --gold: #f0b429;
  --gold-light: #f7cc6a;
  --gold-bg: rgba(240,180,41,0.1);
  --green: #3daa74;
  --green-light: #5dcc90;
  --green-bg: rgba(93,204,144,0.1);
  --red: #e05a3a;
  --red-bg: rgba(224,90,58,0.1);
  --blue: #4a8fd6;
  --blue-light: #7ab4f0;
  --blue-bg: rgba(122,180,240,0.1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.45);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* SCREENS */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ========== AUTH SCREEN ========== */
#auth-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: var(--bg);
}
#auth-screen.active { display: flex; flex-direction: column; }

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-align: center;
}
.auth-logo span { color: var(--gold); }
.auth-tagline { font-size: 0.78rem; color: var(--ink3); margin-bottom: 28px; letter-spacing: 0.04em; text-align: center; }
.auth-legal { display: flex; gap: 20px; justify-content: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border2); }
.auth-legal a { font-size: 0.7rem; color: var(--ink3); text-decoration: none; }
.auth-legal a:hover { color: var(--gold); }

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink3);
  transition: all 0.2s;
}
.auth-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.hidden { display: none; }

.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink3); }
.field-input {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.field-input:focus { border-color: var(--gold); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.field-row .field-group { min-width: 0; overflow: hidden; }
.field-row .field-input { width: 100%; min-width: 0; }

.btn-auth {
  padding: 13px;
  background: var(--ink);
  color: var(--gold-light);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s;
  margin-top: 4px;
}
.btn-auth:hover { opacity: 0.88; transform: translateY(-1px); }

.auth-msg {
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: 8px;
  display: none;
  margin-top: 4px;
}
.auth-msg.error { background: var(--red-bg); color: var(--red); display: block; }
.auth-msg.success { background: var(--green-bg); color: var(--green); display: block; }

/* ========== MAIN APP ========== */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

@media(max-width:768px) {
  /* Su mobile: niente grid, layout lineare — fix sidebar visibile */
  .app-layout { display: block !important; width: 100%; }
  .sidebar { display: none !important; }
  .mobile-nav { display: flex !important; }
}

/* SIDEBAR */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  padding: 0 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar-logo span { color: var(--gold); }

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  cursor: pointer;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--ink);
  color: var(--gold-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}
.user-name { font-family: var(--font-display); font-size: 0.82rem; font-weight: 700; line-height: 1.2; }
.user-level { font-size: 0.7rem; color: var(--gold); font-weight: 600; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--ink2);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--surface2); color: var(--ink); }
.nav-item.active { background: var(--ink); color: var(--gold-light); }
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; }

.sidebar-spacer { flex: 1; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
}
.theme-toggle-label { font-family: var(--font-display); font-size: 0.78rem; font-weight: 600; color: var(--ink2); }
.toggle-switch {
  width: 42px; height: 24px;
  background: var(--border);
  border-radius: 99px;
  position: relative;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}
.toggle-switch.on { background: var(--gold); }
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.2s;
  pointer-events: none;
}
.toggle-switch.on .toggle-thumb { transform: translateX(18px); }

/* MOBILE NAV */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
}
.mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 6px 4px;
  color: var(--ink3);
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  transition: color 0.2s;
}
.mob-nav-item .mn-icon { font-size: 1.2rem; }
.mob-nav-item.active { color: var(--gold); }

/* MAIN CONTENT */
.main-content {
  padding: 32px 28px;
  max-width: 900px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

@media(max-width:768px) {
  .main-content { padding: 16px 14px calc(200px + env(safe-area-inset-bottom)); width: 100%; box-sizing: border-box; }
}

/* PANELS */
.panel { display: none; }
.panel.active { display: block; animation: fadeUp 0.25s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* XP BAR */
.xp-bar-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.xp-level-badge {
  background: var(--ink);
  color: var(--gold-light);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: 0.05em;
}
.xp-bar-info { flex: 1; }
.xp-bar-labels { display: flex; justify-content: space-between; margin-bottom: 5px; }
.xp-label { font-family: var(--font-display); font-size: 0.72rem; color: var(--ink3); font-weight: 600; }
.xp-track { height: 7px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 99px; transition: width 0.7s cubic-bezier(.34,1.56,.64,1); }
.xp-total { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; white-space: nowrap; }

/* STAT CARDS */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
@media(max-width:600px) { .stats-row { grid-template-columns: 1fr 1fr; } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.sc-icon { font-size: 1.3rem; margin-bottom: 6px; }
.sc-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1; }
.sc-label { font-size: 0.72rem; color: var(--ink3); margin-top: 3px; }

/* SECTION HEADER */
.sec-h {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

/* EXERCISE */
.ex-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 12px;
}
.tag-v { background: var(--gold-bg); color: var(--gold); }
.tag-g { background: var(--blue-bg); color: var(--blue); }
.tag-r { background: var(--red-bg); color: var(--red); }
.tag-l { background: var(--green-bg); color: var(--green); }

.ex-q {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.4;
}
.ex-context {
  font-size: 0.85rem;
  color: var(--ink3);
  font-style: italic;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  border-left: 3px solid var(--gold);
}

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media(max-width:480px) { .opts { grid-template-columns: 1fr; } }

.opt-btn {
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: all 0.15s;
  line-height: 1.4;
}
.opt-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-bg); }
.opt-btn.correct { border-color: var(--green-light); background: var(--green-bg); color: var(--green); font-weight: 600; }
.opt-btn.wrong { border-color: var(--red); background: var(--red-bg); color: var(--red); }

.feedback {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.6;
  display: none;
  margin-top: 8px;
}
.feedback.show { display: block; }
.feedback.ok { background: var(--green-bg); border-left: 3px solid var(--green-light); }
.feedback.no { background: var(--red-bg); border-left: 3px solid var(--red); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-dark { background: var(--ink); color: var(--gold-light); }
.btn-gold { background: var(--gold); color: #fff; font-weight: 700; }
.btn-outline { background: transparent; border: 1.5px solid var(--ink3); color: var(--ink2); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.btn-outline:disabled { opacity: 0.35; cursor: default; }
/* Nav esercizi in cima alla card */
.ex-nav-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.ex-counter { font-family:var(--font-display); font-size:0.78rem; font-weight:700; color:var(--ink3); }
.ex-nav-btn { background:var(--surface2); color:var(--ink); border:1.5px solid var(--border); }
.ex-nav-btn:hover:not(:disabled) { background:var(--gold-bg); border-color:var(--gold); color:var(--gold); }
.ex-nav-btn:disabled { opacity:0.3; cursor:default; }
.btn-sm { padding: 7px 14px; font-size: 0.75rem; }

/* FILL BLANK */
.fill-sentence {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 2.2;
}
.fill-inp {
  border: none;
  border-bottom: 2.5px solid var(--gold);
  background: transparent;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  width: 110px;
  outline: none;
  padding: 2px 6px;
  transition: border-color 0.2s;
}
.fill-inp:focus { border-color: var(--gold-light); }
.fill-inp.ok { border-color: var(--green-light); color: var(--green); }
.fill-inp.no { border-color: var(--red); color: var(--red); }

/* VOCAB TABLE */
.vocab-search {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.vocab-search:focus { border-color: var(--gold); }

.vocab-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-btn {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink2);
  transition: all 0.15s;
}
.cat-btn.active { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }

.vocab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media(max-width:500px) { .vocab-grid { grid-template-columns: 1fr; } }

.vword {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s;
}
.vword:hover { border-color: var(--gold); transform: translateY(-1px); }
.vw-en { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; }
.vw-it { font-size: 0.78rem; color: var(--ink3); margin-top: 2px; }
.vw-cat { font-size: 0.6rem; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; }
.spk-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gold-bg);
  color: var(--gold);
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.spk-btn:hover { background: var(--gold); color: white; transform: scale(1.1); }

/* GRAMMAR LESSON */
.lesson-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.lesson-header {
  padding: 14px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.lesson-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; }
.lesson-body { padding: 20px; display: none; }
.lesson-body.open { display: block; }
.rule-box {
  background: var(--gold-bg);
  border: 1px solid rgba(200,134,10,0.2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  line-height: 1.7;
}
.rule-box strong { font-family: var(--font-display); }
.example-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.ex-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.85rem;
}
.ex-en { font-style: italic; color: var(--blue); }
.ex-it { color: var(--ink3); }

/* DIALOGUE */
.dial-scene {
  font-size: 0.7rem;
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 16px;
}
.bubble-wrap { margin-bottom: 12px; }
.bubble-lbl { font-size: 0.63rem; font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink3); margin-bottom: 4px; }
.bubble {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 75%;
}
.bubble-a { background: var(--ink); color: var(--gold-light); border-bottom-left-radius: 4px; }
.bubble-b { background: var(--surface2); color: var(--ink); border-bottom-right-radius: 4px; float: right; }
.clearfix::after { content:''; display:table; clear:both; }

/* PROGRESS */
.prog-skill { margin-bottom: 16px; }
.prog-skill-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.prog-skill-name { font-family: var(--font-display); font-size: 0.82rem; font-weight: 700; }
.prog-skill-pct { font-size: 0.75rem; color: var(--ink3); }
.prog-track { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(.34,1.56,.64,1); }

.week-chart { display: flex; align-items: flex-end; gap: 6px; height: 70px; margin-bottom: 8px; }
.wc-bar { flex: 1; border-radius: 4px 4px 0 0; transition: height 0.4s; min-height: 3px; background: var(--gold); opacity: 0.4; }
.wc-bar.today { opacity: 1; }

.goal-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border2); }
.goal-icon { font-size: 1.2rem; }
.goal-info { flex: 1; }
.goal-title { font-family: var(--font-display); font-size: 0.82rem; font-weight: 700; }
.goal-sub { font-size: 0.72rem; color: var(--ink3); margin-top: 2px; }
.goal-pct { font-family: var(--font-display); font-size: 0.78rem; font-weight: 800; color: var(--gold); }

/* NOTIF */
.notif {
  position: fixed;
  top: 20px; right: 20px;
  background: var(--ink);
  color: var(--gold-light);
  padding: 12px 18px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  max-width: 260px;
}
.notif.show { transform: translateX(0); }

/* SAVE BTN — inline only (no floating overlay) */
.save-btn { display: none !important; } /* floating disabilitato — usa inline */
.save-btn-inline { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; padding:14px; background:var(--green); color:white; border:none; border-radius:var(--radius-sm); font-family:var(--font-display); font-size:0.88rem; font-weight:700; cursor:pointer; margin-top:12px; transition:all 0.2s; }
.save-btn-inline:hover { background:var(--green-light); }

/* XP RULES UI */
.xp-rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.xp-rule-label {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink2);
  flex: 1;
}
.xp-rule-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.xp-rule-input {
  width: 56px;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.xp-rule-input:focus { border-color: var(--gold); }
.xp-rule-unit {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink3);
  width: 20px;
}
@media(max-width: 480px) {
  .xp-rule-row { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* PROFILE */
.profile-section { margin-bottom: 28px; }
.profile-avatar-big {
  width: 72px; height: 72px;
  background: var(--ink);
  color: var(--gold-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 800;
  margin-bottom: 12px;
}
.profile-name-big { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; }
.profile-level-big { color: var(--gold); font-size: 0.85rem; font-weight: 600; margin-top: 4px; }

/* WORD OF DAY */
.wod {
  background: linear-gradient(135deg, var(--ink) 0%, #2a2418 100%);
  color: var(--gold-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.wod::after {
  content: '"';
  position: absolute; right: 16px; top: -24px;
  font-family: var(--font-body);
  font-size: 9rem; opacity: 0.08;
  color: var(--gold-light); line-height: 1;
}
.wod-label { font-family: var(--font-display); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.5; margin-bottom: 10px; }
.wod-word { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; line-height: 1; }
.wod-ph { font-size: 0.88rem; opacity: 0.5; margin: 6px 0; }
.wod-def { font-size: 0.9rem; opacity: 0.8; line-height: 1.5; margin-top: 10px; }
.wod-ex { font-size: 0.8rem; opacity: 0.5; margin-top: 6px; font-style: italic; }

/* PAGINATION */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink2);
  font-family: var(--font-display);
  font-size: 0.75rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.page-btn.active { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }
.page-btn:hover:not(.active) { border-color: var(--gold); }
.page-info { font-size: 0.75rem; color: var(--ink3); }

/* LOADING */
.loading-spinner { text-align: center; padding: 40px; color: var(--ink3); font-style: italic; }

/* ========== PRETEST SCREEN ========== */
#pretest-screen { display:none; align-items:center; justify-content:center; min-height:100vh; padding:24px; background:var(--bg); }
#pretest-screen.active { display:flex; }
.pretest-box { width:100%; max-width:520px; background:var(--surface); border:1px solid var(--border); border-radius:24px; padding:36px 32px; box-shadow:var(--shadow-lg); }
.pretest-intro { text-align:center; }
.pretest-intro .pt-emoji { font-size:3rem; margin-bottom:12px; }
.pretest-intro h2 { font-family:var(--font-display); font-size:1.5rem; font-weight:800; margin-bottom:8px; }
.pretest-intro p { color:var(--ink3); font-size:0.9rem; line-height:1.6; margin-bottom:24px; }
.pt-progress-row { display:flex; align-items:center; gap:12px; margin-bottom:24px; }
.pt-step-label { font-family:var(--font-display); font-size:0.72rem; font-weight:800; color:var(--gold); white-space:nowrap; }
.pt-track { flex:1; height:6px; background:var(--surface2); border-radius:99px; overflow:hidden; }
.pt-fill { height:100%; background:linear-gradient(90deg,var(--gold),var(--gold-light)); border-radius:99px; transition:width 0.5s ease; }
.pt-q { font-family:var(--font-display); font-size:1.05rem; font-weight:700; margin-bottom:8px; line-height:1.4; }
.pt-ctx { font-size:0.82rem; color:var(--ink3); font-style:italic; margin-bottom:14px; padding:8px 12px; background:var(--surface2); border-radius:8px; }
.pt-opts { display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
.pt-opt { padding:12px 16px; border:1.5px solid var(--border); background:var(--bg); border-radius:var(--radius-sm); font-family:var(--font-body); font-size:0.92rem; cursor:pointer; text-align:left; color:var(--ink); transition:all 0.15s; }
.pt-opt:hover:not(:disabled) { border-color:var(--gold); background:var(--gold-bg); }
.pt-opt.correct { border-color:var(--green-light); background:var(--green-bg); color:var(--green); font-weight:600; }
.pt-opt.wrong { border-color:var(--red); background:var(--red-bg); color:var(--red); }
.pt-fb { padding:10px 14px; border-radius:8px; font-size:0.82rem; margin-top:8px; display:none; line-height:1.5; }
.pt-fb.show { display:block; }
.pt-fb.ok { background:var(--green-bg); border-left:3px solid var(--green-light); }
.pt-fb.no { background:var(--red-bg); border-left:3px solid var(--red); }
.pt-result { text-align:center; padding:8px 0; }
.pt-score-big { font-family:var(--font-display); font-size:3.5rem; font-weight:800; line-height:1; color:var(--gold); }
.pt-level-assigned { font-family:var(--font-display); font-size:1.2rem; font-weight:800; margin:12px 0 6px; }
.pt-desc { font-size:0.88rem; color:var(--ink3); line-height:1.6; margin-bottom:20px; }

/* ========== FINAL EXAM MODAL ========== */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:500; align-items:center; justify-content:center; padding:20px; backdrop-filter:blur(4px); }
.modal-overlay.open { display:flex; }
.modal-box { background:var(--surface); border:1px solid var(--border); border-radius:24px; padding:32px 28px; max-width:540px; width:100%; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow-lg); animation:modalIn 0.3s cubic-bezier(.34,1.56,.64,1); }
@keyframes modalIn { from{opacity:0;transform:scale(0.92)} to{opacity:1;transform:scale(1)} }
.modal-title { font-family:var(--font-display); font-size:1.3rem; font-weight:800; margin-bottom:4px; }
.modal-sub { font-size:0.82rem; color:var(--ink3); margin-bottom:20px; }
.exam-q { font-family:var(--font-display); font-size:1rem; font-weight:700; margin-bottom:12px; line-height:1.4; }
.exam-opts { display:flex; flex-direction:column; gap:7px; margin-bottom:10px; }
.exam-opt { padding:10px 14px; border:1.5px solid var(--border); background:var(--bg); border-radius:8px; font-family:var(--font-body); font-size:0.88rem; cursor:pointer; text-align:left; color:var(--ink); transition:all 0.15s; }
.exam-opt:hover:not(:disabled) { border-color:var(--gold); background:var(--gold-bg); }
.exam-opt.correct { border-color:var(--green-light); background:var(--green-bg); color:var(--green); }
.exam-opt.wrong { border-color:var(--red); background:var(--red-bg); color:var(--red); }

/* XP PENALTY */
@keyframes penaltyFlash { 0%{background:rgba(184,50,21,0.18)} 100%{background:transparent} }
.penalty-flash { animation:penaltyFlash 0.7s ease; }

/* LEVEL UP BANNER */
.levelup-banner { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.75); z-index:999; align-items:center; justify-content:center; flex-direction:column; gap:16px; backdrop-filter:blur(6px); }
.levelup-banner.show { display:flex; animation:fadeIn 0.4s ease; }
.levelup-content { text-align:center; color:white; }
.levelup-emoji { font-size:4rem; margin-bottom:8px; }
.levelup-text { font-family:var(--font-display); font-size:2rem; font-weight:800; color:var(--gold-light); }
.levelup-sub { font-size:1rem; opacity:0.7; margin-top:6px; }
.levelup-cta { font-family:var(--font-display); font-size:0.85rem; font-weight:700; color:var(--gold-light); background:rgba(255,255,255,0.1); border:1px solid rgba(255,255,255,0.2); padding:10px 24px; border-radius:99px; cursor:pointer; margin-top:12px; transition:all 0.2s; }
.levelup-cta:hover { background:rgba(255,255,255,0.2); }

/* EXAM READY BANNER */
.exam-ready-card { background:linear-gradient(135deg,#1a1714 0%,#2d2618 100%); color:var(--gold-light); border-radius:var(--radius); padding:20px 22px; margin-bottom:20px; display:none; align-items:center; gap:14px; cursor:pointer; transition:transform 0.2s; }
.exam-ready-card:hover { transform:translateY(-2px); }
.exam-ready-card.visible { display:flex; animation:fadeUp 0.4s ease; }
.exam-ready-icon { font-size:2rem; flex-shrink:0; }
.exam-ready-text .ert-title { font-family:var(--font-display); font-size:1rem; font-weight:800; }
.exam-ready-text .ert-sub { font-size:0.78rem; opacity:0.6; margin-top:3px; }

/* ========== DASHBOARD v2 ========== */
.dash-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:20px; }
.dash-greeting { font-family:var(--font-display); font-size:1.4rem; font-weight:800; }
.dash-date { font-size:0.82rem; color:var(--ink3); margin-top:2px; }
.xp-total-hero { font-family:var(--font-display); font-size:1.6rem; font-weight:800; text-align:right; }
.xp-sublabel { font-size:0.7rem; color:var(--ink3); text-align:right; }

/* WoD v2 */
.wod-v2 { display:flex; gap:14px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; margin-bottom:20px; box-shadow:var(--shadow-sm); }
.wod-accent { width:3px; background:var(--gold); border-radius:99px; flex-shrink:0; }
.wod-body { flex:1; min-width:0; }
.wod-eyebrow { font-family:var(--font-display); font-size:0.65rem; font-weight:800; text-transform:uppercase; letter-spacing:0.1em; color:var(--ink3); margin-bottom:6px; }
.wod-word { font-family:var(--font-display); font-size:1.5rem; font-weight:800; }
.wod-ph { font-size:0.82rem; color:var(--ink3); margin:3px 0; }
.wod-def { font-size:0.88rem; line-height:1.5; margin-top:6px; }
.wod-ex { font-size:0.78rem; color:var(--ink3); margin-top:4px; font-style:italic; }
.wod-actions { display:flex; flex-direction:column; align-items:flex-end; gap:8px; flex-shrink:0; }
.wod-audio-btn { width:36px; height:36px; border-radius:50%; border:none; background:var(--gold-bg); color:var(--gold); cursor:pointer; font-size:1rem; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
.wod-audio-btn:hover { background:var(--gold); color:white; }
.wod-save-btn { font-size:0.72rem; color:var(--blue); background:none; border:none; cursor:pointer; font-family:var(--font-display); font-weight:700; white-space:nowrap; }
.wod-save-btn:hover { color:var(--blue-light); }
.wod-new-btn { width:36px; height:36px; border-radius:50%; border:none; background:var(--border); color:var(--ink2); cursor:pointer; font-size:0.95rem; display:flex; align-items:center; justify-content:center; transition:all 0.15s; }
.wod-new-btn:hover { background:var(--gold-bg); color:var(--gold); }

/* Quick Actions */
.quick-actions { margin-bottom:20px; }
.qa-label { font-family:var(--font-display); font-size:0.72rem; font-weight:700; color:var(--ink3); text-transform:uppercase; letter-spacing:0.08em; margin-bottom:8px; }
.qa-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
@media(max-width:500px) { .qa-grid { grid-template-columns:1fr 1fr; } }
.qa-btn { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:14px 8px; display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; transition:all 0.15s; font-family:var(--font-display); font-size:0.75rem; font-weight:700; color:var(--ink2); }
.qa-btn:hover { border-color:var(--gold); color:var(--gold); transform:translateY(-2px); box-shadow:var(--shadow-sm); }
.qa-icon { font-size:1.3rem; }

/* Stat card delta */
.sc-delta { font-size:0.65rem; margin-top:2px; font-weight:700; font-family:var(--font-display); }
.sc-delta.positive { color:var(--green-light); }
.sc-delta.negative { color:var(--red); }

/* Week mini bar */
.week-mini { display:flex; gap:2px; margin-top:6px; }
.wm-day { flex:1; height:4px; border-radius:2px; background:var(--surface2); }
.wm-day.done { background:var(--green-light); opacity:0.7; }
.wm-day.today { background:var(--green-light); opacity:1; }

/* Sidebar badge */
.nav-badge { margin-left:auto; font-size:0.6rem; font-family:var(--font-display); font-weight:800; background:var(--gold-bg); color:var(--gold); padding:2px 7px; border-radius:99px; }
.nav-item.active .nav-badge { background:rgba(255,255,255,0.15); color:var(--gold-light); }

/* API key field in profile */
.api-key-wrap { margin-top:16px; }
.api-key-inp { width:100%; padding:9px 12px; border:1.5px solid var(--border); background:var(--bg); border-radius:var(--radius-sm); font-family:var(--font-body); font-size:0.88rem; color:var(--ink); outline:none; transition:border-color 0.2s; }
.api-key-inp:focus { border-color:var(--gold); }

/* Vocab CEFR level tabs */
.cefr-tabs { display:flex; gap:4px; flex-wrap:wrap; margin-bottom:10px; }
.cefr-tab { padding:4px 12px; border-radius:99px; border:1.5px solid var(--border); background:transparent; font-family:var(--font-display); font-size:0.7rem; font-weight:800; cursor:pointer; color:var(--ink3); transition:all 0.15s; }
.cefr-tab.active { background:var(--ink); color:var(--gold-light); border-color:var(--ink); }

/* ========== MOBILE — comprehensive ========== */

/* Category/filter button rows: always horizontally scrollable */
.vocab-cats, #ex-cats {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.vocab-cats::-webkit-scrollbar, #ex-cats::-webkit-scrollbar { display: none; }

@media(max-width:768px) {
  /* Progress panel: single column stacked */
  #panel-progress > div[style*="grid-template-columns:1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }

  /* Modal as bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 88vh;
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
  }

  /* CEFR tabs: horizontal scroll */
  .cefr-tabs { flex-wrap:nowrap; overflow-x:auto; padding-bottom:4px; }
  .cefr-tab { flex-shrink:0; }

  /* WoD v2: row then actions below */
  .wod-v2 { flex-wrap:wrap; }
  .wod-actions { flex-direction:row; align-items:center; width:100%; justify-content:flex-end; gap:10px; }

  /* Dash header: stacked */
  .dash-header { flex-direction:column; gap:6px; }
  .xp-total-hero { text-align:left; font-size:1.3rem; }
  .xp-sublabel { text-align:left; }

  /* XP bar compact */
  .xp-bar-wrap { flex-wrap:wrap; gap:10px; }
  .xp-total { font-size:0.9rem; }

  /* WoD word: prevent overflow */
  .wod-word { font-size:1.25rem; word-break:break-word; }

  /* Cards: tighter */
  .card { padding:16px; }
  .stat-card { padding:12px; }
  .sc-num { font-size:1.25rem; }
  .wm-day { min-height:5px; }

  /* Auth */
  .auth-box { padding:28px 22px 22px; border-radius:20px; }
  .pretest-box { padding:24px 18px; }

  /* Profile inline stats: 2 columns */
  #panel-profile .card > div[style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Penalty info: smaller text */
  #panel-home > div[style*="align-items:flex-start"] div { font-size:0.7rem !important; line-height:1.5 !important; }

  /* Exam ready card: wrap arrow */
  .exam-ready-card { flex-wrap:wrap; }

  /* Mobile nav: 7 items tight */
  .mob-nav-item { font-size:0.55rem; padding:5px 2px; }
  .mob-nav-item .mn-icon { font-size:1.1rem; }
}

@media(max-width:400px) {
  /* Very small phones */
  .main-content { padding: 14px 12px 90px; }
  .wod-word { font-size:1.1rem; }
  .sc-num { font-size:1.1rem; }
  .dash-greeting { font-size:1.1rem; }
  .qa-btn { font-size:0.68rem; padding:10px 4px; }
  .stats-row { gap:8px; }
}

/* Cookie banner: sopra il mobile nav */
@media(max-width:768px) { #cookie-banner { bottom: 62px; } }

/* Touch-friendly tap areas (all touch devices) */
@media(hover:none) {
  .btn, .qa-btn, .cefr-tab, .cat-btn { min-height:44px; }
  .mob-nav-item { min-height:52px; justify-content:center; }
  .wod-audio-btn { width:44px; height:44px; }
  .page-btn { min-height:40px; min-width:40px; }
  .exam-opt, .pt-opt { padding:14px 16px; }
  .field-input, .vocab-search, .api-key-inp { font-size:16px; } /* prevent iOS zoom */
}

/* ── DIZIONARIO ──────────────────────────────────────── */
.dict-filter, .dict-cefr {
  padding: 5px 12px; border: 1.5px solid var(--border);
  border-radius: 99px; background: var(--surface); color: var(--ink2);
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.dict-filter.active, .dict-cefr.active { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }
.dict-filter:hover:not(.active), .dict-cefr:hover:not(.active) { border-color: var(--gold); }
.dict-entry {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; transition: border-color 0.15s;
}
.dict-entry:hover { border-color: var(--gold); }
.dict-entry-main { flex: 1; min-width: 0; }
.dict-word { font-family: var(--font-display); font-size: 1rem; font-weight: 800; color: var(--ink); margin-bottom: 2px; }
.dict-word mark { background: var(--gold-bg); color: var(--gold); border-radius: 3px; padding: 0 2px; }
.dict-translation { font-size: 0.85rem; color: var(--ink2); margin-bottom: 4px; }
.dict-example { font-size: 0.78rem; color: var(--ink3); font-style: italic; margin-top: 6px; line-height: 1.5; }
.dict-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.dict-badge { font-family: var(--font-display); font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 7px; border-radius: 99px; }
.badge-cefr { background: var(--gold-bg); color: var(--gold); }
.badge-type { background: var(--blue-bg, rgba(59,130,246,0.12)); color: var(--blue, #3b82f6); }
.badge-cat  { background: var(--surface2); color: var(--ink3); }
.dict-audio-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem; flex-shrink: 0; transition: all 0.15s;
}
.dict-audio-btn:hover { background: var(--ink); color: var(--gold-light); border-color: var(--ink); }
.dict-empty { text-align: center; padding: 40px 20px; color: var(--ink3); font-style: italic; }
@media(max-width:480px) { .dict-entry { flex-direction: column; } .dict-audio-btn { align-self: flex-start; } }

/* VERBI IRREGOLARI */
.irr-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.irr-table th { background:var(--surface2); color:var(--ink3); font-family:var(--font-display); font-size:0.7rem; font-weight:800; text-transform:uppercase; letter-spacing:0.06em; padding:8px 10px; text-align:left; border-bottom:2px solid var(--border); }
.irr-table td { padding:10px 10px; border-bottom:1px solid var(--border); color:var(--ink); vertical-align:top; }
.irr-table tr:hover td { background:var(--surface2); }
.irr-base { font-family:var(--font-display); font-weight:800; color:var(--ink); }
.irr-forms { color:var(--ink2); }
.irr-it { color:var(--ink3); font-style:italic; }
.irr-ex { font-size:0.75rem; color:var(--ink3); font-style:italic; margin-top:4px; padding:6px 8px; background:var(--surface2); border-radius:6px; display:none; }
.irr-ex.open { display:block; }
.irr-ex-btn { background:none; border:none; cursor:pointer; font-size:0.7rem; color:var(--gold); font-family:var(--font-display); font-weight:700; padding:0; margin-top:3px; }

/* Mobile: card invece di tabella */
@media(max-width:700px) {
  .irr-table, .irr-table thead, .irr-table tbody, .irr-table th, .irr-table td, .irr-table tr { display:block; }
  .irr-table thead { display:none; }
  .irr-table tr { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:8px; padding:12px 14px; }
  .irr-table tr:hover td { background:transparent; }
  .irr-table td { padding:3px 0; border:none; }
  .irr-table td::before { content:attr(data-label); font-family:var(--font-display); font-size:0.65rem; font-weight:800; text-transform:uppercase; color:var(--ink3); display:block; margin-bottom:1px; }
  .irr-audio-cell { display:flex; align-items:center; gap:8px; }
}

/* ============================================================
   LEARN PANEL
   ============================================================ */
.learn-level-section { margin-bottom:20px; border:1.5px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.learn-level-header { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; background:var(--surface); cursor:pointer; user-select:none; gap:12px; }
.learn-level-header:hover { background:var(--border); }
.learn-level-badge { font-family:var(--font-display); font-size:0.78rem; font-weight:900; padding:3px 10px; border-radius:20px; background:var(--gold); color:#000; }
.learn-level-title { font-family:var(--font-display); font-size:1rem; font-weight:800; flex:1; }
.learn-level-meta { font-size:0.78rem; color:var(--ink3); }
.learn-level-chevron { font-size:0.8rem; color:var(--ink3); transition:transform 0.2s; }
.learn-level-section.open .learn-level-chevron { transform:rotate(180deg); }
.learn-units-grid { display:none; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px; padding:16px; background:var(--bg); }
.learn-level-section.open .learn-units-grid { display:grid; }
.learn-unit-card { border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:14px; background:var(--surface); cursor:pointer; transition:all 0.15s; position:relative; }
.learn-unit-card:hover:not(.locked) { border-color:var(--gold); transform:translateY(-1px); }
.learn-unit-card.locked { opacity:0.45; cursor:not-allowed; }
.learn-unit-card.completed { border-color:var(--gold); }
.learn-unit-card.test-unit { background:linear-gradient(135deg,var(--surface),rgba(255,180,0,0.06)); }
.learn-unit-num { font-size:0.68rem; font-weight:900; color:var(--ink3); font-family:var(--font-display); margin-bottom:4px; }
.learn-unit-title { font-family:var(--font-display); font-size:0.88rem; font-weight:800; line-height:1.25; margin-bottom:8px; }
.learn-unit-status { font-size:0.75rem; display:flex; align-items:center; gap:5px; }
.learn-unit-prog { height:4px; background:var(--border); border-radius:2px; margin-top:6px; overflow:hidden; }
.learn-unit-prog-fill { height:100%; background:var(--gold); border-radius:2px; transition:width 0.4s; }

/* Unit view */
.learn-unit-back { display:flex; align-items:center; gap:8px; cursor:pointer; color:var(--ink3); font-size:0.85rem; margin-bottom:20px; background:none; border:none; padding:0; font-family:var(--font-body); }
.learn-unit-back:hover { color:var(--gold); }
.learn-steps-nav { display:flex; gap:4px; margin-bottom:24px; }
.learn-step-dot { width:32px; height:6px; border-radius:3px; background:var(--border); transition:background 0.2s; flex:1; }
.learn-step-dot.active { background:var(--gold); }
.learn-step-dot.done { background:var(--gold); opacity:0.5; }
.learn-step-content { min-height:300px; }
.learn-step-header { font-family:var(--font-display); font-size:1.1rem; font-weight:800; margin-bottom:16px; }
.learn-vocab-card { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:8px; background:var(--surface); }
.learn-vocab-en { font-family:var(--font-display); font-size:1rem; font-weight:800; }
.learn-vocab-it { font-size:0.88rem; color:var(--ink3); }
.learn-nav-row { display:flex; justify-content:space-between; align-items:center; margin-top:24px; gap:12px; }
.learn-nav-btn { font-family:var(--font-display); font-size:0.85rem; font-weight:800; padding:10px 20px; border-radius:var(--radius-sm); border:none; cursor:pointer; transition:all 0.15s; }
.learn-nav-btn.primary { background:var(--gold); color:#000; }
.learn-nav-btn.primary:hover { opacity:0.85; }
.learn-nav-btn.secondary { background:var(--surface); color:var(--ink); border:1.5px solid var(--border); }
.learn-nav-btn.secondary:hover { border-color:var(--gold); }
.learn-mini-test-score { text-align:center; padding:24px; }
.learn-mini-test-score .score-num { font-family:var(--font-display); font-size:3rem; font-weight:900; color:var(--gold); }
@media(max-width:768px) {
  .learn-units-grid { grid-template-columns:1fr 1fr; padding:12px; gap:8px; }
  .learn-unit-card { padding:10px; }
  .learn-unit-title { font-size:0.8rem; }
}
@media(max-width:480px) {
  .learn-units-grid { grid-template-columns:1fr; }
}
</style>

/* ==================== PWA ==================== */
@keyframes slideUpPWA {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
</style>