* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e1e4e8;
  min-height: 100vh;
}

[x-cloak] { display: none !important; }

/* Auth Gate */
.auth-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}
.auth-gate h1 { font-size: 2rem; color: #fff; }
.auth-gate p { color: #8b949e; }

/* Buttons */
.btn {
  background: #238636;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #2ea043; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-ghost {
  background: transparent;
  color: #58a6ff;
  border: 1px solid #30363d;
}
.btn-ghost:hover { background: #161b22; border-color: #58a6ff; }

/* Error */
.error { color: #f85149; margin-top: 8px; }
.loading { text-align: center; padding: 40px; color: #8b949e; }

/* Dashboard */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #21262d;
}
header h1 { font-size: 1.5rem; color: #fff; }
.header-right { display: flex; align-items: center; gap: 12px; }
.email { color: #8b949e; font-size: 13px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid #21262d;
}
.tab {
  background: none;
  border: none;
  color: #8b949e;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: #c9d1d9; }
.tab.active {
  color: #fff;
  border-bottom-color: #58a6ff;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 20px;
}
.card-label { color: #8b949e; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-value { font-size: 1.8rem; font-weight: 700; color: #fff; margin: 4px 0; }
.card-sub { color: #8b949e; font-size: 13px; }

/* Panels */
.panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.panel h2 {
  font-size: 1rem;
  color: #c9d1d9;
  margin-bottom: 16px;
  font-weight: 600;
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  color: #8b949e;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid #21262d;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  font-size: 14px;
}
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: 'SF Mono', Monaco, monospace; font-size: 13px; }

/* Service dot */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Billing form */
.panel-sub { color: #8b949e; font-size: 13px; margin: -8px 0 16px; }
.billing-form { margin-bottom: 16px; }
.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.form-input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e1e4e8;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  min-width: 100px;
}
.form-input:focus { outline: none; border-color: #58a6ff; }
.form-wide { flex: 1; min-width: 160px; }
select.form-input { min-width: 120px; }
.billing-status { color: #58a6ff; font-size: 13px; margin-top: 8px; }
.btn-delete {
  background: none;
  border: none;
  color: #f85149;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
}
.btn-delete:hover { color: #ff7b72; }
.empty-state { color: #484f58; font-style: italic; padding: 16px 0; text-align: center; }

/* Expand row */
.expand-row {
  text-align: center;
  padding: 12px 0 4px;
}

/* Asset grid */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.asset-card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  overflow: hidden;
  padding: 8px;
}
.asset-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 4px 2px;
}
.asset-type {
  font-size: 11px;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.asset-name {
  font-size: 14px;
  color: #e1e4e8;
  font-weight: 600;
}
.asset-desc {
  font-size: 12px;
  color: #8b949e;
  padding: 0 4px 4px;
  line-height: 1.4;
}

/* Collapsible sections */
.collapsible-story {
  border-bottom: 1px solid #21262d;
  padding: 8px 0;
}
.collapsible-story:last-child { border-bottom: none; }
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.collapsible-header:hover { color: #fff; }
.collapse-arrow {
  color: #484f58;
  font-size: 12px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.collapsible-title {
  font-weight: 600;
  color: #c9d1d9;
  font-size: 14px;
}
.collapsible-meta {
  color: #8b949e;
  font-size: 12px;
  margin-left: auto;
}
.world-header h2 { font-size: 1.1rem; }
.category-header { padding-left: 8px; }
.category-title {
  font-weight: 600;
  color: #8b949e;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.story-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #21262d;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.story-badge.origin {
  background: #1c2d1c;
  color: #3fb950;
}

/* Sub-tabs (for Assets) */
.subtabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #21262d;
}
.subtab {
  background: none;
  border: none;
  color: #8b949e;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.subtab:hover { color: #c9d1d9; }
.subtab.active {
  color: #e1e4e8;
  border-bottom-color: #58a6ff;
}

/* Origamify tool */
.origamify-form { margin-bottom: 8px; }
.origamify-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.origamify-img-wrap { min-height: 200px; }
.origamify-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #0d1117;
  border: 1px dashed #30363d;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Chart */
.chart-container {
  position: relative;
  height: 300px;
}

/* Model star button */
.btn-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-star:hover { color: #f0c53f !important; }

/* Model category badges */
.model-cat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.model-cat-badge.cat-text { background: #1c2533; color: #58a6ff; }
.model-cat-badge.cat-image { background: #2d1c33; color: #bc8cff; }
.model-cat-badge.cat-voice { background: #1c332d; color: #3fb950; }
.model-cat-badge.cat-music { background: #33291c; color: #f0c53f; }
.model-cat-badge.cat-other { background: #21262d; color: #8b949e; }

/* Bakeoff status badges */
.bakeoff-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.bakeoff-status.status-queued { background: #21262d; color: #8b949e; }
.bakeoff-status.status-testing { background: #1c2533; color: #58a6ff; }
.bakeoff-status.status-complete { background: #1c2d1c; color: #3fb950; }
.bakeoff-status.status-rejected { background: #2d1c1c; color: #f85149; }

/* Comparison grid */
.bakeoff-grid td { vertical-align: top; }

/* Checkbox in tables */
input[type="checkbox"] {
  accent-color: #58a6ff;
  cursor: pointer;
}

/* Voice comparison columns */
@media (max-width: 900px) {
  [style*="grid-template-columns: repeat"] {
    grid-template-columns: 1fr !important;
  }
}

/* Player lookup */
.pl-player-row:hover { background: #1c2533; }
.pl-player-row.pl-selected { background: #1c2533; border-left: 3px solid #58a6ff; }
.pl-char-card:hover { border-color: #58a6ff !important; }
.pl-char-card.pl-char-active { border-color: #58a6ff !important; background: #1c2533 !important; }

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  color: #8b949e;
  font-size: 13px;
  border-top: 1px solid #21262d;
  margin-top: 24px;
}

/* Adventure Quality regression-watch chip
   Renders below each counter in the Adventure Quality panel — one-line
   "Δ +N · 3d med M · status" indicator. Empty when no prior rollup
   exists yet (first day of operation). Wave 1 §7.3 (2026-05-02). */
.regression-watch {
  margin-top: 2px;
  line-height: 1.2;
  white-space: nowrap;
}
