:root {
  --ink: #f4f4f2;
  --mut: #b9bcc8;
  --glass: rgba(12, 14, 30, 0.55);
  --line: rgba(255, 255, 255, 0.16);
  --grad: linear-gradient(115deg, #ffffff 0%, #ffc07a 38%, #ff7a59 68%, #e34fa4 100%);
  --font-d: "Space Grotesk", "Helvetica Neue", sans-serif;
  --font-b: "Inter", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #0b0f2a; color: var(--ink); font-family: var(--font-b); -webkit-font-smoothing: antialiased; }
canvas#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* top bar */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: max(16px, env(safe-area-inset-top)) 20px 0; z-index: 5; pointer-events: none; }
.top > * { pointer-events: auto; }
.back { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-decoration: none; font-family: var(--font-d); font-size: 14px; letter-spacing: 0.02em; }
.back img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background .2s, border-color .2s; }
.icon-btn:hover { border-color: rgba(255,255,255,.45); }
#mute .x { display: none; }
#mute[aria-pressed="true"] .x { display: inline; }
#mute[aria-pressed="true"] .wave { display: none; }

/* orbit hint */
.hint { position: fixed; top: max(24px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 4; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-family: var(--font-d); font-size: 12.5px; letter-spacing: .04em; color: var(--mut); pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.hint.gone { opacity: 0; }
.hint .narrow { display: none; }
@media (max-width: 640px) { .hint { top: 104px; font-size: 11.5px; } .hint .wide { display: none; } .hint .narrow { display: inline; } }

/* view controls */
.view-ctrl { position: fixed; right: max(20px, env(safe-area-inset-right)); top: calc(max(16px, env(safe-area-inset-top)) + 58px); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); user-select: none; -webkit-user-select: none; touch-action: none; }
.view-ctrl button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); opacity: .82; transition: background .15s, opacity .15s; }
.view-ctrl button:hover, .view-ctrl button:focus-visible { background: rgba(255,255,255,.12); opacity: 1; outline: none; }
.view-ctrl button:active { background: rgba(255,192,122,.22); }
.view-ctrl svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view-ctrl .sep { width: 18px; height: 1px; margin: 4px 0; background: var(--line); }
.view-ctrl .pad { display: grid; grid-template-columns: repeat(3, 24px); grid-template-rows: repeat(3, 24px); }
.view-ctrl .pad button { width: 24px; height: 24px; }
.view-ctrl .pad svg { width: 14px; height: 14px; }
.view-ctrl .pad .up { grid-column: 2; grid-row: 1; } .view-ctrl .pad .lt { grid-column: 1; grid-row: 2; }
.view-ctrl .pad .rt { grid-column: 3; grid-row: 2; } .view-ctrl .pad .dn { grid-column: 2; grid-row: 3; }
@media (max-width: 640px) { .view-ctrl { right: 10px; top: 120px; padding: 4px; } .view-ctrl button { width: 34px; height: 34px; } .view-ctrl .pad { grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 30px); } .view-ctrl .pad button { width: 30px; height: 30px; } }

/* caption */
.caption { position: fixed; left: 50%; transform: translateX(-50%); bottom: 112px; width: min(600px, calc(100% - 32px)); text-align: center; z-index: 4; pointer-events: none; transition: opacity .3s; }
.caption .q { font-size: 13px; color: var(--mut); margin-bottom: 8px; min-height: 1em; }
.caption .a { display: inline-block; font-family: var(--font-d); font-size: clamp(17px, 2.1vw, 22px); line-height: 1.4; letter-spacing: -0.005em; padding: 12px 18px; border-radius: 16px; background: rgba(8, 10, 24, 0.62); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); text-shadow: 0 1px 12px rgba(0,0,0,.5); }
.caption .a:empty { display: none; }
.caption .a .dim { color: rgba(244,244,242,.38); }
.dots span { display: inline-block; width: 6px; height: 6px; margin: 0 3px; border-radius: 50%; background: var(--ink); opacity: .3; animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ask bar */
.ask { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); width: min(680px, calc(100% - 24px)); z-index: 5; }
.chips { position: fixed; z-index: 5; right: max(20px, env(safe-area-inset-right)); bottom: 112px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chips button { font-family: var(--font-d); font-size: 13px; letter-spacing: 0.01em; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: border-color .2s, background .2s; }
.chips button:hover { border-color: rgba(255,255,255,.5); background: rgba(20, 22, 44, .7); }
.chips button:disabled { opacity: .4; cursor: default; }
/* unexplored suggestions glow until they have been clicked once */
.chips button.fresh { border-color: rgba(255, 192, 122, .7); animation: chip-glow 2.6s ease-in-out infinite; }
.chips button.fresh:nth-child(2n) { animation-delay: .4s; } .chips button.fresh:nth-child(3n) { animation-delay: .9s; }
@keyframes chip-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 192, 122, .25), 0 0 10px rgba(255, 122, 89, .25); }
  50% { box-shadow: 0 0 0 1px rgba(255, 192, 122, .6), 0 0 22px rgba(227, 79, 164, .55); }
}
/* built-with badge */
.built { position: fixed; z-index: 5; left: max(20px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-family: var(--font-d); font-size: 12.5px; letter-spacing: .02em; transition: border-color .2s, background .2s; }
.built:hover, .built:focus-visible { border-color: rgba(255, 255, 255, .5); background: rgba(20, 22, 44, .7); outline: none; }
.built-k { color: var(--mut); text-transform: uppercase; letter-spacing: .14em; font-size: 10.5px; }
.built-v { color: var(--ink); }
@media (max-width: 1180px) { .built { bottom: auto; top: calc(max(16px, env(safe-area-inset-top)) + 54px); left: max(20px, env(safe-area-inset-left)); height: 34px; padding: 0 12px; } }
@media (max-width: 640px) { .built-k { display: none; } .built { font-size: 11.5px; top: calc(max(16px, env(safe-area-inset-top)) + 50px); } }
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 20px; border-radius: 999px; background: rgba(10, 12, 28, 0.7); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.bar:focus-within { border-color: rgba(255, 192, 122, .6); }
.bar input { flex: 1; min-width: 0; height: 44px; background: transparent; border: 0; outline: 0; color: var(--ink); font: 16px var(--font-b); }
.bar input::placeholder { color: rgba(244,244,242,.45); }
.count { flex: 0 0 auto; font-family: var(--font-d); font-size: 12px; color: rgba(244,244,242,.5); font-variant-numeric: tabular-nums; }
.count.full { color: #ff9a7a; }
.count:empty { display: none; }
.bar .icon-btn { width: 44px; height: 44px; background: transparent; border-color: transparent; backdrop-filter: none; }
.bar .icon-btn.on { background: rgba(227, 79, 164, .25); border-color: rgba(227, 79, 164, .6); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(115deg, #ffc07a, #ff7a59 55%, #e34fa4); color: #160a12; transition: transform .15s, opacity .2s; }
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.05); }
.fine { margin-top: 10px; text-align: center; font-size: 11.5px; color: rgba(244,244,242,.5); }

/* intro overlay */
.intro { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at center, rgba(8,10,28,.35), rgba(8,10,28,.85)); transition: opacity .6s ease; }
.intro.gone { opacity: 0; pointer-events: none; }
.intro-card { max-width: 520px; text-align: center; }
.eyebrow { font-family: var(--font-d); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--mut); }
.intro h1 { margin-top: 14px; font-family: var(--font-d); font-weight: 700; font-size: clamp(44px, 7vw, 72px); line-height: 1.02; letter-spacing: -0.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.lede { margin: 18px auto 0; max-width: 420px; color: var(--mut); font-size: 16px; line-height: 1.55; }
.progress { margin: 28px auto 0; width: 220px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.12); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.top-actions { display: flex; gap: 10px; }
.status { margin-top: 18px; font-family: var(--font-d); font-size: 14px; letter-spacing: .04em; color: var(--mut); }
.start { margin-top: 22px; height: 52px; padding: 0 30px; border-radius: 999px; border: 0; font-family: var(--font-d); font-size: 16px; font-weight: 500; letter-spacing: .02em; background: #f4f4f2; color: #0b0b0b; transition: transform .15s, opacity .2s; }
.start:disabled { opacity: .5; cursor: default; }
.start:not(:disabled):hover { transform: translateY(-1px); }

/* wide: keep the caption clear of the chip column */
@media (min-width: 901px) { .caption { width: min(600px, calc(100vw - 600px)); } }
/* narrow or short screens: chips become a row above the input, caption above them */
@media (max-width: 900px), (max-height: 720px) {
  .chips { right: auto; left: 50%; transform: translateX(-50%); bottom: 104px; width: min(680px, calc(100% - 24px)); flex-direction: row; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: 0 0 auto; }
  .caption { bottom: 156px; }
}
@media (max-width: 640px) {
  .caption { bottom: 156px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: 0 0 auto; }
  .back span { display: none; }
  .back { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: .6; } .chips button.fresh { animation: none; box-shadow: 0 0 14px rgba(255, 122, 89, .35); } }

[hidden] { display: none !important; }
