:root {
  color-scheme: light;
  --ink: #17324b; --muted: #6c7f8e; --brand: #155e75; --brand-dark: #0e3d4d;
  --teal: #0f766e; --sky: #e4f3f6; --mint: #e8f5ef; --gold: #e7a83d;
  --surface: #fff; --bg: #f5f8fa; --line: #dbe6eb; --danger: #b94a48;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.app-shell { max-width: 1440px; margin: 0 auto; min-height: 100vh; padding: 0 24px 44px; }
.topbar { height: 76px; display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 205px; font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--brand), #1d9aaa); box-shadow: 0 7px 17px #155e7535; }
.top-search { display: flex; align-items: center; gap: 8px; width: min(460px, 42vw); padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); color: var(--muted); }
.top-search input { width: 100%; min-height: 42px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.top-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.session-label { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.button, .icon-button { min-height: 42px; padding: 9px 15px; border: 0; border-radius: 11px; cursor: pointer; color: var(--ink); background: #e5eef2; transition: .16s ease; }
.button:hover, .icon-button:hover { filter: brightness(.97); transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--brand); box-shadow: 0 5px 12px #155e7526; }
.button.ghost { border: 1px solid var(--line); background: transparent; }
.button.danger { color: #fff; background: var(--danger); }
.icon-button { display: none; padding: 8px 11px; font-size: 18px; }
.layout { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { position: sticky; top: 0; height: calc(100vh - 76px); padding: 20px 0 16px; border-right: 1px solid var(--line); }
.sidebar nav { display: grid; gap: 4px; padding-right: 18px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 40px; padding: 9px 11px; border-radius: 10px; color: #577082; font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--brand-dark); background: var(--sky); }
.sidebar nav a > span { flex: 1; }
.nav-label { margin: 14px 11px 4px; color: #8da0ab; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; }
.nav-count { display: inline-grid; place-items: center; min-width: 21px; height: 21px; border-radius: 999px; color: #fff; background: var(--brand); font-size: 11px; }
.sidebar-foot { position: absolute; bottom: 15px; display: flex; align-items: center; gap: 8px; padding-left: 11px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #31a373; box-shadow: 0 0 0 4px #31a37320; }
#main { min-width: 0; padding: 30px 0; }
footer { padding-top: 32px; color: #8a9aa5; font-size: 12px; text-align: center; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 27px 30px; margin-bottom: 24px; border-radius: 24px; background: linear-gradient(120deg, #dff2f3, #eaf5ef 70%, #f2eeda); }
.hero h1 { max-width: 720px; margin: 6px 0 7px; font-size: clamp(28px, 4vw, 44px); line-height: 1.12; letter-spacing: -1.2px; }
.hero p { max-width: 720px; margin: 0; }
.hero-art { width: 170px; font-size: 72px; text-align: center; filter: drop-shadow(0 9px 10px #1c6b7430); }
.eyebrow { margin: 0; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: 1.35px; text-transform: uppercase; }
.muted { color: var(--muted); }
.notice { padding: 13px 15px; border-radius: 12px; color: #6b4b22; background: #fff1df; }
.notice.info { color: #275b6d; background: #e4f3f6; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 25px 0 13px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 21px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 19px 0; }
.toolbar-left, .tabs, .chip-row, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tabs .button[aria-pressed="true"], .chip.active { color: #fff; background: var(--brand); }
.chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #577082; background: #fff; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card, .panel, .stat-card { overflow: hidden; border: 1px solid #e5edf0; border-radius: 17px; background: var(--surface); box-shadow: 0 5px 20px #17324b0b; }
.card { transition: .17s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 9px 26px #17324b18; }
.card-cover { display: block; width: 100%; aspect-ratio: 1.65; object-fit: cover; background: #dce9ec; }
.card-body { padding: 16px; }
.card h2, .card h3 { margin: 8px 0 4px; font-size: 17px; line-height: 1.3; }
.card p { margin: 0 0 10px; font-size: 13px; }
.pill { display: inline-block; padding: 4px 9px; border-radius: 999px; color: #366477; background: var(--sky); font-size: 11px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.bar { height: 5px; margin-top: 12px; overflow: hidden; border-radius: 5px; background: #e8eef0; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #48b794); }
.empty { padding: 40px 12px; color: var(--muted); text-align: center; }
.question-card { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.question-card .question-text { margin: 10px 0 17px; font-size: 20px; font-weight: 650; line-height: 1.45; }
.question-card .question-italian { margin: 0 0 15px; color: #587789; font-size: 14px; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.answer { min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); text-align: left; background: #f7fafb; cursor: pointer; }
.answer:hover { border-color: #76aebb; background: var(--sky); }
.answer.correct { border-color: #45a56f; color: #205e3c; background: #e6f5ec; }
.answer.wrong { border-color: #d8796c; color: #8d3e34; background: #fff0ed; }
.feedback { padding: 13px; margin-top: 14px; border-radius: 11px; color: #31556a; background: #edf6f7; }
.feedback.fail { color: #873f36; background: #fff1ed; }
.question-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.mini-stat { color: var(--muted); font-size: 13px; }
.search-field { width: min(450px, 100%); min-height: 43px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: #fff; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.detail-head h1 { margin: 0 0 5px; font-size: clamp(27px, 4vw, 38px); line-height: 1.2; }
.back { display: inline-flex; align-items: center; min-height: 40px; margin-bottom: 8px; color: var(--teal); }
.detail-layout { display: grid; grid-template-columns: minmax(280px, 440px) minmax(0, 1fr); align-items: start; gap: 22px; }
.player-wrap { position: relative; overflow: hidden; border-radius: 17px; background: #102b37; box-shadow: 0 10px 30px #17324b20; }
.player-wrap video { display: block; width: 100%; aspect-ratio: 9 / 16; max-height: min(72vh, 680px); object-fit: contain; background: #102b37; }
.player-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 22px; color: #fff; text-align: center; background: #102b3788; }
.player-overlay.hidden { display: none; }
.player-overlay .button { margin-top: 10px; }
.panel { padding: 19px; margin-bottom: 16px; }
.panel h2, .panel h3 { margin-top: 0; }
.mode-tabs { display: flex; gap: 8px; margin: 12px 0; }
.mode-tabs .button[aria-pressed="true"] { color: #fff; background: var(--brand); }
.step-list { display: grid; gap: 7px; padding: 0; margin: 14px 0; list-style: none; }
.step-list button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px; border: 0; border-radius: 10px; color: var(--ink); text-align: left; background: #f1f6f7; cursor: pointer; }
.step-list button:hover, .step-list button.active { background: #e1f0f0; box-shadow: inset 0 0 0 2px #65a9ab; }
.step-num { display: grid; flex: 0 0 27px; place-items: center; width: 27px; height: 27px; border: 1px solid #9fbdc4; border-radius: 50%; font-size: 12px; }
.step-time { margin-left: auto; color: #47758a; font-size: 12px; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options button { padding: 11px; border: 0; border-radius: 10px; color: var(--ink); text-align: left; background: #f0f5f6; cursor: pointer; }
.quiz-options button.chosen { box-shadow: inset 0 0 0 2px #65a9ab; }
.dashboard-grid, .stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat-card { padding: 17px; }
.stat-card .value { margin: 3px 0 1px; font-size: 29px; font-weight: 800; letter-spacing: -.8px; }
.stat-card .label { color: var(--muted); font-size: 12px; }
.list { display: grid; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.list-item > .grow { flex: 1; min-width: 0; }
.list-item h3, .list-item p { margin: 0; }
.list-item h3 { font-size: 14px; }
.list-item p { color: var(--muted); font-size: 12px; }
.progress-ring { display: grid; place-items: center; width: 100px; height: 100px; border-radius: 50%; background: conic-gradient(var(--teal) var(--progress, 0%), #e2edef 0); }
.progress-ring::after { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; content: attr(data-value); color: var(--ink); background: #fff; font-weight: 800; }
.flashcard { max-width: 600px; padding: 38px 24px; margin: 18px auto; border: 1px solid var(--line); border-radius: 21px; text-align: center; background: linear-gradient(150deg, #fff, #eff9f8); box-shadow: 0 13px 35px #17324b12; }
.flashcard .term { margin: 13px 0 6px; font-size: 34px; font-weight: 800; }
.flashcard .translation { min-height: 30px; margin: 0 0 20px; color: var(--teal); font-size: 20px; }
.flashcard .hint { padding: 12px; border-radius: 11px; color: #517080; background: #f1f7f7; font-size: 13px; }
.road-card { padding: 20px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #155e75, #0f766e); }
.road-card h2 { margin: 0 0 6px; }
.road-card .button { color: #164c5e; background: #e9f8f4; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #567283; background: #f3f8f9; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.dialog { width: min(430px, calc(100vw - 30px)); padding: 0; border: 0; border-radius: 19px; background: transparent; }
.dialog::backdrop { background: #102b3780; backdrop-filter: blur(3px); }
.dialog-card { position: relative; display: grid; gap: 11px; padding: 27px; border-radius: 19px; background: #fff; box-shadow: 0 20px 70px #102b3740; }
.dialog-card h2 { margin: 0; }
.dialog-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
.dialog-card input { width: 100%; min-height: 45px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.dialog-card input:focus, .search-field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #155e7522; }
.dialog-close { position: absolute; top: 10px; right: 12px; width: 33px; height: 33px; border: 0; border-radius: 50%; color: var(--muted); background: #edf3f5; cursor: pointer; font-size: 22px; }
.form-error { padding: 9px 11px; margin: 0; border-radius: 9px; color: #99452c; background: #fff0e7; font-size: 13px; }
.toast { position: fixed; bottom: 22px; left: 50%; z-index: 20; padding: 11px 17px; border-radius: 11px; color: #fff; background: var(--brand-dark); box-shadow: 0 8px 25px #102b3740; transform: translateX(-50%); }
.hidden { display: none !important; }
@media (max-width: 980px) {
  .app-shell { padding: 0 16px 38px; }
  .brand { min-width: auto; }
  .top-search { flex: 1; width: auto; }
  .layout { grid-template-columns: 190px minmax(0, 1fr); gap: 18px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app-shell { padding: 0 13px 80px; }
  .topbar { height: 65px; gap: 10px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 34px; height: 34px; }
  .top-search { order: 3; position: absolute; top: 73px; left: 13px; right: 13px; width: auto; }
  .top-actions { gap: 5px; }
  .session-label { display: none; }
  .icon-button { display: inline-block; }
  .layout { display: block; }
  .sidebar { position: fixed; inset: 65px auto 0 0; z-index: 10; display: none; width: 255px; height: auto; padding: 18px 12px; border-right: 1px solid var(--line); background: #fff; box-shadow: 14px 0 28px #17324b20; }
  .sidebar.open { display: block; }
  .sidebar-foot { position: static; margin-top: 20px; }
  #main { padding-top: 65px; }
  .hero { align-items: flex-start; padding: 22px; margin-bottom: 18px; }
  .hero-art { display: none; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .dashboard-grid, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .toolbar, .detail-head { align-items: flex-start; flex-direction: column; }
  .detail-layout { display: flex; flex-direction: column; gap: 16px; }
  .player-column, .side { width: 100%; }
  .player-column { max-width: 440px; margin: auto; }
  .answer-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  footer { font-size: 11px; }
}
