/* Patente B · Trucchi — design system (ui-ux-pro-max: friendly/rounded, indigo+green) */
:root {
  --primary: #4F46E5; --on-primary: #fff; --secondary: #818CF8;
  --accent: #16A34A; --bg: #EEF2FF; --surface: #ffffff; --surface-2: #F5F7FF;
  --fg: #312E81; --muted: #5B5F77; --border: #C7D2FE; --danger: #DC2626;
  --vero-bg: #E3F4E1; --vero-fg: #157F3B; --falso-bg: #FCE7E7; --falso-fg: #B3261E;
  --conf-bg: #ECEEF6; --conf-fg: #4A4E69;
  --r-lg: 22px; --r-md: 16px; --r-sm: 11px;
  --shadow: 0 2px 4px rgba(49,46,129,.06), 0 8px 24px rgba(49,46,129,.08);
  --shadow-sm: 0 1px 2px rgba(49,46,129,.06), 0 3px 10px rgba(49,46,129,.06);
  --maxw: 720px; --nav-h: 64px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) {
  --primary: #A5B4FC; --on-primary: #1E1B33; --secondary: #818CF8;
  --accent: #4ADE80; --bg: #15131F; --surface: #211E30; --surface-2: #2A2740;
  --fg: #ECEBFF; --muted: #A9A6C4; --border: #38344F; --danger: #F87171;
  --vero-bg: #1C3326; --vero-fg: #6EE7A0; --falso-bg: #3A2024; --falso-fg: #FCA5A5;
  --conf-bg: #2A2740; --conf-fg: #C3C0DC;
  --shadow: 0 2px 6px rgba(0,0,0,.3); --shadow-sm: 0 1px 4px rgba(0,0,0,.25);
} }
:root[data-theme=dark] {
  --primary: #A5B4FC; --on-primary: #1E1B33; --accent: #4ADE80;
  --bg: #15131F; --surface: #211E30; --surface-2: #2A2740; --fg: #ECEBFF;
  --muted: #A9A6C4; --border: #38344F; --danger: #F87171;
  --vero-bg: #1C3326; --vero-fg: #6EE7A0; --falso-bg: #3A2024; --falso-fg: #FCA5A5;
  --conf-bg: #2A2740; --conf-fg: #C3C0DC;
  --shadow: 0 2px 6px rgba(0,0,0,.3); --shadow-sm: 0 1px 4px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: Nunito, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Baloo 2", Nunito, system-ui, sans-serif; line-height: 1.2; margin: 0; }
a { color: inherit; text-decoration: none; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-family: "Baloo 2"; font-weight: 700; font-size: 20px;
}
.brand-name { font-family: "Baloo 2"; font-weight: 700; font-size: 18px; }
.brand-name em { color: var(--muted); font-style: normal; font-weight: 600; }

.icon-btn {
  min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-select { min-height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg); font-family: inherit; font-size: 14px;
  padding: 0 8px; cursor: pointer; }
[dir="rtl"] .app, [dir="rtl"] .hero, [dir="rtl"] .card { text-align: right; }
[dir="rtl"] .back, [dir="rtl"] .tile, [dir="rtl"] .c-head, [dir="rtl"] .cr-top { flex-direction: row-reverse; }

/* layout */
.app { max-width: var(--maxw); margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.page-title { font-size: 26px; margin: 6px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 18px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); min-height: 40px; font-weight: 600; }
.back:hover { color: var(--fg); }

/* hero */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.hero h1 { font-size: 27px; }
.hero p { color: var(--muted); margin: 8px 0 0; }
.hero .promise { color: var(--fg); font-weight: 700; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 4px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px; text-align: center; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-family: "Baloo 2"; font-size: 22px; color: var(--primary); }
.stat span { font-size: 12.5px; color: var(--muted); }

/* grids & cards */
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .grid.two { grid-template-columns: repeat(2, 1fr); } }
.tile {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-sm); cursor: pointer; min-height: 64px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.tile:active { transform: scale(.99); }
.tile .t-ico { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--surface-2);
  color: var(--primary); display: grid; place-items: center; }
.tile .t-ico svg { width: 22px; height: 22px; }
.tile .t-main { min-width: 0; flex: 1; }
.tile .t-main b { font-family: "Baloo 2"; font-weight: 600; font-size: 16px; display: block; }
.tile .t-main span { font-size: 13px; color: var(--muted); }
.tile .t-num { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 15px 17px; box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.card .c-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 { font-size: 16.5px; font-weight: 600; }
.card h3.cue { font-size: 20px; font-weight: 700; letter-spacing: .4px; }
.card .trick { margin: 8px 0 0; }
.card ul { margin: 8px 0 0; padding-left: 20px; }
.card li { margin: 3px 0; }
.card .quiz { margin: 10px 0 0; font-size: 13.5px; color: var(--muted);
  background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 11px; }
.card .quiz b { color: var(--fg); }
.card.withsign { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: start; }
.card .cbody { min-width: 0; }
.psign { width: 84px; height: 84px; flex: none; background: var(--surface-2); border-radius: var(--r-md);
  background-size: 74%; background-repeat: no-repeat; background-position: center; }
.qbadge { display: inline-block; margin: 7px 0 9px; font-size: 12.5px; font-weight: 700;
  color: var(--primary); background: var(--surface-2); border-radius: 999px; padding: 3px 11px; }
button.qbadge { border: 1px solid var(--border); cursor: pointer; font-family: inherit; min-height: 30px;
  display: inline-flex; align-items: center; gap: 5px; -webkit-tap-highlight-color: transparent; }
button.qbadge:hover { background: var(--surface); }
.qbadge .chev { transition: transform .18s ease; font-size: 10px; }
.qbadge.open .chev { transform: rotate(180deg); }
.qpanel { margin: 2px 0 10px; }
.qhead { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .4px; margin: 0 0 4px; display: flex; align-items: center; gap: 9px; }
.qpsign { flex: none; width: 46px; height: 46px; background-size: contain; background-repeat: no-repeat;
  background-position: center; }
.qfignote { font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 11px; margin: 0 0 8px; line-height: 1.5; }
.figtag { display: inline-block; margin-left: 8px; font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; }
.qitem { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.qa { flex: none; font-size: 11px; font-weight: 800; padding: 3px 0; border-radius: 6px; width: 52px;
  text-align: center; letter-spacing: .5px; }
.qa.vero { background: var(--vero-bg); color: var(--vero-fg); }
.qa.falso { background: var(--falso-bg); color: var(--falso-fg); }
.qtext { min-width: 0; }
.qit { line-height: 1.5; font-size: 14.5px; }
.qtr { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.qloading { color: var(--muted); padding: 8px 0; font-size: 13.5px; }
.qtabs { display: flex; gap: 8px; margin: 2px 0 4px; }
.qtab { cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  min-height: 32px; -webkit-tap-highlight-color: transparent; }
.qtab.active[data-vf="falso"] { background: var(--falso-bg); color: var(--falso-fg); border-color: transparent; }
.qtab.active[data-vf="vero"] { background: var(--vero-bg); color: var(--vero-fg); border-color: transparent; }
.qmore { display: block; width: 100%; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 700;
  color: var(--primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px; margin-top: 10px; min-height: 44px; }
.qmore:hover { background: var(--surface); }
[dir="rtl"] .qtr, [dir="rtl"] .qit { text-align: right; }
.card h3.big { font-size: 19px; font-weight: 700; line-height: 1.2; }
.itterm { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.itterm span { font-size: 10px; font-weight: 700; color: var(--primary); background: var(--surface-2);
  border-radius: 5px; padding: 1px 5px; letter-spacing: .5px; }
.examnote { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 13px; font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.word { margin: 9px 0 0; font-size: 13.5px; color: var(--muted); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 7px 11px; }
.word b { color: var(--fg); }
@media (max-width: 460px) { .card.withsign { grid-template-columns: 70px 1fr; } .psign { width: 70px; height: 70px; } }
.card .meta { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); display: flex; gap: 7px; align-items: center; }
.card .meta svg { width: 15px; height: 15px; flex: none; color: var(--accent); }
.tile .t-num svg { width: 20px; height: 20px; }

/* badges */
.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.vero { background: var(--vero-bg); color: var(--vero-fg); }
.badge.falso { background: var(--falso-bg); color: var(--falso-fg); }
.badge.conf { background: var(--conf-bg); color: var(--conf-fg); }
button.badge { cursor: pointer; font-family: inherit; border: none; display: inline-flex; align-items: center;
  gap: 5px; min-height: 28px; -webkit-tap-highlight-color: transparent; }
button.badge:hover { filter: brightness(0.97); }
.badge .chev { font-size: 9px; transition: transform .18s ease; }
.badge.open .chev { transform: rotate(180deg); }
.pill { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--surface-2);
  border-radius: 999px; padding: 3px 10px; }

/* audio button */
.play {
  flex: none; min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--primary); display: grid; place-items: center; cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}
.play:hover { background: var(--primary); color: var(--on-primary); }
.play:active { transform: scale(.92); }
.play svg { width: 19px; height: 19px; }
.play.playing { background: var(--primary); color: var(--on-primary); }

/* search */
.search-wrap { position: relative; margin-bottom: 16px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
#q {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  color: var(--fg); padding: 12px 14px 12px 44px; font-size: 16px; font-family: inherit; outline: none;
}
#q:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.empty { color: var(--muted); text-align: center; padding: 36px 12px; }

/* coverage */
.cov-hero { text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 26px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.cov-hero .big { font-family: "Baloo 2"; font-size: 40px; color: var(--accent); }
.cov-hero .lab { color: var(--muted); }
.bar { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.cov-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 13px; margin-bottom: 8px; }
.cov-row .cr-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.cov-row .cr-top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }

/* bottom nav */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 700; min-height: var(--nav-h);
}
.bottomnav a.active { color: var(--primary); }
.bottomnav .nav-ico svg { width: 24px; height: 24px; }

.disclaimer { margin: 22px 4px 0; font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* audio availability + toast (W-024) */
.play.noaudio { opacity: .4; }
#toast { position: fixed; left: 50%; bottom: calc(70px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  max-width: 86%; background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 13.5px;
  line-height: 1.45; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.3); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 9999; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[dir="rtl"] .itterm, [dir="rtl"] .word, [dir="rtl"] .trick, [dir="rtl"] .big, [dir="rtl"] .qtr { text-align: right; }

/* W-009 freemium / paywall */
.tile.locked { opacity: .92; }
.tile.locked .t-ico { background: var(--surface-2); color: var(--muted); }
.freebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }
.freebar span { display: inline-flex; align-items: center; gap: 7px; }
.freebar svg { width: 16px; height: 16px; }
.freebar a { font-weight: 800; color: var(--primary); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 13px; white-space: nowrap; }
.paywall-card { display: flex; align-items: center; gap: 12px; border-style: dashed; }
.paywall-card .pw-ico { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--surface-2);
  color: var(--primary); display: grid; place-items: center; }
.paywall-card .pw-ico svg { width: 22px; height: 22px; }
.paywall-card b { display: block; }
.paywall-card .pw-sub { font-size: 13px; color: var(--muted); }
.pw-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 24px 20px; box-shadow: var(--shadow); text-align: center; margin-top: 8px; }
.pw-badge { width: 60px; height: 60px; margin: 0 auto 6px; border-radius: 50%; background: var(--surface-2);
  color: var(--primary); display: grid; place-items: center; }
.pw-badge svg { width: 30px; height: 30px; }
.pw-badge.ok { background: var(--vero-bg); color: var(--vero-fg); }
.pw-hero .page-title, .pw-hero .page-sub { text-align: center; }
.pw-list { list-style: none; padding: 0; margin: 18px auto; max-width: 360px; text-align: left; display: grid; gap: 9px; }
.pw-list li { display: flex; align-items: flex-start; gap: 9px; font-size: 14.5px; }
.pw-list svg { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 2px; }
.btn-primary { width: 100%; max-width: 360px; border: none; cursor: pointer; font-family: inherit; font-weight: 800;
  font-size: 16px; color: var(--on-primary); background: var(--primary); border-radius: 14px; padding: 14px 18px;
  min-height: 52px; -webkit-tap-highlight-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .6; }
.pw-have { margin: 16px 0 6px; font-size: 13px; color: var(--muted); }
.pw-redeem { display: flex; gap: 8px; max-width: 360px; margin: 0 auto; }
.pw-redeem input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  color: var(--fg); font-family: inherit; font-size: 14px; padding: 0 12px; min-height: 46px; }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); color: var(--primary); cursor: pointer;
  font-family: inherit; font-weight: 700; border-radius: 12px; padding: 0 16px; min-height: 46px; white-space: nowrap; }
.pw-fine { font-size: 12px; color: var(--muted); margin-top: 16px; }
.home-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--on-primary);
  border-radius: var(--r-md); padding: 14px 16px; margin: 14px 0; font-weight: 700; }
.home-cta a { background: rgba(255,255,255,.18); border-radius: 999px; padding: 8px 15px; font-weight: 800; white-space: nowrap; }
[dir="rtl"] .pw-list { text-align: right; }

/* W-009 legal links + consent */
.pw-consent { font-size: 12px; color: var(--muted); margin: 10px auto 0; max-width: 360px; line-height: 1.5; }
.pw-consent a { color: var(--primary); font-weight: 700; }
.disclaimer .legal-links { display: block; margin-top: 8px; }
.disclaimer .legal-links a { color: var(--primary); font-weight: 700; }
