/* GG Command Deck — INSPINIA-inspired dark admin shell, deep-space navy/indigo */
:root {
  --bg: #0a0e1f; --bg2: #0d1226;
  --card: #131a36; --card2: #161d3d;
  --line: #232b52; --line2: #2c3563;
  --accent: #6d5ef0; --accent2: #7c5cff;
  --blue: #4c6fff; --teal: #2dd4bf; --gold: #d4af37; --gold2: #f1c94f;
  --text: #e7eaf6; --muted: #8a91b4;
  --green: #34d399; --red: #f87171;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, Manrope, -apple-system, system-ui, sans-serif;
  color: var(--text); min-height: 100vh; overflow-x: hidden;
  background:
    radial-gradient(1100px 700px at 75% 12%, #1b2147cc 0%, transparent 55%),
    radial-gradient(800px 600px at -5% 70%, #14224d66 0%, transparent 55%),
    linear-gradient(165deg, var(--bg2) 0%, var(--bg) 60%, #070a18 100%);
  background-attachment: fixed;
}
.galaxy { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover;
  z-index: 0; opacity: .55; pointer-events: none; }
.veil { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(170deg, #0a0e1f99 0%, #0a0e1fb8 55%, #070a18d9 100%); }
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .7; }
.planet { position: fixed; border-radius: 50%; z-index: 0; opacity: .28; filter: blur(1px); pointer-events: none; }
.planet-a { width: 340px; height: 340px; top: 4%; right: -100px;
  background: radial-gradient(circle at 35% 30%, #2c3563, #0d1226 72%); }
.planet-b { width: 110px; height: 110px; bottom: 10%; left: -34px;
  background: radial-gradient(circle at 40% 35%, #4c6fff55, #0d1226 70%); }

.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .76rem; } .center { text-align: center; }
.err { color: var(--red); }

/* ================= shell layout ================= */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.main { padding: calc(14px + env(safe-area-inset-top, 0px)) 18px calc(50px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; align-content: start; min-width: 0; }
.offline-banner { position: fixed; top: env(safe-area-inset-top, 0px); left: 50%; transform: translateX(-50%);
  z-index: 80; padding: 6px 16px; border-radius: 0 0 10px 10px; background: #b45309; color: #fff;
  font-size: .76rem; font-weight: 700; }
.scrim { position: fixed; inset: 0; z-index: 39; background: #00000073; display: none; }
.scrim.show { display: block; }

/* ================= sidebar ================= */
.sidebar { background: #0c1128f2; border-right: 1px solid var(--line);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .06em;
  font-size: .95rem; padding: 2px 6px; }
.brand-name b { color: var(--accent2); }
.me { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); }
.me-avatar { font-size: 1.5rem; width: 42px; height: 42px; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #4c6fff33, var(--card2)); border: 1px solid var(--accent);
  border-radius: 50%; box-shadow: 0 0 14px #6d5ef044; }
.me-name { font-weight: 700; font-size: .88rem; }
.me-rank { color: var(--gold2); font-size: .75rem; font-weight: 600; }
.side-xp { padding: 0 4px; }
.xpbar { position: relative; height: 10px; border-radius: 999px; background: #00000066;
  border: 1px solid var(--line); overflow: hidden; }
.xpfill { height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--blue) 55%, var(--gold) 100%);
  box-shadow: 0 0 10px #6d5ef088; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.side-xp-txt { font-size: .68rem; color: var(--muted); margin-top: 5px; text-align: right; }
.nav { display: grid; gap: 2px; }
.venture-nav { display: grid; gap: 3px; }
.venture-btn { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 600; font-family: inherit; }
.venture-btn:hover { background: #ffffff0a; color: var(--text); }
.venture-btn.active { background: #ffffff0d; color: var(--text);
  border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
.venture-btn .vdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.venture-btn .vtag { display: block; font-size: .62rem; color: var(--muted); font-weight: 500; }
.nav-label { font-size: .62rem; letter-spacing: .14em; color: var(--muted); margin: 12px 8px 4px; }
.nav-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 600; }
.nav-item:hover { background: #ffffff0a; color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, #6d5ef022, transparent); color: var(--text);
  border-left: 3px solid var(--accent); padding-left: 7px; }
.side-foot { margin-top: auto; padding: 10px; }

/* ================= topbar ================= */
.topbar { display: flex; gap: 12px; align-items: center; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative; z-index: 41; }
.iconbtn { display: none; background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.search { flex: 1; }
.search input { width: 100%; max-width: 420px; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #00000040; color: var(--text); font-size: .85rem; }
.search input::placeholder { color: var(--muted); }
.top-icons { display: flex; gap: 8px; align-items: center; }
.chip { padding: 6px 12px; border-radius: 999px; background: #00000040; border: 1px solid var(--line);
  font-size: .78rem; color: var(--muted); white-space: nowrap; }
.chip b { color: var(--text); }
.chip.gold b { color: var(--gold2); }
.top-avatar { font-size: 1.15rem; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--accent); background: var(--card2); }
.crumb span { margin: 0 4px; }
.crumb b { color: var(--text); }

/* ================= KPI cards ================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 12px; }
.kpi { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px; }
.kpi-head { display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; color: var(--muted); font-weight: 600; }
.badge { font-size: .6rem; font-weight: 800; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.badge.violet { background: #6d5ef026; color: #a79bff; }
.badge.blue { background: #4c6fff26; color: #8da4ff; }
.badge.teal { background: #2dd4bf26; color: #5ee8d5; }
.badge.gold { background: #d4af3726; color: var(--gold2); }
.kpi-body { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.kpi-num { font-size: 1.45rem; font-weight: 800; }
.kpi-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.donut { --p: 0; --c: var(--accent); width: 56px; height: 56px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #232b52 0);
  display: grid; place-items: center; position: relative; }
.donut::before { content: ""; width: 40px; height: 40px; border-radius: 50%; background: var(--card); }
.donut::after { content: attr(data-txt); position: absolute; font-size: .62rem; font-weight: 800; }

/* ================= cards / rows ================= */
.row { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) {
  .row { grid-template-columns: 1.6fr 1fr; }
}
.col { display: grid; gap: 12px; align-content: start; }
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: .92rem; letter-spacing: .03em; }

/* pills */
.pills { display: flex; gap: 5px; flex-wrap: wrap; }
.pill { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font-weight: 600; font-size: .76rem; }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent2); }

/* ================= buttons ================= */
.btn { padding: 9px 16px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  background: #ffffff10; color: var(--text); font-weight: 600; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.96); }
.btn.accent { background: linear-gradient(135deg, var(--accent), var(--blue)); border: none; color: #fff; }
.btn.accent:hover { filter: brightness(1.12); }
.btn.small { padding: 7px 13px; font-size: .8rem; }
.btn.mic { padding: 7px 11px; font-size: .95rem; }
.btn.mic.listening { background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.4); } }

/* ================= lock ================= */
.lock { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; }
.lock-card { text-align: center; padding: 38px 30px; border: 1px solid var(--line2);
  border-radius: 16px; background: var(--card); width: min(92vw, 360px); box-shadow: 0 20px 60px #00000080; }
.lock-logo { font-size: 2.6rem; }
.lock-card h1 { font-size: 1.05rem; letter-spacing: .35em; margin: 10px 0 4px; }
.lock-card input { width: 100%; margin: 16px 0 10px; padding: 12px; font-size: 1.4rem; text-align: center;
  letter-spacing: .5em; background: #00000050; border: 1px solid var(--line2); border-radius: 10px; color: var(--text); }

/* ================= quests ================= */
.quest-list { display: grid; gap: 7px; }
.quest { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #0c122833; }
.quest:hover { border-color: var(--line2); background: #0c122866; }
.quest.stale { border-color: #f8717166; box-shadow: 0 0 10px #f8717122; }
.quest .info { flex: 1; min-width: 0; }
.quest .t { font-weight: 700; font-size: .86rem; }
.quest .d { font-size: .73rem; color: var(--muted); margin-top: 2px; }
.quest .xp { color: var(--gold2); font-weight: 800; white-space: nowrap; font-size: .82rem; }
.quest .xp .stale-tag { color: var(--red); font-size: .64rem; display: block; text-align: right; }
.quest button.done-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--accent);
  background: transparent; color: var(--accent2); font-size: .95rem; cursor: pointer; flex: none; }
.quest button.done-btn:hover { background: var(--accent); color: #fff; }
.quest.completed { opacity: .5; } .quest.completed .t { text-decoration: line-through; }
.boss-row { border-color: var(--gold); background: linear-gradient(90deg, #d4af3710, transparent); }
.new-quest { display: flex; gap: 8px; margin-top: 12px; }
.new-quest input { flex: 1; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: #00000040; color: var(--text); font-size: .85rem; }
.new-quest #nqXp { flex: 0 0 80px; }

/* ================= storyline / wins ================= */
.story-list { display: grid; gap: 9px; }
.story { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0c122833; }
.story .t { font-weight: 700; font-size: .84rem; }
.story .bar { height: 7px; margin-top: 8px; border-radius: 999px; background: #00000066; overflow: hidden; }
.story .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--teal)); }
.win-list { list-style: none; display: grid; gap: 6px; }
.win-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px;
  border-radius: 9px; background: #0c122833; border: 1px solid var(--line); font-size: .78rem; }
.win-list .xp { color: var(--gold2); font-weight: 800; white-space: nowrap; }
.win-list .ts { color: var(--muted); font-size: .66rem; }

/* ================= stats ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
.stat { padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c122833; }
.stat .k { font-size: .68rem; color: var(--muted); letter-spacing: .03em; }
.stat .v { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-top: 4px; cursor: pointer; }
.stat .v input { width: 100%; font-size: 1.05rem; background: #00000060; color: var(--text);
  border: 1px solid var(--accent); border-radius: 8px; padding: 4px 8px; }

/* ================= party ================= */
.party { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.member { display: flex; gap: 8px; align-items: center; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #0c122833; }
.member .e { font-size: 1.25rem; }
.member .n { font-weight: 700; font-size: .82rem; }
.member .r { font-size: .66rem; color: var(--muted); }
.member .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: auto;
  box-shadow: 0 0 8px var(--green); flex: none; }

/* ================= idea bank + chat ================= */
.inputrow { display: flex; gap: 8px; align-items: stretch; }
.inputrow textarea { flex: 1; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line);
  background: #00000040; color: var(--text); resize: vertical; font-family: inherit; font-size: .85rem; }
.inputbtns { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.idea-list { list-style: none; margin-top: 12px; display: grid; gap: 6px; }
.idea-list li { padding: 9px 12px; border-radius: 9px; background: #0c122833;
  border: 1px solid var(--line); font-size: .82rem; }
.idea-list li .ts { color: var(--muted); font-size: .66rem; display: block; }
.chat-log { max-height: 300px; min-height: 140px; overflow-y: auto; display: grid; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #0c122833; margin-bottom: 10px; }
.msg { padding: 8px 12px; border-radius: 11px; font-size: .84rem; max-width: 85%;
  white-space: pre-wrap; word-wrap: break-word; }
.msg.me { background: var(--accent); justify-self: end; border-bottom-right-radius: 3px; color: #fff; }
.msg.them { background: var(--card2); border: 1px solid var(--line2); justify-self: start; border-bottom-left-radius: 3px; }
.msg.sys { color: var(--muted); font-size: .72rem; justify-self: center; background: transparent; }
.msg.them.thinking { color: var(--muted); font-style: italic; }

/* ================= juice ================= */
.burst { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%);
  font-size: 2rem; font-weight: 900; color: var(--gold2); z-index: 60; pointer-events: none;
  text-shadow: 0 0 18px #d4af37; animation: rise 1.2s ease-out forwards; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -90px) scale(1.25); } }
.levelup { position: fixed; inset: 0; display: grid; place-items: center; z-index: 70;
  background: #0008; backdrop-filter: blur(4px); }
.levelup-card { text-align: center; padding: 36px 44px; border-radius: 18px; border: 1px solid var(--accent);
  background: var(--card2); box-shadow: 0 0 60px #6d5ef066; animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.levelup-glow { font-size: 3rem; animation: pulse 1.2s infinite; }
.levelup-card h2 { letter-spacing: .4em; color: var(--gold2); margin: 8px 0; }
.levelup-card p { color: var(--muted); margin-bottom: 18px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ================= mobile ================= */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 240px; transform: translateX(-100%);
    transition: transform .25s ease; box-shadow: 20px 0 60px #000000c0; }
  /* solid + brighter when open so the drawer pops against the scrim */
  .sidebar.open { transform: translateX(0); background: #151c3d; border-right-color: var(--line2); }
  .iconbtn { display: block; }
  .main { padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(50px + env(safe-area-inset-bottom, 0px)); }
  .chat-log { max-height: 240px; }
  /* iOS Safari zooms-and-sticks on focus when inputs are <16px */
  input, textarea, select { font-size: 16px !important; }
}
