/* The Vortex. Contents:  1. Tokens and base  2. Top, next step, tabs  3. Controls  4. Questions
   5. The map (hub, branches, paths, steps, prizes)  6. Vision board  7. Daily view  8. Sheet and toasts
   9. You  10. Still mode */

/* ---------- 1. Tokens and base ---------- */
:root {
  --bg: #14151b; --panel: #1d1e28; --raised: #262836; --line: #34364a; --line-strong: #4a4d68;
  --text: #eceef4; --dim: #9da0b3; --violet: #9b7bff; --pink: #e0607e; --gold: #f4c463; --gold-deep: #c9892f; --good: #7fd6a0; --bad: #ff8a8a;
  --head: "Michroma", system-ui, sans-serif; --body: "Barlow", system-ui, sans-serif;
  --radius: 14px; --side: max(16px, env(safe-area-inset-left, 0px));
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { min-height: 100vh; padding-bottom: 190px; color: var(--text); font: 400 17px/1.5 var(--body); background: var(--bg);
  background-image: radial-gradient(640px at 12% 0%, rgba(155,123,255,.16), transparent), radial-gradient(520px at 92% 18%, rgba(224,96,126,.10), transparent); background-attachment: fixed; }
h1, h2, h3, .eyebrow, .btn, .tabs button, .name, .level { font-family: var(--head); font-weight: 400; text-transform: uppercase; }
h1 { font-size: 22px; line-height: 1.3; letter-spacing: .04em; text-wrap: balance; }
h2 { font-size: 13px; letter-spacing: .14em; color: var(--violet); }
h3 { font-size: 12px; letter-spacing: .1em; }
.eyebrow { font-size: 10px; letter-spacing: .22em; color: var(--gold); }
.note { color: var(--dim); font-size: 15px; }
main { width: min(100%, 980px); margin: 0 auto; padding: 8px var(--side) 0; padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 18px; }

/* ---------- 2. Top, next step, tabs ---------- */
.top { display: flex; align-items: center; gap: 12px; width: min(100%, 980px); margin: 0 auto; padding: 18px var(--side) 10px; }
.mark { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(from 40deg, var(--violet), var(--pink), var(--gold), var(--violet)); box-shadow: 0 0 18px rgba(155,123,255,.55); animation: turn 14s linear infinite; }
.mark::after { content: ""; display: block; width: 14px; height: 14px; margin: 8px; border-radius: 50%; background: var(--bg); }
.name { font-size: 15px; letter-spacing: .12em; white-space: nowrap; }
.level { margin-left: auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 9.5px; letter-spacing: .14em; color: var(--gold); white-space: nowrap; }
@keyframes turn { to { transform: rotate(360deg); } }

.next { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); z-index: 8; display: flex; align-items: center; gap: 14px;
  width: min(100% - 24px, 956px); margin: 0 auto; padding: 14px 16px; border: 1px solid var(--gold-deep); border-radius: var(--radius);
  background: linear-gradient(135deg, #2a2536, #33282f); box-shadow: 0 14px 40px -12px #000, 0 0 0 1px rgba(244,196,99,.12); }
.next-text { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.next-text b { display: block; font-size: 19px; font-weight: 600; line-height: 1.25; }
.next-text small { display: block; margin-top: 3px; color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; display: flex; justify-content: center; gap: 6px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(20,21,27,.94); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
.tabs button { flex: 0 1 150px; min-height: 42px; border: 1px solid transparent; border-radius: 999px; background: none; color: var(--dim); font-size: 10.5px; letter-spacing: .14em; cursor: pointer; }
.tabs button[aria-current="true"] { border-color: var(--violet); color: var(--text); background: rgba(155,123,255,.12); }

/* ---------- 3. Controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); color: var(--text); font-size: 10.5px; letter-spacing: .1em; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--violet); }
.btn--go { background: var(--gold); border-color: var(--gold); color: #1b1408; }
.btn--go:hover { border-color: #fff; }
.btn--quiet { min-height: 38px; padding: 0 14px; font-size: 9.5px; color: var(--dim); }
.btn--bad { color: var(--bad); }
.btn:disabled { opacity: .4; cursor: default; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--dim); }
input[type="text"], input[type="date"], input[type="number"], select, textarea { width: 100%; min-width: 0; padding: 12px 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: #12131a; color: var(--text); font: 400 16px/1.4 var(--body); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .step:focus-visible, .prize:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
textarea { min-height: 84px; resize: vertical; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { display: grid; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.switch { display: inline-flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.switch i { position: relative; width: 46px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-pressed="true"] i { background: var(--gold-deep); }
.switch[aria-pressed="true"] i::after { transform: translateX(20px); }

/* ---------- 4. Questions ---------- */
.ask { width: min(100%, 560px); margin: 4vh auto 0; }
.ask-dots { display: flex; gap: 6px; }
.ask-dots i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.ask-dots i.on { background: var(--gold); }
.ask-rows { display: grid; gap: 10px; }
.ask-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ask-row.two { grid-template-columns: 1.4fr 1fr; }
.ask-row.three { grid-template-columns: 1.4fr 1fr 1fr; }

/* ---------- 5. The map ---------- */
.stars { display: flex; flex-wrap: wrap; gap: 8px; }
.stars span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; color: var(--dim); }
.stars b { color: var(--gold); font-weight: 500; }

/* the hub: the core in the middle, a block for every branch above and below it, each tied to the core by a line
   that brightens as its branch fills in (--p runs from 0 to 1) */
.hub { display: grid; gap: 26px 12px; grid-template-columns: repeat(var(--cols, 3), 1fr); padding: 6px 0; }
.hub-core { grid-column: 1 / -1; justify-self: center; display: grid; place-items: center; width: 132px; height: 132px; border-radius: 50%; text-align: center;
  background: radial-gradient(circle at 50% 40%, #3a2f63, #17151f 70%); border: 1px solid var(--violet); box-shadow: 0 0 40px rgba(155,123,255,.4), inset 0 0 26px rgba(155,123,255,.25); }
.hub-core b { font: 400 11px/1.4 var(--head); letter-spacing: .14em; text-transform: uppercase; }
.hub-core small { display: block; margin-top: 4px; color: var(--gold); font-size: 13px; }
.block { position: relative; display: grid; gap: 8px; align-content: start; min-width: 0; padding: 12px 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.block:hover, .block[aria-pressed="true"] { border-color: var(--violet); }
.block b { font: 400 10.5px/1.35 var(--head); letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere; }
.block small { color: var(--dim); font-size: 12.5px; }
.block .bar, .branch-head .bar { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.block .bar i, .branch-head .bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }
.block::after { content: ""; position: absolute; left: 50%; width: 2px; height: 26px; background: linear-gradient(var(--gold), var(--violet)); opacity: calc(.18 + var(--p) * .82); box-shadow: 0 0 calc(var(--p) * 10px) var(--gold); }
.block.above::after { top: 100%; } .block.below::after { bottom: 100%; }

.branch { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); overflow: hidden; scroll-margin-top: 12px; }
.branch-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; width: 100%; padding: 16px 18px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.branch-head .bar { grid-column: 1 / -1; }
.branch-head small { color: var(--dim); font-size: 13px; }
.branch-body { display: grid; gap: 18px; padding: 4px 18px 18px; }

/* a path: steps in a row, tied by links, ending in the prize. A link lights when the step before it is gold.
   On a phone the row becomes a column, so the whole path and its prize are seen by scrolling down. */
.path-name { margin-bottom: -14px; color: var(--gold); font-size: 13.5px; font-weight: 500; }
.path-name::before { content: "→ "; color: var(--dim); }
.path { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 14px 2px 16px; scroll-snap-type: x proximity; }
.step { position: relative; flex: 0 0 168px; display: grid; gap: 6px; align-content: start; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raised); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; scroll-snap-align: start; }
.step b { font-weight: 600; font-size: 15px; line-height: 1.25; }
.step small { color: var(--dim); font-size: 12.5px; }
.step .meter { color: var(--violet); font-size: 13px; font-weight: 500; }
.step.next-up { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet), 0 0 22px rgba(155,123,255,.3); }
.step.gold { border-color: var(--gold); background: linear-gradient(150deg, #5a4318, #2f2613 60%, #4a3712); box-shadow: 0 0 18px rgba(244,196,99,.28); }
.step.gold b { color: #ffe9b0; } .step.gold small, .step.gold .meter { color: #d9bd7c; }
.step.gold::before { content: "★"; position: absolute; top: 8px; right: 10px; color: var(--gold); font-size: 13px; }
.step.shine::after, .prize.shine::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.75) 50%, transparent 65%); transform: translateX(-120%); animation: shine .9s ease-out 1; }
@keyframes shine { to { transform: translateX(120%); } }
.step.add { flex-basis: 64px; place-items: center; align-content: center; border-style: dashed; background: none; color: var(--dim); font-size: 22px; }
.link { flex: 0 0 26px; align-self: center; height: 3px; background: var(--line-strong); }
.link.lit { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); box-shadow: 0 0 10px rgba(244,196,99,.7); }
.prize { position: relative; flex: 0 0 176px; display: grid; gap: 6px; place-items: center; align-content: center; padding: 14px; border: 1px solid var(--gold-deep); border-radius: 50px 14px 50px 14px; color: var(--text); font: inherit; text-align: center; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, rgba(244,196,99, calc(.10 + var(--p) * .34)), #1b1a22 72%); box-shadow: 0 0 calc(10px + var(--p) * 34px) rgba(244,196,99, calc(.18 + var(--p) * .5)); animation: glow 3.2s ease-in-out infinite; }
.prize b { font: 400 11px/1.4 var(--head); letter-spacing: .08em; text-transform: uppercase; overflow-wrap: anywhere; }
.prize small { color: var(--gold); font-size: 12.5px; }
.prize.won { border-color: #fff; background: radial-gradient(circle at 50% 30%, #ffe9b0, #c9892f 55%, #5a4318); color: #1b1408; } .prize.won small { color: #1b1408; }
@keyframes glow { 50% { filter: brightness(1.18); } }

/* ---------- 6. Vision board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.dream { position: relative; aspect-ratio: 3 / 4; perspective: 900px; }
.dream-flip { position: absolute; inset: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.dream.turned .dream-flip { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: grid; align-content: end; padding: 12px; border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--raised) center / cover no-repeat; text-align: left; }
.face.front::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(10,10,14,.85)); }
.face.front b { position: relative; font: 400 10.5px/1.4 var(--head); letter-spacing: .08em; text-transform: uppercase; }
.face.front.empty { place-items: center; align-content: center; border-style: dashed; color: var(--dim); text-align: center; }
.face.front.empty::before { display: none; }
.face.back { align-content: center; gap: 8px; transform: rotateY(180deg); background: linear-gradient(150deg, #2c2547, #1b1a26); border-color: var(--gold-deep); text-align: center; }
.face.back b { font: 400 11px/1.4 var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.face.back span { font-size: 15px; }
.dream::after { content: ""; position: absolute; inset: 0; border-radius: 16px; pointer-events: none; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%); background-size: 250% 100%; background-position: 130% 0; opacity: 0; }
.dream.shimmer::after { opacity: 1; animation: shimmer .8s ease-out 1; }
@keyframes shimmer { to { background-position: -30% 0; } }
.dream-edit { position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(20,21,27,.8); color: var(--text); font-size: 14px; cursor: pointer; }

/* ---------- 7. Daily view ---------- */
.daily { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto 1fr auto; gap: 16px; justify-items: center; padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px)); background: #0c0c11;
  background-image: radial-gradient(700px at 50% 40%, rgba(155,123,255,.22), transparent); }
.daily-clock { font: 400 13px var(--head); letter-spacing: .2em; color: var(--gold); }
.daily-stage { align-self: center; width: min(78vw, 46vh, 420px); }
.daily-stage .dream-edit { display: none; }
.daily-title { text-align: center; }

/* ---------- 8. Sheet and toasts ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(6,6,9,.78); overflow-y: auto; }
.sheet-card { width: min(100%, 460px); display: grid; gap: 14px; padding: 24px; border: 1px solid var(--line-strong); border-top: 2px solid var(--violet); border-radius: 18px; background: var(--panel); }
.sheet-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.sheet-acts .left { margin-right: auto; }
.count { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.toasts { position: fixed; left: 50%; top: 14px; z-index: 40; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 12px 16px; border: 1px solid var(--gold-deep); border-radius: 12px; background: #2a2536; text-align: center; box-shadow: 0 12px 30px -12px #000; }

/* ---------- 9. You ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.chips small { color: var(--gold); margin-left: 6px; }

@media (max-width: 640px) {
  .hub { --cols: 2 !important; }
  .pair, .ask-row.two, .ask-row.three { grid-template-columns: 1fr; }
  .next { gap: 10px; padding: 12px; } .next-text b { font-size: 17px; }
  .name { font-size: 12.5px; } .level { padding: 5px 10px; font-size: 8.5px; letter-spacing: .1em; }
  .path { flex-direction: column; overflow: visible; }
  .step, .step.add, .prize { flex: 0 0 auto; }
  .step.add { min-height: 44px; }
  .link { flex: 0 0 18px; width: 3px; height: 18px; }
  .link.lit { background: linear-gradient(var(--gold-deep), var(--gold)); }
  .prize { min-height: 110px; }
}

/* ---------- 10. Still mode ---------- */
@media (prefers-reduced-motion: reduce) {
  .mark, .prize { animation: none; }
  .step.shine::after, .prize.shine::after, .dream.shimmer::after { animation: none; opacity: 0; }
  .dream-flip { transition: none; }
}
