:root {

  --ink:          #0b1220;
  --ink-soft:     #364152;
  --ink-mute:     #5b6779;
  --line:         #e4e8f0;
  --line-strong:  #c6cfe0;
  --surface:      #ffffff;
  --surface-sunk: #f6f8fc;
  --canvas:       #fbfcfe;
  --sheen:        rgba(255, 255, 255, .85);

  --accent:       #1d4ed8;
  --accent-hi:    #3b6bf0;
  --accent-deep:  #12309a;
  --accent-wash:  #eef3ff;

  --on-accent:    #ffffff;

  --ok:           #0f7a4f;
  --ok-wash:      #e8f6ef;
  --danger:       #c02434;
  --danger-wash:  #fdeef0;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --sh-1: 0 1px 2px rgba(11, 18, 32, .05);
  --sh-2: 0 2px 6px rgba(11, 18, 32, .05), 0 10px 24px -12px rgba(11, 18, 32, .12);
  --sh-3: 0 1px 3px rgba(11, 18, 32, .05), 0 12px 28px -10px rgba(11, 18, 32, .14),
          0 40px 80px -32px rgba(17, 36, 92, .22);

  --sh-soft: 0 1px 2px rgba(11, 18, 32, .04), 0 6px 18px -10px rgba(11, 18, 32, .1);
  --sh-focus: 0 0 0 3px var(--accent-wash), 0 0 0 4.5px var(--accent);

  --gap:    18px;
  --pad-x:  clamp(20px, 5vw, 40px);
  --sec-y:  clamp(64px, 9vw, 108px);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono",
               Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .68, .32, 1);
}

:root[data-theme="dark"] {
  --ink:          #eef2f9;
  --ink-soft:     #b3bdcf;
  --ink-mute:     #8e9ab0;
  --line:         #1e2941;
  --line-strong:  #2c3a58;
  --surface:      #101828;
  --surface-sunk: #0c1322;
  --canvas:       #080c15;
  --sheen:        rgba(255, 255, 255, .12);

  --accent:       #6f92ff;
  --accent-hi:    #8fabff;
  --accent-deep:  #4f74e8;
  --accent-wash:  #1a2440;
  --on-accent:    #0b1220;

  --ok:           #4bd39a;
  --ok-wash:      #10291f;
  --danger:       #ff8a95;
  --danger-wash:  #2a1219;

  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 24px -12px rgba(0, 0, 0, .6);
  --sh-3: 0 1px 3px rgba(0, 0, 0, .4), 0 14px 32px -10px rgba(0, 0, 0, .6),
          0 44px 90px -34px rgba(0, 0, 0, .8);
  --sh-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px -10px rgba(0, 0, 0, .5);
  --sh-focus: 0 0 0 3px rgba(111, 146, 255, .22), 0 0 0 4.5px var(--accent);
}

@media (max-width: 560px) {
  :root { --pad-x: 10px; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.16; letter-spacing: -.028em; font-weight: 650; }
p  { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a  { color: inherit; text-decoration: none; }
svg { display: block; width: 100%; height: 100%; }
[hidden] { display: none !important; }

button, input {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--canvas); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  transition: border-color .2s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.header-right { display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }

.brand { display: inline-flex; align-items: center; gap: 11px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px -3px color-mix(in srgb, var(--accent) 55%, transparent);
}

.brand-name { font-size: 1.03rem; font-weight: 500; letter-spacing: -.02em; }
.brand-name strong { font-weight: 700; }

.site-nav { display: flex; gap: clamp(16px, 3vw, 28px); font-size: .95rem; color: var(--ink-soft); }
.site-nav a { position: relative; padding: 6px 0; transition: color .16s var(--ease); }
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s var(--ease);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a:hover::after { transform: scaleX(1); }

.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 560; }
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.theme-toggle,
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease),
              background .16s var(--ease), transform .14s var(--ease);
}
.theme-toggle:hover,
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active,
.icon-btn:active { transform: scale(.94); }

.icon-btn svg { width: 20px; height: 20px; }

.header-tools { display: flex; align-items: center; gap: 8px; }

.theme-icon {
  grid-area: 1 / 1;
  width: 20px; height: 20px;
  transition: opacity .2s var(--ease), transform .3s var(--ease);
}

.theme-icon--sun  { opacity: 0; transform: rotate(-70deg) scale(.6); }
.theme-icon--moon { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-icon--sun  { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-icon--moon { opacity: 0; transform: rotate(70deg) scale(.6); }

.menu-toggle {
  display: none;
  place-items: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .16s var(--ease), border-color .16s var(--ease);
}
.menu-toggle:hover { color: var(--accent); border-color: var(--accent); }

.menu-bars,
.menu-bars::before,
.menu-bars::after {
  display: block;
  width: 18px;
  height: 1.9px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .24s var(--ease), opacity .16s var(--ease);
}
.menu-bars { position: relative; }
.menu-bars::before, .menu-bars::after { content: ""; position: absolute; }
.menu-bars::before { transform: translateY(-6px); }
.menu-bars::after  { transform: translateY(6px); }

.nav-open .menu-bars { background: transparent; }
.nav-open .menu-bars::before { transform: rotate(45deg); }
.nav-open .menu-bars::after  { transform: rotate(-45deg); }

@media (max-width: 760px) {
  .menu-toggle { display: grid; }

  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: grid;
    gap: 0;
    padding: 6px var(--pad-x) 16px;
    border-bottom: 1px solid var(--line);
    background: var(--canvas);
    box-shadow: var(--sh-2);
    font-size: 1rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity .2s var(--ease), transform .24s var(--ease),
                visibility .24s;
  }
  .site-header.nav-open .site-nav {
    visibility: visible;
    opacity: 1;
    transform: none;
  }
  .site-nav a { padding: 15px 2px; border-bottom: 1px solid var(--line); }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a::after { display: none; }
  .site-nav a[aria-current="page"] { color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav { transition: none; }
}

.hero {
  position: relative;
  padding: clamp(28px, 3.6vw, 44px) 0 clamp(40px, 5vw, 60px);
}

.hero-glow {
  position: absolute;
  inset: -240px 0 auto 0;
  height: 640px;
  pointer-events: none;
  background:
    radial-gradient(42% 50% at 50% 30%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%),
    radial-gradient(36% 44% at 78% 6%, color-mix(in srgb, #7c3aed 11%, transparent), transparent 72%);
  filter: blur(6px);
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -.042em;
}

.lede {
  max-width: 58ch;
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.1rem);
  text-wrap: balance;
}

.calc-card {
  position: relative;
  width: 100%;
  margin-top: clamp(20px, 2.4vw, 26px);
  padding: clamp(22px, 2.6vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-soft);
  text-align: left;
}
.calc-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(170deg, var(--sheen), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.tool-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 24px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.tool-switch a {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: .93rem;
  font-weight: 540;
  text-align: center;
  line-height: 1.25;
  transition: color .16s var(--ease), background .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tool-switch a:hover { color: var(--ink); background: var(--surface); }

.tool-switch a[aria-current="page"],
.tool-switch a[aria-current="page"]:hover {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 640;
  box-shadow: 0 1px 2px rgba(11, 18, 32, .18),
              0 6px 14px -6px color-mix(in srgb, var(--accent) 75%, transparent);
}

.calc-head { margin-bottom: 26px; }
.calc-head h2 { font-size: 1.35rem; letter-spacing: -.03em; }
.calc-sub { margin-top: 6px; color: var(--ink-mute); font-size: .9rem; }

.calc-form {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
  align-items: start;
}
.row-2, #luogo-fields { display: contents; }

.calc-form [data-field],
.manual,
.actions,
.form-status { grid-column: span 12; }

@media (min-width: 560px) {
  .calc-form [data-field="sesso"],
  .calc-form [data-field="data"]      { grid-column: span 6; }
  .calc-form [data-field="comune"]    { grid-column: span 8; }
  .calc-form [data-field="provincia"] { grid-column: span 4; }
}

@media (min-width: 1000px) {
  .calc-form [data-field="cognome"],
  .calc-form [data-field="nome"],
  .calc-form [data-field="sesso"]     { grid-column: span 4; }
  .calc-form [data-field="data"]      { grid-column: span 4; }
  .calc-form [data-field="comune"]    { grid-column: span 5; }
  .calc-form [data-field="provincia"] { grid-column: span 3; }

  .calc-form .manual  { grid-column: span 7; align-self: center; }
  .calc-form .actions { grid-column: span 5; justify-content: flex-end; margin-top: 0; }
  .calc-form .actions .btn--primary { flex: 0 1 auto; min-width: 258px; }

  .calc-form--singolo .actions {
    grid-column: span 12;
    justify-content: stretch;
    margin-top: 8px;
  }
  .calc-form--singolo .actions .btn--primary { flex: 1 1 auto; }
  .calc-form--singolo .actions .btn--ghost   { flex: 0 0 200px; }
}

.field { position: relative; margin: 0; padding: 0; border: 0; min-width: 0; }

.input {
  width: 100%;
  height: 62px;
  padding: 24px 16px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 1rem;
  color: var(--ink);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
  -webkit-appearance: none;
          appearance: none;
}
.input::placeholder { color: transparent; }
.input:hover:not(:focus):not(.input--readonly) { border-color: var(--ink-mute); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--sh-focus); }

.input--readonly {
  background: var(--surface-sunk);
  color: var(--ink-soft);
  cursor: default;
}
.input--mono { font-family: var(--font-mono); letter-spacing: .16em; text-transform: uppercase; }

.field > label {
  position: absolute;
  left: 17px;
  top: 20px;
  color: var(--ink-mute);
  font-size: 1rem;
  pointer-events: none;
  transform-origin: left top;
  transition: transform .17s var(--ease), color .17s var(--ease);
  will-change: transform;
}

.input:focus + label,
.input:not(:placeholder-shown) + label,
.field--static > label {
  transform: translateY(-11px) scale(.76);
}
.input:focus + label { color: var(--accent); }
.field--static .input { padding-top: 26px; }

.field-hint, .field-error { font-size: .82rem; line-height: 1.4; }
.field-hint { margin-top: 6px; padding-left: 3px; color: var(--ink-mute); }

.field-error {
  display: none;
  margin-top: 6px;
  padding-left: 3px;
  color: var(--danger);
  font-weight: 520;
}
.field.is-invalid .field-error { display: block; }
.field.is-invalid .input { border-color: var(--danger); }
.field.is-invalid .input:focus {
  box-shadow: 0 0 0 3px var(--danger-wash), 0 0 0 4.5px var(--danger);
}
.field.is-invalid .field-hint { display: none; }

.field--fieldset { display: flex; flex-direction: column; }

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 62px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.segmented input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}
.segmented > label {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: .95rem;
  font-weight: 520;
  cursor: pointer;
  transition: color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.segmented > label:hover { color: var(--ink); }

.segmented-thumb {
  position: absolute;
  z-index: 1;
  top: 5px; left: 5px;
  width: calc(50% - 5px);
  height: calc(100% - 10px);
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(11, 18, 32, .18),
              0 6px 14px -6px color-mix(in srgb, var(--accent) 75%, transparent);
  opacity: 0;
  transition: transform .26s var(--ease), opacity .18s var(--ease);
}
.segmented input:checked + label { color: var(--on-accent); font-weight: 640; }
.segmented:has(input:checked) .segmented-thumb { opacity: 1; }
.segmented:has(#sesso-f:checked) .segmented-thumb { transform: translateX(100%); }
.segmented:has(input:focus-visible) {
  border-color: var(--accent);
  box-shadow: var(--sh-focus);
}
.field.is-invalid .segmented { border-color: var(--danger); }

.field--combo .input { padding-right: 46px; }

.combo-toggle {
  position: absolute;
  top: 17px; right: 10px;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-mute);
  cursor: pointer;
  transition: transform .2s var(--ease), color .16s var(--ease), background .16s var(--ease);
}
.combo-toggle:hover { color: var(--ink); background: var(--surface-sunk); }
.combo-toggle svg { width: 20px; height: 20px; }
.field--combo.is-open .combo-toggle { transform: rotate(180deg); color: var(--accent); }

.combo-list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  left: 0; right: 0;
  max-height: 268px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-3);
  scrollbar-width: thin;
}

.combo-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 9px;
  cursor: pointer;
  font-size: .96rem;
  transition: background .12s var(--ease);
}
.combo-list li:hover { background: var(--accent-wash); color: var(--accent); }

.combo-list li[aria-selected="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.combo-list li .opt-meta {
  flex: 0 1 auto;
  min-width: 6.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .04em;
}
.combo-list li[aria-selected="true"] .opt-meta { color: inherit; opacity: .75; }
.combo-empty { padding: 14px 13px; color: var(--ink-mute); font-size: .92rem; cursor: default; }
.combo-empty:hover { background: none; color: var(--ink-mute); }

.manual { display: grid; gap: 14px; }

.manual-field { max-width: 220px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check-box {
  flex: none;
  display: grid;
  place-items: center;
  width: 21px; height: 21px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--on-accent);
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.check-box svg {
  width: 14px; height: 14px;
  opacity: 0;
  transform: scale(.6);
  transition: opacity .16s var(--ease), transform .18s var(--ease);
}
.check input:checked + .check-box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check-box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check-box { box-shadow: var(--sh-focus); }
.check:hover .check-box { border-color: var(--ink-mute); }

.actions { display: flex; gap: 12px; margin-top: 8px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.012em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease),
              background .18s var(--ease), border-color .18s var(--ease),
              opacity .18s var(--ease);
}
.btn svg { flex: none; width: 19px; height: 19px; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  flex: 1;
  background: linear-gradient(178deg, var(--accent-hi), var(--accent) 58%, var(--accent-deep));
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(11, 18, 32, .16),
              0 10px 22px -9px color-mix(in srgb, var(--accent) 78%, transparent);
}
.btn--primary:hover {
  box-shadow: 0 1px 2px rgba(11, 18, 32, .18),
              0 14px 30px -9px color-mix(in srgb, var(--accent) 88%, transparent);
  filter: brightness(1.05);
}
.btn--primary[disabled] {
  cursor: not-allowed;
  opacity: .45;
  box-shadow: none;
  filter: none;
  transform: none;
}

.btn--ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}
.btn--ghost:hover { border-color: var(--ink-mute); color: var(--ink); }

.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label { opacity: 0; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 19px; height: 19px;
  border: 2.2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .62s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-status {
  min-height: 1.2em;
  color: var(--danger);
  font-size: .87rem;
  font-weight: 520;
  text-align: center;
}

.result {
  margin-top: 26px;
  padding: 30px clamp(18px, 3vw, 28px) 24px;
  border: 1px solid color-mix(in srgb, var(--ok) 26%, var(--line));
  border-radius: var(--r-lg);
  background: var(--ok-wash);
  text-align: center;
  animation: reveal .42s var(--ease) both;
}
@keyframes reveal {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.result-check { width: 52px; height: 52px; margin: 0 auto 14px; color: var(--ok); }
.rc-circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: draw .5s var(--ease) .06s forwards; }
.rc-tick   { stroke-dasharray: 40;  stroke-dashoffset: 40;  animation: draw .34s var(--ease) .38s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.result-title {
  color: var(--ok);
  font-size: .8rem;
  font-weight: 680;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.result-code {
  margin: 14px 0 4px;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 5.4vw, 2.2rem);
  font-weight: 620;
  letter-spacing: .06em;
  word-break: break-all;
}
.result-code:focus { outline: none; }

.cf-seg {
  padding: 3px 1px;
  border-radius: 5px;
  border-bottom: 2px solid transparent;
  cursor: help;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.cf-seg:hover, .cf-seg.is-active {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  border-bottom-color: var(--ok);
  color: var(--ok);
}

.result-legend { min-height: 2.6em; color: var(--ink-soft); font-size: .89rem; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
}
.result-actions .btn { flex: 1; max-width: 220px; }
.btn--copy.is-done { background: var(--ok); filter: none; }

.result-note { margin-top: 18px; color: var(--ink-mute); font-size: .79rem; line-height: 1.5; }

@media (max-width: 420px) {
  .result-actions { flex-direction: column; }
  .result-actions .btn { max-width: none; }
}

.howto { padding: 0 0 clamp(56px, 7vw, 88px); }

.howto-title {
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  letter-spacing: -.03em;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.howto-card {
  display: flex;
  flex-direction: column;
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-soft);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.howto-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
}

.howto-num {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  margin-bottom: 14px;
  border-radius: 9px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: .88rem;
  font-weight: 680;
}

.howto-card h3 { font-size: 1.05rem; letter-spacing: -.024em; }
.howto-card p {
  margin-top: 8px;
  margin-bottom: 18px;
  color: var(--ink-soft);
  font-size: .93rem;
  line-height: 1.65;
}
.howto-card strong { color: var(--ink); font-weight: 620; }

.howto-shot {
  display: block;
  width: 100%;
  height: auto;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

:root[data-theme="dark"] .howto-shot { filter: brightness(.86) contrast(1.02); }

.howto-note {
  margin-top: 20px;
  color: var(--ink-mute);
  font-size: .86rem;
}

.guide {
  padding: var(--sec-y) 0;
  border-top: 1px solid var(--line);
  background: var(--surface-sunk);
}

.guide-card {
  padding: clamp(26px, 4vw, 56px) clamp(20px, 3.4vw, 52px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-soft);
}

.guide h2 {
  position: relative;
  margin-top: clamp(48px, 5.5vw, 68px);
  padding-top: 21px;
  font-size: clamp(1.35rem, 2.7vw, 1.72rem);
  letter-spacing: -.034em;
  scroll-margin-top: 90px;
}
.guide h2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 34px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.guide-card > h2:first-child { margin-top: 0; }

.guide-card > h3 {
  margin-top: 34px;
  font-size: clamp(1.08rem, 1.9vw, 1.2rem);
  letter-spacing: -.024em;
}

.guide p { margin-top: 18px; color: var(--ink-soft); line-height: 1.75; }
.guide p strong { color: var(--ink); font-weight: 620; }
.guide em { font-style: normal; color: var(--ink); font-weight: 520; }

.guide-intro { font-size: 1.06rem; }

.fact-grid, .use-grid, .pitfall-grid {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

@media (min-width: 640px) {
  .pitfall-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 760px) {
  .fact-grid, .use-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  .pitfall-grid { grid-template-columns: repeat(3, 1fr); }
}

.fact-card, .use-card, .pitfall-card {
  padding: 21px 22px 23px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.fact-card:hover, .use-card:hover, .pitfall-card:hover { transform: translateY(-2px); }

.fact-card h3, .use-card h3, .pitfall-card h3 {
  font-size: 1.02rem;
  letter-spacing: -.024em;
}
.fact-card p, .use-card p, .pitfall-card p {
  margin-top: 8px;
  font-size: .92rem;
  line-height: 1.62;
}

.fact-card {
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
  background: var(--accent-wash);
}
.fact-card p { color: var(--ink-soft); }

.use-card {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: linear-gradient(176deg,
              color-mix(in srgb, var(--accent) 13%, var(--surface)),
              var(--accent-wash));
}
.use-card h3 { color: var(--accent-deep); }

:root[data-theme="dark"] .use-card h3 { color: var(--accent-hi); }
.use-card p { color: var(--ink-soft); }

.pitfall-card { background: var(--surface-sunk); }
.pitfall-card h3 { position: relative; padding-left: 18px; }
.pitfall-card h3::before {
  content: "";
  position: absolute;
  left: 1px; top: .52em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.pitfall-card p { color: var(--ink-soft); }

.callout {
  margin-top: 28px;
  padding: 20px 24px 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-left: 3px solid var(--accent);
  border-radius: 5px var(--r-md) var(--r-md) 5px;
  background: var(--accent-wash);
}
.callout h3 {
  color: var(--accent);
  font-size: .76rem;
  font-weight: 680;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.callout p { margin-top: 9px; }

.guide-figure { margin: 30px 0 0; }
.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.guide-figure figcaption {
  margin-top: 11px;
  color: var(--ink-mute);
  font-size: .87rem;
  line-height: 1.55;
}

:root[data-theme="dark"] .guide-figure img { filter: brightness(.88) contrast(1.02); }

@media (max-width: 700px) {
  .figure-scroll { overflow-x: auto; border-radius: var(--r-md); }
  .figure-scroll img { min-width: 640px; }
}

.guide-figure--lead { margin-top: 26px; }
.guide-figure--lead img {
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
}
:root[data-theme="dark"] .guide-figure--lead img { filter: none; }

.table-scroll {
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);

  background: var(--surface-sunk);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
}
.guide-table caption {
  padding: 14px 18px 0;
  color: var(--ink-mute);
  font-size: .8rem;
  text-align: left;
}
.guide-table th, .guide-table td {
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.guide-table thead th {
  color: var(--ink-mute);
  font-size: .76rem;
  font-weight: 640;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.guide-table tbody th { color: var(--ink-soft); font-weight: 520; }

.guide-table--wrap th, .guide-table--wrap td { white-space: normal; }
.guide-table--wrap tbody th { white-space: nowrap; }
.guide-table tbody tr:last-child th,
.guide-table tbody tr:last-child td { border-bottom: 0; }
.guide-table code {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-wash);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: .88em;
  font-weight: 600;
}

.faq-block {
  margin-top: clamp(52px, 6vw, 72px);
  padding-top: clamp(40px, 5vw, 56px);
  border-top: 1px solid var(--line);
}
.faq-block h2 { margin-top: 0; }

.faq { margin-top: 28px; display: grid; gap: 10px; }

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.faq-item[open] {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: var(--sh-2);
}

.faq-item summary {
  position: relative;
  padding: 19px 52px 19px 22px;
  font-size: 1.01rem;
  font-weight: 560;
  letter-spacing: -.014em;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after,
.faq-item summary::before {
  content: "";
  position: absolute;
  right: 24px;
  top: 50%;
  width: 13px;
  height: 1.9px;
  border-radius: 2px;
  background: var(--accent);
  transform: translateY(-50%);
  transition: transform .24s var(--ease), opacity .24s var(--ease);
}
.faq-item summary::before { transform: translateY(-50%) rotate(90deg); }
.faq-item[open] summary::before { transform: translateY(-50%) rotate(0); opacity: 0; }

.faq-item p {
  margin-top: 0;
  padding: 0 22px 21px;
  color: var(--ink-soft);
  font-size: .96rem;
}

.site-footer {
  padding: clamp(46px, 6vw, 68px) 0 34px;
  border-top: 1px solid var(--line);
  background: var(--canvas);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 34px;
  justify-content: space-between;
  align-items: flex-start;
}
.brand--footer { margin-bottom: 14px; }
.footer-note { max-width: 46ch; color: var(--ink-mute); font-size: .88rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 34px 56px; color: var(--ink-soft); font-size: .92rem; }
.footer-col { display: grid; gap: 11px; align-content: start; }
.footer-head {
  margin-bottom: 2px;
  color: var(--ink-mute);
  font-size: .74rem;
  font-weight: 620;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.footer-nav a:hover { color: var(--accent); }

.linkish {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.linkish:hover { color: var(--accent); }

.copyright {
  max-width: 1200px;
  margin: 34px auto 0;
  padding: 22px var(--pad-x) 0;
  border-top: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: .81rem;
}

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--canvas);
  font-size: .92rem;
  font-weight: 550;
  box-shadow: var(--sh-3);
  transform: translate(-50%, 18px);
  opacity: 0;
  transition: transform .28s var(--ease), opacity .28s var(--ease);
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.wrap--narrow { max-width: 920px; }

.page { border-top: 0; }

.page-title {
  font-size: clamp(1.75rem, 4.4vw, 2.5rem);
  letter-spacing: -.042em;
  line-height: 1.1;
}
.page-meta { margin-top: 16px; color: var(--ink-mute); font-size: .85rem; }

.page-list { display: grid; gap: 12px; margin-top: 20px; }
.page-list li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.page-list li::before {
  content: "";
  position: absolute;
  left: 2px; top: .72em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.page-list strong { color: var(--ink); font-weight: 620; }

.contact-box {
  display: grid;
  gap: 8px;
  margin-top: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-sunk);
}
.contact-box .contact-label {
  color: var(--ink-mute);
  font-size: .76rem;
  font-weight: 620;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.contact-box a {
  color: var(--accent);
  font-size: clamp(1.05rem, 3vw, 1.28rem);
  font-weight: 620;
  letter-spacing: -.02em;
  word-break: break-word;
}
.contact-box a:hover { text-decoration: underline; }

.page-card a { color: var(--accent); text-decoration: underline; }

.cookie-banner {
  position: fixed;
  z-index: 70;
  left: 0; right: 0;
  bottom: 0;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(16px);
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.cookie-banner.is-visible { opacity: 1; transform: none; }

.cookie-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  max-width: 940px;
  margin-inline: auto;
  padding: 13px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-3);
}

.cookie-text {
  flex: 1 1 320px;
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.5;
}
.cookie-text a { color: var(--accent); text-decoration: underline; white-space: nowrap; }

.cookie-actions { display: flex; flex: 0 0 auto; gap: 8px; }

.btn--sm { min-height: 44px; padding: 0 18px; font-size: .9rem; }

@media (max-width: 560px) {
  .cookie-actions { flex: 1 1 100%; }
  .cookie-actions .btn { flex: 1 1 0; }
}

.result--warn {
  border-color: color-mix(in srgb, var(--danger) 26%, var(--line));
  background: var(--danger-wash);
}
.result--warn .result-check,
.result--warn .result-title { color: var(--danger); }

.rc-bang { display: none; }
.result--warn .rc-tick { display: none; }
.result--warn .rc-bang { display: block; }

.result-code .omo-char {
  padding: 0 2px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 700;
}

.decode {
  display: grid;
  grid-template-columns: max-content 1fr;
  margin: 22px 0 0;
  text-align: left;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}
.decode dt,
.decode dd {
  padding: 13px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}
.decode dt {
  padding-right: 22px;
  color: var(--ink-mute);
  font-size: .74rem;
  font-weight: 640;
  letter-spacing: .09em;
  text-transform: uppercase;
  line-height: 1.9;
}
.decode dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 580;
  letter-spacing: -.012em;
}

.decode-alt {
  display: block;
  margin-top: 3px;
  color: var(--ink-mute);
  font-size: .82rem;
  font-weight: 440;
  line-height: 1.55;
  letter-spacing: 0;
}
.decode-mono { font-family: var(--font-mono); letter-spacing: .04em; }
.decode-ok   { color: var(--ok); }
.decode-bad  { color: var(--danger); }
.decode-warn { color: #b45309; }

@media (max-width: 560px) {

  .decode { grid-template-columns: 1fr; }
  .decode dt { padding: 14px 0 0; border-bottom: 0; line-height: 1.5; }
  .decode dd { padding-top: 4px; }
}
