/* The Dvara Method — app styles. One dark theme, matching the Dvara Chart. */
:root {
  --bg: #11142a; --surface: #191d36; --sunk: #232843; --raised: #20254a;
  --fg: #e5e7f2; --muted: #a3a9c6; --rule: #30365a; --idle: #3a4064;
  --pers: #e5e7f2; --des: #ff6a50; --transit: #34c6b4; --partner: #ad8bf2;
  --defined: #d99f35; --defined-ink: #2a1c00; --cstroke: #6b7194; --accent: #e6a640;
  --body-fill: #2b2d4d; --body-edge: #4c4d78; --body-detail: #5f5f8e; --petal: #3a3d60; --both: #b48be0;
  --display: "Marcellus", "Palatino Linotype", Palatino, Georgia, serif;
  --body: "Karla", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --nav-h: 68px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--body); font-size: 16px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 21px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.3; }
p { margin: 0; }
.sub { color: var(--muted); font-size: 14px; }
.tiny { font-size: 12px; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* layout */
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px); }
.screen { display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.hero { border-color: #5a4a2a; background: linear-gradient(180deg, #221f3b, var(--surface)); }
.card.tap { cursor: pointer; text-align: left; width: 100%; }
.card.tap:active { transform: scale(.99); }
.stat { padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--rule); display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-weight: 400; font-size: 18px; }
.stat.gold b { color: var(--defined); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--sunk); }
.pill.gold { background: #3a2f17; color: #f1c26a; }
.pill.teal { background: #143a3a; color: #7fe0d3; }
.pill.violet { background: #2e2650; color: #cbb4f7; }
.pill.coral { background: #3d1f22; color: #ffa494; }
.dot { width: 10px; height: 10px; border-radius: 5px; display: inline-block; flex: none; }

/* buttons */
.btn { min-height: 48px; padding: 0 20px; border-radius: 24px; border: none; background: var(--accent); color: #1c1305; font-weight: 700; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--rule); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 22px; border: 1px solid var(--rule); background: var(--sunk); color: var(--fg); font-size: 15px; cursor: pointer; text-align: left; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1c1305; font-weight: 700; }
.linkbtn { background: none; border: none; color: var(--accent); padding: 0; cursor: pointer; font-weight: 600; min-height: 32px; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--rule); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

/* tabs inside a screen */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: none; padding: 10px 12px; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* bottom navigation */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: #141831; border-top: 1px solid var(--rule); display: flex; justify-content: center; z-index: 20; }
nav.bottom .in { display: flex; width: 100%; max-width: 520px; justify-content: space-around; align-items: center; }
nav.bottom button { background: none; border: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; min-width: 60px; min-height: 52px; justify-content: center; cursor: pointer; position: relative; }
nav.bottom button[aria-current="page"] { color: var(--accent); font-weight: 700; }
nav.bottom svg { width: 24px; height: 24px; }
nav.bottom .lock { position: absolute; top: 4px; right: 12px; width: 12px; height: 12px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 14px; color: var(--muted); }
input[type=text], input[type=date], input[type=time], select, textarea { min-height: 48px; border-radius: 12px; border: 1px solid var(--rule); background: #151933; padding: 10px 14px; width: 100%; font-size: 16px; }
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7a80a0; }
:focus-visible { outline: 2px solid var(--transit); outline-offset: 2px; }

/* chart */
figure.chartfig { margin: 0; display: flex; flex-direction: column; gap: 10px; }
svg.bg { width: 100%; height: auto; display: block; border-radius: 22px; background: var(--surface); }
svg.bg .sg { font: 500 12px var(--body); fill: var(--muted); }
svg.bg .gn { font: 600 11px var(--mono); text-anchor: middle; dominant-baseline: central; }
svg.bg .ck { font: italic 400 14px var(--display); fill: var(--muted); text-anchor: end; dominant-baseline: central; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
svg.bg .cc { font: 700 13.5px var(--body); fill: var(--fg); text-anchor: start; dominant-baseline: central; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
svg.bg text.sg { text-anchor: middle; dominant-baseline: central; }
svg.bg .tap { cursor: pointer; }
svg.bg .tap:focus { outline: none; }
svg.bg .tap:focus-visible > circle, svg.bg .tap:focus-visible > path:first-of-type { stroke: var(--accent); stroke-width: 3; }
.tapinfo { background: var(--sunk); border: 1px solid var(--rule); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.tapinfo ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* hexagram glyph */
.hex { width: 46px; height: 50px; border-radius: 12px; background: #141831; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; flex: none; }
.hex i { display: block; width: 26px; height: 4px; border-radius: 1px; background: currentColor; }
.hex i.yin { background: linear-gradient(90deg, currentColor 0 44%, transparent 44% 56%, currentColor 56% 100%); }

/* list rows */
.item { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--rule); text-align: left; width: 100%; cursor: pointer; }
.item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .t { font-family: var(--display); font-size: 17px; }
.chev { color: var(--muted); flex: none; }

/* bottom sheet */
.sheet-back { position: fixed; inset: 0; background: rgba(5, 7, 18, .62); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--bg); border: 1px solid var(--rule); border-bottom: none; border-radius: 24px 24px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom, 0px) + 24px); display: flex; flex-direction: column; gap: 14px; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--rule); margin: 4px auto 2px; }
.sheet .close { align-self: flex-end; }

/* paywall */
.lockcard { text-align: center; align-items: center; padding: 26px 18px; gap: 14px; }
.lockcard ul { text-align: left; margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.plans { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.plan { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; width: 100%; text-align: left; }
.plan[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* misc */
.counter { min-width: 84px; min-height: 64px; border-radius: 18px; border: 1px solid var(--rule); background: var(--sunk); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.counter b { font-size: 22px; }
.bar { height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--transit); }
.mala { font-family: var(--display); font-size: 22px; letter-spacing: .06em; color: var(--accent); width: 72px; height: 72px; border-radius: 36px; border: 1px solid var(--accent); background: #2a2440; display: flex; align-items: center; justify-content: center; flex: none; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: #dfe1ee; }
.door { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--sunk); }
.door .grow { flex: 1; }
.toggle[aria-pressed="true"] { background: var(--accent); color: #1c1305; border-color: var(--accent); }
.days { display: flex; gap: 6px; justify-content: space-between; }
.days button { flex: 1; min-height: 58px; border-radius: 14px; border: 1px solid var(--rule); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; cursor: pointer; padding: 0; }
.days button b { font-size: 17px; }
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1c1305; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.empty { padding: 18px; border-radius: 16px; border: 1px dashed var(--rule); color: var(--muted); text-align: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px); background: #2a2f55; color: var(--fg); padding: 10px 16px; border-radius: 12px; z-index: 50; font-size: 14px; max-width: 90vw; }
.welcome { min-height: 70dvh; justify-content: center; }
.brand { font-family: var(--display); font-size: 34px; line-height: 1.15; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* birthplace search */
.placelist { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30; background: var(--raised); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; box-shadow: 0 12px 28px rgba(0, 0, 0, .35); }
.placeopt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 10px 14px; background: none; border: none; border-bottom: 1px solid var(--rule); color: var(--fg); text-align: left; cursor: pointer; }
.placeopt:last-child { border-bottom: none; }
.placeopt:hover, .placeopt:focus-visible { background: var(--sunk); }

/* ---------- Temple at night: the spiritual layer ---------- */
:root { --gold: #e3b45e; --gold-soft: rgba(227, 180, 94, .38); --gold-faint: rgba(227, 180, 94, .14); --lamp: rgba(240, 168, 64, .16); }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 420px at 50% -140px, var(--lamp), transparent 70%),
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255, 255, 255, .5) 50%, transparent 52%),
    radial-gradient(1px 1px at 68% 9%, rgba(255, 255, 255, .4) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 84% 34%, rgba(255, 236, 200, .45) 50%, transparent 52%),
    radial-gradient(1px 1px at 33% 52%, rgba(255, 255, 255, .3) 50%, transparent 52%),
    radial-gradient(1px 1px at 52% 76%, rgba(255, 255, 255, .28) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 7% 88%, rgba(255, 236, 200, .35) 50%, transparent 52%);
  background-size: 100% 100%, 260px 260px, 310px 310px, 290px 290px, 240px 240px, 330px 330px, 270px 270px;
  background-repeat: no-repeat, repeat, repeat, repeat, repeat, repeat, repeat;
}
h1 { letter-spacing: .01em; }
.card { border-color: #2f3359; }
.card.hero { border-color: var(--gold-soft); background: linear-gradient(180deg, #24203d 0%, var(--surface) 70%); }

/* the dvara: an arched doorway with a double gold frame */
.arch { border-radius: 50% 50% 22px 22px / 64px 64px 22px 22px; padding-top: 40px; border-color: var(--gold-soft);
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 6px var(--gold-faint), 0 18px 40px -24px rgba(240, 168, 64, .45); }
.shrine { border: 1px solid var(--gold-soft); border-radius: 50% 50% 26px 26px / 185px 185px 26px 26px; padding: 34px 10px 12px;
  background: radial-gradient(circle at 50% 42%, rgba(240, 168, 64, .10), transparent 62%), var(--surface);
  box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 6px var(--gold-faint); }
.shrine svg.bg { background: transparent; border-radius: 50%; }

/* lotus divider */
.ornament { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 4px 0; }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-soft)); }
.ornament::after { background: linear-gradient(90deg, var(--gold-soft), transparent); }
.ornament svg { flex: none; }
.sectitle { text-align: center; }
.sectitle .sub { margin-top: 2px; }
.emblem { display: flex; justify-content: center; color: var(--gold); filter: drop-shadow(0 0 18px rgba(240, 168, 64, .45)); }

/* lamplit buttons and navigation */
.btn { background: linear-gradient(180deg, #f1c063, #d8952e); box-shadow: 0 8px 22px -10px rgba(240, 168, 64, .7); }
.btn.ghost { background: transparent; box-shadow: none; }
.chip { border-color: #343a66; }
.chip[aria-pressed="true"] { background: linear-gradient(180deg, #f1c063, #d8952e); }
nav.bottom { background: rgba(16, 19, 40, .94); backdrop-filter: blur(8px); border-top-color: var(--gold-faint); }
nav.bottom button[aria-current="page"]::before { content: ""; position: absolute; top: 2px; width: 6px; height: 6px; transform: rotate(45deg); background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* the guide */
.guide { display: flex; align-items: center; gap: 14px; }
.lamp { width: 56px; height: 56px; border-radius: 28px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--gold);
  background: radial-gradient(circle, rgba(240, 168, 64, .30), rgba(240, 168, 64, .05) 60%, transparent 70%); border: 1px solid var(--gold-soft); }
.lamp.small { width: 30px; height: 30px; border-radius: 15px; }
.answer { border-color: var(--gold-faint); background: linear-gradient(180deg, #1d1f3c, var(--surface)); border-radius: 22px 22px 22px 6px; }
.answer .who { display: flex; align-items: center; gap: 8px; font-family: var(--display); color: var(--gold); font-size: 15px; }
.mine { align-self: flex-end; max-width: 85%; background: var(--raised); border: 1px solid var(--rule); border-radius: 20px 20px 6px 20px; padding: 10px 14px; }
@media (prefers-reduced-motion: no-preference) {
  .lamp svg { animation: flicker 3.2s ease-in-out infinite; }
  @keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 60% { opacity: .95; } }
}

/* 21-day phases */
.phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.phase { border: 1px solid var(--rule); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.phase b { font-size: 14px; color: var(--fg); font-weight: 600; }
.phase.past { border-color: rgba(52, 198, 180, .45); }
.phase.past b { color: var(--transit); }
.phase.on { border-color: var(--gold); background: rgba(227, 180, 94, .10); }
.phase.on b { color: var(--gold); }

[tabindex="-1"]:focus { outline: none; }
