@font-face {
  font-family: 'Ezra SIL';
  src: url('fonts/SILEOT.woff') format('woff');
  font-display: swap;
}

:root {
  --bg: #04050e;
  --glass: rgba(12, 14, 30, 0.55);
  --glass-2: rgba(16, 18, 38, 0.7);
  --line: rgba(150, 160, 220, 0.16);
  --gold: #e8c468;
  --text: #e9eaf6;
  --muted: #8b93b8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, sans-serif; }

#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; pointer-events: none; }

#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr 500px;
  grid-template-rows: 74px 1fr 50px;
  grid-template-areas:
    "rail topbar topbar"
    "rail stage  detail"
    "bottombar bottombar bottombar";
}

/* ---------- left rail ---------- */
#rail {
  grid-area: rail;
  display: flex; flex-direction: column;
  padding: 20px 14px; gap: 14px; overflow-y: auto;
  background: var(--glass); backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
}
.rail-title { font-family: "Cinzel", serif; font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); padding: 0 6px 4px; }
#lessons { display: flex; flex-direction: column; gap: 8px; }
/* accordion groups */
.acc { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.02); }
.acc-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 13px; background: none; border: none; cursor: pointer; font: inherit;
  font-family: "Cinzel", serif; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text); }
.acc-head:hover { color: var(--gold); }
.acc-caret { font-style: normal; font-size: 10px; color: var(--muted); transition: transform .2s; }
.acc.open .acc-caret { transform: rotate(180deg); }
.acc-body { display: none; flex-direction: column; padding: 2px 6px 8px; }
.acc.open .acc-body { display: flex; }
.lesson { text-align: left; padding: 8px 11px; margin: 1px 0; border: none; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; transition: all .15s; }
.lesson:hover { color: var(--text); background: rgba(255,255,255,.04); }
.lesson.active { color: var(--gold); background: rgba(232,196,104,.12); }

/* ---------- top bar ---------- */
#topbar {
  grid-area: topbar; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line);
  background: linear-gradient(to bottom, rgba(10,12,28,.55), transparent);
}
.brand h1 { margin: 0; font-family: "Cinzel", serif; font-weight: 600; font-size: 24px; letter-spacing: .12em;
  color: #f1ecff; text-shadow: 0 0 22px rgba(150,120,255,.4); }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-family: "EB Garamond", serif; font-style: italic; }
.actions { display: flex; gap: 10px; }
.actions button {
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 16px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--muted); transition: all .2s;
}
.actions button:hover { color: var(--text); border-color: rgba(232,196,104,.4); }
.actions .lamp { color: var(--gold); border-color: rgba(232,196,104,.5);
  box-shadow: 0 0 16px rgba(232,196,104,.3); }

/* ---------- stage ---------- */
#stage { grid-area: stage; position: relative; overflow: hidden; }
#tree-svg { width: 100%; height: 100%; display: block; overflow: visible; } /* glows at the edge (Keter, Malkuth) are not clipped */

/* tree text */
#tree-svg .he { font-family: "EB Garamond", serif; font-size: 46px; font-weight: 600; }
#tree-svg .it { font-family: "Cinzel", serif; font-size: 14px; letter-spacing: .12em; fill: rgba(233,234,246,.78); }
#tree-svg .badge-n { font-family: "Inter", sans-serif; font-size: 19px; font-weight: 600; fill: #e9eaf6; }
#tree-svg .glyph { font-family: "EB Garamond", serif; font-size: 27px; fill: rgba(233,226,255,.6); }
#tree-svg .node { cursor: pointer; }
/* the drawings are not text to select: labels on the channels let the click (and the pointer cursor) reach the channel beneath */
#tree-svg, #wheel-svg, #body { -webkit-user-select: none; user-select: none; }
#tree-svg text { pointer-events: none; }
#tree-svg .node .ring { transition: fill .2s; }
#tree-svg .node:hover .halo { stroke-width: 8; }
#tree-svg .node.selected .halo { stroke-width: 9; }
#tree-svg .node.selected .he { font-size: 50px; }

/* settings modal (Visualizzazione / Livelli / Sfondo) */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,6,16,.55); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: 340px; max-width: 90vw; padding: 20px 22px 22px;
  background: var(--glass-2); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-family: "Cinzel", serif; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.modal-x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.modal-x:hover { color: var(--text); }

/* viz panel — vertical, lives inside the settings modal */
#viz-panel { display: flex; flex-direction: column; gap: 18px; }
.viz-group { display: flex; flex-direction: column; gap: 3px; }
.viz-row { display: flex; flex-direction: column; gap: 2px; }
#viz-panel h2 { margin: 0 0 6px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  font-family: "Cinzel", serif; }
.viz { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin: 0;
  background: none; border: none; border-radius: 9px; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; }
.viz span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; }
.viz:hover { color: var(--text); background: rgba(255,255,255,.03); }
.viz.active { color: var(--gold); }
.viz.active span { color: var(--gold); border-color: rgba(232,196,104,.55); box-shadow: 0 0 10px rgba(232,196,104,.3); }

/* ---------- detail (reading) panel ---------- */
#detail {
  grid-area: detail; margin: 16px 16px 0 0; padding: 26px 26px 24px;
  background: var(--glass-2); backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 20px;
  overflow-y: auto;
}
#detail::-webkit-scrollbar { width: 8px; }
#detail::-webkit-scrollbar-thumb { background: rgba(150,160,220,.2); border-radius: 8px; }

.dt-head { display: flex; justify-content: space-between; align-items: flex-start; }
.dt-he { font-family: "EB Garamond", serif; font-size: 52px; line-height: 1; font-weight: 600; }
.dt-title { font-family: "Cinzel", serif; font-size: 16px; letter-spacing: .1em; margin-top: 10px; }
.dt-sub { color: var(--muted); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin-top: 4px; }
.dt-emblem { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid; font-size: 26px; }
/* dynamic tarot cards in the panel header (in place of the star emblem) */
.dt-cards { display: flex; gap: 8px; flex: none; }
.dt-card { width: 48px; aspect-ratio: 118 / 229; object-fit: cover; /* Marseille cards (Warin, img/carte) */ border-radius: 9px;
  border: 1px solid; background: #0b0d1c; transition: transform .18s ease; cursor: pointer; }
.dt-card:hover { transform: translateY(-3px) scale(1.05); }
.dt-card:not([data-arcana]) { cursor: default; }

.dt-block { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.dt-block:first-of-type { border-top: none; }
.dt-block h3 { margin: 0 0 12px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
  font-family: "Cinzel", serif; }
.dt-block p { margin: 0; line-height: 1.6; font-family: "EB Garamond", serif; font-size: 17px; color: #d7d9ec; }

.rows .row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed rgba(150,160,220,.08); font-size: 13px; }
.rows .row span { color: var(--muted); }
.rows .row b { font-weight: 500; }

.dt-he-row { display: flex; align-items: baseline; gap: 12px; }
.dt-he2 { font-family: "EB Garamond", serif; font-size: 52px; font-weight: 600; color: var(--muted); line-height: 1; }
/* the sign or planet of a Hebrew letter, tiny capitals under it (data-name set by app2.js). Each letter is a little
   column as wide as the wider of letter and name, so names never overlap and the letters stay close */
.dt-he[data-name], .dt-he2[data-name] { display: inline-flex; flex-direction: column; align-items: center; width: max-content; }
.dt-he[data-name]::after, .dt-he2[data-name]::after { content: attr(data-name); margin-top: 5px; white-space: nowrap;
  font-family: "Lato", "Sora", system-ui, sans-serif; font-size: 6px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; line-height: 1; color: var(--muted); }
.dt-he-row { align-items: flex-start; gap: 10px; }
/* natal sign panel: list of planets in the sign (no per-planet tarot) */
.planet-list { display: flex; flex-direction: column; gap: 2px; }
.pl-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 0;
  background: none; border: none; border-radius: 9px; cursor: pointer; font: inherit; text-align: left;
  color: var(--text); transition: background .15s; }
.pl-row:hover { background: rgba(255,255,255,.05); }
.pl-he { font-family: 'Ezra SIL', "EB Garamond", serif; font-size: 21px; line-height: 1; width: 22px; text-align: center; flex: none; }
.pl-glyph { width: 18px; text-align: center; font-size: 13px; flex: none; opacity: .8; } 
.pl-glyph { font-family: "Noto Sans Symbols 2", "Noto Sans Symbols", "Apple Symbols", "Segoe UI Symbol", serif; }
.pl-name { font-size: 14px; flex: none; min-width: 80px; display: flex; flex-direction: column; gap: 1px; }
.pl-cusp { font-size: 11px; font-style: normal; color: var(--gold); letter-spacing: .02em; line-height: 1.1; }
.pl-row.pl-ghost { opacity: .5; }
.pl-cusp.ghost { color: var(--muted); }
.pl-cusp-note { color: var(--muted); }
.pl-formula { font-size: 13.5px; color: var(--text); flex: 1; }
/* back button (e.g. from a planet card back to its sign) */
.dt-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; padding: 5px 11px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px;
  color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; }
.dt-back:hover { color: var(--gold); border-color: rgba(232,196,104,.4); }
.pl-pos { font-size: 12px; color: var(--muted); margin-left: auto; letter-spacing: .02em; white-space: nowrap; }
.pl-pos .retro { color: #ff7a9a; font-weight: 700; }

.dt-meta { margin-top: 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.dt-meta .retro { color: #ff7a9a; font-weight: 700; }
.dt-meta .abs-deg { color: var(--gold); font-weight: 600; }
.arcana { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.arc { display: flex; align-items: center; gap: 8px; padding: 8px 13px; font-size: 13.5px; color: var(--text);
  background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; }
.arc-ic { color: var(--gold); font-size: 12px; }

.aspects { display: flex; flex-direction: column; gap: 5px; }
.aspect { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 3px 0; }
/* clickable aspect rows: isolate + blink the two planets on tree and wheel */
.aspect[data-a1] { cursor: pointer; border-radius: 8px; padding-left: 8px; padding-right: 8px; margin: 0 -8px; transition: background .15s; }
.aspect[data-a1]:hover { background: rgba(255,255,255,.05); }
.aspect[data-a1].on { background: rgba(232,196,104,.10); }
.aspect .asp-sym { width: 18px; text-align: center; font-size: 15px; flex: none; display: inline-flex; justify-content: center; align-items: center; }
.asp-svg { width: 14px; height: 14px; display: block; }
.aspect .asp-name { color: var(--text); min-width: 96px; }
.aspect .asp-other { color: var(--muted); flex: 1; }
.aspect .asp-orb { color: var(--muted); font-size: 12px; flex: none; }
/* distance between the two planets on the 360° circle (0-180): the number that makes the aspect */
.aspect .asp-sep { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; min-width: 3.2em; text-align: right; }
.aspect .asp-orb { min-width: 3.4em; text-align: right; font-variant-numeric: tabular-nums; }

.links { display: flex; flex-direction: column; gap: 8px; }
.link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; font: inherit;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-align: left; transition: all .18s; }
.link:hover { background: rgba(255,255,255,.06); border-color: rgba(232,196,104,.3); }
.lk-num { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid; display: grid; place-items: center;
  font-size: 12px; color: var(--text); }
.lk-body { flex: 1; display: flex; flex-direction: column; }
.lk-body b { font-size: 14px; }
.lk-body i { font-size: 12px; color: var(--muted); font-style: normal; }
.lk-go { color: var(--muted); font-size: 20px; }

.approfondisci { width: 100%; margin-top: 26px; padding: 15px; cursor: pointer; font: inherit; font-size: 14px;
  letter-spacing: .12em; text-transform: uppercase; color: #efeaff;
  background: linear-gradient(135deg, rgba(120,90,220,.45), rgba(60,80,180,.4));
  border: 1px solid rgba(150,140,230,.4); border-radius: 14px;
  box-shadow: 0 0 22px rgba(110,90,220,.25); transition: all .2s; }
.approfondisci:hover { box-shadow: 0 0 30px rgba(140,110,255,.45); }

/* ---------- bottom bar ---------- */
#bottombar { grid-area: bottombar; display: flex; align-items: stretch; padding: 0 18px;
  border-top: 1px solid var(--line); background: rgba(8,10,22,.6); position: relative; }
.chips { display: flex; flex: 1; justify-content: center; align-items: stretch; }
.chip { display: flex; align-items: center; gap: 8px; padding: 0 20px; color: var(--muted); position: relative; }
.chip + .chip::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 16px; background: var(--line); }
.chip .ci { font-size: 13px; color: var(--muted); }
.chip > div { display: flex; align-items: baseline; gap: 6px; }
.chip b { font-size: 11.5px; color: var(--text); font-weight: 500; letter-spacing: .03em; }
.chip i { font-size: 11px; font-style: normal; color: var(--muted); }
.chip.active { color: var(--gold); }
.chip.active .ci { color: var(--gold); }
.chip.active b { color: var(--gold); }

/* ---------- natal input form (header) ---------- */
.natal-form { display: flex; align-items: center; gap: 10px; }
.field { display: flex; flex-direction: column; justify-content: center; padding: 5px 12px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; }
.field small { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
.field input { background: none; border: none; color: var(--text); font: inherit; font-size: 13px; outline: none; color-scheme: dark; }
.field.place { min-width: 168px; }
.field input::placeholder { color: rgba(139,147,184,.55); }
.natal-go { padding: 0 18px; height: 44px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 13px; letter-spacing: .06em;
  color: #efeaff; background: linear-gradient(135deg, rgba(120,90,220,.5), rgba(60,80,180,.45));
  border: 1px solid rgba(150,140,230,.4); transition: box-shadow .2s; }
.natal-go:hover { box-shadow: 0 0 18px rgba(140,110,255,.45); }

/* path words (planets / signs) */
#tree-svg .word { font-family: "Inter", sans-serif; font-size: 13px; font-weight: 700; letter-spacing: .5px; }

/* ---------- view switch + stage layout (tree / wheel) ---------- */
.view-switch { position: absolute; top: 14px; left: 14px; z-index: 6;
  display: flex; gap: 4px; padding: 3px; background: var(--glass-2); border: 1px solid var(--line);
  border-radius: 12px; backdrop-filter: blur(12px); }
.view-switch button { padding: 6px 12px; border: none; background: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 12px; border-radius: 9px; transition: all .18s; }
.view-switch button:hover { color: var(--text); }
.view-switch button.active { color: var(--gold); background: rgba(232,196,104,.14); }

#stage-canvas { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3%; padding: 30px 2% 0; }
#tree-svg { height: 100%; width: auto; max-width: 100%; display: block; }
#wheel { position: relative; height: 82%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
#wheel-svg { width: 100%; height: 100%; }
#wheel-empty { position: absolute; max-width: 230px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5;
  font-family: "EB Garamond", serif; }
#wheel.ready #wheel-empty { display: none; }
/* words on the wheel in the sans of the logo tagline (KABBALISTIC ASTROLOGY), wide-spaced capitals */
#wheel-svg .wsign { font-size: 12px; font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
#wheel-svg .wsign-arc { letter-spacing: .22em; font-weight: 400; }
#wheel-svg .wasc, #wheel-svg .wdeg, #wheel-svg .whouse { font-family: "Lato", "Sora", system-ui, sans-serif; }
#wheel-svg .wsign-he-in { font-family: 'Ezra SIL', "EB Garamond", serif; font-weight: 600; letter-spacing: 0; }
#wheel-svg .wzod { font-size: 11px; font-weight: 400; letter-spacing: 0; }
#wheel-svg .wplanet.wplanet-sm { font-size: 8.5px; } /* beats the generic .wplanet size below */
/* variant: no dots, the glyph alone sits on the ring with a glow in its colour */
body.ak-nodots #wheel-svg .wplanet-hit circle { fill: transparent; stroke: none; filter: none !important; }
body.ak-nodots #wheel-svg .wplanet.wplanet-sm { font-size: 17px; filter: drop-shadow(0 0 4px currentColor); paint-order: stroke; stroke: rgba(5,6,14,.9); stroke-width: 2.5px; }
#wheel-svg .wmark.wsign-he { font-size: 12px; }
#wheel-svg .wmark-name { font-size: 7.5px; letter-spacing: .14em; font-weight: 400; }
/* modules with the bar: one legend (Names · Letters · Hebrew) drives tree AND wheel, the wheel's own Signs/Letters pair goes */
body.ak-mod #wheel-flags { display: none !important; }
/* modules: no degree figures on the wheel (the ticks at the boundaries stay) */
body.ak-mod #wheel-svg .wdeg { display: none; }
#wheel-svg .wband:hover { opacity: .4 !important; }
#wheel-svg .wplanet { font-size: 16px; }
/* astrological glyphs: the shipped symbol font first (Sun lives in Symbols 2), then whatever the system has */
.ak-glyph, #wheel-svg .wplanet, #wheel-svg .wzod { font-family: "Noto Sans Symbols 2", "Noto Sans Symbols", "Apple Symbols", "Segoe UI Symbol", serif; }
.dt-he { font-family: "Noto Sans Symbols 2", "Noto Sans Symbols", "EB Garamond", serif; }
#wheel-svg .wasc { font-size: 11px; letter-spacing: .1em; font-weight: 600; }
#wheel-svg .whouse { font-size: 10px; font-family: "Inter", sans-serif; }
#wheel-svg .wretro { font-size: 9px; font-weight: 700; }
/* wheel "lettere" view: Hebrew letters (signs inside the ring, planets in the dots) */
#wheel-svg .wsign-he { font-family: 'Ezra SIL', "EB Garamond", serif; font-size: 21px; font-weight: 600; }
#wheel-svg .wplanet-he { font-family: 'Ezra SIL', "EB Garamond", serif; font-size: 16px; font-weight: 600; }
#wheel-svg .wplanet.wplanet-sm.wplanet-he { font-size: 9px; }
body.ak-nodots #wheel-svg .wplanet.wplanet-sm.wplanet-he { font-size: 18px; }
/* wheel "aspetti" view: degree-ruler labels */
#wheel-svg .wdeg { font-size: 9.5px; font-family: "Inter", sans-serif; letter-spacing: .04em; }
/* cross-highlight: mirror the tree focus on the wheel (selected lit, rest dimmed) */
#wheel-svg .wband, #wheel-svg .wsign, #wheel-svg .wplanet-hit, #wheel-svg .wtick { transition: opacity .25s ease; }
#wheel-svg .wdim { opacity: .14 !important; }
#wheel-svg .wband.wsel { opacity: .6 !important; }
#wheel-svg .wsign.wsel { opacity: 1 !important; font-weight: 700; }
#wheel-svg .wplanet-hit.wsel circle { stroke-width: 2.6; }
/* selected aspect: its line pulses bright while the others recede */
/* stroke-opacity + width, not opacity: .wasp-sel pins opacity with !important, which froze the old pulse */
@keyframes wAspPulse { 0%, 100% { stroke-opacity: 1; stroke-width: 3.4px; } 50% { stroke-opacity: .2; stroke-width: 5.5px; } }
#wheel-svg .wasp { transition: opacity .25s ease; }
#wheel-svg .wasp-sel { opacity: 1 !important; stroke-width: 2.6; animation: wAspPulse 1.1s ease-in-out infinite; }
/* selected planet: the dot breathes gently, its degree tick pulses (like the tree conduit) */
@keyframes wDotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes wTickPulse { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
#wheel-svg .wplanet-hit.wsel { animation: wDotPulse 1.3s ease-in-out infinite; }
#wheel-svg .wtick.wsel { stroke-width: 3; animation: wTickPulse 1.1s ease-in-out infinite; }

#stage[data-view="albero"] #wheel { display: none; }
#stage[data-view="zodiaco"] #tree-svg { display: none; }
#stage[data-view="zodiaco"] #wheel { height: 92%; }
#stage[data-view="entrambi"] #tree-svg { height: 94%; }
#stage[data-view="entrambi"] #wheel { height: 66%; }

/* ---------- "Corpo" pane: the tree mapped on the body, BESIDE the tree.
   Toggled from the tree legend (body.show-corpo); never a standalone view. */
/* explicit box (aspect-ratio) + absolutely-positioned svg: WebKit/Safari fails to
   re-measure a %-height svg after a display:none round-trip — this layout avoids it */
#body { display: none; height: 94%; aspect-ratio: 131 / 387; position: relative; flex: none; }
#body svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
/* the figure is cropped below the knees: fade the cut instead of a hard edge */
#body { -webkit-mask-image: linear-gradient(#000 90%, transparent); mask-image: linear-gradient(#000 90%, transparent); }
body.show-corpo #stage[data-view="albero"] #body,
body.show-corpo #stage[data-view="entrambi"] #body { display: block; }
body.show-corpo #stage[data-view="entrambi"] #body { height: 86%; }
/* mobile: one tall figure at a time — the #m-corpo pill (Albero tab) SWAPS the
   tree with the body full screen (body.m-corpo). Desktop side-by-side is off. */
@media (max-width: 979px) {
  #body { display: none !important; }
  /* the swap follows the tree wherever it appears: albero AND entrambi
     (after Calcola the app auto-switches to entrambi) */
  body.m-corpo #stage[data-view="albero"] #body { display: block !important; height: 94%; }
  body.m-corpo #stage[data-view="entrambi"] #body { display: block !important; height: 48%; }
  body.m-corpo #stage[data-view="albero"] #tree-svg,
  body.m-corpo #stage[data-view="entrambi"] #tree-svg { display: none; }
}
#body .body-ch { transition: opacity .25s; cursor: pointer; }
#body .body-ch:hover { stroke-width: 2.2; }
#body .body-node { cursor: pointer; }
#body .body-chakra { fill: #f2ecdc; pointer-events: none; }
#body .body-chakra .bc-n { font-family: "Marcellus", serif; font-size: 8px; }
#body .body-chakra .bc-w { font-family: "Spectral", serif; font-size: 3.6px; font-weight: 600; letter-spacing: .08em; }
#body .body-node:hover .body-ring { stroke-width: 3; }
/* focus mirror: active channel + its two spheres blink, the rest dims */
#body .body-dim { opacity: .16; }
#body .body-ch.blink { animation: conduitBlink 1.1s ease-in-out infinite; }
#body .body-node.blink .body-ring { animation: conduitBlink 1.1s ease-in-out infinite; }

.natal-go.busy { opacity: .8; }

/* livelli section in viz panel */
.lay { display: flex; align-items: center; gap: 10px; padding: 7px 10px; color: var(--muted); font-size: 14px; cursor: pointer; border-radius: 8px; }
.lay input { accent-color: var(--gold); width: 15px; height: 15px; }
.lay:hover { color: var(--text); background: rgba(255,255,255,.03); }

@media (max-width: 1240px) {
  .natal-form .field small { display: none; }
  .field.place { min-width: 120px; }
}
@media (max-width: 1100px) {
  #app { grid-template-columns: 210px 1fr 360px; }
}

/* traditional Hebrew typeface for all Hebrew letters */
#tree-svg .he, #tree-svg .glyph, .dt-he, .dt-he2 { font-family: 'Ezra SIL', "EB Garamond", serif; }
.asp-phrase { color: var(--text); flex: 1; }

/* selected planet/sign: only its channels blink on the tree */
@keyframes conduitBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.18; } }
#tree-svg .conduit.blink { animation: conduitBlink 1.1s ease-in-out infinite; }
/* spotlight: when something blinks, the other conduits recede (no glow, lower opacity) */
#tree-svg .conduit.dimmed { opacity: 0.32 !important; filter: saturate(0.6) !important; transition: opacity .25s ease; }

/* ============================================================
   RESPONSIVE — mobile shell (see responsive.js). Desktop (>=980px)
   is unchanged; the rules below activate only under 980px.
   ============================================================ */

/* shared elements — hidden on desktop by default */
#nav-burger { display: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 11px;
  background: rgba(255,255,255,.04); color: var(--muted); font-size: 17px; place-items: center; cursor: pointer; flex: none; }
#nav-burger:hover { color: var(--text); }
#m-tabbar { display: none; border-top: 1px solid var(--line); background: rgba(8,10,22,.92); backdrop-filter: blur(14px);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
#m-tabbar button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; background: none; border: none; color: var(--muted); font: inherit; font-size: 8.5px;
  letter-spacing: .02em; white-space: nowrap; cursor: pointer; }
#m-tabbar .ic { font-size: 16px; line-height: 1; }
#m-tabbar button.active { color: var(--gold); }
#m-tabbar button.active .ic { filter: drop-shadow(0 0 8px rgba(232,196,104,.5)); }
#m-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(3,4,12,.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s; }
#m-scrim.on { opacity: 1; }
#m-scrim[hidden] { display: none; }

/* drawer menu footer (settings) — only shown on mobile, inside the drawer */
.m-menu { display: none; }
.m-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: none; border: none; border-radius: 8px; color: var(--muted); font: inherit; font-size: 13.5px;
  letter-spacing: .02em; cursor: pointer; }
.m-menu-item:hover { color: var(--gold); background: rgba(255,255,255,.04); }
.m-mi-ic { font-size: 15px; width: 18px; text-align: center; }

@media (max-width: 979px) {
  html, body { overflow: hidden; }
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "topbar" "stage" "mtab";
    height: 100dvh;
  }

  /* topbar */
  #nav-burger { display: grid; }
  #topbar { padding: 0 12px; gap: 10px; }
  #topbar .actions { display: none; }
  .brand h1 { font-size: 17px; letter-spacing: .06em; }
  .brand p { display: none; }

  /* rail -> left drawer */
  #rail { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: 282px; max-width: 84vw;
    transform: translateX(-104%); transition: transform .28s cubic-bezier(.4,0,.2,1); }
  body.m-rail #rail { transform: none; }
  /* natal form relocated into the drawer (by responsive.js) */
  #rail #natal { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0 4px 14px; }
  #rail #natal .field { width: 100%; }
  #rail #natal .field small { display: block; }
  #rail #natal .field.place { min-width: 0; }
  #rail #natal .natal-go { height: 44px; }
  /* settings entry pinned to the bottom of the drawer */
  .m-menu { display: block; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }

  /* detail -> bottom sheet */
  #detail { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    max-height: 82dvh; padding: 0 22px 26px; border-radius: 22px 22px 0 0; border-bottom: none;
    transform: translateY(101%); transition: transform .3s cubic-bezier(.4,0,.2,1); }
  body.m-sheet #detail { transform: none; }
  .m-sheet-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: center;
    padding: 13px 0 10px; margin: 0 -22px 4px; background: linear-gradient(to bottom, var(--glass-2) 70%, rgba(16,18,38,0));
    touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
  .m-sheet-head:active { cursor: grabbing; }
  .m-grab { width: 46px; height: 5px; border-radius: 5px; background: rgba(150,160,220,.45); transition: background .2s, width .2s; }
  .m-sheet-head:active .m-grab { background: var(--gold); width: 60px; }
  .m-close { position: absolute; right: 14px; top: 4px; font-size: 24px; line-height: 1; padding: 0 4px;
    color: var(--muted); background: none; border: none; cursor: pointer; }
  .m-close:hover { color: var(--text); }

  /* bottom chips out, tab bar in */
  #bottombar { display: none; }
  #m-tabbar { display: flex; grid-area: mtab; }

  /* stage: full width; "Entrambi" stacks vertically */
  #stage-canvas { flex-direction: column; gap: 1.5%; padding: 56px 3% 8px; }
  #stage[data-view="entrambi"] #tree-svg { height: auto; width: auto; max-width: 92%; max-height: 52%; }
  #stage[data-view="entrambi"] #wheel { height: auto; width: min(70vw, 42vh); max-height: 46%; }
  /* solo Zodiaco: size the wheel by WIDTH so it fits a portrait screen */
  #stage[data-view="zodiaco"] #wheel { height: auto; width: min(92vw, 74vh); max-height: 100%; }
}

/* ---------- module "natal" (my natal chart): no calculations, no lessons, no saved charts, essential lettering ---------- */
body.ak-mod #natal, body.ak-mod #m-natal-cta, body.ak-mod #rail, body.ak-mod #rail-scrim,
body.ak-mod #ir-lessons, body.ak-mod #save-chart, body.ak-mod #ir-maps, body.ak-mod #nav-burger,
body.ak-mod #bottombar, body.ak-mod #wheel-empty,
body.ak-mod #lettering-flags [data-lettering="chakra"], body.ak-mod #lettering-flags [data-lettering="arcani"],
body.ak-mod #lettering-flags [data-lettering="ordinali"], body.ak-mod #lettering-flags [data-lettering="valori"],
body.ak-mod #m-tabbar [data-mtab="nuova"], body.ak-mod #m-tabbar [data-mtab="salva"], body.ak-mod #m-tabbar [data-mtab="mappe"] { display: none !important; }
@media (min-width: 980px) { body.ak-mod #app { grid-template-rows: 0 1fr 0;
  grid-template-areas: "rail topbar topbar topbar" "rail stage side detail" "bottombar bottombar bottombar bottombar"; } }
body.ak-mod.natal-empty #wheel-empty { display: block !important; }
.dt-locked p { color: var(--muted); line-height: 1.6; }
.dt-cta { display: inline-block; margin-top: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(232,196,104,.45); color: var(--gold); text-decoration: none; font-size: 13px; }
.dt-cta:hover { background: rgba(232,196,104,.1); }

/* ---------- module "natal": night landscape behind the tree, and the light that follows the selection ---------- */
body.ak-mod { background: #05060e; }
/* the landscape sits behind everything, half transparent, so the tree stays the protagonist */
body.ak-mod::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('img/natal-bg.jpg') center bottom / cover no-repeat; opacity: .5; }
body.ak-mod #bg-canvas { opacity: .5; z-index: 0; }
body.ak-mod #app { position: relative; z-index: 1; }
body.ak-mod #stage, body.ak-mod #detail, body.ak-mod #topbar, body.ak-mod #icon-rail { background: transparent; }
/* the reading panel is glass: the figure shows through, the strong blur keeps the text readable */
body.ak-mod #detail { background: linear-gradient(180deg, rgba(8,9,20,.3), rgba(8,9,20,.44)); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1); }
body.ak-mod #detail .m-sheet-head { background: linear-gradient(to bottom, rgba(8,9,20,.36) 70%, rgba(8,9,20,0)); }
/* a soft shadow under the letters keeps them readable over the coloured channels */
body.ak-mod #detail { text-shadow: 0 1px 2px rgba(0,0,0,.65), 0 0 12px rgba(0,0,0,.5); }
/* selected channel / planet / sefirah: gold light that pulses; the rest of the tree recedes
   (!important: tree-view and the app write inline styles and their own .blink/.dimmed rules) */
@keyframes akPulse { 0%, 100% { opacity: 1; filter: drop-shadow(0 0 8px var(--ak-focus, #e8c468)) drop-shadow(0 0 22px color-mix(in srgb, var(--ak-focus, #e8c468) 85%, transparent)) drop-shadow(0 0 48px color-mix(in srgb, var(--ak-focus, #e8c468) 45%, transparent)); }
  50% { opacity: .72; filter: drop-shadow(0 0 4px var(--ak-focus, #e8c468)) drop-shadow(0 0 12px color-mix(in srgb, var(--ak-focus, #e8c468) 50%, transparent)) drop-shadow(0 0 26px color-mix(in srgb, var(--ak-focus, #e8c468) 20%, transparent)); } }
@keyframes akPulseNode { 0%, 100% { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--ak-focus, #e8c468) 95%, transparent)) drop-shadow(0 0 30px color-mix(in srgb, var(--ak-focus, #e8c468) 55%, transparent)); } 50% { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--ak-focus, #e8c468) 60%, transparent)) drop-shadow(0 0 14px color-mix(in srgb, var(--ak-focus, #e8c468) 25%, transparent)); } }
/* recessed channels and spheres go DARK, never transparent (nothing shows through them) */
/* --ak-recess: the one dark grey of everything not involved in the selection (default #23252f; set on <html>,
   never on body, so an admin value from /admin/albero-colori is not shadowed) */
body.ak-mod.ak-has-focus #tree-svg .conduit:not(.ak-focus) { opacity: 1 !important; stroke: var(--ak-recess, #23252f) !important; filter: none !important; animation: none !important; transition: stroke .35s; }
body.ak-mod.ak-has-focus #tree-svg .conduit:not(.ak-focus) ~ text, body.ak-mod.ak-has-focus #tree-svg text[data-li]:not(.ak-focus) { fill: rgba(233,234,246,.62) !important; }
body.ak-mod.ak-has-focus #tree-svg .conduit-flow:not(.ak-focus), body.ak-mod.ak-has-focus #tree-svg .conduit-flow-rev:not(.ak-focus) { opacity: .08 !important; transition: opacity .35s; }
body.ak-mod.ak-has-focus #tree-svg .conduit-edge:not(.ak-focus) { opacity: .4 !important; transition: opacity .35s; } /* the border of a recessed channel stays visible */
body.ak-mod #tree-svg.tree-view .conduit-edge.dimmed { filter: none !important; opacity: .4 !important; } /* same look whether the focus comes from a sphere or from a channel/planet (the app's .dimmed) */
body.ak-mod #tree-svg .conduit-edge.ak-focus { stroke: color-mix(in srgb, var(--ak-focus-channel, #f0d488) 55%, transparent) !important; }
body.ak-mod #tree-svg .conduit-flow.ak-focus, body.ak-mod #tree-svg .conduit-flow-rev.ak-focus { stroke: #fff2c8 !important; opacity: .5 !important; }
body.ak-mod #tree-svg .conduit.ak-focus { opacity: 1 !important; stroke: var(--ak-focus-channel, #f0d488) !important; filter: none; animation: akPulse 1.6s ease-in-out infinite !important; }
body.ak-mod.ak-has-focus #tree-svg .node.ak-dim { opacity: 1; filter: none; }
body.ak-mod.ak-has-focus #tree-svg .node.ak-dim .halo, body.ak-mod.ak-has-focus #tree-svg .node.ak-dim .ring, body.ak-mod.ak-has-focus #tree-svg .node.ak-dim .disc { fill: var(--ak-recess, #23252f) !important; transition: fill .35s; }
body.ak-mod.ak-has-focus #tree-svg .node.ak-dim .it { fill: rgba(233,234,246,.72) !important; }
body.ak-mod.ak-has-focus #tree-svg .node.ak-dim .verb { fill: color-mix(in srgb, var(--ak-focus, #e8c468) 60%, transparent) !important; }
body.ak-mod #tree-svg .node.ak-focus { opacity: 1; animation: akPulseNode 1.6s ease-in-out infinite; }
/* the label on a lit channel: dark ink on the gold */
body.ak-mod #tree-svg text.ak-focus, body.ak-mod #tree-svg.tree-view .word.ak-focus, body.ak-mod #tree-svg.tree-view .glyph.ak-focus { fill: var(--ak-focus-text, #120d02) !important; opacity: 1 !important; font-weight: 700 !important; paint-order: stroke; stroke: rgba(255,245,210,.55); stroke-width: 1.2px; }
/* lit labels keep exactly the size they have at rest: words only turn bold, Hebrew letters only turn dark
   (no bold, no outline: both made the lit letter look bigger than its neighbours) */
body.ak-mod #tree-svg.tree-view .glyph.ak-focus { font-weight: 400 !important; stroke: none; }
body.ak-mod #tree-svg .node.ak-focus .halo { stroke: var(--ak-focus, #e8c468) !important; stroke-width: 10 !important; }
/* the wheel follows: the selected planet and its sign glow gold, the others fade (.wsel/.wdim come from the app) */
body.ak-mod #wheel-svg .wplanet-hit.wsel text { fill: var(--ak-wheel-focus, #f0d488) !important; animation: akPulseNode 1.6s ease-in-out infinite; }
body.ak-mod #wheel-svg .wplanet-hit circle { filter: none !important; }
body.ak-mod #wheel-svg .wplanet-hit.wsel circle { stroke: var(--ak-focus, #e8c468) !important; filter: drop-shadow(0 0 10px var(--ak-focus, #e8c468)) !important; }
body.ak-mod #wheel-svg .wband.wsel { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--ak-focus, #e8c468) 70%, transparent)); opacity: .9 !important; }
body.ak-mod #wheel-svg .wsign.wsel { fill: var(--ak-wheel-focus, #f0d488) !important; }
body.ak-mod #wheel-svg .wdim { opacity: var(--ak-wheel-dim, .1) !important; }
/* ---------- natal: no icon rail; ONE row (views + legend) inside the same box as the site header ---------- */
body.ak-mod #icon-rail { display: none !important; }
/* the bar itself (and its bottom divider) runs full width; only the CONTENT sits in the header's box */
body.ak-mod #topbar { width: 100%; box-sizing: border-box; padding: 0 max(24px, calc(50% - 625px)) !important; gap: 22px; }
body.ak-mod #topbar #ak-views { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid rgba(214,184,121,.22); border-radius: 999px; flex: none; }
body.ak-mod #topbar .view-switch { gap: 2px; padding: 0; border: 0; flex: none; margin: 0; }
body.ak-mod #topbar #ak-views button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; letter-spacing: 1.6px; font-size: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-family: "Spectral", serif; font-weight: 600; text-transform: uppercase; }
body.ak-mod #topbar #ak-views button.ak-body-btn { min-width: 0; }
@media (min-width: 980px) {
  /* desktop: the whole bar stands as a narrow column between the figure and the reading panel */
  body.ak-mod #topbar { grid-area: side; flex-direction: column; justify-content: flex-start; align-items: stretch; height: auto; width: auto;
    padding: 12px 6px 12px !important; gap: 12px; border-bottom: 0; border-left: 1px solid var(--line); overflow: visible; }
  body.ak-mod #topbar .ak-back { order: -1; display: flex; align-items: center; justify-content: center; width: 100%; height: 34px; margin: 0 0 2px; padding: 0; font-size: 18px; color: var(--muted); text-decoration: none; }
  body.ak-mod #topbar .ak-back:hover { color: var(--gold); }
  body.ak-mod #topbar .ak-back span { display: none; }
  body.ak-mod #topbar #ak-views { flex-direction: column; align-items: stretch; gap: 2px; padding: 3px; border-radius: 14px; }
  body.ak-mod #topbar .view-switch { flex-direction: column; }
  body.ak-mod #topbar #ak-views button { flex-direction: column; justify-content: center; gap: 4px; min-width: 0; width: 100%; padding: 7px 2px 6px; border-radius: 11px; letter-spacing: 1.1px; font-size: 7px; }
  body.ak-mod #topbar #ak-views button svg { width: 17px; height: 17px; }
  body.ak-mod #topbar .view-switch .ak-bl-long { display: none; }
  body.ak-mod #topbar #ak-legend { flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 0 0; border-left: 0; border-top: 1px solid rgba(214,184,121,.2); }
  body.ak-mod #topbar #ak-legend .collabel { flex-direction: column; align-items: stretch; }
  body.ak-mod #topbar #ak-legend #lettering-flags, body.ak-mod #topbar #ak-legend #wheel-flags, body.ak-mod #topbar #ak-legend #wheel-toggles { flex-direction: column; }
  body.ak-mod #topbar #ak-legend #lab-wheel { margin: 10px 0 0; padding: 12px 0 0; border-left: 0; border-top: 1px solid rgba(214,184,121,.2); }
  body.ak-mod #topbar #ak-legend button { min-width: 0; width: 100%; padding: 6px 2px 5px; }
  /* tooltips open to the left of the rail ("html" outranks the generic tooltip rule further down, which would
     put left: 50% back and squeeze the box to zero width) */
  html body.ak-mod #topbar [data-ak-tip]::after { top: 50%; left: auto; right: calc(100% + 10px); transform: translateY(-50%) translateX(4px); }
  html body.ak-mod #topbar [data-ak-tip]:hover::after { transform: translateY(-50%) translateX(0); }
  body.ak-mod #topbar .actions { display: none; }
}
@media (max-width: 979px) { body.ak-mod #topbar .ak-bl-short { display: none; } }
@media (min-width: 980px) {
  /* three independent switches: Tree, Wheel, Body (all off = only the landscape) */
  body.ak-mod #topbar #ak-views .view-switch button.ak-both { display: none !important; }
  body.ak-mod #topbar #ak-views .view-switch button.active { color: var(--muted); background: none; }
  body.ak-mod #topbar #ak-views button.ak-on, body.ak-mod #topbar #ak-views button.ak-body-btn.on { color: var(--gold); background: rgba(214,184,121,.12); }
  body.ak-mod.ak-no-tree #tree-svg, body.ak-mod.ak-no-tree #lab-tree { display: none !important; }
  body.ak-mod.ak-no-wheel #wheel, body.ak-mod.ak-no-wheel #lab-wheel { display: none !important; }
  body.ak-mod.ak-no-tree.ak-no-wheel #ak-legend { display: none; }
  body.ak-mod.ak-no-tree.ak-no-wheel.show-corpo #stage[data-view="entrambi"] #body { height: 92cqh; }
  body.ak-mod.ak-no-tree.show-corpo #stage[data-view="entrambi"] #wheel { height: min(84cqh, 50cqw); }
  body.ak-mod.ak-no-tree.ak-no-wheel:not(.show-corpo) #stage-canvas { visibility: hidden; }
}
@media (max-width: 979px) {
  body.ak-mod #topbar #ak-views .view-switch button.active { color: var(--gold); background: rgba(214,184,121,.12); }
}
body.ak-mod #topbar .view-switch .vi { display: none; }
body.ak-mod #topbar svg { width: 15px; height: 15px; flex: none; }
body.ak-mod #topbar svg circle { fill: none; stroke: currentColor; stroke-width: 1.3; }
body.ak-mod #topbar .view-switch svg circle[r="2.2"] { fill: currentColor; stroke: none; }
/* legend: icons with a 7px caption underneath, no pills */
body.ak-mod #ak-legend { display: flex; align-items: center; gap: 4px; min-width: 0; padding-left: 18px; border-left: 1px solid rgba(214,184,121,.2); }
body.ak-mod #ak-legend .collabel { position: static; flex-direction: row; align-items: center; gap: 2px; pointer-events: auto; }
body.ak-mod #ak-legend .collabel > span:first-child { display: none; }
body.ak-mod #ak-legend #lettering-flags, body.ak-mod #ak-legend #wheel-flags, body.ak-mod #ak-legend #wheel-toggles { flex-direction: row; gap: 2px; }
body.ak-mod #ak-legend #wheel-toggles { margin: 0; padding: 0; border: 0; }
body.ak-mod #ak-legend #lab-wheel { margin-left: 10px; padding-left: 12px; border-left: 1px solid rgba(214,184,121,.2); }
body.ak-mod #ak-legend button { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 44px; padding: 5px 6px 4px; border: 0; border-radius: 8px; background: none; color: var(--muted); }
body.ak-mod #ak-legend button .ak-bl { font-size: 7px; letter-spacing: 1.1px; font-weight: 600; text-transform: uppercase; line-height: 1.3; text-align: center; }
body.ak-mod #ak-legend button .ak-ig { font-family: "Spectral", "Noto Sans Hebrew", serif; font-size: 15px; line-height: 15px; height: 15px; letter-spacing: 0; text-transform: none; }
body.ak-mod #ak-legend button svg { width: 16px; height: 16px; }
body.ak-mod #ak-legend button:hover { color: var(--text); background: rgba(214,184,121,.06); }
body.ak-mod #ak-legend button.on { color: var(--gold); background: rgba(214,184,121,.1); }
/* tooltips: plain words under the control */
body.ak-mod #topbar [data-ak-tip] { position: relative; }
body.ak-mod #topbar [data-ak-tip]::after { content: attr(data-ak-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(-4px);
  background: #12131f; color: var(--text); border: 1px solid rgba(214,184,121,.3); border-radius: 8px; padding: 6px 10px; font-family: "Spectral", serif; font-size: 11.5px; font-weight: 400;
  letter-spacing: .2px; text-transform: none; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s, transform .15s; z-index: 50; }
body.ak-mod #topbar [data-ak-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 979px) {
  /* tablet / phone: the shell of responsive.js takes over (tab bar, sheet). The bar is not a row any more:
     three icons (Tree · Zodiac · Both) in the top-right corner over the figure, the way back top-left;
     the figure starts right under the header; the figure alone pinch-zooms (touch-action) */
  body.ak-mod #ak-legend, body.ak-mod #topbar #ak-views .ak-body-btn, body.ak-mod #topbar .actions { display: none; }
  body.ak-fused #topbar #ak-views .ak-body-btn { display: inline-flex; } /* fused: Chakras is a fourth icon in the corner */
  body.ak-mod #app { grid-template-rows: 0 1fr auto; }
  body.ak-mod #topbar { position: relative; height: 0; min-height: 0; padding: 0 !important; border: 0; overflow: visible; z-index: 7; }
  body.ak-mod #topbar #ak-views { position: absolute; top: 10px; right: 10px; margin: 0; flex-direction: column; gap: 3px; padding: 3px;
    border-radius: 14px; background: rgba(8,10,22,.55); backdrop-filter: blur(8px); }
  body.ak-mod #topbar .view-switch { flex-direction: column; gap: 3px; }
  body.ak-mod #topbar #ak-views button { padding: 9px; border-radius: 10px; min-width: 0; }
  body.ak-mod #topbar #ak-views button .ak-bl { display: none; }
  body.ak-mod #topbar #ak-views button svg { width: 18px; height: 18px; }
  body.ak-mod #topbar .ak-back { position: absolute; top: 10px; left: 10px; display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 12px; background: rgba(8,10,22,.55); color: var(--muted); text-decoration: none; font-size: 17px; }
  body.ak-mod #topbar .ak-back span { display: none; }
  body.ak-mod #topbar [data-ak-tip]::after { display: none; }
  body.ak-mod #stage-canvas { touch-action: none; justify-content: flex-start; }
  body.ak-fused #stage #stage-canvas { justify-content: flex-start; padding-top: 8px; }
  /* the tab bar sits ABOVE the sheet: a lowered sheet slides behind it, never over it */
  body.ak-mod #m-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: rgba(8,10,22,.96); }
  body.ak-mod #app { padding-bottom: 45px; box-sizing: border-box; }
  /* the reading sheet stops above the tab bar (45px): Tree · Zodiac · Reading · Settings always at hand */
  body.ak-mod #detail { bottom: 45px; max-height: calc(82dvh - 45px); border-radius: 22px 22px 0 0; }
  body.ak-mod #m-scrim { bottom: 45px; }
}
/* ---------- natal: the three figures share the WIDTH of the stage (body, tree, wheel scale together);
   the reading panel narrows with the window ---------- */
@media (min-width: 980px) { body.ak-mod #app { grid-template-columns: 0 1fr 68px clamp(300px, 30vw, 500px); } }
@media (min-width: 980px) {
  body.ak-mod #stage-canvas { container-type: size; gap: 2%; padding: 12px 2% 0; }
  body.ak-mod.show-corpo #stage[data-view="entrambi"] #stage-canvas { padding-left: 2%; }
  body.ak-mod.show-corpo #stage[data-view="entrambi"] #body { height: min(86cqh, 50cqw); }
  /* the tree keeps the full-height dividers on both sides; its drawing scales to the width share */
  body.ak-mod.show-corpo #stage[data-view="entrambi"] #tree-svg { align-self: stretch; height: auto; max-height: none; width: min(38cqw, 52cqh); flex: none;
    border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0 2%; margin: 0 1%; box-sizing: content-box; }
  body.ak-mod.show-corpo #stage[data-view="entrambi"] #wheel { width: auto; height: min(78cqh, 36cqw); }
  body.ak-mod #stage[data-view="entrambi"] #tree-svg { height: min(94cqh, 80cqw); }
  body.ak-mod #stage[data-view="entrambi"] #wheel { width: auto; height: min(78cqh, 46cqw); }
  body.ak-mod.show-corpo #stage[data-view="albero"] #body { height: min(94cqh, 55cqw); }
  body.ak-mod.show-corpo #stage[data-view="albero"] #tree-svg { height: min(100%, 90cqw); }
}

/* ---------- fused layout (module natal2): the Tree inside the zodiac wheel ----------
   The wheel is one square figure; the tree is centred over it and scaled to the inner circle
   (wheel viewBox 568, thin ring inner r=218 with markers and degrees just inside, tree radius ~750 of its 1520 viewBox -> ~70% of the height).
   The aspect lines under the tree fade; a selected one still lights up. */
body.ak-fused #wheel-empty, body.ak-fused #m-corpo { display: none !important; }
/* Chakras: the body figure sits inside the wheel in place of the tree (same inscribed circle, taller shape -> 66%) */
body.ak-fused #stage-canvas #body { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 72%; width: auto; margin: 0; }
body.ak-fused.show-corpo #stage-canvas #body { display: block; }
body.ak-fused.show-corpo #stage-canvas #tree-svg { display: none; }
body.ak-fused.show-corpo.ak-no-wheel #stage-canvas #body { height: 94%; }
body.ak-fused #stage-canvas #wheel { position: relative; height: min(96%, 96cqw); width: auto; aspect-ratio: 1 / 1; margin: 0 auto; }
body.ak-fused #stage-canvas #tree-svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 70%; width: auto; max-height: none;
  border: 0; padding: 0; margin: 0; pointer-events: none; }
/* only the spheres and the channels take the mouse (labels stay transparent to it, as in the app) */
body.ak-fused #stage-canvas #tree-svg .node, body.ak-fused #stage-canvas #tree-svg .conduit { pointer-events: auto; }
body.ak-fused #wheel-svg .wasp:not(.wasp-sel) { opacity: .22 !important; }
body.ak-fused #wheel-svg .wdeg { opacity: .6; }
/* the Tree switch hides only the tree; the wheel switch hides only the ring, the tree stays */
body.ak-fused.ak-no-wheel #wheel { display: flex !important; }
body.ak-fused.ak-no-wheel #wheel-svg { visibility: hidden; }
body.ak-fused.ak-no-wheel #stage-canvas #tree-svg { height: 94%; }
/* phone tabs: "tree" shows the fused figure, "wheel" the bare ring */
body.ak-fused #stage[data-view="albero"] #wheel { display: flex; }
@media (max-width: 979px) {
  /* phones and tablets: one figure at a time, as big as the screen allows.
     Tree tab = the tree alone · Zodiac tab = the wheel alone · Both = the fused figure */
  body.ak-fused #stage #stage-canvas { container-type: size; padding: 6px 0 0; gap: 0; justify-content: flex-start; box-sizing: border-box; }
  /* the peeking reading sheet (92px) stays below the figure, never over it */
  body.ak-fused.m-peek #stage #stage-canvas { padding-bottom: 96px; }
  body.ak-fused #stage[data-view="entrambi"] #wheel, body.ak-fused #stage[data-view="zodiaco"] #wheel {
    width: min(100cqw, 100cqh); height: auto; max-height: none; aspect-ratio: 1 / 1; }
  body.ak-fused #stage[data-view="albero"] #wheel { width: 100%; height: 100%; aspect-ratio: auto; }
  body.ak-fused #stage[data-view="albero"] #wheel-svg { visibility: hidden; }
  body.ak-fused #stage[data-view="albero"] #stage-canvas #tree-svg { height: 96%; }
  body.ak-fused.show-corpo #stage-canvas #body { display: block !important; height: 72%; }
  body.ak-fused.show-corpo #stage[data-view="albero"] #stage-canvas #body { height: 96%; }
  /* legend pop-up above the tab bar */
  #ak-legend-pop { position: fixed; left: 8px; right: 8px; bottom: 53px; z-index: 70; display: none; padding: 10px 8px; border-radius: 16px;
    background: rgba(8,10,22,.94); border: 1px solid rgba(214,184,121,.22); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 -8px 30px rgba(0,0,0,.4); }
  #ak-legend-pop.open { display: block; }
  body.ak-mod #ak-legend-pop #ak-legend { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; padding: 0; border: 0; }
  body.ak-mod #ak-legend-pop #ak-legend .collabel { display: flex; flex-direction: row; align-items: center; gap: 2px; }
  body.ak-mod #ak-legend-pop #ak-legend #lab-wheel { margin-left: 8px; padding-left: 10px; border-left: 1px solid rgba(214,184,121,.2); }
  body.ak-mod #ak-legend-pop #ak-legend button { min-width: 54px; padding: 7px 4px 6px; }
  body.ak-mod #ak-legend-pop #ak-legend button .ak-bl { font-size: 7.5px; }
  body.ak-mod #ak-legend-pop #ak-legend button svg { width: 18px; height: 18px; }
  body.ak-mod #ak-legend-pop #ak-legend button .ak-ig { font-size: 17px; line-height: 17px; height: 17px; }
  #m-tab-legend .ic svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 1.3; }
  /* wheel type on phones: bigger glyphs, no degree figures */
  #wheel-svg .wzod { font-size: 19px; }
  #wheel-svg .wmark.wsign-he { font-size: 19px; }
  #wheel-svg .wmark-name { font-size: 10px; }
  #wheel-svg .wplanet.wplanet-sm { font-size: 11px; }
  #wheel-svg .wplanet.wplanet-sm.wplanet-he { font-size: 12px; }
  #wheel-svg .wdeg { display: none; }
}
@media (min-width: 980px) {
  body.ak-fused #stage[data-view="entrambi"] #stage-canvas #wheel { height: min(96cqh, 96cqw); }
  body.ak-fused #stage[data-view="entrambi"] #stage-canvas #tree-svg { height: 70%; }
  body.ak-fused.show-corpo #stage[data-view="entrambi"] #stage-canvas #body { height: 72%; width: auto; }
  body.ak-fused.show-corpo.ak-no-wheel #stage[data-view="entrambi"] #stage-canvas #body { height: 94%; }
  body.ak-fused.ak-no-wheel #stage[data-view="entrambi"] #stage-canvas #tree-svg { height: 94%; }
}

/* ---------- phones held sideways (modules): a compact desktop, not a stacked phone ----------
   figure on the left at full height · icon column · reading panel on the right (no bottom sheet, no tab bar) */
@media (max-width: 979px) and (orientation: landscape) and (max-height: 560px) {
  body.ak-mod #app { grid-template-columns: 1fr 50px minmax(240px, 38%); grid-template-rows: 0 1fr 0;
    grid-template-areas: "topbar topbar topbar" "stage side detail" "mtab mtab mtab"; height: 100dvh; }
  body.ak-mod #topbar { grid-area: side; position: relative; height: auto; display: flex; flex-direction: column; align-items: stretch;
    padding: 6px 4px !important; gap: 6px; border-left: 1px solid var(--line); border-bottom: 0; overflow: visible; }
  body.ak-mod #topbar .ak-back { position: static; width: 100%; height: 30px; border-radius: 9px; font-size: 15px; background: none; }
  body.ak-mod #topbar #ak-views { position: static; margin: 0; flex-direction: column; gap: 2px; padding: 2px; border-radius: 12px; background: none; backdrop-filter: none; }
  body.ak-mod #topbar #ak-views button { padding: 7px 4px; }
  body.ak-mod #topbar #ak-views button svg { width: 16px; height: 16px; }
  body.ak-mod #ak-legend { display: none; }
  body.ak-mod #detail { position: static !important; transform: none !important; transition: none !important; grid-area: detail; margin: 0; max-height: none; height: auto;
    border-radius: 0; border-left: 1px solid var(--line); padding: 14px 16px 18px; overflow: auto; z-index: auto; }
  body.ak-mod #detail .m-sheet-head { display: none; }
  body.ak-mod #m-tabbar, body.ak-mod #m-scrim { display: none !important; }
  body.ak-mod #stage-canvas, body.ak-fused #stage #stage-canvas, body.ak-fused.m-peek #stage #stage-canvas { padding: 4px; justify-content: center; }
  body.ak-fused #stage[data-view="entrambi"] #wheel, body.ak-fused #stage[data-view="zodiaco"] #wheel { width: min(100cqw, 100cqh); }
  body.ak-fused #stage[data-view="albero"] #stage-canvas #tree-svg { height: 98%; }
  body.ak-mod .dt-he, body.ak-mod .dt-he2 { font-size: 34px; }
  body.ak-mod .dt-title { font-size: 20px; }
}

/* ---------- modules: the tree writes in the same sans as the wheel and the logo tagline ---------- */
/* name almost at the centre of the sphere, verb right under it */
body.ak-mod #tree-svg.tree-view .node .it { font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 400; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; transform: translateY(9px); }
body.ak-mod #tree-svg.tree-view .node .verb { font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 400; font-size: 22px; letter-spacing: .02em; transform: translateY(1px); }
body.ak-mod #tree-svg.tree-view .node .it[data-lines="2"] { transform: translateY(2px); }
/* Hebrew lettering: Hebrew name + transliteration as one block, centred in the sphere */
body.ak-mod #tree-svg.tree-view[data-lettering="ebraico"] .node .he { transform: translateY(-4px); }
body.ak-mod #tree-svg.tree-view[data-lettering="ebraico"] .node .it { transform: translateY(-10px); font-size: 17px; letter-spacing: .1em; }
body.ak-mod #tree-svg.tree-view .node .it[data-lines="2"] ~ .verb { transform: translateY(-7px); }
body.ak-mod #tree-svg.tree-view .word { font-family: "Lato", "Sora", system-ui, sans-serif !important; font-weight: 400 !important; font-size: 14.5px !important; letter-spacing: .14em; }
body.ak-mod #tree-svg.tree-view .layer-arcana .word { font-size: 10px !important; letter-spacing: .08em; }
body.ak-mod #tree-svg.tree-view .node.daat .it { font-size: 11px; }

/* ---------- variant 'wheel edges': sphere rings and channel borders in the wheel's own outline colour ----------
   (modules.js EDGES / ?edges=wheel|own). The selection keeps its gold. */
body.ak-wheel-edges { --ak-edge: var(--ak-tree-edge, #5b6285); } /* admin -> Colori dell'Albero -> Interfaccia */
body.ak-wheel-edges #tree-svg .node:not(.ak-focus) .halo, body.ak-wheel-edges #tree-svg .node:not(.ak-focus) .ring { stroke: var(--ak-edge) !important; stroke-width: 4 !important; }
body.ak-wheel-edges #tree-svg .conduit-edge:not(.ak-focus) { stroke: var(--ak-edge) !important; stroke-width: 48px !important; } /* 4 a side, like the sphere rings */
body.ak-wheel-edges.ak-has-focus #tree-svg .node.ak-dim .halo, body.ak-wheel-edges.ak-has-focus #tree-svg .node.ak-dim .ring { stroke: var(--ak-edge) !important; stroke-opacity: .5; }

/* ---------- modules: kickers and small capitals in the panel use the sans of the logo tagline ---------- */
body.ak-mod .dt-block h3, body.ak-mod .dt-meta, body.ak-mod .dt-sub, body.ak-mod .ak-x-kicker, body.ak-mod .dt-back, body.ak-mod .pl-pos small, body.ak-mod .m-sheet-head .m-title {
  font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 400; letter-spacing: .22em; }
body.ak-mod .dt-block h3 { font-size: 10.5px; color: var(--gold); }
body.ak-mod .dt-meta { font-size: 10.5px; letter-spacing: .18em; }

/* ---------- modules: the chakra labels on the body in the logo sans ---------- */
body.ak-mod #body .body-chakra .bc-n { font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 400; font-size: 7.5px; }
body.ak-mod #body .body-chakra .bc-w { font-family: "Lato", "Sora", system-ui, sans-serif; font-weight: 400; font-size: 3.4px; letter-spacing: .16em; }
body.ak-mod #body .body-node text, body.ak-mod #body .body-label { font-family: "Lato", "Sora", system-ui, sans-serif; }

/* ---------- explore mode: the reading panel ---------- */
body.ak-mod .ak-x { padding: 26px 28px; }
body.ak-mod .ak-x-kicker { margin: 0 0 8px; color: var(--gold); font-family: "Spectral", serif; font-size: 10px; letter-spacing: 3px; text-transform: uppercase; }
body.ak-mod .ak-x h2 { margin: 0 0 18px; font-family: "Cormorant Garamond", serif; font-weight: 500; font-size: 30px; line-height: 1.15; }
body.ak-mod .ak-x-text { font-family: "Spectral", serif; font-size: 15px; line-height: 1.65; color: var(--text); }
body.ak-mod .ak-x-text h3 { font-family: "Cormorant Garamond", serif; font-size: 20px; margin: 0 0 10px; }
body.ak-mod .ak-x-wait, body.ak-mod .ak-x-missing { color: var(--muted); font-style: italic; }
body.ak-mod .ak-x-key { color: var(--muted); font-family: "Inter", sans-serif; font-size: 11px; opacity: .7; }
body.ak-mod .ak-x-hint { margin-top: 0; padding-top: 0; border-top: 0; color: var(--muted); font-family: "Spectral", serif; font-size: 12.5px; font-style: italic; line-height: 1.5; }
body.ak-mod .ak-x-clear { margin-top: 14px; background: none; border: 1px solid rgba(214,184,121,.3); border-radius: 999px; color: var(--muted); padding: 6px 14px; font-family: "Spectral", serif; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; cursor: pointer; }
body.ak-mod .ak-x-clear:hover { color: var(--gold); border-color: var(--gold); }
