/* ==========================================================================
   Bottega — Pomodoro d'arte
   Tema: museo notturno. Pareti damascate, cornici dorate intagliate,
   lampade da quadro in ottone, targhette incise, parquet.
   ========================================================================== */

:root {
  --ink: #0d0907;
  --ink-2: #16100c;
  --ivory: #f1e7d3;
  --ivory-dim: #b9ab92;
  --muted: #8d7f69;
  --gold-1: #f6e29b;
  --gold-2: #d4af5f;
  --gold-3: #a47c32;
  --gold-4: #6b4b18;
  --oxblood: #4a1a1f;
  --line: rgba(var(--accent-rgb), .22);
  --card: rgba(var(--surface-rgb), .72);
  --serif: "Cormorant Garamond", "Cormorant", "Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* —— tema (Oro antico, predefinito) —— */
  --ink-rgb: 13, 9, 7;
  --surface-rgb: 30, 22, 17;
  --surface-hi-rgb: 44, 32, 24;
  --surface-lo-rgb: 18, 13, 10;
  --surface-solid: #1e1611;
  --sheet-a: #1d1510;
  --sheet-b: #120c09;
  --tint-rgb: 255, 255, 255;
  --field: rgba(0,0,0,.35);
  --gold-0: #fbe9a8;
  --accent-rgb: 212, 175, 95;
  --accent-hi-rgb: 246, 226, 155;
  --accent-text: var(--gold-1);
  --accent-text-2: var(--gold-2);
  --on-accent: #2a1b06;
  --danger: #f0a09a;
  --studio-wall: #1c1411;
  --studio-wall-break: #121a1c;
  --time-a: #fff8e2;
  --time-b: #f1e2b6;
  color-scheme: dark;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  --plaster: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='4' seed='7'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .9  0 0 0 0 .8  0 0 0 .09 0'/></filter><rect width='100%25' height='100%25' filter='url(%23p)'/></svg>");
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
body {
  background: var(--ink);
  color: var(--ivory);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-text-2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: rgba(var(--tint-rgb),.07); padding: 1px 5px; border-radius: 4px; }

/* ---------- Bottoni ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: 999px; padding: 12px 22px;
  font-weight: 600; letter-spacing: .02em; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; transition: transform .15s, filter .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.gold {
  color: var(--on-accent);
  background: linear-gradient(180deg, #fbe9a8 0%, #e2bd66 45%, #b88a36 55%, #e6c676 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -2px 4px rgba(90,60,10,.4) inset, 0 8px 22px -6px rgba(var(--accent-rgb), .55), 0 2px 4px rgba(0,0,0,.6);
  text-shadow: 0 1px 0 rgba(255,245,210,.6);
}
.btn.gold:hover { filter: brightness(1.06); }
.btn.ghost { background: rgba(var(--tint-rgb),.05); border: 1px solid var(--line); color: var(--ivory); }
.btn.big { font-family: var(--serif); font-size: 24px; padding: 12px 44px; min-width: 170px; }
.btn.round { width: 52px; height: 52px; padding: 0; font-size: 18px; }

/* ==========================================================================
   Login / installazione
   ========================================================================== */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(ellipse 60% 45% at 50% 0%, rgba(255,214,150,.22), transparent 70%),
    var(--plaster),
    radial-gradient(ellipse at 50% 120%, #000 10%, transparent 60%),
    linear-gradient(#2a1215, #1a0b0d);
}
.wall-light { position: fixed; inset: 0; pointer-events: none; background: var(--noise); opacity: .18; mix-blend-mode: overlay; }
.auth-card {
  position: relative; width: min(420px, 100%); padding: 34px 28px 28px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(var(--surface-rgb),.92), rgba(var(--surface-rgb),.95));
  border: 1px solid var(--line);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.6);
  text-align: center;
}
.auth-card.install { width: min(560px, 100%); text-align: left; }
.auth-card h1 { font-family: var(--serif); font-weight: 600; font-size: 44px; margin: 6px 0 0; text-align: center; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff4c9, #d4af5f 55%, #8a6424); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card .lead { margin: 0 0 18px; color: var(--ivory-dim); font-family: var(--serif); font-style: italic; font-size: 19px; text-align: center; }
.crest {
  width: 66px; height: 66px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  font: 600 36px var(--serif); color: var(--on-accent);
  background: radial-gradient(circle at 35% 30%, #fff3c4, #d4af5f 45%, #7a5820 100%);
  box-shadow: inset 0 -3px 6px rgba(60,40,5,.5), inset 0 2px 3px rgba(255,255,255,.6), 0 10px 25px rgba(0,0,0,.6);
}
.auth-quote { font-family: var(--serif); font-size: 18px; font-style: italic; color: var(--ivory-dim); margin: 0 0 20px; }
.auth-quote cite { display: block; font-size: 13px; font-style: normal; color: var(--muted); margin-top: 6px; font-family: var(--sans); }
.auth-card label, .sheet label { display: block; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 0; }
.auth-card input, .sheet input[type=number], .link-form input {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 10px; background: var(--field);
  border: 1px solid rgba(var(--tint-rgb),.08); color: var(--ivory); outline: none; font-size: 16px; text-transform: none; letter-spacing: 0;
}
.auth-card input:focus, .sheet input:focus, .link-form input:focus { border-color: var(--gold-3); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.who { display: flex; gap: 10px; justify-content: center; margin-bottom: 4px; }
.who-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; cursor: pointer;
  border-radius: 12px; background: rgba(var(--tint-rgb),.04); border: 1px solid rgba(var(--tint-rgb),.06);
}
.who-btn.on { border-color: var(--accent-text-2); background: rgba(var(--accent-rgb), .08); }
.avatar, .avatar-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 600 20px var(--serif); color: var(--on-accent);
  background: radial-gradient(circle at 35% 30%, #fff3c4, #d4af5f 50%, #8a6424);
}
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; padding: 4px 14px 14px; }
legend { padding: 0 6px; color: var(--accent-text-2); font-family: var(--serif); font-size: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.notice { padding: 10px 12px; border-radius: 10px; background: rgba(var(--tint-rgb),.05); }
.notice.err { background: rgba(170,40,40,.18); border: 1px solid rgba(220,80,80,.3); }
.notice.ok { background: rgba(60,140,80,.18); border: 1px solid rgba(90,180,110,.3); }
.steps { color: var(--ivory-dim); }
pre.code { white-space: pre-wrap; font-size: 12px; background: #000; padding: 10px; border-radius: 8px; }

/* ==========================================================================
   App shell
   ========================================================================== */
body.app {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 40% at 50% -5%, rgba(255,205,140,.10), transparent 70%),
    var(--ink);
}
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(180deg, rgba(var(--ink-rgb),.95), rgba(var(--ink-rgb),.75));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(var(--accent-rgb), .1);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 18px var(--serif); color: var(--on-accent);
  background: radial-gradient(circle at 35% 30%, #fff3c4, #d4af5f 50%, #7a5820); }
.brand-name { font: 600 22px var(--serif); letter-spacing: .06em; }
.today-chip { font-size: 12px; color: var(--accent-text-2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.avatar-btn { border: 0; cursor: pointer; width: 34px; height: 34px; font-size: 17px; }

main#views { padding-bottom: calc(90px + var(--safe-b)); }
.view { display: none; animation: fadeIn .35s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + var(--safe-b));
  background: linear-gradient(180deg, rgba(var(--surface-lo-rgb),.82), rgba(var(--surface-lo-rgb),.96));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(var(--accent-rgb), .14);
}
.tab { background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--muted); padding: 6px 0; border-radius: 12px; transition: color .2s; }
.tab .ti { font-size: 19px; line-height: 1.1; }
.tab.on { color: var(--accent-text); text-shadow: 0 0 12px rgba(var(--accent-hi-rgb), .35); }
.section-title { font: 600 30px var(--serif); margin: 22px 18px 10px; }
.sub-title { font: 600 20px var(--serif); margin: 22px 18px 8px; color: var(--ivory-dim); }

/* ---------- Pillole modalità ---------- */
.mode-pills { display: flex; gap: 6px; justify-content: center; padding: 14px 12px 4px; }
.pill { border: 1px solid transparent; background: rgba(var(--tint-rgb),.04); color: var(--ivory-dim); padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.pill.on { color: var(--accent-text); border-color: var(--line); background: rgba(var(--accent-rgb), .1); }

.import-banner { margin: 10px 16px 0; padding: 12px 14px; border-radius: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, rgba(var(--accent-rgb), .15), rgba(var(--accent-rgb), .04)); border: 1px solid var(--line); font-size: 14px; }

/* ==========================================================================
   Il palcoscenico: parete, lampada, cornice, targhetta
   ========================================================================== */
.stage { padding: 6px 0 0; }
.wall {
  --wall: var(--studio-wall);
  position: relative; margin: 8px 12px 0; padding: 46px 16px 26px; border-radius: 22px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  background:
    radial-gradient(ellipse 55% 70% at 50% 8%, rgba(255,222,165,.30), rgba(255,210,150,.08) 45%, transparent 70%),
    var(--plaster),
    radial-gradient(ellipse at 50% 120%, rgba(0,0,0,.65), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--wall) 85%, #fff 4%), var(--wall));
  box-shadow: inset 0 0 80px rgba(0,0,0,.65), inset 0 1px 0 rgba(var(--tint-rgb),.04);
  transition: background .8s;
}
.wall::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .14; mix-blend-mode: overlay; pointer-events: none; }
body.mode-short .wall, body.mode-long .wall { --wall: var(--studio-wall-break); }

/* Lampada da quadro in ottone */
.picture-light { position: relative; z-index: 3; width: 46%; max-width: 220px; height: 12px; margin-bottom: 14px; }
.picture-light span {
  position: absolute; inset: 0; border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #fff1b8 0%, #caa253 35%, #7b5a1f 70%, #b8914a 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.6), 0 8px 16px -6px rgba(255,220,150,.6);
}
.picture-light::before, .picture-light::after {
  content: ""; position: absolute; top: -26px; width: 4px; height: 30px; border-radius: 2px;
  background: linear-gradient(90deg, #6b4b18, #e7c977, #6b4b18);
  box-shadow: 1px 2px 3px rgba(0,0,0,.6);
}
.picture-light::before { left: 22%; transform: rotate(-8deg); }
.picture-light::after { right: 22%; transform: rotate(8deg); }
.cone {
  position: absolute; z-index: 2; top: 56px; left: 50%; width: 120%; max-width: 640px; height: 62%; transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255,230,175,.16), rgba(255,220,160,.03) 70%, transparent);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); filter: blur(18px); mix-blend-mode: screen; pointer-events: none;
}

/* Cornice dorata intagliata */
.frame {
  --fw: 18px;
  position: relative; z-index: 1; display: inline-block; margin: 0; padding: var(--fw);
  background:
    linear-gradient(145deg, #5e4214 0%, #f4dc8c 16%, #b48a3a 30%, #fff0b5 44%, #a37a2c 58%, #ecd17f 76%, #4e360f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,240,190,.55),
    inset 0 0 0 3px #6b4b18,
    inset 0 0 0 5px #e2c06e,
    inset 0 0 0 7px #7d5a1e,
    inset 3px 3px 4px 8px rgba(255,236,170,.22),
    inset -4px -4px 8px 8px rgba(35,20,4,.5),
    0 1px 0 #3a2a0c,
    0 26px 38px -10px rgba(0,0,0,.85),
    0 55px 90px -25px rgba(0,0,0,.7);
  border-radius: 3px;
}
/* fila di perle intagliate */
.frame::before {
  content: ""; position: absolute; inset: 7px; padding: 4px; border-radius: 2px; pointer-events: none;
  background: radial-gradient(circle at 40% 38%, #fff6cf 0 1.1px, #d9b764 1.7px, #6e4f19 2.6px, transparent 3px) 0 0 / 7px 7px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: .9;
}
/* riflesso della luce sull'oro */
.frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 3px;
  background: linear-gradient(118deg, rgba(255,255,255,.45), transparent 26%, transparent 64%, rgba(0,0,0,.32));
  mix-blend-mode: overlay;
}
.liner {
  position: relative; padding: 7px;
  background: linear-gradient(135deg, #f2e8cf, #cbbb94);
  box-shadow: inset 0 0 0 1px rgba(60,40,10,.35), inset 0 3px 7px rgba(0,0,0,.4);
}
.liner::before { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .35; mix-blend-mode: multiply; pointer-events: none; }
.artwork {
  position: relative; overflow: hidden; line-height: 0; background: #d8cdb4;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.artwork img { display: block; max-width: 100%; transition: filter 1.2s ease; }
/* trama della tela + vernice */
.artwork::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background:
    var(--noise),
    repeating-linear-gradient(0deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(var(--tint-rgb),.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: .55;
  box-shadow: inset 0 0 50px rgba(25,12,0,.38);
}
.sheen {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255,250,230,.28) 50%, transparent 62%);
  transform: translateX(-130%);
}
.sheen.run { animation: sheen 2.4s .5s ease-in-out; }
@keyframes sheen { to { transform: translateX(130%); } }

/* Il cavalletto dello Studio */
#artwork { width: min(calc(100vw - 110px), 420px); }
#artwork img { width: 100%; height: 100%; object-fit: cover; }
#veil { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; }
.placeholder {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; line-height: 1.35;
  background:
    var(--noise),
    repeating-linear-gradient(0deg, rgba(90,70,40,.08) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(90,70,40,.08) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, #efe4c9, #cdbf9f);
  color: #5b4a30;
}
.ph-title { font: italic 600 30px var(--serif); }
.ph-sub { font-size: 13px; margin-top: 8px; max-width: 240px; }

/* Targhetta in ottone */
.plaque {
  position: relative; z-index: 3; margin-top: 22px; min-width: 200px; max-width: 92%; padding: 9px 22px 10px; text-align: center; border-radius: 3px;
  background: linear-gradient(180deg, #f1dfa6 0%, #c9a65c 48%, #b08c45 52%, #dcc283 100%);
  color: #2e1f08; box-shadow: 0 4px 10px rgba(0,0,0,.6), inset 0 0 0 1px rgba(90,60,15,.6), inset 0 1px 0 rgba(255,255,255,.6);
}
.plaque::before, .plaque::after {
  content: ""; position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5cc, #8a6424 70%); box-shadow: 0 1px 1px rgba(0,0,0,.5);
}
.plaque::before { left: 7px; } .plaque::after { right: 7px; }
.pl-title { font: 700 17px/1.2 var(--serif); letter-spacing: .02em; text-shadow: 0 1px 0 rgba(255,245,210,.6); }
.pl-sub { font: 500 12px/1.3 var(--sans); color: #4b3714; margin-top: 2px; }
.plaque.large { margin-top: 26px; padding: 12px 28px; }
.plaque.large .pl-title { font-size: 22px; }
.plaque.large .pl-sub { font-size: 13px; }

/* ---------- Timer ---------- */
.timer-block { text-align: center; padding: 10px 18px 0; }
.time {
  font: 600 clamp(68px, 20vw, 112px)/1 var(--serif); letter-spacing: .02em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #fff8e2 0%, #f1e2b6 45%, #c9a65c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 18px rgba(var(--accent-rgb), .18));
}
.progress { height: 3px; margin: 6px auto 0; max-width: 320px; background: rgba(var(--tint-rgb),.07); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); box-shadow: 0 0 10px rgba(var(--accent-hi-rgb), .6); transition: width .5s linear; }
.rounds { display: flex; justify-content: center; gap: 8px; margin: 12px 0 2px; }
.rounds i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--gold-3); }
.rounds i.on { background: radial-gradient(circle at 35% 35%, #fff1b8, #c9a65c); border-color: transparent; box-shadow: 0 0 8px rgba(var(--accent-hi-rgb), .5); }
.subject-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 8px; max-width: 460px; margin: 14px auto 0; }
.subject-row label { min-width: 0; display: flex; flex-direction: column; text-align: left; background: rgba(var(--tint-rgb),.04); border: 1px solid rgba(var(--tint-rgb),.06); border-radius: 12px; padding: 6px 12px; }
.subject-row span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.subject-row input, .subject-row select { width: 100%; min-width: 0; background: none; border: 0; outline: none; padding: 2px 0; font-size: 15px; color: var(--ivory); -webkit-appearance: none; appearance: none; }
.subject-row select option { background: var(--surface-solid); }
.controls { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 18px 0 6px; }

.quote-card {
  margin: 22px 18px 8px; padding: 18px 20px; border-radius: 16px; position: relative;
  background: linear-gradient(180deg, rgba(var(--surface-hi-rgb),.6), rgba(var(--surface-lo-rgb),.6)); border: 1px solid rgba(var(--accent-rgb), .12);
  font-family: var(--serif); text-align: center; transition: opacity .6s;
}
.quote-card::before { content: "“"; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font: 600 64px/1 var(--serif); color: var(--gold-3); }
.quote-card p { margin: 6px 0 0; font-size: 20px; font-style: italic; line-height: 1.35; }
.quote-card cite { display: block; margin-top: 8px; font: 500 12px var(--sans); color: var(--muted); font-style: normal; letter-spacing: .03em; }

.break-panel { margin: 10px 18px; }
.tip { text-align: center; color: var(--accent-text); font-family: var(--serif); font-size: 19px; margin: 6px 0 14px; }
.flashcard { text-align: center; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.fc-head { font: 600 20px var(--serif); margin-bottom: 10px; }
.fc-img img { max-width: 100%; max-height: 260px; border-radius: 4px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.fc-answer { margin-top: 10px; font-family: var(--serif); font-size: 18px; }
.flashcard .btn { margin-top: 12px; }

/* ==========================================================================
   Overlay: opera completata / dettaglio
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse 70% 55% at 50% 10%, rgba(255,215,150,.20), transparent 65%), #070504;
  animation: fadeIn .4s ease;
}
.overlay .frame.big { max-width: calc(100vw - 32px); }
.overlay .frame.big .artwork img { max-height: 56vh; max-width: min(calc(100vw - 92px), 900px); width: auto; height: auto; }
.acq-inner, .detail-inner { min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: calc(40px + var(--safe-t)) 18px calc(40px + var(--safe-b)); }
.detail-inner { padding-top: calc(70px + var(--safe-t)); }
.acq-kicker { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--accent-text-2); margin-bottom: 26px; }
.acq-inner .frame { animation: hang 1.1s cubic-bezier(.2,.8,.2,1); }
@keyframes hang { from { transform: translateY(-30px) scale(.9); opacity: 0; filter: brightness(.3); } 60% { filter: brightness(1.15); } to { transform: none; opacity: 1; filter: none; } }
.acq-desc { max-width: 560px; text-align: center; color: var(--ivory-dim); font-family: var(--serif); font-size: 18px; }
.acq-actions { margin-top: 16px; }
.close { position: fixed; top: calc(12px + var(--safe-t)); right: 14px; z-index: 5; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0,0,0,.6); color: var(--ivory); font-size: 24px; cursor: pointer; }
.detail-text { max-width: 640px; width: 100%; margin-top: 24px; }
.detail-text h2 { font: 600 32px/1.15 var(--serif); margin: 0; }
.dt-meta { color: var(--accent-text-2); margin-top: 6px; }
.dt-desc { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ivory-dim); }
.dt-extract { line-height: 1.65; color: #d9ceb9; }
.dt-foot { margin-top: 18px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }

/* ==========================================================================
   Museo: sale con pareti damascate e parquet
   ========================================================================== */
.museum-head { text-align: center; padding: 24px 18px 6px; }
.museum-head h2 { font: 600 34px var(--serif); margin: 0; }
.museum-head p { margin: 4px 0 0; color: var(--muted); }
.rooms { padding: 10px 0; }
.room { position: relative; margin: 18px 10px 28px; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(0,0,0,.9); }
.room-wall {
  --wall: #4a1a1f;
  position: relative;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255,215,160,.18), transparent 70%),
    radial-gradient(ellipse 14px 24px at 50% 50%, rgba(255,215,170,.07) 55%, transparent 60%) 0 0 / 56px 84px,
    radial-gradient(ellipse 14px 24px at 50% 50%, rgba(255,215,170,.07) 55%, transparent 60%) 28px 42px / 56px 84px,
    radial-gradient(circle at 50% 50%, rgba(0,0,0,.22) 0 2px, transparent 3px) 14px 21px / 28px 42px,
    linear-gradient(180deg, color-mix(in srgb, var(--wall) 90%, #fff 6%), var(--wall) 70%, color-mix(in srgb, var(--wall) 70%, #000));
}
.room-wall::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .16; mix-blend-mode: overlay; pointer-events: none; }
.room-title {
  position: relative; z-index: 2; display: table; margin: 0 auto; padding: 8px 20px 6px; text-align: center;
  font: 600 13px var(--sans); letter-spacing: .28em; text-transform: uppercase; color: #f2e3b8;
  border-bottom: 1px solid rgba(242,227,184,.35);
}
.room-title small { display: block; letter-spacing: .1em; font-weight: 500; color: rgba(242,227,184,.6); text-transform: none; font-size: 12px; }
.room-row { position: relative; z-index: 2; display: flex; gap: 46px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 26px 30px 34px; align-items: flex-start; scrollbar-width: none; }
.room-row::-webkit-scrollbar { display: none; }
.hung { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; scroll-snap-align: center; cursor: pointer; position: relative; }
.hung .picture-light { width: 60%; margin-bottom: 10px; height: 9px; }
.hung .picture-light::before, .hung .picture-light::after { top: -16px; height: 18px; }
.hung .glow { position: absolute; top: 12px; left: 50%; width: 160%; height: 100%; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(ellipse 50% 45% at 50% 30%, rgba(255,225,170,.26), transparent 70%); mix-blend-mode: screen; }
.hung .frame { --fw: 13px; transition: transform .35s ease; }
.hung:hover .frame { transform: translateY(-3px) scale(1.015); }
.hung .artwork img { height: clamp(130px, 24vh, 260px); width: auto; max-width: 56vw; }
.hung .plaque { margin-top: 16px; min-width: 150px; max-width: 220px; padding: 6px 16px 7px; }
.hung .plaque .pl-title { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hung .plaque .pl-sub { font-size: 11px; }
.baseboard { height: 14px; background: linear-gradient(180deg, #2a1a10, #120a05); box-shadow: 0 -2px 6px rgba(0,0,0,.5); position: relative; z-index: 2; }
.floor {
  height: 54px; position: relative;
  background:
    linear-gradient(180deg, rgba(255,210,150,.16), transparent 50%, rgba(0,0,0,.5)),
    repeating-linear-gradient(90deg, #5c3b22 0 46px, #2c1a0d 46px 48px, #6a462a 48px 92px, #2c1a0d 92px 94px, #4f321c 94px 140px, #2c1a0d 140px 142px),
    #4a2f1a;
}
.floor::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .3; mix-blend-mode: overlay; }

.empty { text-align: center; padding: 40px 30px; color: var(--ivory-dim); font-family: var(--serif); font-size: 19px; }
.empty-frame { width: 160px; height: 200px; margin: 0 auto 20px; border: 14px solid #b48a3a; border-image: linear-gradient(145deg, #5e4214, #f4dc8c, #a37a2c, #ecd17f, #4e360f) 1; background: rgba(0,0,0,.4); box-shadow: 0 20px 40px rgba(0,0,0,.7); }

/* ==========================================================================
   Suoni
   ========================================================================== */
.mixer { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 0 16px; }
.snd {
  position: relative; padding: 14px; border-radius: 16px; cursor: pointer; user-select: none; overflow: hidden;
  background: linear-gradient(160deg, rgba(var(--surface-hi-rgb),.85), rgba(var(--surface-lo-rgb),.85)); border: 1px solid rgba(var(--tint-rgb),.06); transition: border-color .3s, box-shadow .3s;
}
.snd.on { border-color: var(--gold-3); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), .2), 0 10px 30px -10px rgba(var(--accent-rgb), .35); }
.snd .icon { font-size: 26px; color: var(--accent-text-2); }
.snd .name { font-weight: 600; margin-top: 4px; }
.snd input[type=range] { width: 100%; margin-top: 10px; }
.snd .eq { position: absolute; right: 12px; top: 14px; display: flex; gap: 2px; align-items: flex-end; height: 16px; opacity: 0; transition: opacity .3s; }
.snd.on .eq { opacity: 1; }
.snd .eq i { width: 3px; background: var(--gold-2); animation: eq 1s infinite ease-in-out; border-radius: 2px; }
.snd .eq i:nth-child(2) { animation-delay: .2s; } .snd .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 16px; } }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: rgba(var(--tint-rgb),.12); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #c9a65c 60%, #7a5820); box-shadow: 0 2px 6px rgba(0,0,0,.6); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, #c9a65c 60%, #7a5820); }
.master { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; color: var(--ivory-dim); font-size: 14px; }
.master input { flex: 1; }
.players { padding: 0 16px; display: grid; gap: 12px; }
.player { border-radius: 14px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.player iframe { display: block; width: 100%; border: 0; }
.link-form { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 16px 0; }
.links { padding: 8px 16px 0; display: grid; gap: 8px; }
.link-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid rgba(var(--tint-rgb),.05); }
.link-item .lk-badge { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.lk-badge.yt { background: #c4302b; color: #fff; } .lk-badge.sp { background: #1db954; color: #000; } .lk-badge.other { background: #444; }
.link-item .lk-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-item button { background: none; border: 0; cursor: pointer; color: var(--ivory-dim); font-size: 13px; padding: 6px; }
.link-item button.play { color: var(--accent-text); }
.presets { display: grid; gap: 8px; padding: 0 16px; }
.presets a { text-decoration: none; padding: 12px 14px; border-radius: 12px; background: rgba(var(--tint-rgb),.03); border: 1px solid rgba(var(--tint-rgb),.06); color: var(--ivory); font-size: 14px; }

/* ==========================================================================
   Statistiche
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 16px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 14px; border-radius: 16px; background: linear-gradient(160deg, rgba(var(--surface-hi-rgb),.8), rgba(var(--surface-lo-rgb),.8)); border: 1px solid rgba(var(--accent-rgb), .12); }
.kpi b { display: block; font: 600 34px/1.05 var(--serif); color: var(--accent-text); }
.kpi span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.card { margin: 14px 16px 0; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid rgba(var(--accent-rgb), .12); }
.card h3 { margin: 0 0 12px; font: 600 20px var(--serif); }
.chart svg { width: 100%; height: auto; display: block; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 46px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ivory-dim); }
.bar-row .track { height: 10px; border-radius: 6px; background: rgba(var(--tint-rgb),.06); overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); }
.bar-row .val { text-align: right; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.duel-row { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; margin: 10px 0; }
.duel-row .who-name { font-weight: 600; }
.duel-row .meta { font-size: 12px; color: var(--muted); }
.duel-row .track { height: 12px; margin-top: 4px; border-radius: 8px; background: rgba(var(--tint-rgb),.06); overflow: hidden; }
.duel-row .fill { height: 100%; background: linear-gradient(90deg, #7d5a1e, #f6e29b); border-radius: 8px; transition: width 1s; }
.duel-row.me .avatar { box-shadow: 0 0 0 2px var(--ink), 0 0 0 3px var(--gold-2); }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.hours i { aspect-ratio: 1 / 2.2; border-radius: 3px; background: rgba(var(--accent-rgb), calc(.06 + var(--v) * .9)); }
.hours-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ==========================================================================
   Piano
   ========================================================================== */
#view-piano > .muted { padding: 0 18px; margin: 0; }
.plan-progress { margin: 12px 18px 4px; height: 8px; border-radius: 6px; background: rgba(var(--tint-rgb),.07); overflow: hidden; }
.plan-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); transition: width .6s; }
#planCount { padding: 0 18px; }
.week { margin: 16px 16px 0; border-radius: 16px; background: var(--card); border: 1px solid rgba(var(--accent-rgb), .1); overflow: hidden; }
.week h3 { margin: 0; padding: 12px 14px; font: 600 18px var(--serif); background: rgba(var(--accent-rgb), .07); border-bottom: 1px solid rgba(var(--accent-rgb), .1); }
.day { display: grid; grid-template-columns: 26px 38px 1fr; gap: 10px; padding: 12px 14px; border-bottom: 1px solid rgba(var(--tint-rgb),.04); cursor: pointer; }
.day:last-child { border-bottom: 0; }
.day .chk { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--gold-3); display: grid; place-items: center; font-size: 14px; color: var(--on-accent); }
.day.done .chk { background: linear-gradient(180deg, #fbe9a8, #c9a65c); border-color: transparent; }
.day.done .chk::after { content: "✓"; }
.day .dname { font-weight: 600; color: var(--accent-text-2); }
.day .pages { font-size: 13px; color: var(--ivory); }
.day .topics { font-size: 13px; color: var(--muted); margin-top: 2px; }
.day.done .pages, .day.done .topics { opacity: .45; text-decoration: line-through; }
.day.review { background: rgba(var(--tint-rgb),.02); }

/* ==========================================================================
   Impostazioni (bottom sheet) e toast
   ========================================================================== */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .25s; }
.sheet-inner {
  position: relative; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 24px 20px calc(24px + var(--safe-b));
  border-radius: 22px 22px 0 0; background: linear-gradient(180deg, var(--sheet-a), var(--sheet-b)); border-top: 1px solid var(--line);
}
.sheet-inner .close { position: absolute; }
.sheet h2 { font: 600 28px var(--serif); margin: 0 0 6px; }
.sheet h3 { font: 600 20px var(--serif); margin: 24px 0 4px; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex !important; align-items: center; gap: 10px; text-transform: none !important; letter-spacing: 0 !important; font-size: 15px !important; color: var(--ivory) !important; margin-top: 14px !important; }
.switch input { width: 20px; height: 20px; accent-color: var(--gold-2); }
.import-progress { height: 6px; border-radius: 6px; background: rgba(var(--tint-rgb),.08); overflow: hidden; margin: 8px 0; }
.import-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); transition: width .4s; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 70; padding: 10px 16px; border-radius: 12px;
  background: var(--surface-solid); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 14px; max-width: 90vw; animation: fadeIn .3s; }

@media (min-width: 900px) {
  #view-studio { display: none; }
  #view-studio.active { display: grid; grid-template-columns: 1.15fr 1fr; grid-template-areas: "pills pills" "banner banner" "stage timer" "stage quote" "stage break"; align-items: start; max-width: 1200px; margin: 0 auto; }
  .mode-pills { grid-area: pills; } .import-banner { grid-area: banner; } .stage { grid-area: stage; }
  .timer-block { grid-area: timer; padding-top: 50px; } .quote-card { grid-area: quote; } .break-panel { grid-area: break; }
  #artwork { width: 460px; }
  .wall { min-height: 74vh; justify-content: center; }
  body.mode-short #view-studio.active, body.mode-long #view-studio.active { grid-template-areas: "pills pills" "banner banner" "break timer" "break quote"; }
  .break-panel { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* in pausa la materia e l'epoca non servono */
body.mode-short .subject-row, body.mode-long .subject-row { display: none; }

/* ==========================================================================
   Piano: esame, voci, rimodulazione
   ========================================================================== */
.sheet input:not([type=checkbox]):not([type=range]):not([type=color]), .sheet textarea {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 10px; background: var(--field);
  border: 1px solid rgba(var(--tint-rgb),.08); color: var(--ivory); outline: none; font-size: 16px; text-transform: none; letter-spacing: 0; font-family: var(--sans);
  color-scheme: dark;
}
.sheet textarea { resize: vertical; line-height: 1.4; }
.sheet input:focus, .sheet textarea:focus { border-color: var(--gold-3); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.weekday-chips { display: flex; gap: 6px; margin-top: 8px; }
.wd { flex: 1; aspect-ratio: 1; max-width: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(var(--tint-rgb),.04); color: var(--ivory-dim); cursor: pointer; font-weight: 600; }
.wd.on { background: radial-gradient(circle at 35% 30%, #fff3c4, #d4af5f 55%, #8a6424); color: var(--on-accent); border-color: transparent; }
.unit-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn.danger { color: var(--danger); border-color: rgba(220,90,80,.35); }

.exam-card {
  position: relative; display: flex; align-items: center; gap: 16px; margin: 20px 16px 6px; padding: 18px; border-radius: 20px; overflow: hidden;
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, rgba(255,214,150,.16), transparent 60%),
    linear-gradient(160deg, var(--sheet-a), var(--sheet-b));
  border: 1px solid rgba(var(--accent-rgb), .25); box-shadow: 0 20px 40px -18px rgba(0,0,0,.9);
}
.exam-card::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .12; mix-blend-mode: overlay; pointer-events: none; }
.exam-medal {
  flex: none; width: 84px; height: 84px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--on-accent);
  background: radial-gradient(circle at 35% 30%, #fff5cf, #e0bd6a 45%, #8a6424 100%);
  box-shadow: inset 0 -4px 8px rgba(70,45,5,.5), inset 0 3px 4px rgba(255,255,255,.6), 0 0 0 4px rgba(var(--accent-rgb), .18), 0 12px 24px rgba(0,0,0,.6);
}
.exam-medal b { font: 700 32px/1 var(--serif); }
.exam-medal span { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.exam-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.exam-kicker { font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--accent-text-2); }
.exam-name { font: 600 24px/1.15 var(--serif); margin-top: 2px; }
.exam-date { color: var(--ivory-dim); font-size: 14px; margin-top: 4px; }
.exam-edit { position: relative; z-index: 1; flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--accent-text); cursor: pointer; font-size: 16px; }
.exam-card .btn { position: relative; z-index: 1; flex: none; }

.plan-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.plan-chips span { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(var(--accent-rgb), .08); border: 1px solid rgba(var(--accent-rgb), .18); color: var(--accent-text); }
.plan-alert { display: flex; gap: 12px; align-items: center; margin: 12px 16px 0; padding: 12px 14px; border-radius: 14px; font-size: 14px;
  background: linear-gradient(90deg, rgba(190,70,50,.2), rgba(190,70,50,.06)); border: 1px solid rgba(220,110,90,.35); }
.plan-alert span { flex: 1; }
.plan-actions { display: flex; gap: 8px; padding: 14px 16px 0; }
.plan-actions .btn:first-child { flex: 1; }
.plan-menu { margin: 8px 16px 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-solid); }
.plan-menu button { display: block; width: 100%; text-align: left; padding: 13px 16px; background: none; border: 0; border-bottom: 1px solid rgba(var(--tint-rgb),.05); cursor: pointer; }
.plan-menu button:last-child { border-bottom: 0; color: var(--danger); }
.week h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.week h3 small { font: 500 12px var(--sans); color: var(--muted); }
.day-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 4px; font-size: 13px; font-weight: 600; color: var(--accent-text-2); }
.day-head small { margin-left: auto; color: var(--muted); font-weight: 500; }
.day-head.is-today { color: var(--accent-text); }
.tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; font-weight: 700; }
.tag.today { background: linear-gradient(180deg, #fbe9a8, #c9a65c); color: var(--on-accent); }
.tag.late { background: rgba(200,80,60,.25); color: var(--danger); }
.unit { display: grid; grid-template-columns: 26px 1fr 30px; gap: 10px; padding: 8px 14px 12px; border-bottom: 1px solid rgba(var(--tint-rgb),.04); align-items: start; }
.unit:last-child { border-bottom: 0; }
.unit .chk { width: 24px; height: 24px; margin-top: 1px; border-radius: 7px; border: 1.5px solid var(--gold-3); background: none; cursor: pointer; display: grid; place-items: center; color: var(--on-accent); font-size: 14px; padding: 0; }
.unit.done .chk { background: linear-gradient(180deg, #fbe9a8, #c9a65c); border-color: transparent; }
.unit.done .chk::after { content: "✓"; font-weight: 700; }
.unit .u-body { cursor: pointer; min-width: 0; }
.u-title { font-weight: 600; }
.u-meta { font-size: 12px; color: var(--accent-text-2); margin-top: 1px; }
.u-topics { font-size: 13px; color: var(--muted); margin-top: 3px; }
.unit.done .u-title, .unit.done .u-topics, .unit.done .u-meta { opacity: .45; text-decoration: line-through; }
.unit.review .u-title { font-family: var(--serif); font-size: 17px; font-style: italic; color: var(--accent-text); }
.unit.late:not(.done) .chk { border-color: #d47a68; }
.u-edit { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px; }
.exam-day { margin: 16px 16px 0; padding: 14px; text-align: center; border-radius: 14px; font-family: var(--serif); font-size: 19px;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), .16), rgba(var(--accent-rgb), .05)); border: 1px solid rgba(var(--accent-rgb), .35); color: var(--accent-text); }
.small-empty { font-size: 17px; }
.today-plan { display: block; margin: 12px auto 0; max-width: 460px; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--ivory-dim);
  background: rgba(var(--accent-rgb), .07); border: 1px solid rgba(var(--accent-rgb), .18); line-height: 1.4; }
.today-plan b { color: var(--accent-text); }

/* ==========================================================================
   Temi colore
   ========================================================================== */
/* Lapislazzuli: il blu delle volte di Giotto, con l'oro */
html[data-theme="lapislazzuli"] {
  --ink: #070a14; --ink-rgb: 7, 10, 20; --ink-2: #0c1122;
  --surface-rgb: 20, 27, 48; --surface-hi-rgb: 30, 40, 70; --surface-lo-rgb: 12, 17, 32;
  --surface-solid: #141b30; --sheet-a: #151d36; --sheet-b: #0b1022;
  --ivory: #e9ecf5; --ivory-dim: #aab3c9; --muted: #7a84a0;
  --studio-wall: #101833; --studio-wall-break: #0f1f2a;
}
/* Porpora: velluto cremisi e oro rosa */
html[data-theme="porpora"] {
  --ink: #10070a; --ink-rgb: 16, 7, 10; --ink-2: #1a0b10;
  --surface-rgb: 36, 16, 22; --surface-hi-rgb: 52, 24, 32; --surface-lo-rgb: 22, 10, 14;
  --surface-solid: #26111a; --sheet-a: #2a121b; --sheet-b: #16080d;
  --ivory: #f5e6e8; --ivory-dim: #c9a9ae; --muted: #9a7a80;
  --gold-0: #ffe7dc; --gold-1: #f6c7b3; --gold-2: #e0a088; --gold-3: #a86a55; --gold-4: #6e3f30;
  --accent-rgb: 224, 160, 136; --accent-hi-rgb: 246, 199, 179;
  --on-accent: #3a160c; --time-a: #fff1ea; --time-b: #f6d3c4;
  --studio-wall: #2a0f16; --studio-wall-break: #1d1420;
}
/* Verde Veronese: verderame e ottone */
html[data-theme="veronese"] {
  --ink: #06100d; --ink-rgb: 6, 16, 13; --ink-2: #0a1814;
  --surface-rgb: 16, 32, 27; --surface-hi-rgb: 24, 46, 39; --surface-lo-rgb: 10, 22, 18;
  --surface-solid: #11221c; --sheet-a: #12261f; --sheet-b: #08140f;
  --ivory: #e6f1ec; --ivory-dim: #a8c2b8; --muted: #7a978c;
  --gold-0: #f3f7d2; --gold-1: #dde8a8; --gold-2: #b9c77c; --gold-3: #7d8b4a; --gold-4: #4b5628;
  --accent-rgb: 185, 199, 124; --accent-hi-rgb: 221, 232, 168;
  --on-accent: #1e240b; --time-a: #f7fbe6; --time-b: #e4ecc0;
  --studio-wall: #0e231c; --studio-wall-break: #0f1d22;
}
/* Notte d'argento: nero e argento */
html[data-theme="argento"] {
  --ink: #0a0a0c; --ink-rgb: 10, 10, 12; --ink-2: #121215;
  --surface-rgb: 24, 24, 28; --surface-hi-rgb: 36, 36, 42; --surface-lo-rgb: 16, 16, 19;
  --surface-solid: #18181c; --sheet-a: #1c1c21; --sheet-b: #0f0f12;
  --ivory: #eceef2; --ivory-dim: #b4b8c2; --muted: #80858f;
  --gold-0: #ffffff; --gold-1: #e6e9ef; --gold-2: #c3c8d2; --gold-3: #858b97; --gold-4: #4f545e;
  --accent-rgb: 195, 200, 210; --accent-hi-rgb: 230, 233, 239;
  --on-accent: #1b1d22; --time-a: #ffffff; --time-b: #e3e6ec;
  --studio-wall: #16171b; --studio-wall-break: #121820;
}
/* Pergamena: tema chiaro */
html[data-theme="pergamena"] {
  color-scheme: light;
  --ink: #f2ebde; --ink-rgb: 242, 235, 222; --ink-2: #ebe2d1;
  --surface-rgb: 255, 251, 243; --surface-hi-rgb: 255, 253, 248; --surface-lo-rgb: 236, 227, 210;
  --surface-solid: #fbf6ec; --sheet-a: #fbf6ec; --sheet-b: #f1e8d8;
  --ivory: #2a2016; --ivory-dim: #5c4b39; --muted: #8a7863;
  --tint-rgb: 90, 60, 20; --field: rgba(255,255,255,.8);
  --gold-0: #fbeab0; --gold-1: #e9c979; --gold-2: #c99a45; --gold-3: #9a6f22; --gold-4: #6b4b18;
  --accent-rgb: 185, 140, 60; --accent-hi-rgb: 201, 154, 69;
  --accent-text: #7a5418; --accent-text-2: #8d6420;
  --on-accent: #2a1b06; --danger: #a33b2b;
  --time-a: #4a3410; --time-b: #7a5418;
  --studio-wall: #2a1f17; --studio-wall-break: #1d2427;
}
html[data-theme="pergamena"] body.app { background: radial-gradient(ellipse 80% 40% at 50% -5%, rgba(201,154,69,.18), transparent 70%), var(--ink); }
html[data-theme="pergamena"] .quote-card, html[data-theme="pergamena"] .card, html[data-theme="pergamena"] .kpi,
html[data-theme="pergamena"] .week, html[data-theme="pergamena"] .snd, html[data-theme="pergamena"] .link-item,
html[data-theme="pergamena"] .exam-card { box-shadow: 0 10px 30px -18px rgba(80,50,10,.45); }
html[data-theme="pergamena"] .time { filter: none; }
html[data-theme="pergamena"] .exam-edit { background: rgba(255,255,255,.6); }

/* Le parti "fisiche" del museo (sale, opere aperte) restano in penombra in ogni tema */
.overlay, .auth-page {
  --ivory: #f1e7d3; --ivory-dim: #b9ab92; --muted: #8d7f69;
  --accent-text: var(--gold-1); --accent-text-2: var(--gold-2);
  --tint-rgb: 255, 255, 255; --field: rgba(0,0,0,.35);
  color: var(--ivory);
}

/* Elementi d'accento costruiti con le variabili del tema */
.btn.gold {
  background: linear-gradient(180deg, var(--gold-0) 0%, var(--gold-2) 45%, var(--gold-3) 55%, color-mix(in srgb, var(--gold-2) 85%, white) 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -2px 4px rgba(0,0,0,.25) inset, 0 8px 22px -6px rgba(var(--accent-rgb), .55), 0 2px 4px rgba(0,0,0,.5);
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.crest, .avatar, .avatar-btn, .brand-mark, .exam-medal, .wd.on {
  background: radial-gradient(circle at 35% 30%, var(--gold-0), var(--gold-2) 50%, var(--gold-4));
}
.time { background-image: linear-gradient(180deg, var(--time-a) 0%, var(--time-b) 45%, var(--gold-2) 100%); }
.rounds i { border-color: var(--gold-3); }
.rounds i.on, .tag.today, .unit.done .chk, .day.done .chk { background: linear-gradient(180deg, var(--gold-0), var(--gold-2)); }
.rounds i.on { box-shadow: 0 0 8px rgba(var(--accent-hi-rgb), .5); }
.unit .chk, .day .chk { border-color: var(--gold-3); }
input[type=range]::-webkit-slider-thumb { background: radial-gradient(circle at 35% 30%, var(--gold-0), var(--gold-2) 60%, var(--gold-4)); }
input[type=range]::-moz-range-thumb { background: radial-gradient(circle at 35% 30%, var(--gold-0), var(--gold-2) 60%, var(--gold-4)); }
.quote-card::before { color: var(--gold-3); }
.duel-row .fill { background: linear-gradient(90deg, var(--gold-4), var(--gold-1)); }
.hours i { background: rgba(var(--accent-rgb), calc(.06 + var(--v) * .9)); }

/* ---------- Selettore dei temi ---------- */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.theme-opt { position: relative; padding: 0; border-radius: 14px; overflow: hidden; cursor: pointer; border: 2px solid transparent; background: none; text-align: left; }
.theme-opt.on { border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .2); }
.theme-opt .sw { display: block; height: 62px; position: relative; }
.theme-opt .sw i { position: absolute; right: 10px; bottom: 10px; width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.5), inset 0 1px 2px rgba(255,255,255,.6); }
.theme-opt .sw b { position: absolute; left: 10px; top: 12px; width: 46%; height: 6px; border-radius: 3px; opacity: .85; }
.theme-opt .sw b + b { top: 24px; width: 30%; opacity: .5; }
.theme-opt .nm { display: block; padding: 7px 10px; font-size: 12px; font-weight: 600; background: rgba(var(--surface-hi-rgb), .9); color: var(--ivory); }
.accent-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.accent-row input[type=color] { width: 46px; height: 46px; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.accent-row input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.accent-row input[type=color]::-webkit-color-swatch { border: 2px solid var(--line); border-radius: 50%; }
.accent-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.accent-presets button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(var(--tint-rgb), .15); cursor: pointer; }
.accent-presets button.on { outline: 2px solid var(--ivory); outline-offset: 2px; }
