/* IBI Horoscope — night-indigo and gold, light and dark (the IBI Palmistry look).
   Edge to edge on EVERY screen (IBI rule, 15 Oct 2026): no outer gutter, full-bleed cards, 10 px inner side padding.
   Wide screens (≥ 1000 px) use two columns: what you fill in or look at on the left, the result on the right. */
:root {
  --ts: 1;
  --bg: #faf6ee; --bg2: #f1eadb; --card: #ffffff; --ink: #1d1530; --muted: #5b5274; --line: rgba(29, 21, 48, .12);
  --gold: #9a6a12; --gold-2: #c08a26; --gold-ink: #ffffff; --accent: #0369a1; --danger: #b42318; --ok: #0e7a43;
  --shadow: 0 6px 24px rgba(40, 24, 80, .08);
  --chart-bg: #fffaf0; --chart-line: #9a6a12; --chart-ink: #1d1530; --chart-asc: #b42318; --chart-dim: #8a7fa8;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0b24; --bg2: #17112f; --card: #1c1538; --ink: #f3eefc; --muted: #b9aed8; --line: rgba(255, 255, 255, .10);
  --gold: #ecbe5c; --gold-2: #f6d58a; --gold-ink: #1a1206; --accent: #35c0ed; --danger: #ff7b72; --ok: #4ade80;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --chart-bg: #141033; --chart-line: #ecbe5c; --chart-ink: #f3eefc; --chart-asc: #ff8a7a; --chart-dim: #9b90c2;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
.card, .view { overflow-wrap: break-word; }
button, .btn, select, input, label, .chip, [role="button"] { overflow-wrap: normal; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: calc(16px * var(--ts)) / 1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", sans-serif;
  min-height: 100dvh;
}
:root[data-theme="dark"] body { background: radial-gradient(1200px 600px at 80% -10%, #2a1a5e 0%, transparent 60%), var(--bg); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: calc(28px * var(--ts)); }
h2 { font-size: calc(20px * var(--ts)); }
h3 { font-size: calc(16px * var(--ts)); }
a { color: var(--accent); }
small { font-size: calc(13px * var(--ts)); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--card); padding: 8px; }
.grow { flex: 1; }
.center { text-align: center; }
.mt { margin-top: 14px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-version-badge { font: 700 calc(12px * var(--ts)) / 1 system-ui, sans-serif; padding: 4px 7px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); letter-spacing: .02em; flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.logo { height: 34px; width: auto; }
.logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
.brand-name { font: 700 calc(20px * var(--ts)) Georgia, serif; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .btn { white-space: nowrap; flex: 0 0 auto; }
.top .switch, .top .icon-btn { flex: 0 0 auto; }
.icon-btn { min-width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 20px; cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 48px; height: 28px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); position: relative; transition: background .2s; }
.knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); transition: transform .2s; }
.switch input:checked + .track { background: color-mix(in srgb, var(--gold) 30%, var(--bg2)); }
.switch input:checked + .track .knob { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-ico { font-size: 16px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; font: 600 calc(16px * var(--ts)) / 1.2 system-ui, sans-serif; cursor: pointer; text-decoration: none; transition: transform .08s, filter .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { min-height: 52px; padding: 12px 22px; font-size: calc(17px * var(--ts)); }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: calc(14px * var(--ts)); }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); box-shadow: 0 4px 18px color-mix(in srgb, var(--gold) 35%, transparent); }
:root[data-theme="light"] .btn-gold { background: var(--gold); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-danger-ghost { background: var(--card); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* layout: edge to edge at every width */
main { padding: 0; }
.view { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-left: 0; border-right: 0; border-radius: 0; padding: 16px 10px; box-shadow: none; min-width: 0; }
.layout { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col-input, .col-output { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.layout > .card.col-input, .layout > .card.col-output { display: block; }
.hint { color: var(--muted); margin: 0 0 12px; font-size: calc(15px * var(--ts)); }
.hint.err { color: var(--danger); margin: 8px 0 0; min-height: 1em; }
.micro { color: var(--muted); font-size: calc(13px * var(--ts)); margin: 10px 0 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-weight: 600; font-size: calc(14px * var(--ts)); }
.field small { color: var(--muted); font-weight: 400; }
input[type=text], input[type=date], input[type=time], input[type=number], input[type=password], select {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: calc(16px * var(--ts)) system-ui, sans-serif;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: calc(15px * var(--ts)); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: 0 0 auto; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg.seg3 { grid-template-columns: 1fr 1fr 1fr; }
.seg button { min-height: 48px; border: 0; background: var(--bg); color: var(--ink); font: 600 calc(15px * var(--ts)) system-ui, sans-serif; cursor: pointer; padding: 0 10px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-checked="true"] { background: var(--gold); color: var(--gold-ink); }
.seg-sm button { min-height: 38px; font-size: calc(14px * var(--ts)); }

/* place search */
.place-field { position: relative; margin-top: 4px; }
.place-list { position: absolute; left: 0; right: 0; top: calc(100% - 22px); z-index: 15; list-style: none; margin: 0; padding: 4px; max-height: 300px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.place-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; min-height: 44px; }
.place-list li small { display: block; color: var(--muted); }
.place-list li[aria-selected="true"], .place-list li:hover { background: var(--bg2); }
.place-chosen { color: var(--ok); min-height: 1.2em; }
.manual { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.manual summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.minor-box { border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 12px; padding: 4px 12px 10px; margin: 10px 0; background: color-mix(in srgb, var(--gold) 6%, var(--card)); }
.minor-box small { color: var(--muted); }
.scan-compare { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.scan-compare h3 { margin: 0 0 6px; }
.scan-compare table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--ts)); }
.scan-compare td, .scan-compare th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.scan-compare .yes { color: var(--ok); font-weight: 700; } .scan-compare .no { color: var(--danger); font-weight: 700; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: calc(12px * var(--ts)); color: var(--gold); font-weight: 700; margin: 0 0 6px; }
.hero h1 { font-size: calc(36px * var(--ts)); }
.lead { font-size: calc(17px * var(--ts)); color: var(--muted); margin: 0 0 16px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { max-width: 300px; width: 100%; justify-self: center; }
.hero-chart { width: 100%; height: auto; display: block; }
.hc-frame { fill: color-mix(in srgb, var(--gold) 10%, transparent); stroke: var(--gold); stroke-width: 2; }
.hc-grid { stroke: var(--gold); stroke-width: 1.4; fill: none; stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 2.4s ease forwards; }
.hc-center { fill: color-mix(in srgb, var(--gold) 14%, transparent); stroke: var(--gold); stroke-width: 1.4; }
.hc-om { text-anchor: middle; font: 700 22px "Noto Sans Tamil", serif; fill: var(--gold); }
.hc-sub { text-anchor: middle; font: 700 12px Georgia, serif; fill: var(--muted); letter-spacing: .2em; }
.hc-stars circle { fill: var(--gold-2); animation: twinkle 2.8s ease-in-out infinite; }
.hc-stars circle:nth-child(2n) { animation-delay: 1.2s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes twinkle { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .hc-grid, .hc-stars circle, .bar i { animation: none !important; } .hc-grid { stroke-dashoffset: 0; } }

.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px 18px; }
.legend-grid > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 8px; }
.legend-grid small { grid-column: 2; color: var(--muted); }
.lg-ico { font-size: 24px; grid-row: span 2; }
.tips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tips li { display: flex; gap: 12px; align-items: flex-start; }
.tips li > span { font-size: 26px; line-height: 1; }
.tips b { display: block; } .tips small { color: var(--muted); }
.disclaimer { color: var(--muted); font-size: calc(13px * var(--ts)); text-align: center; margin: 4px 10px 8px; }

/* people */
.people-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.person { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.person .av { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--gold) 16%, var(--bg2)); }
.person button.open { all: unset; cursor: pointer; display: block; min-width: 0; }
.person button.open:focus-visible { outline: 2px solid var(--accent); }
.person b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { color: var(--muted); display: block; }

/* scan */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--bg2); display: grid; place-items: center; font-size: 13px; text-align: center; padding: 4px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; z-index: 1; }
.busy { text-align: center; padding: 12px 0; }
.bar { height: 6px; border-radius: 999px; background: var(--bg2); overflow: hidden; margin: 12px auto 14px; max-width: 360px; }
.bar i { display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--gold); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* charts */
.chart-box { width: 100%; max-width: 560px; margin: 8px auto; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-tools { margin: 4px 0; }
.chart-tools .seg { min-width: 180px; }
svg .c-bg { fill: var(--chart-bg); }
svg .c-line { stroke: var(--chart-line); stroke-width: 1.6; fill: none; }
svg .c-sign { fill: var(--chart-dim); font: 600 10px system-ui, sans-serif; }
svg .c-pl { fill: var(--chart-ink); font: 700 15px system-ui, sans-serif; }
svg .c-pl.asc { fill: var(--chart-asc); }
svg .c-deg { fill: var(--chart-dim); font: 500 10px system-ui, sans-serif; }
svg .c-retro { fill: var(--chart-asc); font: 700 9px system-ui, sans-serif; }
svg .c-title { fill: var(--chart-line); font: 700 17px Georgia, serif; text-anchor: middle; }
svg .c-sub { fill: var(--chart-ink); font: 500 12px system-ui, sans-serif; text-anchor: middle; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 8px; }
.fact { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--bg); }
.fact small { display: block; color: var(--muted); }
.fact b { font-size: calc(16px * var(--ts)); }
.table-wrap { overflow-x: auto; }
table.planets { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--ts)); }
table.planets th, table.planets td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.planets th { color: var(--muted); font-weight: 600; }
.tag { font: 600 calc(12px * var(--ts)) system-ui, sans-serif; padding: 2px 8px; border-radius: 999px; background: var(--bg2); color: var(--muted); white-space: nowrap; }
.tag.good { color: var(--ok); }

/* reading */
.headline-card h1 { font-size: calc(30px * var(--ts)); }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.badge { padding: 5px 11px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: calc(14px * var(--ts)); font-weight: 600; }
.badge.gold { background: color-mix(in srgb, var(--gold) 18%, var(--card)); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.stamp { color: var(--muted); font-size: calc(13px * var(--ts)); margin: 6px 0 0; }
.section-nav { position: sticky; top: 61px; z-index: 10; display: flex; gap: 8px; overflow-x: auto; padding: 8px 10px; background: var(--bg); scrollbar-width: none; }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; font-size: calc(14px * var(--ts)); }
.card[id^="s"] { scroll-margin-top: 120px; }
.traits { display: grid; gap: 10px; margin: 14px 0; }
.trait { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr) 2.6rem; gap: 10px; align-items: center; }
.trait b { font-size: calc(15px * var(--ts)); }
.trait .meter { height: 10px; border-radius: 999px; background: var(--bg2); overflow: hidden; }
.trait .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: inherit; }
.trait em { font-style: normal; color: var(--muted); font-size: calc(14px * var(--ts)); text-align: right; }
.trait small { grid-column: 1 / -1; color: var(--muted); margin-top: -6px; }
.two-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-lists h3 { font-family: system-ui, sans-serif; }
.two-lists ul { margin: 0; padding-left: 20px; }
.notes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.note { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.note h3 { font-family: system-ui, sans-serif; margin: 0 0 4px; }
.note p { margin: 0; }
.now-rows { display: grid; gap: 12px; }
.now-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; }
.now-row > span { font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--bg2); }
.now-row b { display: block; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--gold), color-mix(in srgb, var(--gold) 15%, transparent)); }
.timeline li { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 8px 0; }
.timeline .ti { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: var(--card); border: 2px solid var(--gold); z-index: 1; }
.timeline .when { color: var(--gold); font-weight: 700; font-size: calc(14px * var(--ts)); }
.timeline b { display: block; font-size: calc(17px * var(--ts)); }
.timeline p { margin: 2px 0 0; color: var(--muted); }
.from { display: inline-block; margin-top: 4px; font-size: calc(12px * var(--ts)); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.dasa { display: grid; gap: 8px; }
.dasa details { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.dasa details.now { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 30%, transparent) inset; }
.dasa summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; cursor: pointer; align-items: center; min-height: 48px; }
.dasa summary small { color: var(--muted); }
.dasa ul { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 4px; }
.dasa li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; font-size: calc(14px * var(--ts)); padding: 4px 0; border-top: 1px solid var(--line); }
.dasa li.now { color: var(--gold); font-weight: 700; }
.lucky { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.lucky div { text-align: center; padding: 12px 6px; border-radius: 12px; background: var(--bg2); }
.lucky small { display: block; color: var(--muted); }
.lucky b { font-size: calc(18px * var(--ts)); }
.advice { margin: 8px 0 0; padding-left: 20px; }
.advice li { margin-bottom: 6px; }
.lock-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; margin-top: 12px; border-radius: 14px; border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); background: color-mix(in srgb, var(--gold) 8%, var(--card)); }
.lock-card p { margin: 2px 0 10px; color: var(--muted); }
.lock-ico { font-size: 26px; line-height: 1; }
.lang-pick { display: grid; gap: 6px; margin: 14px 0 4px; font-weight: 600; font-size: calc(16px * var(--ts)); }
.lang-pick small { font-weight: 400; color: var(--muted); font-size: calc(13px * var(--ts)); }
.lang-switch { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; font-weight: 600; font-size: calc(16px * var(--ts)); }
.lang-switch span { flex: 0 0 auto; }
.lang-switch select { flex: 1 1 auto; min-width: 0; }
.lang-switch select:disabled { opacity: .6; }
.speaking { background: color-mix(in srgb, var(--gold) 16%, transparent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 16%, transparent); border-radius: 10px; transition: background .25s, box-shadow .25s; }
::highlight(ibi-word) { background-color: var(--gold); color: #1a1200; }
@media (prefers-reduced-motion: reduce) { .speaking { transition: none; } }
.eng-list { display: grid; gap: 8px; margin: 8px 0 14px; }
.eng { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.eng input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); }
.eng small { display: block; color: var(--muted); }
.eng:has(input:checked) { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--card)); }
.eng.off { opacity: .55; cursor: not-allowed; }
.modal-body .field { margin-bottom: 10px; }
.modal-body input[readonly] { color: var(--muted); }

/* footer, drawer, install bar, modal, toast */
.foot { text-align: center; color: var(--muted); padding: 12px 10px calc(24px + env(safe-area-inset-bottom)); font-size: calc(14px * var(--ts)); }
.foot p { margin: 4px 0; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(340px, 88vw); background: var(--card); border-left: 1px solid var(--line); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.drawer-nav { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; }
.drawer-nav > button, .drawer-nav > a { all: unset; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px; border-radius: 10px; cursor: pointer; color: var(--ink); font-size: calc(16px * var(--ts)); }
.drawer-nav > button:hover, .drawer-nav > a:hover { background: var(--bg2); }
.drawer-nav > button:focus-visible, .drawer-nav > a:focus-visible { outline: 2px solid var(--accent); }
.drawer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 12px; font-size: calc(16px * var(--ts)); }
.drawer-row select { width: auto; min-height: 40px; }
.drawer hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.install-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.install-bar img { border-radius: 10px; }
.install-bar small { display: block; color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--card); color: var(--ink); border-radius: 18px; width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px 6px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 6px 16px 12px; overflow-y: auto; }
.modal-body ol, .modal-body ul { padding-left: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.modal-foot:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .3); font-size: calc(15px * var(--ts)); }

/* wide screens: two columns across the full width (tested at 1520 × 695) */
@media (min-width: 1000px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
  .result-layout { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .layout > .col-input { position: sticky; top: 62px; max-height: calc(100dvh - 70px); overflow-y: auto; }
  .card { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .layout > .card:first-child, .layout > .col-input > .card { border-left: 0; }
  .layout > .card:last-child, .layout > .col-output > .card { border-right: 0; }
  #vHome .card { border-left: 0; border-right: 0; }
  .section-nav { top: 62px; }
}
/* tablets / small laptops */
@media (max-width: 820px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-art { max-width: 200px; order: -1; }
  .hero h1 { font-size: calc(30px * var(--ts)); }
}
/* phones */
@media (max-width: 640px) {
  .logo { height: 28px; }
  .brand-name { font-size: calc(17px * var(--ts)); }
  .top { gap: 8px; }
  .grid2, .grid3, .tips, .two-lists { grid-template-columns: minmax(0, 1fr); }
  .cta .btn, .actions:not(.wrap) .btn { flex: 1 1 100%; }
  .actions.wrap .btn { flex: 1 1 calc(50% - 5px); padding-left: 8px; padding-right: 8px; }
  .two-lists ul, .advice { padding-left: 18px; }
  .now-row { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .now-row > span { width: 32px; height: 32px; font-size: 20px; border-radius: 10px; }
  .section-nav { top: 57px; }
  .trait { grid-template-columns: minmax(0, 1fr) 2.6rem; row-gap: 6px; }
  .trait b { grid-column: 1 / -1; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { border-radius: 18px 18px 0 0; width: 100%; max-height: 92dvh; }
  .modal-foot .btn { flex: 1 1 100%; }
  .chart-tools .seg { min-width: 0; flex: 1 1 140px; }
}
@media (max-width: 480px) {
  .top > .switch { display: none; }
  .logo { height: 24px; }
  .top .btn-sm { padding: 6px 10px; }
}
@media (max-width: 480px) { html[data-edition="saas"] .top .btn-lbl { display: none; } }
@media (max-width: 400px) {
  .top { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .brand { gap: 6px; }
  .app-version-badge { padding: 4px 5px; }
  .brand-name { font-size: calc(16px * var(--ts)); }
  .top .btn-sm { padding: 6px 8px; }
  .top .icon-btn { min-width: 42px; }
  .lucky { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media print {
  .top, .foot, .actions, .section-nav, .install-bar, .drawer, .scrim, .toast, #vHome, #vPeople, #vForm, #vScan, .chart-tools, .lang-switch, #readStart { display: none !important; }
  body { background: #fff !important; color: #000; }
  .layout { display: block !important; }
  .col-input { position: static !important; max-height: none !important; overflow: visible !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
