:root {
  --qgs-ink: #0f1c22;
  --qgs-paper: #e8f0ef;
  --qgs-mist: #c5d5d3;
  --qgs-accent: #1a7a72;
  --qgs-accent-2: #d97706;
  --qgs-warn: #b45309;
  --qgs-line: #a8bfbc;
  --qgs-card: #f7fbfa;
  --qgs-ok: #0f766e;
  --qgs-muted: #5b6e6c;
  --qgs-serif: 'Noto Serif SC', 'Songti SC', serif;
  --qgs-sans: 'DM Sans', 'PingFang SC', system-ui, sans-serif;
  --qgs-dock-h: 4.4rem;
  --qgs-phone-bezel: #1a2428;
}
* { box-sizing: border-box; }
body.qgs {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(var(--qgs-dock-h) + 1.25rem);
  background:
    radial-gradient(ellipse at 12% -8%, #9fd4cb 0%, transparent 40%),
    radial-gradient(ellipse at 88% 4%, #f0c987 0%, transparent 36%),
    linear-gradient(165deg, #d5e8e4 0%, var(--qgs-paper) 48%, #d0e0dc 100%);
  color: var(--qgs-ink);
  font-family: var(--qgs-sans);
}
kbd {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.72em;
  padding: 0.05em 0.35em;
  border-radius: 0.25rem;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.12);
  margin-right: 0.15rem;
}
.qgs-top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--qgs-line);
  background: rgba(247, 251, 250, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.qgs-brand { display: flex; gap: 0.75rem; align-items: center; }
.qgs-mark {
  width: 2.55rem; height: 2.55rem; border-radius: 0.65rem;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2a9b8f, var(--qgs-accent));
  color: #f0fffc;
  font-family: var(--qgs-serif); font-weight: 700; font-size: 1.25rem;
  box-shadow: 0 6px 16px rgba(26, 122, 114, 0.28);
}
.qgs-brand h1 { margin: 0; font-family: var(--qgs-serif); font-size: 1.28rem; letter-spacing: 0.02em; }
.qgs-brand p { margin: 0.2rem 0 0; color: var(--qgs-muted); font-size: 0.8rem; }
.qgs-top-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.qgs-select {
  display: flex; flex-direction: column; gap: 0.15rem;
  font-size: 0.68rem; color: var(--qgs-muted); font-weight: 600;
}
.qgs-select select {
  border: 1px solid var(--qgs-line); border-radius: 0.45rem;
  padding: 0.45rem 0.6rem; background: #fff; font-size: 0.88rem;
  min-width: 8.5rem; color: var(--qgs-ink);
}
.qgs-btn, .qgs-btn-ghost {
  border: 0; border-radius: 0.45rem; padding: 0.48rem 0.8rem;
  background: var(--qgs-accent); color: #fff; font-weight: 600; cursor: pointer;
  font-size: 0.88rem; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.qgs-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,122,114,0.25); }
.qgs-btn-ghost {
  background: transparent; color: var(--qgs-accent); border: 1px solid var(--qgs-accent);
}
.qgs-link { color: var(--qgs-accent); text-decoration: none; font-size: 0.9rem; white-space: nowrap; }
.qgs-banner {
  margin: 0; padding: 0.5rem 1.25rem;
  background: linear-gradient(90deg, #e0f5f1, #f7fbfa);
  color: var(--qgs-ok);
  border-bottom: 1px solid var(--qgs-line); font-size: 0.86rem;
}
.qgs-tabs {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  padding: 0.55rem 1.1rem;
  border-bottom: 1px solid var(--qgs-line);
  background: rgba(255,255,255,0.45);
  position: sticky; top: 4.6rem; z-index: 20;
}
.qgs-tabs button {
  border: 0; background: transparent; padding: 0.45rem 0.75rem;
  border-radius: 0.4rem; cursor: pointer; font-weight: 600;
  color: var(--qgs-muted); font-size: 0.9rem;
}
.qgs-tabs button.active {
  background: var(--qgs-accent); color: #fff;
}
.qgs-main { padding: 1rem 1.25rem 1.5rem; max-width: 1280px; margin: 0 auto; }
.qgs-panel { display: none; }
.qgs-panel.active { display: block; animation: qgs-in 0.28s ease; }
@keyframes qgs-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.qgs-grid { display: grid; gap: 1rem; }
.qgs-grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.qgs-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.qgs-card {
  background: var(--qgs-card);
  border: 1px solid var(--qgs-line);
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
}
.qgs-card h2, .qgs-card h3 {
  margin: 0 0 0.55rem;
  font-family: var(--qgs-serif);
  font-size: 1.05rem;
}
.qgs-muted { color: var(--qgs-muted); font-size: 0.88rem; }
.qgs-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #d1f0eb;
  color: var(--qgs-ok);
  margin-right: 0.35rem;
}
.qgs-pill.live { background: #bbf7d0; color: #166534; }
.qgs-pill.wip { background: #fde68a; color: #92400e; }
.qgs-pill.archive { background: #e5e7eb; color: #4b5563; }
.qgs-pill.prototype { background: #c7d2fe; color: #3730a3; }
.qgs-pill.engine { background: #fecaca; color: #991b1b; }
.qgs-pill.shipped { background: #bbf7d0; color: #166534; }
.qgs-pill.design { background: #e0e7ff; color: #3730a3; }

.qgs-stages {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0;
}
.qgs-stage {
  flex: 1; min-width: 5.5rem;
  text-align: center;
  padding: 0.65rem 0.4rem;
  border-radius: 0.55rem;
  border: 1px dashed var(--qgs-line);
  background: rgba(255,255,255,0.55);
  font-size: 0.78rem; font-weight: 700;
}
.qgs-stage.on {
  border-style: solid;
  color: #fff;
  border-color: transparent;
}

.qgs-pillar {
  display: inline-block;
  margin: 0.2rem 0.35rem 0.2rem 0;
  padding: 0.35rem 0.65rem;
  border-radius: 0.4rem;
  background: #fff;
  border: 1px solid var(--qgs-line);
  font-size: 0.85rem;
}

.qgs-metric {
  text-align: center;
  padding: 0.85rem 0.5rem;
}
.qgs-metric b {
  display: block;
  font-size: 1.35rem;
  font-family: var(--qgs-serif);
  color: var(--qgs-accent);
  margin-bottom: 0.2rem;
}
.qgs-metric span { font-size: 0.78rem; color: var(--qgs-muted); }

.qgs-timeline { position: relative; padding-left: 1.25rem; }
.qgs-timeline::before {
  content: '';
  position: absolute; left: 0.35rem; top: 0.2rem; bottom: 0.2rem;
  width: 2px; background: var(--qgs-mist);
}
.qgs-tl-item {
  position: relative;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--qgs-card);
  border: 1px solid var(--qgs-line);
  border-radius: 0.65rem;
}
.qgs-tl-item::before {
  content: '';
  position: absolute; left: -1.05rem; top: 1.1rem;
  width: 0.65rem; height: 0.65rem; border-radius: 50%;
  background: var(--qgs-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--qgs-accent);
}

.qgs-play-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .qgs-play-layout { grid-template-columns: 1fr; justify-items: center; }
}

/* 手机框：保持设计宽高比等比缩小，禁止只压高度导致猎场「画面上移 + 底栏悬空」 */
.qgs-phone-shell {
  --pw: 390px;
  --ph: 844px;
  --phone-fit: min(1, (78vh - 3rem) / var(--ph), 42vw / var(--pw));
  width: calc(var(--pw) * var(--phone-fit) + 20px);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}
.qgs-phone-bezel {
  width: calc(var(--pw) * var(--phone-fit) + 18px);
  padding: calc(22px * var(--phone-fit)) calc(9px * var(--phone-fit)) calc(16px * var(--phone-fit));
  background: linear-gradient(160deg, #2a3338, var(--qgs-phone-bezel));
  border-radius: calc(2rem * var(--phone-fit));
  box-shadow:
    0 20px 50px rgba(15, 28, 34, 0.35),
    inset 0 0 0 2px #3d4a50;
  position: relative;
}
.qgs-phone-bezel::before {
  content: '';
  position: absolute;
  top: calc(8px * var(--phone-fit));
  left: 50%;
  transform: translateX(-50%);
  width: calc(88px * var(--phone-fit));
  height: calc(10px * var(--phone-fit));
  border-radius: 999px;
  background: #0a1012;
  z-index: 2;
  pointer-events: none;
}
.qgs-phone-screen {
  width: calc(var(--pw) * var(--phone-fit));
  height: calc(var(--ph) * var(--phone-fit));
  /* 直角内容区：避免圆角裁掉头像 / 底栏四角 */
  border-radius: 0;
  overflow: hidden;
  background: #0a1012;
  position: relative;
  margin: 0;
}
.qgs-phone-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #111;
  display: block;
}
.qgs-phone-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 1.5rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.9rem;
  background: #111827;
}
.qgs-phone-empty strong { display: block; color: #e5e7eb; margin-bottom: 0.5rem; font-family: var(--qgs-serif); }

.qgs-doc-list { list-style: none; padding: 0; margin: 0; }
.qgs-doc-list li {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--qgs-line);
  font-size: 0.88rem;
  word-break: break-all;
}
.qgs-doc-list code { font-size: 0.8em; color: var(--qgs-muted); }

.qgs-role {
  display: flex; flex-direction: column; gap: 0.35rem;
  min-height: 6.5rem;
}
.qgs-role .qgs-role-name {
  font-family: var(--qgs-serif); font-weight: 700; font-size: 1rem;
}
.qgs-game-card {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s;
}
.qgs-game-card:hover { transform: translateY(-2px); border-color: var(--qgs-accent); }
.qgs-game-card.selected { outline: 2px solid var(--qgs-accent); }

.qgs-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  justify-content: space-between; align-items: center;
  padding: 0.65rem 1.25rem;
  min-height: var(--qgs-dock-h);
  background: rgba(15, 28, 34, 0.94);
  color: #e8f0ef;
  border-top: 1px solid #2a3a40;
}
.qgs-dock-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; align-items: baseline; }
.qgs-dock-meta strong { font-family: var(--qgs-serif); font-size: 1rem; }
.qgs-dock-url { font-size: 0.78rem; color: #9fd4cb; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qgs-dock-hint { font-size: 0.75rem; color: #8a9a98; }
.qgs-dock-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.qgs-dock .qgs-btn-ghost { color: #9fd4cb; border-color: #3d6b66; }

.qgs-toast {
  position: fixed; bottom: calc(var(--qgs-dock-h) + 1rem); left: 50%;
  transform: translateX(-50%);
  background: var(--qgs-ink); color: #fff;
  padding: 0.55rem 1rem; border-radius: 0.5rem;
  font-size: 0.88rem; z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* —— 深度优化 · 文档 / 便签 / 环 / 搜索 —— */
#qgsSearch, #qgsWorker, #qgsAdminKey {
  border: 1px solid var(--qgs-line); border-radius: 0.45rem;
  padding: 0.45rem 0.6rem; background: #fff; font-size: 0.85rem;
  min-width: 7rem; max-width: 11rem;
}
#qgsSearch { min-width: 11rem; max-width: 16rem; }
.qgs-oneliner {
  margin: 0.75rem 0 0; line-height: 1.55;
  font-family: var(--qgs-serif); font-size: 1.05rem;
}
.qgs-pillars { margin-top: 0.85rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.qgs-quick { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.qgs-overview-metrics {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center;
}
@media (max-width: 800px) { .qgs-overview-metrics { grid-template-columns: 1fr; } }
.qgs-ring {
  --pct: 0;
  width: 7.5rem; height: 7.5rem; border-radius: 50%;
  background: conic-gradient(var(--qgs-accent) calc(var(--pct) * 1%), var(--qgs-mist) 0);
  display: grid; place-items: center;
}
.qgs-ring-inner {
  width: 5.6rem; height: 5.6rem; border-radius: 50%; background: var(--qgs-card);
  display: grid; place-items: center; text-align: center;
}
.qgs-ring-inner b { font-size: 1.35rem; font-family: var(--qgs-serif); }
.qgs-ring-inner small { font-size: 0.68rem; color: var(--qgs-muted); }
.qgs-metric-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.75rem;
}
.qgs-metric-row div {
  background: rgba(26,122,114,0.06); border-radius: 0.5rem; padding: 0.45rem;
  text-align: center;
}
.qgs-metric-row b { display: block; font-size: 1.1rem; font-family: var(--qgs-serif); }
.qgs-metric-row span { font-size: 0.7rem; color: var(--qgs-muted); }
.qgs-health { font-size: 0.82rem; margin: 0.55rem 0 0; }
.qgs-health.ok { color: var(--qgs-ok); }
.qgs-health.bad { color: #b45309; }
.qgs-doc-shell {
  display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0.85rem; align-items: start;
}
@media (max-width: 900px) { .qgs-doc-shell { grid-template-columns: 1fr; } }
.qgs-doc-nav {
  background: var(--qgs-card); border: 1px solid var(--qgs-line); border-radius: 0.75rem;
  padding: 0.75rem; max-height: 70vh; overflow: auto; position: sticky; top: 5.5rem;
}
.qgs-doc-nav h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.qgs-doc-btn {
  display: block; width: 100%; text-align: left; border: 1px solid transparent;
  background: transparent; border-radius: 0.45rem; padding: 0.45rem 0.5rem; cursor: pointer;
  margin-bottom: 0.25rem;
}
.qgs-doc-btn:hover { background: rgba(26,122,114,0.06); }
.qgs-doc-btn.active { border-color: var(--qgs-accent); background: rgba(26,122,114,0.08); }
.qgs-doc-btn b { display: block; font-size: 0.85rem; }
.qgs-doc-btn small { color: var(--qgs-muted); font-size: 0.68rem; word-break: break-all; }
.qgs-doc-reader {
  background: var(--qgs-card); border: 1px solid var(--qgs-line); border-radius: 0.75rem;
  padding: 1rem 1.15rem; min-height: 20rem;
}
.qgs-doc-head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.75rem; }
.qgs-doc-head h2 { margin: 0; font-family: var(--qgs-serif); font-size: 1.25rem; }
.qgs-doc-head .path { margin: 0.25rem 0 0; font-size: 0.75rem; color: var(--qgs-muted); word-break: break-all; }
.qgs-md h1, .qgs-md h2, .qgs-md h3 { font-family: var(--qgs-serif); }
.qgs-md pre {
  background: #0f1c22; color: #e8f0ef; padding: 0.75rem; border-radius: 0.5rem;
  overflow: auto; font-size: 0.78rem;
}
.qgs-md code { font-size: 0.85em; }
.qgs-art-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.qgs-art-bar {
  flex: 1; min-width: 140px; height: 0.55rem; background: var(--qgs-mist); border-radius: 999px; overflow: hidden;
}
.qgs-art-bar i { display: block; height: 100%; background: var(--qgs-accent); border-radius: 999px; }
.qgs-art-bar.sm { margin-top: 0.55rem; height: 0.35rem; }
.qgs-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.qgs-chip {
  border: 1px solid var(--qgs-line); border-radius: 999px; padding: 0.2rem 0.55rem;
  background: #fff; cursor: pointer; font-size: 0.75rem; font-weight: 600;
}
.qgs-chip.on { border-color: var(--qgs-accent); background: rgba(26,122,114,0.1); color: var(--qgs-accent); }
.qgs-notes { display: grid; gap: 0.55rem; margin-top: 0.85rem; max-height: 50vh; overflow: auto; }
.qgs-note {
  border: 1px solid var(--qgs-line); border-radius: 0.55rem; padding: 0.55rem 0.65rem; background: #fff;
}
.qgs-note.done { opacity: 0.65; }
.qgs-note .meta { font-size: 0.72rem; color: var(--qgs-muted); margin-bottom: 0.25rem; }
.qgs-note .body { font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; }
#qgsNoteBody {
  width: 100%; border: 1px solid var(--qgs-line); border-radius: 0.5rem;
  padding: 0.55rem; font: inherit; resize: vertical; background: #fff;
}
.qgs-tl-item {
  cursor: pointer; border-radius: 0.55rem; padding: 0.35rem;
  transition: background 0.12s;
}
.qgs-tl-item:hover, .qgs-tl-item.on { background: rgba(26,122,114,0.07); }
.qgs-search-pop {
  position: fixed; top: 4.6rem; right: 1.25rem; z-index: 50;
  width: min(360px, 92vw); max-height: 50vh; overflow: auto;
  background: #fff; border: 1px solid var(--qgs-line); border-radius: 0.65rem;
  box-shadow: 0 12px 32px rgba(15,28,34,0.18);
}
.qgs-search-hit {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 0.55rem 0.75rem; cursor: pointer; border-bottom: 1px solid var(--qgs-line);
}
.qgs-search-hit:hover { background: rgba(26,122,114,0.06); }
.qgs-search-hit b { display: block; font-size: 0.88rem; }
.qgs-search-hit small { color: var(--qgs-muted); font-size: 0.72rem; word-break: break-all; }
.qgs-lib-head { margin-bottom: 0.75rem; }
.qgs-lib-head h2 { margin: 0; font-family: var(--qgs-serif); }
