/* Duelli+ V14 — sei temi. Ogni tema ridefinisce colori, forme e decorazioni.
   Il selettore [data-theme] vale sia per la pagina sia per le anteprime nelle impostazioni. */

/* DUEL CORE — HUD olografico ciano */
:where([data-theme="core"]), :where([data-theme="core"]) *, .tc-preview[data-theme="core"], .tc-preview[data-theme="core"] * {
  --neon: #5fe3ff; --neon-rgb: 95, 227, 255; --neon2: #9cf7e8;
  --ink: #e9f8ff; --ink-dim: #8fb2c6; --deep: #02070f; --surface: #071626; --surface-2: #0c2236;
  --cut: 18px; --cut-s: 8px; --r: 0px;
  --panel-deco: repeating-linear-gradient(0deg, rgba(var(--neon-rgb), .025) 0 1px, transparent 1px 4px);
}

/* INFERNO DRIVE — reattore, corazze diagonali */
:where([data-theme="inferno"]), :where([data-theme="inferno"]) *, .tc-preview[data-theme="inferno"], .tc-preview[data-theme="inferno"] * {
  --neon: #ff6a3d; --neon-rgb: 255, 106, 61; --neon2: #ffc35a;
  --ink: #fff1ea; --ink-dim: #d39a8a; --deep: #0e0406; --surface: #1d0a0d; --surface-2: #2c1013;
  --cut: 26px; --cut-s: 10px; --r: 0px;
  --font-title: 'Barlow Condensed', Impact, sans-serif;
  --bg: radial-gradient(ellipse 70% 35% at 85% -5%, rgba(255, 70, 40, .35), transparent 70%), linear-gradient(170deg, #160608, #0e0406 60%, #080203);
  --bg-pattern: repeating-linear-gradient(125deg, rgba(255, 106, 61, .045) 0 2px, transparent 2px 30px);
  --panel-fill: radial-gradient(ellipse at 50% 110%, rgba(255, 106, 61, .25), transparent 60%), repeating-linear-gradient(135deg, rgba(255, 255, 255, .018) 0 14px, transparent 14px 28px), linear-gradient(170deg, var(--surface-2), var(--surface));
  --panel-edge: linear-gradient(160deg, #ffb347, var(--accent) 35%, #ff3d2e 70%, #5a1310);
  --panel-deco: repeating-linear-gradient(135deg, #ffb347 0 8px, #1a0507 8px 16px) top right / 64px 5px no-repeat;
  --btn-bg: linear-gradient(170deg, rgba(255, 106, 61, .2), rgba(40, 8, 10, .6));
  --shape: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  --shape-s: polygon(var(--cut-s) 0, 100% 0, 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, 0 100%, 0 var(--cut-s));
}
body[data-theme="inferno"] .lp { font-style: italic; text-shadow: 0 0 22px rgba(255, 106, 61, .55), 3px 3px 0 rgba(0, 0, 0, .5); }
body[data-theme="inferno"] .p-name { font-style: italic; letter-spacing: .14em; }

/* ARCANE NEXUS — sigilli e rune */
:where([data-theme="arcane"]), :where([data-theme="arcane"]) *, .tc-preview[data-theme="arcane"], .tc-preview[data-theme="arcane"] * {
  --neon: #c79bff; --neon-rgb: 199, 155, 255; --neon2: #7fe0ff;
  --ink: #f4edff; --ink-dim: #a99bc6; --deep: #08051a; --surface: #130c2a; --surface-2: #1f1440;
  --cut: 0px; --cut-s: 0px; --r: 22px;
  --font-title: 'Cinzel', Georgia, serif;
  --bg: radial-gradient(circle at 50% 18%, rgba(140, 90, 220, .35), transparent 45%), linear-gradient(#0a0720, #160c2c);
  --bg-pattern: repeating-radial-gradient(circle at 50% 45%, transparent 0 58px, rgba(199, 155, 255, .05) 59px 60px, transparent 61px 110px);
  --panel-fill: radial-gradient(circle at 50% 45%, rgba(199, 155, 255, .16), transparent 55%), repeating-radial-gradient(circle at 50% 45%, transparent 0 36px, rgba(199, 155, 255, .045) 37px 38px), linear-gradient(170deg, var(--surface-2), var(--surface));
  --panel-edge: linear-gradient(160deg, #7fe0ff, var(--accent) 30%, #c79bff 65%, #3a2470);
  --panel-deco: radial-gradient(circle at 50% 50%, transparent 46%, rgba(199, 155, 255, .12) 46.5% 47%, transparent 47.5%) center / min(100%, 120cqh) auto no-repeat;
  --shape: none; --shape-s: none;
}
body[data-theme="arcane"] .p-frame, body[data-theme="arcane"] .p-frame::before, body[data-theme="arcane"] .p-frame::after { clip-path: none; }
body[data-theme="arcane"] .p-amounts button, body[data-theme="arcane"] .apply, body[data-theme="arcane"] .p-extra button,
body[data-theme="arcane"] .btn, body[data-theme="arcane"] .seg, body[data-theme="arcane"] .seg button,
body[data-theme="arcane"] .hud-chip, body[data-theme="arcane"] .hud-icon, body[data-theme="arcane"] .dock button { border-radius: 999px; }
body[data-theme="arcane"] .p-sum, body[data-theme="arcane"] .p-icon { border-radius: 14px; }
body[data-theme="arcane"] .lp { font-family: 'Cinzel', Georgia, serif; font-weight: 700; letter-spacing: 0; text-shadow: 0 0 26px rgba(199, 155, 255, .7); }
body[data-theme="arcane"] .lp { font-size: min(24cqw, 28cqh); }
body[data-theme="arcane"] .lp[data-len="5"] { font-size: min(20cqw, 26cqh); }
body[data-theme="arcane"] .lp[data-len="6"] { font-size: min(16cqw, 24cqh); }
body[data-theme="arcane"] .lp[data-len="8"] { font-size: min(12cqw, 20cqh); }
body[data-theme="arcane"] .hud-mark { clip-path: circle(50%); }
body[data-theme="arcane"] .sheet, body[data-theme="arcane"] .modal, body[data-theme="arcane"] .roll { clip-path: none; }

/* AEGIS PROTOCOL — tattico, griglia militare */
:where([data-theme="aegis"]), :where([data-theme="aegis"]) *, .tc-preview[data-theme="aegis"], .tc-preview[data-theme="aegis"] * {
  --neon: #9fe870; --neon-rgb: 159, 232, 112; --neon2: #e6f27a;
  --ink: #eef7e6; --ink-dim: #93a88a; --deep: #050906; --surface: #0c140d; --surface-2: #142016;
  --cut: 6px; --cut-s: 3px; --r: 0px;
  --font-lp: 'Rajdhani', 'Arial Narrow', sans-serif;
  --bg: linear-gradient(170deg, #070d08, #050906);
  --bg-pattern: repeating-linear-gradient(90deg, transparent 0 39px, rgba(159, 232, 112, .05) 40px), repeating-linear-gradient(0deg, transparent 0 39px, rgba(159, 232, 112, .05) 40px);
  --panel-fill: linear-gradient(90deg, rgba(159, 232, 112, .05) 1px, transparent 1px) 0 0 / 20px 20px, linear-gradient(0deg, rgba(159, 232, 112, .05) 1px, transparent 1px) 0 0 / 20px 20px, linear-gradient(170deg, var(--surface-2), var(--surface));
  --panel-edge: linear-gradient(var(--accent), rgba(159, 232, 112, .55));
  --panel-deco:
    linear-gradient(var(--neon), var(--neon)) top left / 18px 2px no-repeat, linear-gradient(var(--neon), var(--neon)) top left / 2px 18px no-repeat,
    linear-gradient(var(--neon), var(--neon)) bottom right / 18px 2px no-repeat, linear-gradient(var(--neon), var(--neon)) bottom right / 2px 18px no-repeat;
  --btn-bg: rgba(159, 232, 112, .07);
}
body[data-theme="aegis"] .p-frame::after { inset: 5px; }
body[data-theme="aegis"] .lp { font-weight: 700; letter-spacing: .02em; text-shadow: 0 0 14px rgba(159, 232, 112, .45); }
body[data-theme="aegis"] .p-name, body[data-theme="aegis"] .hud-name { font-family: ui-monospace, 'Consolas', monospace; letter-spacing: .08em; }
body[data-theme="aegis"] .lp-label::before { content: '[ '; }
body[data-theme="aegis"] .lp-label::after { content: ' ]'; }

/* SOLAR RELIC — oro e architettura antica */
:where([data-theme="solar"]), :where([data-theme="solar"]) *, .tc-preview[data-theme="solar"], .tc-preview[data-theme="solar"] * {
  --neon: #ffc965; --neon-rgb: 255, 201, 101; --neon2: #fff0c2;
  --ink: #fff7e6; --ink-dim: #c9ae80; --deep: #0f0a05; --surface: #1c1309; --surface-2: #2c1f0e;
  --cut: 14px; --cut-s: 6px; --r: 0px;
  --font-title: 'Cinzel', Georgia, serif;
  --bg: radial-gradient(ellipse 60% 35% at 50% 0, rgba(255, 190, 90, .28), transparent 75%), linear-gradient(170deg, #160e06, #0f0a05 60%, #080502);
  --bg-pattern: repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 201, 101, .045) 46px 48px, transparent 48px 96px);
  --panel-fill: radial-gradient(ellipse at 50% 0, rgba(255, 201, 101, .22), transparent 60%), linear-gradient(170deg, var(--surface-2), var(--surface));
  --panel-edge: linear-gradient(160deg, #fff0c2, #ffc965 25%, var(--accent) 55%, #6e4a12);
  --panel-deco: repeating-linear-gradient(90deg, rgba(255, 201, 101, .5) 0 10px, transparent 10px 14px) top / 100% 3px no-repeat, repeating-linear-gradient(90deg, rgba(255, 201, 101, .5) 0 10px, transparent 10px 14px) bottom / 100% 3px no-repeat;
  --shape: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  --shape-s: polygon(var(--cut-s) 0, calc(100% - var(--cut-s)) 0, 100% var(--cut-s), 100% calc(100% - var(--cut-s)), calc(100% - var(--cut-s)) 100%, var(--cut-s) 100%, 0 calc(100% - var(--cut-s)), 0 var(--cut-s));
}
body[data-theme="solar"] .lp { font-family: 'Cinzel', Georgia, serif; font-weight: 700; color: #fff3d6; text-shadow: 0 2px 0 #6e4a12, 0 0 24px rgba(255, 201, 101, .55); }
body[data-theme="solar"] .lp { font-size: min(24cqw, 28cqh); }
body[data-theme="solar"] .lp[data-len="5"] { font-size: min(20cqw, 26cqh); }
body[data-theme="solar"] .lp[data-len="6"] { font-size: min(16cqw, 24cqh); }
body[data-theme="solar"] .lp[data-len="8"] { font-size: min(12cqw, 20cqh); }

/* TITAN ARENA — metallo, piastre e bulloni */
:where([data-theme="titan"]), :where([data-theme="titan"]) *, .tc-preview[data-theme="titan"], .tc-preview[data-theme="titan"] * {
  --neon: #8fd3ff; --neon-rgb: 143, 211, 255; --neon2: #d8e4ec;
  --ink: #eef3f7; --ink-dim: #93a3b0; --deep: #080b0e; --surface: #161b20; --surface-2: #232a31;
  --cut: 10px; --cut-s: 5px; --r: 0px;
  --font-title: 'Barlow Condensed', Impact, sans-serif;
  --bg: linear-gradient(170deg, #12171c, #080b0e);
  --bg-pattern: repeating-linear-gradient(0deg, rgba(255, 255, 255, .015) 0 2px, transparent 2px 6px);
  --panel-fill: radial-gradient(circle at 14px 14px, #6c7884 0 3px, #2c343c 3.5px 4.5px, transparent 5px), radial-gradient(circle at calc(100% - 14px) 14px, #6c7884 0 3px, #2c343c 3.5px 4.5px, transparent 5px), radial-gradient(circle at 14px calc(100% - 14px), #6c7884 0 3px, #2c343c 3.5px 4.5px, transparent 5px), radial-gradient(circle at calc(100% - 14px) calc(100% - 14px), #6c7884 0 3px, #2c343c 3.5px 4.5px, transparent 5px), repeating-linear-gradient(90deg, rgba(255, 255, 255, .02) 0 1px, transparent 1px 3px), linear-gradient(175deg, #2a323a, #1a2026 60%, #12161a);
  --panel-edge: linear-gradient(180deg, #a7b3bd, var(--accent) 40%, #48525b 80%, #20262c);
  --panel-deco: linear-gradient(90deg, transparent 20%, rgba(0, 0, 0, .35) 20% 80%, transparent 80%) top / 100% 6px no-repeat;
  --btn-bg: linear-gradient(180deg, #3a434c, #232a31);
  --btn-edge: rgba(255, 255, 255, .14);
}
body[data-theme="titan"] .lp { color: #f4f8fb; text-shadow: 0 2px 0 #000, 0 0 18px rgba(143, 211, 255, .35); }
body[data-theme="titan"] .p-name { letter-spacing: .18em; }

/* anteprime nelle impostazioni */
.tc-preview {
  --accent: var(--neon);
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; height: 70px; padding: 6px;
  background: var(--bg-pattern), var(--bg); background-color: var(--deep);
  clip-path: var(--shape-s); border-radius: var(--r);
}
.tc-panel {
  display: grid; place-items: center; background: var(--panel-fill); box-shadow: inset 0 0 0 1px var(--neon), inset 0 2px 0 var(--neon);
  clip-path: var(--shape-s); border-radius: calc(var(--r) / 2);
}
.tc-panel b { font-family: var(--font-lp); font-weight: 800; font-size: 22px; color: var(--ink); text-shadow: 0 0 10px rgba(var(--neon-rgb), .6); }
.tc-preview[data-theme="arcane"] .tc-panel b, .tc-preview[data-theme="solar"] .tc-panel b { font-family: 'Cinzel', Georgia, serif; font-size: 17px; }
