:root{
  color-scheme:dark;
  --bg:#141122;--panel:#1e192e;--panel2:#271f3b;--line:#3d334d;--ink:#f6eee6;--muted:#c0b4ce;
  --gold:#edc783;--gold2:#f9d99e;--lilac:#ccb1f9;--danger:#f19a9a;
  --radius:18px;font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:#0c0a15;color:var(--ink)}
body{min-height:100vh}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
button:disabled{opacity:.5;cursor:default}
:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
img{display:block;max-width:100%}
[hidden]{display:none!important}
.serif{font-family:Georgia,"Times New Roman",serif}

/* phone-sized column */
#app{max-width:480px;min-height:100vh;margin:0 auto;background:var(--bg);position:relative;padding-bottom:84px;box-shadow:0 0 60px #000}
.view{padding:16px 16px 24px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 16px 6px}
.topbar h1{font:1.35rem Georgia,serif;margin:0}
.chips{display:flex;gap:10px;color:var(--muted);font-size:.8rem;margin-top:2px;flex-wrap:wrap}
.pill{display:inline-flex;align-items:center;gap:6px;padding:6px 11px;border-radius:999px;background:var(--panel);border:1px solid var(--line);font-weight:650;font-size:.9rem}
.pill .moon-ico{color:var(--gold)}
.avatar{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;background:var(--panel2);border:1px solid #6c5590;color:var(--lilac);font-weight:700}
.back{display:inline-flex;align-items:center;gap:6px;color:var(--muted);padding:6px 0}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:14px;padding:12px 18px;font-weight:700}
.btn-gold{background:var(--gold);color:#2a1d22}
.btn-gold:hover{background:var(--gold2)}
.btn-ghost{background:var(--panel);border:1px solid var(--line)}
.btn-ghost:hover{background:var(--panel2)}
.btn-block{width:100%}
.btn-sm{padding:7px 13px;border-radius:999px;font-size:.88rem}

/* cards and sections */
.section-title{font:1.15rem Georgia,serif;margin:22px 0 10px;display:flex;justify-content:space-between;align-items:baseline}
.section-title small{font:600 .8rem system-ui;color:var(--lilac)}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:16px}
.banner{position:relative;overflow:hidden;border-radius:var(--radius);border:1px solid #544264;padding:16px 16px 14px;background:linear-gradient(90deg,#1b1530ee 45%,#1b153055),url(../assets/ui/hero.webp) right center/cover,#231a36}
.banner .tag{position:absolute;top:12px;inset-inline-end:12px}
.tag{font-size:.7rem;font-weight:800;letter-spacing:.04em;padding:3px 8px;border-radius:999px;background:#2f2546;color:var(--gold);border:1px solid #5b4a6e}
.tag.ai{color:var(--lilac)}
.eyebrow{font-size:.75rem;letter-spacing:.12em;text-transform:uppercase;color:var(--gold);font-weight:700}
.clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.muted{color:var(--muted)}
.small{font-size:.85rem}
.link{color:var(--gold);font-weight:700}

/* guides row */
.hscroll{display:flex;gap:12px;overflow-x:auto;padding-bottom:6px;scroll-snap-type:x mandatory}
.hscroll::-webkit-scrollbar{height:0}
.guide{flex:0 0 150px;scroll-snap-align:start;position:relative;border-radius:16px;overflow:hidden;border:1px solid var(--line);background:#000;min-height:210px;display:flex;flex-direction:column;justify-content:flex-end}
.guide img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.guide::after{content:"";position:absolute;inset:0;background:linear-gradient(transparent 35%,#0d0a16f2)}
.guide>*:not(img){position:relative;z-index:1}
.guide .tag{position:absolute;top:8px;inset-inline-start:8px}
.guide .body{padding:10px}
.guide strong{display:block;font-size:1.02rem}
.guide small{display:block;color:#ddd0ea;font-size:.75rem;line-height:1.3;margin-bottom:8px}

/* readings grid */
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.tile{position:relative;border-radius:16px;overflow:hidden;min-height:150px;border:1px solid var(--line);text-align:start;display:flex;flex-direction:column;justify-content:flex-end;padding:12px;background:radial-gradient(ellipse at 70% 20%,#4d3670,#211a33 70%)}
.tile .glyph{position:absolute;top:12px;inset-inline-end:14px;font-size:2.2rem;color:var(--gold);opacity:.9}
.tile img.bg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.75}
.tile::after{content:"";position:absolute;inset:0;background:linear-gradient(transparent 40%,#0d0a16e6)}
.tile>*:not(img){position:relative;z-index:1}
.tile .tag{position:absolute;top:10px;inset-inline-start:10px;z-index:2}
.tile strong{font-size:1rem}
.tile small{color:var(--muted);font-size:.78rem}

/* tarot card */
.tcard{aspect-ratio:3/5;border-radius:10px;position:relative;perspective:900px}
.tcard .inner{position:absolute;inset:0;transition:transform .7s cubic-bezier(.2,.7,.2,1);transform-style:preserve-3d}
.tcard.flipped .inner{transform:rotateY(180deg)}
.tcard .face{position:absolute;inset:0;border-radius:10px;overflow:hidden;backface-visibility:hidden;border:1px solid #b58c7c;box-shadow:0 8px 22px #0009}
.tcard .face img{width:100%;height:100%;object-fit:cover}
.tcard .front{transform:rotateY(180deg)}
.tcard .fallback{width:100%;height:100%;display:grid;place-items:center;text-align:center;padding:8px;background:radial-gradient(ellipse,#614683,#261d38 75%);color:var(--gold);font:1rem Georgia,serif}
.tcard .q{position:absolute;inset:0;display:grid;place-items:center;font:2.6rem Georgia,serif;color:var(--gold);text-shadow:0 0 18px #000;backface-visibility:hidden}
.slot{aspect-ratio:3/5;border-radius:10px;border:1.5px dashed #6a5784;display:grid;place-items:center;color:var(--muted);font-size:.8rem;background:#1a1528}
.spread{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:10px 0 6px}
.spread.four{grid-template-columns:repeat(4,1fr);gap:8px}
.spread .label{text-align:center;font-size:.8rem;color:var(--muted);margin-top:6px}
.spread .label.fate{color:var(--gold)}

.fan{display:flex;overflow-x:auto;padding:24px 8px 18px;scroll-snap-type:x proximity}
.fan::-webkit-scrollbar{height:0}
.fan button{flex:0 0 74px;margin-inline-end:-30px;aspect-ratio:3/5;border-radius:8px;overflow:hidden;border:1px solid #b58c7c;box-shadow:-4px 6px 14px #0008;transition:transform .2s;scroll-snap-align:center}
.fan button:hover{transform:translateY(-10px)}
.fan button.taken{display:none}
.fan button img{width:100%;height:100%;object-fit:cover}

.shuffle-stage{position:relative;border-radius:var(--radius);overflow:hidden;aspect-ratio:757/1000;max-height:56vh;margin:auto;background:#000}
.shuffle-stage img{width:100%;height:100%;object-fit:cover}
.shuffle-stage p{position:absolute;left:0;right:0;bottom:0;margin:0;padding:14px;background:linear-gradient(transparent,#000c);text-align:center}

/* reading text */
.reading p{margin:0 0 14px;line-height:1.65}
.reading .dropcap::first-letter{float:inline-start;font:3.2rem/0.9 Georgia,serif;color:var(--gold);margin-block-start:4px;margin-inline-end:8px}
[dir=rtl] .reading .dropcap::first-letter{float:none;font:inherit;color:inherit;margin:0}
.reading h3{font:1.05rem Georgia,serif;color:var(--gold);margin:18px 0 6px}
.locked{position:relative;margin-top:6px}
.locked .blur{filter:blur(6px);user-select:none;pointer-events:none;opacity:.7}
.locked .over{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;text-align:center;padding:10px;background:linear-gradient(#14112200,#141122 60%)}
.writing{display:flex;align-items:center;gap:10px;color:var(--muted);padding:14px 0}
.dots::after{content:"";display:inline-block;width:1.5em;text-align:left;animation:dots 1.2s steps(4) infinite}
@keyframes dots{0%{content:""}25%{content:"."}50%{content:".."}75%{content:"..."}}

/* chat */
body:has(.chat-view){display:flex;flex-direction:column;height:100dvh;min-height:0;overflow:hidden}
#app:has(.chat-view){display:flex;flex:1;min-height:0;width:100%;padding-bottom:0}
.chat-view{display:flex;flex:1;flex-direction:column;min-width:0}
.chat{display:flex;flex-direction:column;gap:10px;padding:8px 16px 120px}
.msg{max-width:85%;padding:10px 13px;border-radius:16px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.msg.bot{background:var(--panel);border:1px solid var(--line);border-start-start-radius:4px;align-self:flex-start}
.msg.me{background:#4a3770;align-self:flex-end;border-start-end-radius:4px}
.msg-row{display:flex;gap:8px;align-items:flex-end}
.msg-row img{width:30px;height:30px;border-radius:50%;object-fit:cover;flex:none}
.composer{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:480px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:#120f1ef2;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:8px;z-index:20}
.chat-view .composer{position:relative;bottom:auto;left:auto;transform:none;flex:none}
.composer form{display:flex;gap:8px}
.composer input,.field{flex:1;min-width:0;padding:11px 13px;border-radius:12px;border:1px solid #675775;background:#171224}
.options{display:flex;flex-wrap:wrap;gap:8px}
.options button{padding:8px 13px;border-radius:999px;background:var(--panel);border:1px solid #6a5784}
.options button:hover,.options button.on{background:#3a2c55;border-color:var(--lilac)}
.guide-head{display:flex;flex:none;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line);position:sticky;top:0;background:#141122f5;z-index:5}
.guide-head img{width:46px;height:46px;border-radius:50%;object-fit:cover;border:1px solid var(--gold)}
.chat-clock{display:grid;min-width:0;max-width:92px;text-align:end;line-height:1.2}
.chat-time-label{font-size:.72rem;color:var(--muted)}
.chat-time{color:var(--gold);font-size:1.02rem;font-variant-numeric:tabular-nums}
.guide-head .pill{flex:none}
.chat-stage {
  --portrait-x: 50%;
  --portrait-y: 26%;
  --eye-line: 27%;
  isolation: isolate;
  position: relative;
  container-type: size;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #30233e, #141122 76%);
}
.chat-portrait-welcome:not(.chat-portrait-fallback) {
  --portrait-x: var(--welcome-x, 50%);
  --portrait-y: var(--welcome-y, 33%);
  width: max(100cqw, 165cqh);
  mask-image: none;
}
.chat-stage[data-guide="maya"] { --welcome-y: 24.5%; }
.chat-stage[data-guide="dorian"] { --welcome-x: 49%; --welcome-y: 25.5%; }
.chat-stage[data-guide="vesper"] { --welcome-y: 19%; }
.chat-stage[data-guide="malakor"] { --welcome-x: 49.5%; --welcome-y: 27%; }
.chat-stage[data-guide="orion"] { --welcome-x: 50.5%; --welcome-y: 22%; }
.chat-stage[data-guide="lyra"] { --welcome-x: 51%; --welcome-y: 33.5%; }
.chat-portrait-fallback {
  --portrait-y: 37%;
  width: min(94cqw, 74cqh);
}
.chat-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 30%, #14112218 48%, #141122ed 100%);
}
.chat-portrait {
  position: absolute;
  z-index: -2;
  left: 50%;
  top: var(--eye-line);
  height: auto;
  max-width: none;
  transform: translate(calc(-1 * var(--portrait-x)), calc(-1 * var(--portrait-y)));
  pointer-events: none;
  mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent),
    linear-gradient(180deg, #000 78%, transparent);
  mask-composite: intersect;
}
.chat-stage::after {
  content: "";
  position: absolute;
  inset: -20px;
  z-index: -3;
  pointer-events: none;
  background: var(--welcome-scene) center / cover no-repeat;
  filter: blur(20px) brightness(.46);
}
.chat-stage.is-reading:has(.chat-portrait-reading.is-ready)::after {
  background-image: var(--reading-scene);
}
@container (min-aspect-ratio: 2/1) {
  .chat-portrait-welcome:not(.chat-portrait-fallback) {
    width: 167cqh;
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  }
}
.chat-portrait-reading {
  visibility: hidden;
  width: min(94cqw, 65cqh);
  --portrait-x: 50%;
  --portrait-y: 26%;
  --eye-line: 24%;
}
.chat-stage[data-guide="maya"] .chat-portrait-reading { width: min(94cqw, 55cqh); --portrait-y: 30%; }
.chat-stage[data-guide="malakor"] .chat-portrait-reading { --portrait-y: 23%; }
.chat-stage[data-guide="vesper"] .chat-portrait-reading { --portrait-x: 54%; --portrait-y: 22%; }
.chat-stage[data-guide="orion"] .chat-portrait-reading { --portrait-x: 52%; --portrait-y: 24%; }
.chat-stage[data-guide="lyra"] .chat-portrait-reading { --portrait-x: 55%; --portrait-y: 27%; }
.chat-stage.is-reading:has(.chat-portrait-reading.is-ready) > .chat-portrait:not(.chat-portrait-reading) { visibility: hidden; }
.chat-stage.is-reading > .chat-portrait-reading.is-ready { visibility: visible; }
.chat-scroll {
  position: absolute;
  inset: 39% 0 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}
.chat-stage .chat {
  min-height: 100%;
  max-width: 62rem;
  margin-inline: auto;
  padding: 8px clamp(8px, 2vw, 18px) 12px;
}
.chat-stage .chat > :first-child { margin-block-start: auto; }
@media (max-width: 440px) {
  .guide-head { gap: 7px; padding-inline: 8px; }
  .guide-head img { width: 36px; height: 36px; }
  .chat-view .composer { padding-inline: 8px; }
  .chat-view .composer form { gap: 5px; }
  .chat-view .composer form > .btn { padding-inline: 9px; }
}
.chat-stage .msg.bot{background:#1e192ef5}
.chat-audio{display:flex;align-items:center;gap:4px;margin-top:3px}
.chat-audio audio{min-width:0;width:min(180px,100%);height:34px}
.chat-mic{align-self:center;flex:none}
.chat-mic[aria-pressed=true]{color:var(--gold);background:var(--panel2)}
.chat-mic-status{margin:0}
.sample-voices{margin:0 12px;padding:8px 12px;border:1px solid var(--line);border-radius:12px;background:#1e192eee}
.sample-voices summary{color:var(--gold);cursor:pointer;font-weight:650}
.sample-voices p{margin:8px 0}
.sample-voices label{display:flex;align-items:center;gap:8px}
.sample-voices select{padding:5px 8px;max-width:65%;background:#171224;color:var(--ink)}
.sample-voice-links{display:grid;gap:6px;margin-top:8px}
.sample-voice-links a{justify-content:space-between;color:var(--ink);text-decoration:none}
.sample-voice-links small{color:var(--muted);font-weight:400;text-align:end}

/* forms */
.form{display:grid;gap:12px}
.form label{display:grid;gap:4px;font-weight:650;font-size:.9rem}
.form .field,.form select{width:100%;padding:10px 12px;border-radius:10px;border:1px solid #675775;background:#171224}
.row{display:flex;gap:10px;align-items:center}

/* zodiac trio */
.trio{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.zcell{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:12px 8px;text-align:center}
.zcell img{width:44px;height:44px;margin:0 auto 6px;filter:drop-shadow(0 0 6px #edc78355)}
.zcell b{display:block}
.zcell small{color:var(--muted);font-size:.72rem}

/* bottom nav */
.tabbar{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:100%;max-width:480px;display:flex;justify-content:space-around;padding:8px 6px calc(8px + env(safe-area-inset-bottom));background:#120f1ef5;border-top:1px solid var(--line);z-index:20}
.tabbar a{flex:1;text-align:center;color:var(--muted);text-decoration:none;font-size:.72rem;display:grid;gap:2px;justify-items:center}
.tabbar a span{font-size:1.25rem;line-height:1}
.tabbar a.on{color:var(--gold)}

/* sheet / modal */
.sheet-back{position:fixed;inset:0;background:#07050ccc;z-index:50;display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:480px;max-height:92vh;overflow:auto;background:#1b1529;border:1px solid #5b4a6e;border-radius:22px 22px 0 0;padding:20px 18px calc(20px + env(safe-area-inset-bottom));animation:up .25s ease-out}
@keyframes up{from{transform:translateY(40px);opacity:0}}
.sheet h2{font:1.45rem Georgia,serif;margin:0 0 6px;text-align:center}
.plans{display:grid;gap:10px;margin:14px 0}
.plan{display:flex;justify-content:space-between;align-items:center;padding:13px 15px;border-radius:14px;border:1.5px solid var(--line);background:var(--panel);text-align:start}
.plan.on{border-color:var(--gold);background:#2a2138}
.plan .tag{margin-inline-start:8px}
[data-sku]{unicode-bidi:isolate}
.ticks{list-style:none;padding:0;margin:10px 0;display:grid;gap:6px}
.ticks li::before{content:"✦ ";color:var(--gold)}
.packs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:10px 0}
.pack{padding:12px 6px;border-radius:14px;border:1px solid var(--line);background:var(--panel);text-align:center;position:relative}
.pack b{display:block;font-size:1.2rem;color:var(--gold)}
.pack .tag{position:absolute;top:-9px;left:50%;transform:translateX(-50%);white-space:nowrap}

/* splash */
.splash{min-height:100vh;display:flex;flex-direction:column;justify-content:flex-end;padding:28px 22px 40px;background:linear-gradient(180deg,#14112200 20%,#141122 72%),url(../assets/ui/hero.webp) 70% top/cover}
.splash .logo{width:72px;height:72px;border-radius:20px;margin-bottom:16px}
.splash h1{font:2.6rem Georgia,serif;margin:0;letter-spacing:-.02em}

.toast{position:fixed;left:50%;bottom:96px;transform:translateX(-50%);background:#2c2240;border:1px solid var(--gold);padding:10px 16px;border-radius:12px;z-index:60;max-width:90vw;text-align:center;animation:up .2s}
.list-item{display:flex;gap:12px;align-items:center;padding:12px;border-radius:14px;background:var(--panel);border:1px solid var(--line);margin-bottom:10px}
.list-item .thumbs{display:flex}
.list-item .thumbs img{width:30px;border-radius:4px;margin-inline-end:-10px;border:1px solid #b58c7c}
.list-item .grow{flex:1;min-width:0;text-align:start}
.icon-btn{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:var(--muted)}
.icon-btn:hover{background:var(--panel2);color:var(--ink)}
.icon-btn.on{color:var(--gold)}
.tabs{display:flex;gap:8px;margin:6px 0 14px}
.tabs button{padding:7px 14px;border-radius:999px;border:1px solid var(--line);background:var(--panel)}
.tabs button.on{border-color:var(--gold);color:var(--gold)}
.moonrow{display:flex;justify-content:space-between;gap:6px;text-align:center;font-size:.72rem;color:var(--muted)}
.moonrow b{display:block;font-size:1.4rem;color:var(--ink)}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

/* Maya at the table behind the card choice, so the person is never "talking to nothing" */
.reader-stage{position:relative;isolation:isolate;min-height:calc(100vh - 150px)}
.reader-stage::before{content:"";position:absolute;inset:0;z-index:-1;background:
  linear-gradient(180deg,#141122d9 0%,#14112233 22%,#14112255 48%,#141122f0 78%,#141122 100%),
  url(../assets/guides/maya-tavolo.webp) center 0%/cover no-repeat}
.reader-line{margin-bottom:8px}
.reader-line img{width:42px;height:42px;border:1px solid var(--gold)}
.reader-line .msg{background:#1e192ee6;backdrop-filter:blur(4px)}
.reader-stage .slot{background:#1a1528b3;backdrop-filter:blur(2px)}
.reader-stage .spread{margin:170px 26px 0;gap:14px}
.reader-stage .spread .label{margin-top:3px}

/* Wheel of all 22 cards (pick screen) */
.wheel{position:relative;height:170px;margin:0 -16px 6px;overflow:hidden;touch-action:pan-y;user-select:none;cursor:grab}
.wheel:active{cursor:grabbing}
.wheel-card{position:absolute;left:50%;top:14px;width:62px;height:103px;margin-left:-31px;border-radius:8px;overflow:hidden;
  border:1px solid #b58c7c;box-shadow:0 6px 16px #000a;transform-origin:50% 300px;transition:filter .2s}
.wheel-card img{width:100%;height:100%;object-fit:cover;pointer-events:none}
.wheel-card:hover,.wheel-card:focus-visible{filter:brightness(1.25) drop-shadow(0 0 8px #edc783aa)}
.wheel-card.taken{display:none}
.wheel::after{content:"";position:absolute;inset:auto 0 0;height:40px;background:linear-gradient(transparent,#141122);pointer-events:none}
