/* =============================================================
  STYLE.CSS — Blocchi numerati
  [1] Variabili, reset, tipografia
  [2] Liquid background
  [3] Header
  [4] Dock (scrollabile)
  [5] Layout + componenti
  [6] Filtri
  [7] Opzioni (card risposta)
  [8] Liste lezioni
  [9] Simulazione (segbar, pill)
  [10] Animazioni
============================================================= */

/* [1] Variabili, reset, tipografia */
:root {
  --bg: #0b1220;
  --panel: rgba(255,255,255,0.06);
  --card: rgba(255,255,255,0.12);
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --primary: #007aff;   /* blu tipico iOS */
  --accent: #5ac8fa;    /* azzurro acqua */
  --ok: #34c759;        /* verde iOS */
  --err: #ff3b30;       /* rosso iOS */
  --border: rgba(255,255,255,0.18);
  /* iOS visual tokens */
  --ios-surface: rgba(255,255,255,0.04);
  --ios-elev: rgba(9,20,40,0.08);
  --ios-radius-large: 20px;
  --ios-radius-medium: 14px;
  --ios-radius-pill: 999px;
  --ios-shadow: 0 10px 30px rgba(9,20,40,0.12);
}
/* Theme overrides */
html.theme-light {
  /* modern light palette */
  --bg: linear-gradient(180deg,#f7fbff 0%, #eef6ff 100%);
  --panel: rgba(10,25,40,0.02);
  --card: rgba(255,255,255,0.96);
  --text: #091223;
  --muted: #6b7785;
  --primary: #0a66ff;
  --accent: #00b4ff;
  --border: rgba(9,20,40,0.06);
  --ok: #00a86b;
  --err: #c62828;
  --glass: rgba(255,255,255,0.75);
}
/* dark theme uses defaults in :root */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin:0; padding:0;
  background:var(--bg);
  color:var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, sans-serif;
}
/* Respect iOS safe area and give comfortable spacing */
body{ padding-top: env(safe-area-inset-top, 12px); padding-left: env(safe-area-inset-left, 12px); padding-right: env(safe-area-inset-right, 12px); }
a { color:inherit; text-decoration:none; }
/* end [1] */

/* [2] Liquid background */
.liquid-bg{position:fixed;inset:0;z-index:-1;overflow:hidden;pointer-events:none}
.blobs{position:absolute;inset:0;filter:url(#goo); opacity:.9}
.blob{position:absolute;width:420px;height:420px;border-radius:50%;background:radial-gradient(closest-side, rgba(124,108,246,.35), rgba(36,214,239,.15) 60%, transparent 70%);animation:float 14s ease-in-out infinite}
.blob.b2{left:55%;top:-10%;animation-duration:18s}
.blob.b3{left:-10%;top:45%;animation-duration:20s}
@keyframes float{0%{transform:translate(0,0)}50%{transform:translate(20px, -10px)}100%{transform:translate(0,0)}}

/* Confirm modal */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:60}
.modal .backdrop{position:absolute;inset:0;background:rgba(2,6,12,0.6);backdrop-filter:blur(4px)}
.modal .dialog{position:relative;z-index:2;min-width:280px;max-width:92vw;padding:18px;border-radius:14px;background:var(--card);border:1px solid var(--border);box-shadow:var(--ios-shadow);text-align:left}
.modal .dialog h3{margin:0 0 8px 0;font-size:1.1rem}
.modal .dialog p{margin:0 0 12px 0;color:var(--muted)}
.modal .dialog .actions{display:flex;justify-content:flex-end;gap:8px}
.modal .dialog .actions .btn{min-width:96px}
.modal[aria-hidden="true"]{display:none}

/* [3] Header */
.app-header{position:sticky;top:0;backdrop-filter:saturate(1.3) blur(8px);border-bottom:1px solid var(--border);z-index:10;background:linear-gradient(180deg, rgba(15,23,42,.75), rgba(15,23,42,.55))}
.brandbar{display:flex;align-items:center;gap:12px;padding:12px 16px}
.logo{font-size:22px}
.logo img{height:36px; display:block; border-radius:8px; object-fit:cover}
@media (max-width:420px){ .logo img{height:30px} }
.brand{display:flex;flex-direction:column;line-height:1}
.brand .muted{color:var(--muted);font-size:12px}

/* [4] Dock (scrollabile) - ENHANCED PROFESSIONAL VERSION */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  pointer-events: none;
  padding: 12px 16px env(safe-area-inset-bottom, 16px);
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.02) 40%,
    rgba(0, 0, 0, 0.05) 100%
  );
}

.dock-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.dock-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.02) 100%
  );
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 8px 12px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  pointer-events: auto;
  max-width: calc(100vw - 32px);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
}

.dock-inner::-webkit-scrollbar {
  display: none;
}

/* Gradient overlays per indicare scroll */
.dock-inner::before,
.dock-inner::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dock-inner::before {
  left: 0;
  background: linear-gradient(
    90deg,
    rgba(var(--bg-rgb, 11, 18, 32), 0.8) 0%,
    transparent 100%
  );
}

.dock-inner::after {
  right: 0;
  background: linear-gradient(
    270deg,
    rgba(var(--bg-rgb, 11, 18, 32), 0.8) 0%,
    transparent 100%
  );
}

/* Theme-specific dock styling */
.theme-light .dock-inner {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0.75) 100%
  );
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.02),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.theme-light .dock-inner::before {
  background: linear-gradient(
    90deg,
    rgba(247, 251, 255, 0.9) 0%,
    transparent 100%
  );
}

.theme-light .dock-inner::after {
  background: linear-gradient(
    270deg,
    rgba(247, 251, 255, 0.9) 0%,
    transparent 100%
  );
}

/* Enhanced dock items */
.dock a {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 64px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Ripple effect on tap */
.dock a::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(
    circle,
    rgba(var(--primary-rgb, 0, 123, 255), 0.3) 0%,
    transparent 70%
  );
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  pointer-events: none;
}

.dock a:active::before {
  width: 120px;
  height: 120px;
}

/* Icon styling */
.dock .icon {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Label styling */
.dock .lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

/* Hover effects */
.dock a:hover {
  transform: translateY(-2px);
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.08);
  border-color: rgba(var(--primary-rgb, 0, 123, 255), 0.2);
  box-shadow: 
    0 4px 12px rgba(var(--primary-rgb, 0, 123, 255), 0.15),
    0 2px 6px rgba(0, 0, 0, 0.1);
}

.dock a:hover .icon {
  transform: scale(1.1);
}

.dock a:hover .lbl {
  opacity: 1;
}

/* Active state */
.dock a.active {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    color-mix(in srgb, var(--primary) 85%, white 15%) 100%
  );
  color: white;
  border-color: var(--primary);
  box-shadow: 
    0 4px 16px rgba(var(--primary-rgb, 0, 123, 255), 0.4),
    0 2px 8px rgba(var(--primary-rgb, 0, 123, 255), 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.dock a.active .icon {
  transform: scale(1.05);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.dock a.active .lbl {
  opacity: 1;
  font-weight: 700;
}

/* Pulse animation for active item */
.dock a.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--accent)
  );
  border-radius: 18px;
  z-index: -1;
  opacity: 0.3;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .dock {
    padding: 8px 12px env(safe-area-inset-bottom, 12px);
  }
  
  .dock-inner {
    padding: 6px 8px;
    gap: 4px;
    border-radius: 20px;
  }
  
  .dock a {
    padding: 10px 12px;
    gap: 3px;
    min-width: 56px;
    border-radius: 14px;
  }
  
  .dock .icon {
    font-size: 18px;
  }
  
  .dock .lbl {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .dock {
    padding: 6px 8px env(safe-area-inset-bottom, 8px);
  }
  
  .dock-inner {
    padding: 4px 6px;
    gap: 2px;
    border-radius: 18px;
  }
  
  .dock a {
    padding: 8px 10px;
    gap: 2px;
    min-width: 48px;
    border-radius: 12px;
  }
  
  .dock .icon {
    font-size: 16px;
  }
  
  .dock .lbl {
    font-size: 9px;
    letter-spacing: 0.1px;
  }
}

/* Ultra-compact mode for very small screens */
@media (max-width: 360px) {
  .dock a {
    padding: 6px 8px;
    min-width: 44px;
  }
  
  .dock .lbl {
    display: none;
  }
  
  .dock .icon {
    font-size: 18px;
  }
  
  /* Show tooltip on long press for label-less icons */
  .dock a[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 8px;
  }
  
  .dock a:hover::after {
    opacity: 1;
  }
}

/* Enhanced scrolling indicators */
.dock-inner.scrollable-left::before {
  opacity: 1;
}

.dock-inner.scrollable-right::after {
  opacity: 1;
}

/* Focus states for accessibility */
.dock a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.dock a:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .dock a,
  .dock .icon,
  .dock .lbl,
  .dock a::before,
  .dock a::after {
    transition: none;
    animation: none;
  }
  
  .dock a:hover {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .dock-inner {
    border: 2px solid var(--border);
    background: var(--card);
  }
  
  .dock a {
    border: 1px solid var(--border);
  }
  
  .dock a.active {
    border: 2px solid var(--primary);
  }
}

/* [5] Layout + componenti */
main {
  padding:18px;
  max-width:980px;
  margin:0 auto 92px auto;
}
.panel { 
  display:none; 
  animation: fadeIn 0.3s ease;
}
.panel.active { 
  display:block; 
}

/* Debug: evidenzia pannello attivo in development */
.panel.active {
  display: block !important;
}

/* Assicura che i link del dock siano cliccabili */
.dock a {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.dock a:hover {
  transform: scale(1.05);
}

/* KPI Grid per i report */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.kpi-box {
  text-align: center;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.2s ease;
}

.kpi-box:hover {
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* Titoli delle sezioni */
.section-header {
  text-align: center;              /* centra tutto il blocco */
  margin: 20px 0 30px 0;           /* spaziatura sopra e sotto */
}
.section-header h1 {
  margin: 0;
  font-weight: 700;
  font-size: 2rem;                 /* più grande */
  letter-spacing: -0.02em;
}
.section-header .sub {
  display: block;
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}
.sub { color:var(--muted); margin:.3rem 0 1rem 0; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--ios-radius-large);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--ios-shadow);
}

.btn {
  border:0;
  border-radius: var(--ios-radius-medium);
  padding: 12px 16px;
  font-weight:700;
  cursor:pointer;
  transition: transform .12s cubic-bezier(.25,.8,.25,1), box-shadow .18s ease, background .18s ease;
  background: transparent;
  color: var(--text);
  min-height:44px; /* comfortable iOS tappable size */
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
}
.btn.primary {
  background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 70%, black 10%));
  color: white;
  box-shadow: 0 8px 20px rgba(10,90,200,0.14);
  border-radius: var(--ios-radius-medium);
}
/* Danger / terminate button */
.btn.danger{ background: linear-gradient(180deg, var(--err), color-mix(in srgb, var(--err) 70%, black 10%)); color:white; box-shadow:0 8px 20px rgba(200,40,40,0.14); }
.btn.danger::after{ background: rgba(255,255,255,0.08); }
.btn:active {
  transform: scale(.97);
}

/* Hide header terminate button during practice because inline control is used */
#endPractice{ display:none; }
.btnrow {
  display:flex; gap:10px; margin-top:12px; flex-wrap:wrap;
}
.small { font-size:13px; color:var(--muted); }

.kpis { display:flex; gap:10px; flex-wrap:wrap; margin-top:8px; }
.kpi {
  padding:10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border:1px solid var(--border);
  border-radius:12px;
  font-weight:600;
}

.grid { display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:700px){ .grid{grid-template-columns:1fr 1fr} }
.divider { border:1px solid var(--border); opacity:.3; margin:10px 0; }
/* end [5] */

/* [6] Filtri */
.filters{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:12px}
label{display:flex;flex-direction:column;gap:6px;font-size:14px}
/* Uniform inputs look (including search) to avoid white default */
input[type="number"], input[type="text"], input[type="email"], input[type="search"]{
  padding:12px; border-radius:10px; border:1px solid var(--border);
  background:rgba(255,255,255,0.03); color:var(--text);
}
input[type="search"]::-webkit-search-cancel-button{ -webkit-appearance:none; height:14px; width:14px; background:none; }
input[type="search"]::placeholder{ color: var(--muted); }
input[type="search"]:focus{ outline:none; box-shadow: 0 6px 18px rgba(9,20,40,0.12); }

/* Custom select */
.custom-select{ position:relative; padding:12px;border-radius:10px;border:1px solid var(--border);background:var(--card);color:var(--text);min-width:160px; cursor:pointer; }
.custom-select .selected{ display:flex; align-items:center; gap:8px; }
.custom-select .chev{ margin-left:auto; opacity:.7 }
.custom-select[aria-expanded="true"]{ box-shadow:0 8px 20px rgba(9,20,40,0.08); }
.custom-select .options{ display:none; position:absolute; left:0; right:0; top:calc(100% + 8px); background:var(--card); border:1px solid var(--border); border-radius:10px; max-height:220px; overflow:auto; z-index:40; padding:6px; }
.custom-select[aria-expanded="true"] .options{ display:block; }
.custom-select .opt-item{ padding:8px 10px; border-radius:8px; cursor:pointer; }
.custom-select .opt-item:hover{ background: linear-gradient(90deg, rgba(124,108,246,0.06), rgba(90,200,250,0.04)); }
.custom-select .opt-item.active{ background: linear-gradient(90deg, rgba(124,108,246,0.12), rgba(90,200,250,0.08)); font-weight:700; }

/* Styled native select for a modern look (used by default now) */
.styled-select{
  -webkit-appearance:none; -moz-appearance:none; appearance:none;
  padding:10px 40px 10px 12px; min-width:160px; border-radius:10px; border:1px solid var(--border);
  background:var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 10px center/18px auto;
  color:var(--text); font-weight:600; cursor:pointer;
}
.theme-light .styled-select{ background:var(--card) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23091223' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 10px center/18px auto; color:var(--text); }
.styled-select:focus{ outline: none; box-shadow: 0 6px 18px rgba(9,20,40,0.12); }
.styled-select[disabled]{ opacity:0.6; cursor:not-allowed; }

/* Settings specific tweaks */
.card.settings { padding: 14px; }
.card.settings label { font-weight:600; }

/* [7] Opzioni (card risposta) */
.question{margin:.2rem 0 .8rem 0;font-size:18px}
.options{display:flex;flex-direction:column;gap:10px}
.opt{padding:14px;border:1px solid var(--border);border-radius:12px;background:rgba(12,20,38,.82);transition:border .15s ease, transform .05s ease;cursor:pointer}
.opt:active{transform:scale(.995)}
.opt.selected{border-color:var(--primary);box-shadow:0 0 0 2px rgba(124,108,246,.3) inset}
.opt.correct{border-color:var(--ok);box-shadow:0 0 0 2px rgba(34,197,94,.25) inset}
.opt.wrong{border-color:var(--err);box-shadow:0 0 0 2px rgba(239,68,68,.25) inset}

/* [8] Liste lezioni */
.list{list-style:none;padding:0;margin:0}
.list li{border:1px solid var(--border);border-radius:14px;padding:14px;background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));transition:transform .15s ease, border .2s}
.list li:hover{transform:translateY(-6px);border-color:var(--accent); box-shadow:0 18px 40px rgba(9,20,40,0.06);}
.lesson-title{font-weight:700;margin:0 0 .5rem 0}
.lesson-body{color:#d5dde6;line-height:1.65}
.figure{background:rgba(255,255,255,.02);border:1px solid var(--border);border-radius:12px;padding:10px;margin:10px 0}

/* [9] Simulazione */
.segbar{
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.seg{
  position: relative;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
}

.seg:hover {
  background: rgba(0, 123, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.seg .fill{
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
  border-radius: 0 0 12px 12px;
}

.seg .label{
  position: relative;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  z-index: 2;
}

.seg.active{
  background: rgba(0, 123, 255, 0.12);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.seg.active .label {
  color: var(--primary);
  font-weight: 700;
}

.subj-buttons{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 0 0;
}

.pill{
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.pill:hover {
  background: rgba(0, 123, 255, 0.08);
  border-color: var(--primary);
}

.pill.active{
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #0056b3));
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Responsive per la barra segmentata */
@media (max-width: 768px) {
  .segbar {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .seg {
    height: 42px;
    padding: 6px;
  }
  
  .seg .label {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .segbar {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .seg {
    height: 38px;
    padding: 4px;
  }
  
  .seg .label {
    font-size: 10px;
  }
  
  .pill {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* [9.1] Practice Timer (circolare) — griglia simmetrica (timer | titolo | timer) */
.practice-head{
  --timer-size: 86px;                    /* dimensione anello desktop */
  position: sticky; top: 10px; z-index: 5;

  display: grid;
  grid-template-columns: var(--timer-size) 1fr var(--timer-size);
  align-items: center;

  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--ios-radius-large);
  /* Use theme-aware card background so timer remains visible in dark/light themes */
  background: var(--card);
  backdrop-filter: blur(8px) saturate(150%);
  box-shadow: var(--ios-shadow);
  margin-bottom: 14px;
  min-height: 96px;
}

/* colonna 1: solo uno SPACER della stessa larghezza del timer */
.practice-head::before{
  content: "";
  display: block;
  grid-column: 1;
  width: var(--timer-size);
  height: 1px;
}

/* colonna 2: titolo perfettamente centrato */
.practice-head .head-info{
  grid-column: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; text-align: center;
}
.practice-head .pill{ font-weight: 700; }

/* colonna 3: timer a destra */
.timer-badge{
  grid-column: 3;
  justify-self: end;
  width: var(--timer-size); height: var(--timer-size); min-width: var(--timer-size);
  position: relative; display: flex; align-items: center; justify-content: center;
}

/* Stili per il timer SVG - AGGIUNTI/CORRETTI */
.timer-badge .ring{ 
  position: absolute; 
  inset: 0; 
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.timer-badge .ring .bg{ 
  fill: none; 
  stroke: rgba(255,255,255,.12); 
  stroke-width: 6;
  r: 35;
  cx: 50;
  cy: 50;
}

.timer-badge .ring .fg{
  fill: none; 
  stroke: var(--primary); 
  stroke-width: 6; 
  stroke-linecap: round;
  r: 35;
  cx: 50;
  cy: 50;
  stroke-dasharray: 220; 
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .8s cubic-bezier(.25,.8,.25,1), stroke .3s ease;
  filter: drop-shadow(0 2px 4px rgba(10,90,200,0.3));
}

.timer-badge.low .ring .fg{ 
  stroke: var(--err); 
}

.timer-badge .time{ 
  position: relative; 
  font-weight: 800; 
  font-size: 14px;
  letter-spacing: -.02em; 
  color: var(--text);
  z-index: 2;
}

/* Correzioni per tema chiaro */
.theme-light .timer-badge .ring .bg{ 
  stroke: rgba(9,20,40,0.15); 
}

/* Mobile: timer sotto, tutto centrato */
@media (max-width: 680px){
  .practice-head{
    --timer-size: 74px;                  /* timer un po' più piccolo */
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 10px;
    min-height: auto;
  }
  .practice-head::before{ display:none; }
  .practice-head .head-info{ grid-column: 1; }
  .timer-badge{ grid-column: 1; justify-self: center; }
  
  .timer-badge .time {
    font-size: 12px;
  }
}

/* [10] Animazioni */
.fade-in {
  animation: fadeIn .45s cubic-bezier(.25,.8,.25,1) both;
}
@keyframes fadeIn {
  from { opacity:0; transform: translateY(8px) scale(.98); }
  to   { opacity:1; transform: none; }
}

.btn.primary {
  position:relative;
  overflow:hidden;
}
.btn.primary::after {
  content:"";
  position:absolute;
  inset:0;
  background:rgba(255,255,255,0.2);
  opacity:0;
  transform:scale(0.8);
  border-radius:inherit;
  transition:opacity .3s ease, transform .3s ease;
}
.btn.primary:active::after {
  opacity:1;
  transform:scale(1);
}
/* end [10] */

/* Report charts */
.report-charts{ display:flex; flex-direction:column; gap:8px; }
.subject-row{ display:flex; align-items:center; gap:12px; padding:8px; border-radius:10px; background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border:1px solid var(--border); }
.subject-label{ min-width:180px; font-weight:700; color:var(--muted); }
.subject-bar-wrap{ flex:1; background: rgba(255,255,255,0.03); border-radius:8px; height:14px; overflow:hidden; border:1px solid rgba(255,255,255,0.02); }
.subject-bar{ height:100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .6s cubic-bezier(.25,.8,.25,1); }
.subject-numbers{ min-width:110px; text-align:right; font-weight:700; }


/* [11] Modal iOS picker */
.modal{
  position:fixed; inset:0; z-index:50; display:none;
  align-items:center; justify-content:center;
}
.modal.show{ display:flex; }
.modal .backdrop{
  position:absolute; inset:0; background:rgba(0,0,0,.45); backdrop-filter:blur(4px);
}
.modal .sheet{
  position:relative; width:min(680px, 92vw);
  background: var(--card); color: var(--text); border:1px solid var(--border); backdrop-filter: blur(20px) saturate(180%);
  border-radius:28px; padding:22px 20px;
  box-shadow:0 24px 64px rgba(9,20,40,0.14);
}
.modal .title{ font-size:22px; font-weight:800; margin:0 0 12px 0; text-align:center; }
.modal .row{ display:flex; align-items:center; gap:12px; padding:6px 0; }
.modal .step{
  width:44px; height:44px; border-radius:14px; border:none; cursor:pointer;
  background: var(--primary); color:#fff; font-size:22px; font-weight:800;
}
.modal input[type="range"]{
  flex:1; accent-color: var(--accent); height:4px;
}
.modal .actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:16px; }
.modal .actions .btn{ background: rgba(255,255,255,0.08); color: var(--text); border:1px solid var(--border);}
.modal .actions .btn.primary{ background: var(--primary); color:#fff; }

/* === iOS Picker (redesign minimale) === */
.ios-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.ios-picker-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ios-picker-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, var(--card) 0%, rgba(var(--card-rgb, 28, 32, 50), 0.98) 100%);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  max-width: 600px;
  margin: 0 auto;
}

.ios-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(var(--border-rgb, 255, 255, 255), 0.1);
}

.ios-picker-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.ios-picker-cancel,
.ios-picker-done {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.ios-picker-cancel:hover,
.ios-picker-done:hover {
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.1);
}

.ios-picker-cancel:active,
.ios-picker-done:active {
  transform: scale(0.96);
}

.ios-picker-body {
  padding: 32px 24px 40px;
}

/* Grid numpad stile iOS calculator */
.ios-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.ios-picker-value {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 56px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -1px;
}

.ios-picker-btn {
  aspect-ratio: 1;
  border: none;
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.08);
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ios-picker-btn:hover {
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.15);
  transform: scale(1.05);
}

.ios-picker-btn:active {
  transform: scale(0.95);
}

.ios-picker-btn.selected {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #0056b3));
  color: white;
  box-shadow: 0 4px 16px rgba(var(--primary-rgb, 0, 123, 255), 0.4);
}

/* Dark mode */
.dark .ios-picker-container {
  background: linear-gradient(180deg, rgba(28, 32, 50, 1) 0%, rgba(28, 32, 50, 0.98) 100%);
}

.dark .ios-picker-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Responsive */
@media (max-width: 480px) {
  .ios-picker-grid {
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }
  
  .ios-picker-value {
    font-size: 48px;
    min-height: 60px;
  }
  
  .ios-picker-btn {
    font-size: 20px;
  }
}

/* === Quiz Questions (Liquid Style) === */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.q-header .pill {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #0056b3));
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.q-header .small {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.q-stem {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  margin: 24px 0;
  font-weight: 500;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.opt-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  font-size: 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.opt-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb, 0, 123, 255), 0.1), transparent);
  transition: left 0.5s ease;
}

.opt-btn:hover::before {
  left: 100%;
}

.opt-btn:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(var(--primary-rgb, 0, 123, 255), 0.15);
}

.opt-btn:active {
  transform: translateX(4px) scale(0.98);
}

.opt-key {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #0056b3));
  color: white;
  border-radius: 50%;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb, 0, 123, 255), 0.3);
}

.opt-text {
  flex: 1;
  color: var(--text);
  line-height: 1.5;
}

/* Stati risposta */
.opt-btn.selected {
  background: rgba(0, 123, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.opt-btn.selected .opt-key {
  background: var(--primary);
  color: white;
}

.opt-btn.correct {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.08);
  animation: correctPulse 0.6s ease;
}

.opt-btn.correct .opt-key {
  background: linear-gradient(135deg, #28a745, #218838);
  box-shadow: 0 2px 12px rgba(40, 167, 69, 0.4);
}

.opt-btn.wrong {
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.08);
  animation: wrongShake 0.5s ease;
}

.opt-btn.wrong .opt-key {
  background: linear-gradient(135deg, #dc3545, #c82333);
  box-shadow: 0 2px 12px rgba(220, 53, 69, 0.4);
}

.opt-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.opt-btn.correct::after,
.opt-btn.wrong::after {
  content: '';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-size: contain;
  background-repeat: no-repeat;
}

.opt-btn.correct::after {
  content: '✓';
  color: #28a745;
  font-size: 24px;
  font-weight: bold;
}

.opt-btn.wrong::after {
  content: '✗';
  color: #dc3545;
  font-size: 24px;
  font-weight: bold;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

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

/* Responsive */
@media (max-width: 768px) {
  .q-stem {
    font-size: 16px;
  }
  
  .opt-btn {
    padding: 14px 16px;
    gap: 12px;
  }
  
  .opt-key {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 14px;
  }
  
  .opt-text {
    font-size: 15px;
  }
}

/* Dark mode adjustments */
.dark .opt-btn {
  background: rgba(255, 255, 255, 0.03);
}

.dark .opt-btn:hover {
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.12);
}

.dark .opt-btn.selected {
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.15);
}

/* Evidenzia risposta corretta in modalità 'Mostra soluzione' (non seleziona) */
.opt.correct-hint { outline: 2px dashed var(--accent); box-shadow: 0 0 0 3px rgba(90,200,250,.2) inset; }
.opt.correct-hint::after { content: "✓"; font-weight: 800; margin-left: 8px; }

/* Stile per i picker button */
.picker-btn {
  min-width: 80px;
  font-weight: 600;
  background: var(--card);
  border: 2px solid var(--primary);
  color: var(--primary);
  position: relative;
}

.picker-btn::after {
  content: '▾';
  margin-left: 8px;
  opacity: 0.6;
  font-size: 12px;
}

.picker-btn:hover {
  background: rgba(var(--primary-rgb, 0, 123, 255), 0.1);
  transform: translateY(-1px);
}

/* Pulsanti navigazione quiz */
.btnrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn.danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn.danger:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
  transform: translateY(-2px);
}

.btn.danger:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 480px) {
  .btnrow {
    flex-direction: column;
    width: 100%;
  }
  
  .btnrow .btn {
    width: 100%;
  }
  
  .btnrow .btn[style*="margin-left"] {
    margin-left: 0 !important;
    margin-top: 8px;
  }
}

/* === Soluzione === */
.solution-container {
  margin-top: 24px;
}

.solution-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 12px 20px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.solution-toggle .icon {
  font-size: 18px;
}

.solution-toggle:hover {
  background: linear-gradient(135deg, #218838, #1aa179);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
}

.solution-toggle.active {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

.solution-toggle.active:hover {
  background: linear-gradient(135deg, #c82333, #bd2130);
}

.solution-box {
  margin-top: 16px;
  padding: 20px;
  background: rgba(40, 167, 69, 0.05);
  border: 2px solid #28a745;
  border-radius: 12px;
  animation: solutionSlide 0.3s ease;
}

.solution-content {
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

@keyframes solutionSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark mode */
.dark .solution-box {
  background: rgba(40, 167, 69, 0.1);
  border-color: #20c997;
}

/* Responsive */
@media (max-width: 480px) {
  .solution-toggle {
    font-size: 14px;
    padding: 10px 16px;
  }
  
  .solution-box {
    padding: 16px;
  }
  
  .solution-content {
    font-size: 14px;
  }
}

/* === Riepilogo risultati === */
.results-summary {
  animation: fadeIn 0.5s ease;
}

.result-item {
  transition: transform 0.2s ease;
}

.result-item:hover {
  transform: translateX(4px);
}

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

/* Risposta selezionata (ma modificabile) */
.opt-btn.selected {
  background: rgba(0, 123, 255, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.opt-btn.selected .opt-key {
  background: var(--primary);
  color: white;
}

/* Hover sempre attivo per permettere cambio */
.opt-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.opt-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* Evidenzia risposta corretta quando soluzione visibile */
.opt-btn.correct-highlight {
  background: rgba(40, 167, 69, 0.15) !important;
  border-color: #28a745 !important;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2) !important;
}

.opt-btn.correct-highlight .opt-key {
  background: #28a745 !important;
  color: white !important;
}

/* === Settings Page Styles === */
.settings-card {
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.settings-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.settings-title h3 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
}

.settings-title p {
  margin: 0;
  opacity: 0.8;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.setting-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
}

.setting-item.danger-zone {
  background: rgba(220, 53, 69, 0.05);
  border-color: rgba(220, 53, 69, 0.3);
}

.setting-item.danger-zone:hover {
  background: rgba(220, 53, 69, 0.08);
  border-color: var(--err);
}

.setting-info {
  flex: 1;
  min-width: 0;
}

.setting-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--text);
}

.setting-desc {
  margin: 0;
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.4;
}

.setting-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.setting-btn .icon,
.setting-btn .flag {
  font-size: 18px;
}

.settings-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.info-item {
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.info-label {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* Links Section */
.links-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(0, 123, 255, 0.08);
  border: 1px solid rgba(0, 123, 255, 0.2);
  border-radius: 10px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.link-item:hover {
  background: rgba(0, 123, 255, 0.15);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.link-item .icon {
  font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
  .settings-header {
    flex-direction: column;
    text-align: center;
  }
  
  .setting-item {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .setting-btn {
    width: 100%;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .links-section {
    grid-template-columns: 1fr;
  }
}

/* Dark mode adjustments */
.dark .setting-item {
  background: rgba(255, 255, 255, 0.02);
}

.dark .setting-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* === Enhanced Lessons Page Styles === */

/* Hero Section */
.lessons-hero {
  background: linear-gradient(135deg, 
    rgba(0, 123, 255, 0.1) 0%, 
    rgba(90, 200, 250, 0.05) 50%, 
    rgba(124, 108, 246, 0.1) 100%);
  border-radius: 24px;
  padding: 40px 32px;
  margin-bottom: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.lessons-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(0,123,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 24px;
  box-shadow: 0 8px 32px rgba(0, 123, 255, 0.3);
}

.lessons-hero h2 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lessons-hero p {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 32px 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 24px;
  max-width: 500px;
  margin: 0 auto;
}

.hero-stats .stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Methodology Section */
.methodology-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.method-card {
  padding: 24px;
  border-radius: 16px;
  border: 2px solid;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.method-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s ease;
}

.method-card:hover::before {
  left: 100%;
}

.method-card.primary {
  background: rgba(0, 123, 255, 0.05);
  border-color: rgba(0, 123, 255, 0.2);
}

.method-card.secondary {
  background: rgba(255, 149, 0, 0.05);
  border-color: rgba(255, 149, 0, 0.2);
}

.method-card.tertiary {
  background: rgba(40, 167, 69, 0.05);
  border-color: rgba(40, 167, 69, 0.2);
}

.method-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--primary);
  color: white;
}

.method-card.secondary .method-icon {
  background: #ff9500;
}

.method-card.tertiary .method-icon {
  background: #28a745;
}

.method-content h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 700;
}

.method-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Enhanced Search */
.search-section {
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
}

.search-container {
  position: relative;
  max-width: 500px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--primary);
  z-index: 3;
}

.search-container input {
  width: 100%;
  padding: 16px 20px 16px 60px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.search-container input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
  transform: translateY(-2px);
}

.search-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.search-container input:focus + .search-bg {
  opacity: 0.05;
}

/* Professional Grid */
.subjects-grid-container {
  margin-bottom: 40px;
}

.grid-header {
  text-align: center;
  margin-bottom: 40px;
}

.grid-header h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--text);
}

.grid-header p {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
}

.subjects-professional-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 24px;
}

.subject-card-pro {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.subject-card-pro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.subject-card-pro.priority-high::before {
  background: linear-gradient(90deg, #dc3545, #ff6b6b);
}

.subject-card-pro.priority-medium::before {
  background: linear-gradient(90deg, #ff9500, #ffb347);
}

.subject-card-pro.priority-low::before {
  background: linear-gradient(90deg, #28a745, #5cb85c);
}

.subject-card-pro:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.subject-icon-pro {
  position: relative;
}

.icon-gradient {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.bio-gradient { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.chem-gradient { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.math-gradient { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.physics-gradient { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.logic-gradient { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.culture-gradient { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }

.priority-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.priority-badge.high {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.priority-badge.medium {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
  border: 1px solid rgba(255, 149, 0, 0.3);
}

.priority-badge.low {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.card-body h3 {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-weight: 800;
}

.card-body h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-body h3 a:hover {
  color: var(--primary);
}

.subject-weight {
  font-size: 14px;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 12px;
}

.subject-description {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 16px 0;
  font-size: 14px;
}

.subject-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.module-chip {
  padding: 4px 10px;
  background: rgba(0, 123, 255, 0.1);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(0, 123, 255, 0.2);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.difficulty-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stars {
  display: flex;
  gap: 2px;
}

.star {
  color: #ddd;
  font-size: 14px;
}

.star.filled {
  color: #ffd700;
}

.study-time {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.progress-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-bar-pro {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill-pro {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text-pro {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* Final Stats Section */
.final-stats-section {
  margin-top: 40px;
}

.stats-card {
  background: linear-gradient(135deg, 
    rgba(0, 123, 255, 0.05) 0%, 
    rgba(124, 108, 246, 0.05) 100%);
  border: 2px solid rgba(0, 123, 255, 0.1);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
}

.stats-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(0, 123, 255, 0.3);
}

.stats-content h3 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--text);
}

.stats-content p {
  color: var(--muted);
  margin: 0 0 24px 0;
  font-size: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.stats-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.stats-numbers .stat-item {
  text-align: center;
}

.stats-numbers .number {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.stats-numbers .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .lessons-hero {
    padding: 32px 24px;
  }
  
  .lessons-hero h2 {
    font-size: 24px;
  }
  
  .lessons-hero p {
    font-size: 16px;
  }
  
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .methodology-section {
    grid-template-columns: 1fr;
  }
  
  .subjects-professional-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-card {
    padding: 24px;
  }
  
  .stats-numbers {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .subject-card-pro {
    padding: 20px;
  }
  
  .card-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .hero-stats {
    grid-template-columns: 1fr;
  }
  
  .search-container input {
    padding: 14px 18px 14px 50px;
  }
}
