:root {
  --page-bg: #f4f6f9;
  --bar-bg: #ffffff;
  --card-bg: #ffffff;
  --text: #1f2933;
  --muted: #5f6b7a;
  --border: #dde3ea;
  --brand: #1a56db;
  --brand-soft: #e0ebff;
  --btn-bg: #ffffff;
  --btn-border: #c7cfd9;
  --soon-bg: #eef1f5;
  --soon-text: #6b7684;
  --live-bg: #dcfce7;
  --live-text: #15803d;
  --glow-a: rgba(59, 130, 246, .10);
  --glow-b: rgba(245, 158, 11, .08);
  --shadow: 0 18px 40px rgba(23, 32, 51, .10);
  --bar-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #121417;
    --bar-bg: #1b1f24;
    --card-bg: #1b1f24;
    --text: #e6e9ee;
    --muted: #9aa5b1;
    --border: #2c333b;
    --brand: #7aa2ff;
    --brand-soft: rgba(59, 130, 246, .18);
    --btn-bg: #242a31;
    --btn-border: #3a424c;
    --soon-bg: #242a31;
    --soon-text: #8b96a3;
    --live-bg: rgba(34, 197, 94, .16);
    --live-text: #86efac;
    --glow-a: rgba(59, 130, 246, .14);
    --glow-b: rgba(245, 158, 11, .06);
    --shadow: 0 18px 40px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--page-bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body { display: flex; flex-direction: column; overflow: hidden; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.bar {
  flex: 0 0 var(--bar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
  min-width: 0;
}
.bar-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.bar-brand img { display: block; border-radius: 7px; }
.wordmark { font-size: 19px; font-weight: 800; font-style: italic; letter-spacing: -.01em; color: var(--text); }
.wordmark span { color: #f59e0b; }

.tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
}
.tab svg { width: 17px; height: 17px; }
.tab img { display: block; border-radius: 5px; }
a.tab:hover { background: var(--soon-bg); color: var(--text); }
.tab.active { background: var(--brand-soft); color: var(--brand); }
.tab-dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: #16a34a; }
.tab.loaded .tab-dot { display: inline-block; }
.tab-soon { color: var(--soon-text); opacity: .75; cursor: default; font-weight: 500; }
.tab-soon em { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--soon-bg); }

.bar-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.bar-btn svg { width: 16px; height: 16px; }
.bar-btn:hover { border-color: var(--brand); }
.bar-help { border-color: transparent; background: none; color: var(--brand); font-weight: 500; }
.bar-help b { display: none; }

/* ---------- help popover ---------- */
.help-panel {
  position: fixed;
  top: calc(var(--bar-h) + 8px);
  right: 14px;
  width: min(380px, calc(100vw - 32px));
  padding: 18px 18px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 20;
}
.help-panel h2 { font-size: 16px; margin: 0 0 8px; }
.help-panel p, .help-panel ol { margin: 0 0 10px; }
.help-panel ol { padding-left: 20px; }
.help-panel li { margin-bottom: 4px; }
.help-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0b1220; } }
.btn-quiet { border-color: transparent; background: none; color: var(--muted); }

/* ---------- home ---------- */
.home {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 44px 24px 48px;
  background: var(--page-bg) linear-gradient(135deg, var(--glow-a) 0%, transparent 45%, var(--glow-b) 100%);
}
.hero, .cards, .trust { max-width: 1080px; margin-left: auto; margin-right: auto; }
.hero { margin-bottom: 28px; }
.hero h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.01em; margin: 0 0 10px; }
.hero p { color: var(--muted); font-size: 15px; max-width: 680px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.card:not(.card-soon) { box-shadow: 0 6px 18px rgba(23, 32, 51, .06); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head img { display: block; border-radius: 12px; flex: 0 0 auto; }
.card-head > div { flex: 1 1 auto; min-width: 0; }
.card h2 { font-size: 18px; margin: 0; font-style: italic; font-weight: 800; letter-spacing: -.01em; }
.card h2 span { color: #f59e0b; }
.card-soon h2 { font-style: normal; font-weight: 700; }
.platform { color: var(--muted); font-size: 13px; }
.card p { color: var(--muted); margin: 0 0 16px; flex: 1 1 auto; }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.running { color: var(--live-text); font-size: 12px; font-weight: 600; }
.pill { flex: 0 0 auto; align-self: flex-start; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soon-bg); color: var(--soon-text); white-space: nowrap; }
.pill-live { background: var(--live-bg); color: var(--live-text); }
.card-soon { background: transparent; border-style: dashed; }
.card-soon p { margin-bottom: 0; }
.soon-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--soon-bg);
  color: var(--soon-text);
  font-weight: 800;
  letter-spacing: .02em;
}

.trust { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 13px; }
.trust li { display: inline-flex; align-items: center; gap: 7px; }
.trust svg { width: 16px; height: 16px; stroke: #16a34a; }

/* ---------- tool frames ---------- */
.stage { flex: 1 1 auto; position: relative; background: var(--page-bg); }
.pane { position: absolute; inset: 0; }
.pane.off { visibility: hidden; pointer-events: none; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.frame-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--page-bg);
  color: var(--muted);
}
.frame-loading img { border-radius: 12px; }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .bar-btn span { display: none; }
  .bar-help { width: 34px; justify-content: center; border-color: var(--btn-border); }
  .bar-help b { display: inline; }
}
@media (max-width: 640px) {
  .bar { gap: 8px; padding: 0 10px; }
  .bar-brand .wordmark { display: none; }
  .tab-soon { display: none; }
  .tab { padding: 0 9px; }
  .home { padding: 28px 16px 36px; }
  .hero h1 { font-size: 24px; }
  .cards { grid-template-columns: 1fr; }
}
