:root {
  color-scheme: light;
  --bg: #f8f5ff;
  --bg-2: #fff9f1;
  --surface: rgba(255,255,255,.86);
  --surface-solid: #ffffff;
  --surface-soft: #f0ecff;
  --text: #1b1730;
  --muted: #69627b;
  --border: rgba(44,33,74,.12);
  --shadow: 0 24px 60px rgba(80, 53, 135, .14);
  --accent: #7c3aed;
  --accent-2: #ec4899;
  --accent-3: #f59e0b;
  --green: #16a34a;
  --danger: #ef4444;
  --track: #ddd6fe;
  --header: rgba(248,245,255,.82);
  --result-bg: radial-gradient(circle at 20% 10%, rgba(244,114,182,.18), transparent 38%), linear-gradient(145deg,#fff,#fff8fc 55%,#f8f2ff);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090915;
  --bg-2: #121021;
  --surface: rgba(19,18,36,.88);
  --surface-solid: #151426;
  --surface-soft: #201d39;
  --text: #f8f7ff;
  --muted: #b5afca;
  --border: rgba(255,255,255,.10);
  --shadow: 0 24px 70px rgba(0,0,0,.38);
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-3: #fbbf24;
  --green: #22c55e;
  --danger: #fb7185;
  --track: #312e52;
  --header: rgba(9,9,21,.80);
  --result-bg: radial-gradient(circle at 20% 10%, rgba(236,72,153,.18), transparent 38%), linear-gradient(145deg,#151426,#171324 55%,#21163a);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(140deg,var(--bg),var(--bg-2));
  transition: background .25s ease, color .25s ease;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.bg-orb {
  position: fixed;
  z-index: -1;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .23;
  pointer-events: none;
}
.orb-a { top: -12rem; left: -8rem; background: #f472b6; }
.orb-b { right: -10rem; top: 25rem; background: #8b5cf6; }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 68px;
  padding: 10px max(18px, calc((100vw - 1180px)/2));
  background: var(--header);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.brand { display:flex; align-items:center; gap:.7rem; text-decoration:none; font-weight:950; letter-spacing:.08em; font-size:.9rem; }
.brand-mark { display:grid; place-items:center; width:40px; aspect-ratio:1; border-radius:14px; color:white; background:linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow:0 8px 20px rgba(124,58,237,.25); }
.theme-toggle { border:1px solid var(--border); background:var(--surface); color:var(--text); min-height:44px; padding:0 14px; border-radius:999px; display:flex; align-items:center; gap:8px; font-weight:800; cursor:pointer; box-shadow:0 6px 18px rgba(0,0,0,.05); }
.theme-toggle:active { transform:scale(.98); }

.app-shell { width:min(1180px, calc(100% - 28px)); margin:0 auto; padding:34px 0 26px; }
.hero { display:grid; grid-template-columns:1.15fr .85fr; align-items:center; gap:28px; min-height:340px; margin-bottom:24px; overflow:hidden; border-radius:34px; padding:clamp(22px,4vw,48px); background:linear-gradient(135deg, rgba(124,58,237,.95), rgba(236,72,153,.90) 58%, rgba(245,158,11,.9)); color:white; box-shadow:var(--shadow); position:relative; }
.hero::after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 80% 10%,rgba(255,255,255,.28),transparent 34%), radial-gradient(circle at 6% 90%,rgba(255,255,255,.18),transparent 25%); pointer-events:none; }
.hero-copy { position:relative; z-index:2; }
.eyebrow { display:inline-flex; align-items:center; gap:.5rem; font-weight:950; font-size:.75rem; letter-spacing:.13em; text-transform:uppercase; opacity:.92; }
h1 { margin:.45rem 0 .75rem; font-size:clamp(2rem,5vw,4.9rem); line-height:.93; letter-spacing:-.055em; max-width:850px; }
h1 strong { display:inline-block; color:#fff7a8; text-shadow:0 4px 0 rgba(75,29,90,.22); }
.hero p { max-width:720px; margin:0; font-size:clamp(.98rem,1.9vw,1.18rem); line-height:1.55; color:rgba(255,255,255,.9); font-weight:650; }
.hero-art { position:relative; z-index:2; align-self:stretch; display:flex; justify-content:center; align-items:flex-end; min-width:0; }
.hero-art img { width:min(100%,430px); max-height:310px; object-fit:cover; object-position:center 48%; border-radius:28px; transform:rotate(2deg); box-shadow:0 25px 55px rgba(28,7,55,.28); border:2px solid rgba(255,255,255,.55); }

.workspace { display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr); gap:22px; align-items:stretch; }
.card { border:1px solid var(--border); background:var(--surface); backdrop-filter:blur(16px); box-shadow:var(--shadow); border-radius:30px; }
.controls-card { padding:clamp(18px,3vw,30px); }
.section-head { display:flex; align-items:flex-start; gap:12px; }
.section-head h2 { margin:0; font-size:clamp(1.14rem,2vw,1.45rem); }
.section-head p { margin:.25rem 0 0; color:var(--muted); font-size:.9rem; }
.step { display:grid; place-items:center; flex:0 0 auto; width:34px; height:34px; border-radius:11px; background:linear-gradient(135deg,var(--accent),var(--accent-2)); color:white; font-weight:950; }
.options-head { margin-top:24px; padding-top:22px; border-top:1px solid var(--border); }
.levels { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:18px; }
.level-btn { min-width:0; min-height:108px; padding:12px 8px; border:1px solid var(--border); border-radius:18px; background:var(--surface-soft); color:var(--text); cursor:pointer; transition:.2s ease; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:3px; }
.level-btn:hover { transform:translateY(-2px); border-color:rgba(124,58,237,.4); }
.level-btn.active { color:white; background:linear-gradient(135deg,#22c55e,#16a34a); border-color:transparent; box-shadow:0 12px 25px rgba(34,197,94,.22); }
.level-btn[data-level="normali"].active { background:linear-gradient(135deg,#0ea5e9,#2563eb); box-shadow:0 12px 25px rgba(37,99,235,.22); }
.level-btn.satanici.active { background:linear-gradient(135deg,#ef4444,#a21caf); box-shadow:0 12px 25px rgba(239,68,68,.22); }
.level-icon { font-size:1.65rem; }
.level-name { font-weight:950; font-size:.82rem; letter-spacing:.035em; }
.level-btn small { opacity:.78; font-size:.68rem; line-height:1.2; }

.sliders { display:grid; gap:15px; margin:18px 0 22px; }
.range-row { display:block; }
.range-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:7px; font-size:.9rem; font-weight:800; }
.range-title b { min-width:28px; height:28px; display:grid; place-items:center; border-radius:9px; background:var(--surface-soft); color:var(--accent); }
.range-line { display:grid; grid-template-columns:30px 1fr; align-items:center; gap:7px; }
.range-emoji { font-size:1.2rem; text-align:center; }
input[type="range"] { width:100%; accent-color:var(--accent-2); cursor:pointer; }

.primary-btn, .copy-btn, .secondary-btn { border:0; cursor:pointer; font-weight:950; letter-spacing:.015em; border-radius:16px; min-height:54px; padding:12px 16px; transition:transform .15s ease, filter .15s ease; }
.primary-btn { width:100%; color:white; background:linear-gradient(135deg,var(--accent),var(--accent-2)); box-shadow:0 12px 28px rgba(124,58,237,.23); }
.primary-btn:hover, .copy-btn:hover, .secondary-btn:hover { filter:brightness(1.05); transform:translateY(-1px); }
.primary-btn:active, .copy-btn:active, .secondary-btn:active { transform:scale(.985); }

.result-card { position:relative; overflow:hidden; padding:clamp(18px,3vw,30px); background:var(--result-bg); display:flex; flex-direction:column; }
.result-glow { position:absolute; width:220px; height:220px; right:-70px; top:-80px; border-radius:50%; background:radial-gradient(circle,rgba(244,114,182,.25),transparent 70%); pointer-events:none; }
.result-topline { position:relative; z-index:2; display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; }
.badge { display:inline-flex; align-items:center; gap:6px; padding:8px 11px; border-radius:999px; color:white; font-weight:950; font-size:.75rem; letter-spacing:.04em; }
.badge.perbenisti { background:#16a34a; }
.badge.normali { background:#2563eb; }
.badge.satanici { background:linear-gradient(135deg,#ef4444,#a21caf); }
.counter { color:var(--muted); font-size:.78rem; font-weight:750; }
.result-text { position:relative; z-index:2; display:flex; align-items:center; flex:1; min-height:290px; width:100%; padding:26px 4px 14px; font-size:clamp(1.65rem,4vw,3.45rem); line-height:1.08; letter-spacing:-.035em; font-weight:1000; overflow-wrap:anywhere; text-wrap:balance; }
.decorations { min-height:64px; font-size:clamp(1.2rem,3vw,2rem); line-height:1.35; overflow-wrap:anywhere; letter-spacing:.04em; }
.result-actions { display:grid; grid-template-columns:1.15fr .85fr; gap:10px; margin-top:12px; }
.copy-btn { color:white; background:linear-gradient(135deg,#16a34a,#22c55e); box-shadow:0 12px 25px rgba(34,197,94,.18); }
.secondary-btn { color:var(--text); background:var(--surface-soft); border:1px solid var(--border); }
.copy-status { min-height:24px; margin-top:8px; text-align:center; color:var(--green); font-size:.82rem; font-weight:850; }
.mascot-note { margin-top:12px; display:grid; grid-template-columns:100px 1fr; gap:14px; align-items:center; padding:12px; border:1px dashed var(--border); background:var(--surface); border-radius:20px; }
.mascot-note img { width:100px; height:90px; object-fit:cover; object-position:50% 27%; border-radius:16px; }
.mascot-note p { margin:0; color:var(--muted); font-size:.85rem; line-height:1.45; }
.mascot-note strong { color:var(--text); }

.info-strip { margin-top:22px; display:grid; grid-template-columns:150px 1fr auto; gap:24px; align-items:center; padding:20px 24px; overflow:hidden; }
.info-art { height:150px; overflow:hidden; border-radius:22px; background:var(--surface-soft); }
.info-art img { width:100%; height:100%; object-fit:cover; object-position:50% 35%; }
.info-copy h2 { margin:.4rem 0 .45rem; font-size:clamp(1.25rem,2.5vw,2rem); letter-spacing:-.025em; }
.info-copy p { margin:0; color:var(--muted); line-height:1.55; }
.stats { display:flex; gap:10px; }
.stats div { min-width:96px; padding:14px 12px; border-radius:18px; background:var(--surface-soft); border:1px solid var(--border); text-align:center; }
.stats b { display:block; font-size:1.5rem; color:var(--accent); }
.stats span { display:block; margin-top:2px; color:var(--muted); font-size:.72rem; font-weight:800; }

.footer { width:min(1180px,calc(100% - 28px)); margin:0 auto; padding:10px 0 34px; color:var(--muted); font-size:.78rem; display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.footer a { color:var(--text); font-weight:800; text-decoration:none; }
.footer p { margin:0; }

html[data-theme="dark"] .hero-art img { border-color:rgba(255,255,255,.18); }
html[data-theme="dark"] .hero { box-shadow:0 28px 80px rgba(0,0,0,.45); }

@media (max-width: 920px) {
  .app-shell { width:min(760px,calc(100% - 22px)); padding-top:20px; }
  .hero { grid-template-columns:1fr .55fr; min-height:260px; padding:24px; border-radius:28px; }
  .hero-art img { max-height:240px; }
  .workspace { grid-template-columns:1fr; }
  .result-text { min-height:240px; }
  .info-strip { grid-template-columns:120px 1fr; }
  .stats { grid-column:1 / -1; display:grid; grid-template-columns:repeat(3,1fr); }
}

@media (max-width: 620px) {
  .topbar { min-height:60px; padding:8px 12px; }
  .brand { font-size:.75rem; }
  .brand-mark { width:38px; border-radius:12px; }
  .theme-toggle { min-height:42px; padding:0 11px; font-size:.78rem; }
  .app-shell { width:calc(100% - 16px); padding-top:10px; }
  .hero { min-height:0; grid-template-columns:1fr; padding:20px 18px 0; gap:10px; border-radius:24px; text-align:center; }
  .hero-copy { padding-bottom:4px; }
  .hero p { margin-inline:auto; font-size:.9rem; }
  .hero-art { height:128px; overflow:hidden; margin:0 -18px; }
  .hero-art img { width:100%; max-width:none; height:160px; max-height:none; border-radius:20px 20px 0 0; border:0; transform:none; object-position:50% 48%; }
  h1 { font-size:clamp(1.85rem,10vw,3rem); line-height:.94; }
  .card { border-radius:22px; }
  .controls-card, .result-card { padding:16px; }
  .levels { grid-template-columns:1fr; gap:8px; }
  .level-btn { min-height:68px; display:grid; grid-template-columns:38px 1fr; grid-template-rows:auto auto; text-align:left; justify-items:start; padding:10px 14px; }
  .level-icon { grid-row:1/3; align-self:center; }
  .level-btn small { font-size:.69rem; }
  .sliders { gap:13px; }
  .result-text { min-height:220px; padding-top:20px; font-size:clamp(1.45rem,7.8vw,2.25rem); }
  .decorations { min-height:54px; }
  .result-actions { grid-template-columns:1fr; }
  .primary-btn, .copy-btn, .secondary-btn { min-height:52px; font-size:.88rem; }
  .mascot-note { grid-template-columns:80px 1fr; }
  .mascot-note img { width:80px; height:78px; }
  .info-strip { grid-template-columns:86px 1fr; gap:14px; padding:16px; }
  .info-art { height:100px; border-radius:18px; }
  .info-copy p { font-size:.82rem; }
  .stats { gap:6px; }
  .stats div { min-width:0; padding:10px 5px; }
  .stats b { font-size:1.2rem; }
  .stats span { font-size:.62rem; }
  .footer { width:calc(100% - 20px); text-align:center; justify-content:center; }
}

@media (max-width: 390px) {
  .theme-toggle #themeText { display:none; }
  .theme-toggle { width:42px; padding:0; justify-content:center; }
  .brand { letter-spacing:.05em; }
  .section-head p { font-size:.8rem; }
  .range-title { font-size:.82rem; }
  .result-topline { align-items:flex-start; }
  .counter { width:100%; }
  .result-text { font-size:clamp(1.28rem,7.5vw,1.85rem); min-height:205px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; transition:none !important; }
}
