:root {
  --bg: #02030a;
  --glass: rgba(14, 18, 38, 0.55);
  --glass-strong: rgba(12, 16, 34, 0.72);
  --border: rgba(160, 180, 255, 0.16);
  --border-hi: rgba(150, 190, 255, 0.38);
  --text: #e9edff;
  --muted: #95a0c8;
  --dim: #6c779f;
  --accent: #8cc8ff;
  --accent2: #ffd27c;
  --violet: #a68bff;
  --grad: linear-gradient(135deg, #4f8cff 0%, #8b5cff 55%, #d16bff 100%);
  --panel-w: clamp(330px, 30vw, 420px);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#sky { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; }
#sky.dragging { cursor: grabbing; }
#sky.over-star { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(120, 140, 255, 0.04);
}

/* ---------- header ---------- */
#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 18px; z-index: 5; pointer-events: none;
  background: linear-gradient(to bottom, rgba(2,3,10,.75), rgba(2,3,10,0)); }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: #fff;
  background: var(--grad); box-shadow: 0 0 24px rgba(139, 92, 255, 0.55), inset 0 1px 0 rgba(255,255,255,.35); }
.brand h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15;
  background: linear-gradient(90deg, #fff, #cfdcff 60%, #b9a8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; color: #cdd6ff;
  padding: 2px 9px 2px 7px; border-radius: 999px; background: rgba(139, 92, 255, 0.16); border: 1px solid rgba(166, 139, 255, 0.35); }
.badge em { font-style: normal; color: var(--muted); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: #7dffb2; box-shadow: 0 0 8px #7dffb2; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

.controls { display: flex; gap: 10px; align-items: center; padding: 6px 6px 6px 10px; border-radius: 14px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 9px; width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
input[type=search], input[type=text] { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 11px; outline: none; font: inherit; transition: border-color .2s, box-shadow .2s, background .2s; }
input[type=search] { width: 220px; padding-left: 30px; }
input:focus { border-color: var(--border-hi); background: rgba(255,255,255,0.08); box-shadow: 0 0 0 3px rgba(120, 160, 255, 0.15); }
input::placeholder { color: var(--dim); }
.chips { display: flex; gap: 4px; }
.seg { display: flex; padding: 2px; border-radius: 999px; background: rgba(10, 14, 34, 0.55); border: 1px solid var(--border); }
.seg button { font: inherit; font-size: 12px; padding: 4px 11px; border: 0; border-radius: 999px; background: transparent; color: var(--dim); cursor: pointer; transition: background .2s, color .2s; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, rgba(110,140,255,.55), rgba(170,110,255,.5)); box-shadow: 0 0 12px rgba(140,120,255,.35); }
.chip { cursor: pointer; user-select: none; }
.chip input { display: none; }
.chip span { display: inline-block; font-size: 12px; padding: 5px 10px; border-radius: 999px; color: var(--dim);
  border: 1px solid transparent; transition: all .2s; }
.chip input:checked + span { color: var(--text); background: rgba(140, 170, 255, 0.12); border-color: var(--border); }
.chip:hover span { color: var(--text); }
button { font: inherit; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 13px; cursor: pointer; transition: transform .12s, border-color .2s, box-shadow .2s, filter .2s; }
button:hover { border-color: var(--border-hi); }
button:active { transform: scale(.97); }
button.primary { background: var(--grad); border-color: transparent; font-weight: 600; color: #fff;
  box-shadow: 0 4px 18px rgba(120, 90, 255, 0.35), inset 0 1px 0 rgba(255,255,255,.25); }
button.primary:hover { filter: brightness(1.12); box-shadow: 0 6px 24px rgba(140, 100, 255, 0.55), inset 0 1px 0 rgba(255,255,255,.25); }
button:disabled { opacity: .55; cursor: default; filter: saturate(.6); }
.tour-icon { font-size: 10px; }

/* ---------- banners / toasts ---------- */
#mode-banner { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); background: rgba(255, 190, 80, .12);
  border: 1px solid rgba(255, 190, 80, .4); color: var(--accent2); padding: 4px 12px; border-radius: 999px; font-size: 11.5px; z-index: 6;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); white-space: nowrap; }
#toast { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 30; padding: 9px 16px; border-radius: 12px;
  background: rgba(40, 20, 30, 0.75); border: 1px solid rgba(255, 120, 140, 0.45); color: #ffd0d6; font-size: 13px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 8px 30px rgba(0,0,0,.45); animation: toastIn .3s ease; }
#toast.info { background: rgba(20, 30, 50, 0.75); border-color: var(--border-hi); color: #dbe6ff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---------- tooltip ---------- */
#tooltip { position: fixed; pointer-events: none; z-index: 7; padding: 8px 12px 8px 11px; border-radius: 12px; white-space: nowrap;
  background: rgba(12, 16, 34, 0.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border); box-shadow: 0 8px 28px rgba(0,0,0,.5); font-size: 12px; animation: tipIn .12s ease-out; }
@keyframes tipIn { from { opacity: 0; transform: translateY(3px); } }
#tooltip .t-name { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 650; color: #fff; }
#tooltip .t-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
#tooltip .t-sub { color: var(--muted); margin-top: 2px; }
#tooltip .t-sub b { color: #d9e1ff; font-weight: 550; }
#tooltip .t-hint { color: var(--violet); font-size: 10.5px; margin-top: 3px; }

/* ---------- side panel ---------- */
#panel { position: fixed; top: 76px; right: 16px; bottom: 16px; width: var(--panel-w); border-radius: 20px;
  padding: 18px 18px 14px; display: flex; flex-direction: column; z-index: 10; overflow: hidden;
  background: var(--glass-strong);
  transform: translateX(calc(100% + 40px)) scale(.98); opacity: 0; pointer-events: none;
  transition: transform .45s cubic-bezier(.2, .9, .25, 1), opacity .3s ease; }
#panel::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(160deg, rgba(140,180,255,.55), rgba(139,92,255,.15) 35%, rgba(255,255,255,0) 60%, rgba(209,107,255,.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
#panel.open { transform: none; opacity: 1; pointer-events: auto; }
#panel-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; font-size: 18px; line-height: 1;
  border-radius: 50%; background: rgba(255,255,255,.06); }
.panel-head { display: flex; gap: 14px; align-items: center; margin: 0 34px 14px 0; }
#panel-orb { flex: none; width: 46px; height: 46px; border-radius: 50%; position: relative; }
#panel-kicker { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--violet); font-weight: 600; }
#panel h2 { margin: 0; font-size: 25px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.15; }
#panel-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
#facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.fact { background: rgba(255,255,255,.035); border: 1px solid rgba(160,180,255,.1); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.fact.wide { grid-column: span 3; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.fact .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.fact .v { font-size: 15px; font-weight: 650; color: #f2f5ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact .s { font-size: 11px; color: var(--muted); }
.fact.wide .v { font-size: 13px; font-weight: 550; }
.section-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 2px 0 8px;
  display: flex; align-items: center; gap: 6px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.gem { color: var(--violet); }
#chat { flex: 1; overflow-y: auto; padding-right: 6px; margin-right: -6px; scrollbar-width: thin; scrollbar-color: rgba(160,180,255,.25) transparent; }
#chat::-webkit-scrollbar { width: 6px; }
#chat::-webkit-scrollbar-thumb { background: rgba(160,180,255,.25); border-radius: 3px; }
.msg { margin-bottom: 14px; animation: msgIn .35s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg.q { margin-left: 18%; padding: 8px 12px; border-radius: 14px 14px 4px 14px; color: #fff; font-weight: 550;
  background: linear-gradient(135deg, rgba(79,140,255,.35), rgba(139,92,255,.35)); border: 1px solid rgba(160,150,255,.35); }
.msg.err { color: #ffb3bd; background: rgba(255,80,100,.08); border: 1px solid rgba(255,100,120,.3); padding: 10px 12px; border-radius: 12px; font-size: 13px; }
.msg.err .retry { margin-top: 8px; font-size: 12px; padding: 4px 10px; }
.mock-tag { display: inline-block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent2);
  border: 1px solid rgba(255,210,124,.35); border-radius: 6px; padding: 0 6px; margin-bottom: 6px; }

/* thinking state */
.thinking { padding: 4px 0; }
.thinking-head { display: flex; align-items: center; gap: 10px; color: #cfd8ff; font-size: 13px; margin-bottom: 10px; }
.orbit { width: 22px; height: 22px; position: relative; flex: none; }
.orbit::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 10px var(--accent2); }
.orbit i { position: absolute; inset: 0; animation: spin 1.4s linear infinite; }
.orbit i::after { content: ""; position: absolute; top: 0; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.orbit i:nth-child(2) { animation-duration: 2.3s; animation-direction: reverse; }
.orbit i:nth-child(2)::after { background: var(--violet); box-shadow: 0 0 6px var(--violet); }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { height: 11px; border-radius: 6px; margin: 8px 0; background: linear-gradient(90deg, rgba(255,255,255,.05) 0%, rgba(160,170,255,.16) 40%, rgba(255,255,255,.05) 80%);
  background-size: 300% 100%; animation: shimmer 1.6s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

#ask-form { display: flex; gap: 8px; padding-top: 12px; margin-top: 4px; border-top: 1px solid rgba(160,180,255,.1); }
#ask-input { flex: 1; min-width: 0; border-radius: 12px; }
#ask-form button { border-radius: 12px; white-space: nowrap; }

/* markdown */
.md { color: #dfe5ff; font-size: 13.8px; line-height: 1.62; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { margin: .2em 0 .45em; font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  background: linear-gradient(90deg, #fff, #c9b8ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.md h4 { font-size: 14px; }
.md strong { color: #fff; font-weight: 650; }
.md em { color: #cbd3f5; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.25em; }
.md ul { list-style: none; padding-left: 1.1em; }
.md ul li { position: relative; margin: .25em 0; }
.md ul li::before { content: "✦"; position: absolute; left: -1.15em; top: .05em; font-size: .8em; color: var(--violet); }
.md ol li { margin: .25em 0; }
.md ol li::marker { color: var(--violet); font-weight: 600; }
.md code { font-family: var(--mono); font-size: .88em; background: rgba(140,170,255,.12); border: 1px solid rgba(140,170,255,.18); padding: 0 5px; border-radius: 5px; }
.md a { color: var(--accent); border-bottom: 1px dotted; }

/* ---------- tour card ---------- */
#tour-card { position: fixed; left: 18px; bottom: 36px; width: min(390px, calc(100vw - 36px)); border-radius: 18px;
  padding: 14px 16px; z-index: 9; animation: cardIn .45s cubic-bezier(.2,.9,.25,1); }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } }
.tour-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.tour-nav { display: flex; gap: 4px; }
.tour-nav button { padding: 2px 9px; border-radius: 8px; font-size: 13px; }
.tour-progress { height: 3px; background: rgba(255,255,255,.07); border-radius: 2px; margin: 9px 0 6px; overflow: hidden; }
#tour-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), #ff9f6b); box-shadow: 0 0 8px var(--accent2); }
#tour-name { margin: 4px 0 4px; color: var(--accent2); font-size: 21px; font-weight: 750; letter-spacing: -0.01em; cursor: pointer; }
#tour-name:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tour-hint { font-size: 11px; color: var(--dim); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* ---------- page nav ---------- */
.topnav { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; margin-right: auto; margin-left: 6px; }
.topnav a, .topnav button { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; color: var(--muted); border: 1px solid transparent; background: transparent; text-decoration: none; white-space: nowrap; }
.topnav a:hover, .topnav button:hover { color: var(--text); background: rgba(140,170,255,.1); text-decoration: none; }
.topnav a.active { color: #fff; background: linear-gradient(135deg, rgba(110,140,255,.45), rgba(170,110,255,.4)); }
.quest-btn { background: linear-gradient(135deg, rgba(255,190,90,.28), rgba(255,120,170,.25)); border-color: rgba(255,200,120,.35); font-weight: 600; white-space: nowrap; }
.quest-btn:hover { border-color: rgba(255,210,140,.7); box-shadow: 0 0 16px rgba(255,180,100,.35); }
.chip-kids input:checked + span { background: rgba(126,240,176,.14); border-color: rgba(126,240,176,.35); color: #c9ffe1; }

/* ---------- onboarding tips card (on the map) ---------- */
#tips { position: fixed; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 25; width: min(440px, calc(100vw - 32px));
  padding: 14px 18px 12px; border-radius: 18px; animation: cardIn .6s cubic-bezier(.2,.9,.25,1); }
#tips.out { transition: opacity .3s, transform .3s; opacity: 0; transform: translateX(-50%) translateY(10px); }
.tips-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; color: #ffe2a0; }
.tips-list { margin: 0 0 10px; padding-left: 18px; font-size: 13px; color: #d8dffc; line-height: 1.55; }
.tips-list b { color: var(--accent2); }
.tips-list b.ss { color: #ffcf7a; }
.tips-x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--dim); font-size: 20px; padding: 2px 6px; }
.tips-x:hover { color: var(--text); }
.tips-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- quests ---------- */
#quest-picker { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(2,3,10,.55); animation: fadeIn .3s ease; }
.qp-card { position: relative; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: auto; border-radius: 24px; padding: 22px 24px; animation: cardIn .45s cubic-bezier(.2,.9,.25,1); }
.qp-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 18px; }
.qp-kicker { color: var(--accent2); font-weight: 700; font-size: 13px; }
.qp-card h2 { margin: 2px 0 2px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.qp-sub { margin: 0 0 14px; color: var(--muted); }
.qp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.qp-item { display: flex; gap: 12px; text-align: left; align-items: flex-start; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.05); }
.qp-item:hover { transform: translateY(-2px); background: rgba(140,170,255,.1); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.qp-item.done { border-color: rgba(126,240,176,.4); }
.qp-emoji { font-size: 30px; line-height: 1; }
.qp-body { display: grid; gap: 2px; }
.qp-title { font-weight: 700; font-size: 15px; }
.qp-meta { font-size: 11.5px; color: var(--muted); }
.qp-diff { color: var(--accent2); }
.qp-badge { font-size: 11.5px; color: #cfd8ff; }
.qp-badges { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.qp-badges-title { font-weight: 700; margin-bottom: 8px; }
#qp-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.qb { display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px dashed var(--border); color: var(--dim); font-size: 12px; }
.qb.has { border-style: solid; border-color: rgba(255,210,124,.5); background: rgba(255,210,124,.12); color: #ffe7b0; }
.qb-emoji { font-size: 18px; }
#badge-shelf { position: fixed; left: 18px; top: 76px; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 12px; border-radius: 999px; cursor: pointer; animation: cardIn .4s ease; }
.bs-title { font-size: 11px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.bs-badge { font-size: 18px; filter: drop-shadow(0 0 6px rgba(255,210,124,.5)); }
#quest-card { position: fixed; left: 18px; bottom: 36px; width: min(400px, calc(100vw - 36px)); border-radius: 20px; padding: 14px 16px; z-index: 10;
  animation: cardIn .45s cubic-bezier(.2,.9,.25,1); border-color: rgba(255,210,124,.3); }
#quest-card.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.q-head { display: flex; align-items: center; gap: 10px; }
.q-emoji { font-size: 30px; line-height: 1; }
.q-titles { flex: 1; min-width: 0; }
.q-kicker { font-size: 11px; color: var(--accent2); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.q-head h3 { margin: 0; font-size: 18px; font-weight: 750; }
.q-x { width: 28px; height: 28px; padding: 0; border-radius: 50%; font-size: 16px; }
.q-progress { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; margin: 10px 0 5px; overflow: hidden; }
.q-bar { height: 100%; background: linear-gradient(90deg, #7ef0b0, var(--accent2)); box-shadow: 0 0 10px rgba(126,240,176,.6); transition: width .6s cubic-bezier(.2,.9,.25,1); }
.q-dots { display: flex; gap: 5px; margin-bottom: 6px; }
.q-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.12); }
.q-dots span.on { background: #7ef0b0; box-shadow: 0 0 6px #7ef0b0; }
.q-dots span.cur { background: var(--accent2); animation: breathe 1.2s ease-in-out infinite; }
.q-clue { font-size: 15.5px; line-height: 1.45; margin: 6px 0 8px; color: #eef1ff; }
.q-feedback { font-size: 13px; color: var(--muted); padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.04); margin-bottom: 10px; }
.q-feedback.miss, .q-feedback.hint { color: #ffe7b0; background: rgba(255,210,124,.1); border: 1px solid rgba(255,210,124,.25); }
.q-yay { font-size: 19px; margin: 6px 0 6px; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.q-yay b { color: #7ef0b0; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.q-fact { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: #e4e9ff; padding: 9px 11px; border-radius: 12px; background: rgba(126,240,176,.08); border: 1px solid rgba(126,240,176,.22); }
.q-fact span { display: block; font-size: 11px; font-weight: 700; color: #7ef0b0; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.q-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.q-big { font-size: 15px; padding: 9px 18px; border-radius: 12px; }
.q-ghost { background: none; color: var(--dim); }
.q-badge-win { display: flex; align-items: center; gap: 14px; margin: 8px 0 12px; font-size: 15px; }
.q-badge-win b { color: var(--accent2); font-size: 18px; }
.q-badge-big { font-size: 54px; line-height: 1; filter: drop-shadow(0 0 14px rgba(255,210,124,.7)); animation: pop .7s cubic-bezier(.2,1.6,.4,1); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
#confetti i { position: absolute; width: 8px; height: 12px; border-radius: 2px; font-style: normal; animation: confetti 1.5s cubic-bezier(.15,.7,.4,1) forwards; }
#confetti i.spark { width: auto; height: auto; font-size: 18px; text-shadow: 0 0 8px currentColor; }
@keyframes confetti { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 1; }
  70% { opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 120px)) rotate(var(--r)); opacity: 0; } }

/* ---------- footer ---------- */
#credits { position: fixed; bottom: 0; left: 0; right: 0; padding: 7px 16px; font-size: 10.5px; color: var(--dim); z-index: 4;
  pointer-events: none; background: linear-gradient(to top, rgba(2,3,10,.8), rgba(2,3,10,0)); }
#credits a { pointer-events: auto; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1600px) {
  .badge em { display: none; }
  .topnav .nav-label { display: none; }
  .tour-label { display: none; }
}
@media (max-width: 1440px) {
  .chips .chip:nth-child(1), .chips .chip:nth-child(3) { display: none; }
  input[type=search] { width: 150px; }
  .brand h1 { font-size: 17px; }
}
@media (max-width: 1180px) { .brand .badge { display: none; } }
@media (max-width: 1000px) {
  .badge em, .chips { display: none; }
  .tour-label { display: none; }
}
@media (max-width: 720px) {
  :root { --panel-w: calc(100vw - 24px); }
  #panel { right: 12px; top: auto; height: 62vh; }
  input[type=search] { width: 130px; }
  .brand h1 { font-size: 16px; }
}
@media (max-height: 800px) {
  #panel { top: 70px; padding-top: 14px; }
  .panel-head { margin-bottom: 10px; }
  #panel h2 { font-size: 22px; }
  #facts { gap: 6px; margin-bottom: 10px; }
  .fact { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- badge images (Wikipedia thumbnails, initials fallback) ---------- */
.bimg { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, hsl(var(--h) 70% 62%), hsl(var(--h) 55% 30%));
  box-shadow: 0 0 0 2px rgba(255,214,130,.85), 0 0 14px rgba(255,200,110,.35); }
.bimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bimg .bi-ini { font-weight: 800; color: #fff; letter-spacing: .02em; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.bimg.locked { filter: grayscale(1) brightness(.55); box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
.qp-credit { margin-top: 10px; font-size: 11px; color: var(--dim); }
.qp-credit a { color: var(--muted); }
.q-pips { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 3px; }
.q-pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.15); }
.q-pips i.on { background: var(--accent2); box-shadow: 0 0 5px var(--accent2); }
.bs-badge { display: inline-flex; filter: none; }
.q-badge-big .bimg { box-shadow: 0 0 0 3px #ffd27c, 0 0 26px rgba(255,210,124,.7); }
.q-outline-note { margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.q-outline-note b { color: #ffe2a0; }
.t-ss { font-size: 10px; font-weight: 700; color: #ffcf7a; border: 1px solid rgba(255,207,122,.5); border-radius: 999px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.chip-planets span { color: #ffd98f; }
