/* The New Paradigm of Existence Oracle App: night indigo with the deck's gold. */
:root {
  --bg: #140f24;
  --bg-2: #1d1633;
  --surface: #241b3d;
  --surface-2: #2d2449;
  --line: rgba(231, 201, 120, 0.18);
  --text: #f4eee2;
  --muted: #b9b0c9;
  --gold: #e7c978;
  --gold-2: #c9a14a;
  --journey: #5f6662;
  --affirmation: #3b3a86;
  --mastery: #b8902f;
  --radius: 16px;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-script: "Pinyon Script", "Cormorant Garamond", cursive;
  --tabs-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(120% 60% at 50% 0%, #2a1f4a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--gold); }
button { font: inherit; color: inherit; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 18px 8px;
}
.topbar__brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1; }
.topbar__script { font-family: var(--font-script); color: var(--gold); font-size: 1.75rem; }
.topbar__small { font-family: var(--font-display); color: var(--muted); font-size: .85rem; letter-spacing: .08em; margin-top: 2px; }
.topbar__site { color: var(--muted); font-size: .85rem; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

.view { padding: 4px 18px 0; outline: none; }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: rgba(20, 15, 36, 0.94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 112px; height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: .75rem; letter-spacing: .02em;
}
.tabs a svg { width: 1.45em; height: 1.45em; }
.tabs a.is-active { color: var(--gold); }

/* type */
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .75rem; color: var(--gold); margin: 10px 0 0; }
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 2rem; line-height: 1.15; margin: 8px 0 10px; }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; margin: 30px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.fade-in { animation: fade .6s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; margin: 12px 0 0; padding: 12px 20px;
  border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  font-weight: 700; font-size: 1rem;
}
.btn--gold { background: linear-gradient(180deg, #f0d68f, var(--gold-2)); color: #1d1530; box-shadow: 0 6px 20px rgba(201, 161, 74, 0.25); }
.btn--ghost { background: transparent; color: var(--gold); border: 1px solid rgba(231, 201, 120, 0.5); }
.btn:disabled { opacity: .6; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: .9rem; color: var(--text); text-decoration: none; cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--gold); border-color: rgba(231, 201, 120, .6); }
.chip[aria-pressed="true"] svg { fill: currentColor; }
.link { background: none; border: 0; padding: 0; color: var(--gold); text-decoration: underline; cursor: pointer; font-size: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }

/* Card of the Day */
.today { text-align: center; }
.today__date { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; margin: 2px 0 14px; }
.today__hint { color: var(--muted); font-family: var(--font-display); font-style: italic; font-size: 1.15rem; margin: 16px 0 0; }
.today .info, .today .more-cards, .today .install { text-align: left; }
.stage { perspective: 1400px; display: flex; justify-content: center; }
.flip {
  width: min(78vw, 320px); aspect-ratio: 720 / 1011;
  padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 14px;
}
.flip__inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.flip:not(.is-flipped) .flip__inner { animation: glow 3s ease-in-out infinite; }
@keyframes glow { 50% { filter: drop-shadow(0 0 22px rgba(231, 201, 120, .45)); } }
.flip__face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); object-fit: cover; }
.flip__front { transform: rotateY(180deg); }
.more-cards { margin-top: 34px; padding-top: 6px; border-top: 1px solid var(--line); }

/* card text */
.info { margin-top: 22px; }
.badge { display: inline-block; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; margin: 0; color: #fff; }
.badge--journey { background: var(--journey); }
.badge--affirmation { background: var(--affirmation); }
.badge--mastery { background: var(--mastery); color: #1d1530; }
.info__title { font-family: var(--font-script); font-weight: 400; color: var(--gold); font-size: 2.3rem; line-height: 1.2; margin: 10px 0 8px; }
.info__lead { font-family: var(--font-display); font-style: italic; font-size: 1.3rem; line-height: 1.45; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.box p { margin: 6px 0; }
.box--affirm { background: linear-gradient(160deg, #2c2a6a, #221a3e); }
.box--affirm p:nth-child(2) { font-family: var(--font-display); font-size: 1.25rem; line-height: 1.45; }
.box--soft { background: rgba(255, 255, 255, .04); }
.box__label { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--gold); margin: 0 0 4px !important; }
.box__hint { color: var(--muted); font-size: .88rem; }

/* Guided Journey */
.journey { background: linear-gradient(160deg, #2b3431, #1d1a2e); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.journey p { margin: 6px 0; }
.journey__title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.player { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.play { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--gold); color: #1d1530; display: grid; place-items: center; cursor: pointer; flex: none; }
.play svg { width: 24px; height: 24px; stroke: none; }
.seek { flex: 1; accent-color: var(--gold); min-width: 0; }
.time { font-size: .8rem; color: var(--muted); min-width: 78px; text-align: right; font-variant-numeric: tabular-nums; }

/* introduction gift */
.gift { background: linear-gradient(160deg, #4a3a1c, #2a1f3d 70%); border: 1px solid rgba(231, 201, 120, .55); border-radius: var(--radius); padding: 18px; margin: 10px 0 26px; box-shadow: 0 10px 30px rgba(201, 161, 74, .15); }
.gift p { margin: 6px 0; }
.gift__title { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; line-height: 1.2; margin: 4px 0 6px; color: var(--gold); }

/* locked */
.locked { text-align: center; padding-top: 10px; }
.locked__icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--surface); color: var(--gold); margin-top: 8px; }
.locked__icon svg { width: 30px; height: 30px; }
.locked .box { text-align: left; }
.ticks { text-align: left; list-style: none; padding: 0; margin: 16px 0; }
.ticks li { position: relative; padding: 6px 0 6px 30px; border-bottom: 1px solid var(--line); }
.ticks li::before { content: "\2726"; position: absolute; left: 4px; color: var(--gold); }

/* forms */
.field { display: block; margin: 16px 0 6px; }
.field > span, .field-label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 6px; }
.field-label { margin-top: 16px; }
input[type=text], input[type=email], textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.form-error { background: rgba(214, 92, 92, .16); border: 1px solid rgba(214, 92, 92, .5); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }
.segmented { display: flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 6px 0 14px; overflow-x: auto; }
.segmented button { flex: 1; white-space: nowrap; border: 0; background: none; color: var(--muted); padding: 8px 10px; border-radius: 999px; cursor: pointer; font-size: .88rem; }
.segmented [aria-checked="true"], .segmented [aria-selected="true"] { background: var(--surface-2); color: var(--gold); }

/* spreads */
.spreads { display: grid; gap: 10px; margin-top: 18px; }
.spread { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.spread__cards { display: flex; gap: 3px; flex: none; width: 74px; justify-content: center; }
.spread__cards i { width: 20px; height: 30px; border-radius: 3px; background: url("/oracle/cards/thumb/back.jpg") center / cover; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.spread__text { display: flex; flex-direction: column; }
.spread__text strong { font-family: var(--font-display); font-size: 1.25rem; }
.spread__text span { color: var(--muted); font-size: .88rem; line-height: 1.4; }

/* drawing */
.draw { text-align: center; }
.question { font-family: var(--font-display); font-style: italic; font-size: 1.2rem; color: var(--muted); margin: 0 0 10px; }
.slots { display: flex; justify-content: center; gap: 12px; margin: 10px 0 6px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 92px; }
.slot__card { width: 76px; aspect-ratio: 720 / 1011; border-radius: 7px; border: 1px dashed rgba(231, 201, 120, .4); perspective: 600px; }
.slot__label { font-size: .75rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.mini-flip { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .8s ease; }
.mini-flip .flip__face { border-radius: 7px; box-shadow: 0 6px 16px rgba(0, 0, 0, .5); }
.mini-flip.is-flipped { transform: rotateY(180deg); }
.shuffle { position: relative; height: 230px; margin: 16px auto 0; width: 150px; }
.shuffle img { position: absolute; left: 0; top: 0; width: 150px; border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, .5); animation: riffle 0.85s ease-in-out calc(var(--i) * 0.09s) 2 both; }
@keyframes riffle { 0%, 100% { transform: translateX(0) rotate(0); } 30% { transform: translateX(calc((var(--i) - 2) * 34px)) rotate(calc((var(--i) - 2) * 6deg)); } 60% { transform: translateY(-14px) rotate(calc((2 - var(--i)) * 4deg)); } }
.shuffle.is-done { display: none; }
.draw__hint { color: var(--muted); font-family: var(--font-display); font-size: 1.15rem; min-height: 3em; margin: 12px 0 0; }
.fan { display: flex; overflow-x: auto; padding: 34px 28px 40px; margin: 0 -18px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.fan__card {
  flex: none; width: 96px; aspect-ratio: 720 / 1011; margin-left: -58px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 8px; scroll-snap-align: center;
  transform: rotate(calc((var(--k) - var(--t) / 2) * 0.6deg)) translateY(calc(var(--k) * 0px));
  transition: transform .35s ease, opacity .35s ease;
}
.fan__card:first-child { margin-left: 0; }
.fan__card img { border-radius: 8px; box-shadow: -4px 4px 12px rgba(0, 0, 0, .45); width: 100%; height: 100%; object-fit: cover; }
.fan__card:hover, .fan__card:focus-visible { transform: translateY(-16px); }
.fan__card.is-picked { transform: translateY(-60px) scale(1.06); opacity: 0; }
.fan__card:disabled { cursor: default; }

/* reading */
.spread-result { display: grid; gap: 12px; margin: 16px 0 8px; }
.spread-result--1 { justify-items: center; }
.spread-result--1 .result { width: min(78vw, 320px); }
.spread-result--3 { grid-template-columns: repeat(3, 1fr); }
.result { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; text-align: center; }
.result img { border-radius: 10px; box-shadow: 0 10px 26px rgba(0, 0, 0, .5); }
.result__pos { text-transform: uppercase; letter-spacing: .1em; font-size: .7rem; color: var(--gold); margin-top: 6px; }
.result__title { font-family: var(--font-display); font-size: 1rem; line-height: 1.2; }
.spread-result--1 .result__pos, .spread-result--1 .result__title { display: none; }

/* deck */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.grid__card img { border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .45); }
.card-page__img, .sheet__img { display: block; width: min(78vw, 320px); margin: 6px auto 0; padding: 0; border: 0; background: none; cursor: zoom-in; }
.card-page__img img, .sheet__img img { border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
.pager { display: flex; justify-content: space-between; gap: 8px; margin: 22px 0; }

/* journal */
.history { display: grid; gap: 10px; margin-top: 8px; }
.history__item { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; color: var(--text); text-decoration: none; }
.history__cards { display: flex; gap: 3px; flex: none; }
.history__cards img { width: 38px; border-radius: 4px; }
.history__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history__text strong { font-family: var(--font-display); font-size: 1.15rem; }
.history__note { font-size: .9rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* more */
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; margin: 12px 0; }
.fold summary { cursor: pointer; font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; padding: 10px 0; }
.fold[open] summary { color: var(--gold); }
.remind { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.remind select { width: auto; padding: 8px 12px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 46px; height: 28px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); position: relative; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--gold-2); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.disclaimer { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 18px 0 0; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(8, 6, 16, .72); display: flex; align-items: flex-end; justify-content: center; }
.sheet__panel {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  animation: up .3s ease both;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__close { position: sticky; top: 0; float: right; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.sheet__title { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; margin: 4px 44px 10px 0; line-height: 1.2; }
.price { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin: 8px 0; color: var(--gold); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); margin: 20px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* zoom */
.zoom { position: fixed; inset: 0; z-index: 50; background: rgba(5, 4, 10, .94); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.zoom img { max-height: 92vh; width: auto; border-radius: 16px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .92rem; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (min-width: 600px) {
  .view { padding: 4px 24px 0; }
  .fan__card { width: 110px; margin-left: -64px; }
}

/* ---------- opening screen: 8 cards fan out ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(110% 65% at 50% 100%, #6b5326 0%, #2d2449 40%, #1a1430 70%, #0f0b1d 100%);
  cursor: pointer; transition: opacity .7s ease;
}
.intro.is-leaving { opacity: 0; pointer-events: none; }
.intro__fan { --mid: 3; --step: 7deg; position: relative; width: min(94vw, 560px); height: min(70vw, 340px); }
.intro__fan img {
  position: absolute; left: 50%; bottom: 14%; width: min(26vw, 140px); aspect-ratio: 720 / 1011; margin-left: calc(min(26vw, 140px) / -2);
  border-radius: 8px; box-shadow: 0 12px 28px rgba(0, 0, 0, .55); transform-origin: 50% 300%;
  transform: rotate(0deg); opacity: 0;
  animation: intro-fan 1.1s cubic-bezier(.2, .8, .2, 1) calc(.15s + var(--i) * .09s) forwards;
}
@keyframes intro-fan {
  from { transform: rotate(0deg) translateY(30px); opacity: 0; }
  20% { opacity: 1; }
  to { transform: rotate(calc((var(--i) - var(--mid)) * var(--step))); opacity: 1; }
}
.intro__title { font-family: var(--font-script); color: var(--gold); font-size: clamp(2.8rem, 13vw, 4.4rem); line-height: 1; margin: 6px 0 4px; opacity: 0; animation: intro-text .9s ease 1.1s forwards; }
.intro__sub { font-family: var(--font-display); color: var(--muted); letter-spacing: .1em; margin: 0; padding: 0 16px; text-align: center; opacity: 0; animation: intro-text .9s ease 1.4s forwards; }
@keyframes intro-text { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .intro__fan img { animation: none; opacity: 1; transform: rotate(calc((var(--i) - var(--mid)) * var(--step))); }
  .intro__title, .intro__sub { animation: none; opacity: 1; }
}
