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

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a28;
  --border: #2a2a3a;
  --text: #e0e0e8;
  --text-dim: #8888a0;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --green: #00b894;
  --orange: #fdcb6e;
  --red: #e17055;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


.header-right { display: flex; align-items: center; gap: 12px; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-lg { padding: 12px 32px; font-size: 16px; }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* User Bar */
.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.user-info { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-admin { background: var(--accent); color: white; }
.badge-user { background: var(--green); color: #000; }
.badge-guest { background: var(--border); color: var(--text-dim); }

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--accent-light); }
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat-divider { width: 1px; height: 40px; background: var(--border); margin: 0 8px; }

.stat-metric .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
  margin-top: 0;
}
.stat-metric-value {
  font-size: 14px;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.stat-metric-value .stat-period {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  margin-right: 2px;
}
.stat-metric-value .stat-sep {
  color: var(--border);
  margin: 0 4px;
  font-weight: 400;
}

/* Main */
.main { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }

.filter-select {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

/* Game List — masonry-style card grid */
.game-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.15s;
}
.game-card:hover { border-color: var(--accent); background: var(--bg-hover); }

.game-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--bg-hover);
}
.game-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  color: var(--text-dim);
  font-size: 32px;
}

.game-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.game-info-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.game-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}
.game-folder {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.game-type {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  white-space: nowrap;
  flex-shrink: 0;
}

.game-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
}

.game-creator {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.creator-link {
  color: var(--accent-light);
  cursor: pointer;
  text-decoration: none;
}
.creator-link:hover { text-decoration: underline; }

.game-plays {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.game-cost {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.cost-high { color: var(--red); }
.cost-mid { color: var(--orange); }
.cost-low { color: var(--green); }
.cost-old { color: var(--text-dim); font-size: 12px; }

.game-actions {
  display: flex;
  gap: 6px;
  padding-top: 4px;
}

.btn-preview {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: var(--green);
  color: #000;
  transition: all 0.15s;
}
.btn-preview:hover { opacity: 0.85; }
.btn-preview:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; opacity: 0.5; }

.btn-export {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: var(--orange);
  color: #000;
  transition: all 0.15s;
}
.btn-export:hover { opacity: 0.85; }
.btn-export:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; opacity: 0.5; }

.btn-export-full {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--orange);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--orange);
  transition: all 0.15s;
}
.btn-export-full:hover { background: var(--orange); color: #000; }
.btn-export-full:disabled { border-color: var(--border); color: var(--text-dim); cursor: not-allowed; opacity: 0.5; }

.btn-log {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  background: var(--accent);
  color: white;
  transition: all 0.15s;
}
.btn-log:hover { opacity: 0.85; }
.btn-log:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; opacity: 0.5; }

/* Login Prompt */
.login-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}

.login-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
}

.login-icon { font-size: 48px; margin-bottom: 16px; }
.login-card h2 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.login-card > p { color: var(--text-dim); margin-bottom: 32px; }

.login-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-note { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Log Viewer */
.log-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.log-content { display: flex; flex-direction: column; gap: 16px; }

.log-session {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.log-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.log-session-header:hover { background: rgba(108, 92, 231, 0.1); }

.log-session-title { font-weight: 600; font-size: 14px; }
.log-session-meta { font-size: 12px; color: var(--text-dim); }

.log-entries {
  max-height: 600px;
  overflow-y: auto;
  display: none;
}
.log-entries.open { display: block; }

.log-token-summary {
  padding: 12px 16px;
  background: rgba(108, 92, 231, 0.08);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  line-height: 1.6;
}
.token-model {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: baseline;
}
.token-model-name {
  color: var(--accent-light);
  font-weight: 600;
  min-width: 180px;
}
.token-detail {
  color: var(--text-dim);
}
.token-total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(42, 42, 58, 0.5);
  color: var(--green);
  font-weight: 600;
}

.log-entry {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
  font-size: 13px;
  line-height: 1.5;
}
.log-entry:last-child { border-bottom: none; }

.log-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.log-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}
.log-role-green { background: rgba(0, 184, 148, 0.2); color: var(--green); }
.log-role-accent { background: rgba(108, 92, 231, 0.2); color: var(--accent-light); }
.log-role-orange { background: rgba(253, 203, 110, 0.2); color: var(--orange); }
.log-role-dim { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }

.log-category {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.log-time { color: var(--text-dim); font-size: 11px; flex-shrink: 0; }

.log-text {
  color: var(--text);
  word-break: break-word;
}

.log-text-pre {
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  background: rgba(0,0,0,0.2);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 4px;
  max-height: 500px;
  overflow-y: auto;
}

.log-collapsible { position: relative; }

.log-expand-btn {
  display: block;
  margin-top: 6px;
  padding: 2px 10px;
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.log-expand-btn:hover { background: rgba(108, 92, 231, 0.3); }

/* README Section */
.readme-session { border-color: rgba(108, 92, 231, 0.4); }
.readme-header { background: rgba(108, 92, 231, 0.08) !important; }
.readme-header .log-session-title { color: var(--accent-light); }
.readme-stale {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(253, 203, 110, 0.2);
  color: var(--orange);
  margin-left: 8px;
  vertical-align: middle;
}
.readme-generating {
  color: var(--accent-light);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.readme-regen-btn {
  padding: 2px 10px !important;
  font-size: 11px !important;
}

/* Creator Profile */
.creator-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.creator-card h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--accent-light);
}
.creator-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.creator-stat {
  display: flex;
  flex-direction: column;
}
.creator-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.creator-stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.creator-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.creator-chart-card h4 {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.creator-chart {
  width: 100%;
  display: block;
}
.creator-chart .chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.creator-chart .chart-axis { stroke: var(--border); stroke-width: 1; }
.creator-chart .chart-line {
  fill: none;
  stroke: var(--accent-light);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.creator-chart .chart-area {
  fill: rgba(108, 92, 231, 0.12);
}
.creator-chart .chart-point {
  fill: var(--accent-light);
  stroke: var(--bg-card);
  stroke-width: 1.5;
}
.creator-chart .chart-label {
  fill: var(--text-dim);
  font-size: 10px;
  font-family: inherit;
}
.creator-chart-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 13px;
}

/* User name link in bar */
.user-name-link {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.user-name-link:hover { color: var(--accent-light); text-decoration: underline; }

/* Creator profile avatar */
.creator-profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.creator-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.creator-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-edit-profile {
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-edit-profile:hover { background: var(--bg-hover); color: var(--text); }

/* Edit profile modal */
.edit-profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 16px;
}
.edit-profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

/* User actions */
.user-actions { display: flex; gap: 8px; align-items: center; }

/* Usage Health Page */
.health-overview {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.health-overview-item {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  min-width: 140px;
}
.health-overview-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.health-overview-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.health-bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.health-bucket-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.health-bucket-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
}
.health-bucket-card.status-healthy::before { background: var(--green); }
.health-bucket-card.status-warning::before { background: var(--orange); }
.health-bucket-card.status-exhausted::before { background: var(--red); }
.health-bucket-card.status-stale::before { background: var(--text-dim); }
.health-bucket-card.status-unknown::before { background: var(--border); }

.health-bucket-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.health-bucket-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.health-bucket-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-healthy .health-bucket-badge { background: rgba(0,184,148,0.18); color: var(--green); }
.status-warning .health-bucket-badge { background: rgba(253,203,110,0.18); color: var(--orange); }
.status-exhausted .health-bucket-badge { background: rgba(225,112,85,0.2); color: var(--red); }
.status-stale .health-bucket-badge { background: rgba(255,255,255,0.06); color: var(--text-dim); }
.status-unknown .health-bucket-badge { background: rgba(255,255,255,0.06); color: var(--text-dim); }

.health-bucket-reset {
  margin-bottom: 16px;
}
.health-reset-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.health-reset-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.health-reset-detail {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.health-util-bar {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
  margin-bottom: 12px;
}
.health-util-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--orange) 90%, var(--red));
  border-radius: 4px;
  transition: width 0.3s;
}

.live-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 24px;
}
.live-gauge-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.live-gauge-label { color: var(--text-dim); }
.live-gauge-pct {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.live-gauge .health-util-bar { margin-bottom: 4px; }
.live-gauge-reset {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.health-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  font-size: 12px;
}
.health-metric {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
}
.health-metric-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.health-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.health-section h4 {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-events-list {
  display: flex;
  flex-direction: column;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.health-event-row {
  display: grid;
  grid-template-columns: 150px 80px 90px 80px 1fr;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(42,42,58,0.5);
  font-size: 12px;
  align-items: center;
}
.health-event-row:last-child { border-bottom: none; }
.health-event-time { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.health-event-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.health-event-status.warning { background: rgba(253,203,110,0.18); color: var(--orange); }
.health-event-status.rejected { background: rgba(225,112,85,0.2); color: var(--red); }
.health-event-bucket { color: var(--text-dim); font-size: 11px; }
.health-event-util { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.health-event-ctx { color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.health-chart {
  width: 100%;
  display: block;
}
.health-chart .chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.health-chart .chart-axis { stroke: var(--border); stroke-width: 1; }
.health-chart .chart-label { fill: var(--text-dim); font-size: 10px; }
.health-chart .bar-warning5h { fill: rgba(253,203,110,0.7); }
.health-chart .bar-warning7d { fill: rgba(253,203,110,1); }
.health-chart .bar-reject5h { fill: rgba(225,112,85,0.7); }
.health-chart .bar-reject7d { fill: rgba(225,112,85,1); }

.health-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
}
.health-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.health-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.health-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 13px;
}

.health-advice {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}
.health-advice.healthy { background: rgba(0,184,148,0.08); border: 1px solid rgba(0,184,148,0.3); color: var(--green); }
.health-advice.warning { background: rgba(253,203,110,0.08); border: 1px solid rgba(253,203,110,0.3); color: var(--orange); }
.health-advice.exhausted { background: rgba(225,112,85,0.08); border: 1px solid rgba(225,112,85,0.3); color: var(--red); }
.health-advice.stale { background: rgba(255,255,255,0.03); border: 1px solid var(--border); color: var(--text-dim); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.modal-tab {
  background: none;
  border: none;
  padding: 10px 16px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}
.modal-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--accent-light);
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { color: var(--text); margin-bottom: 8px; }
.modal-body ul, .modal-body ol { padding-left: 20px; margin-bottom: 8px; }
.modal-body li { margin-bottom: 4px; }
.modal-body code {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}
.help-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(42, 42, 58, 0.5);
  vertical-align: top;
}
.help-table td:first-child { white-space: nowrap; width: 220px; }

/* Changelog */
.changelog-release {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.changelog-release-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--bg-hover);
  border-bottom: 1px solid transparent;
}
.changelog-release-header:hover { background: rgba(108, 92, 231, 0.08); }
.changelog-release.open .changelog-release-header { border-bottom-color: var(--border); }

.changelog-version {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-light);
}
.changelog-date {
  font-size: 12px;
  color: var(--text-dim);
}
.changelog-release-body {
  display: none;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
}
.changelog-release.open .changelog-release-body { display: block; }

.changelog-release-body ul { padding-left: 18px; margin: 4px 0; }
.changelog-release-body li { margin-bottom: 4px; }
.changelog-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 4px;
}
.changelog-tag-new { background: rgba(0, 184, 148, 0.2); color: var(--green); }
.changelog-tag-fix { background: rgba(225, 112, 85, 0.2); color: var(--red); }
.changelog-tag-improve { background: rgba(253, 203, 110, 0.2); color: var(--orange); }
.changelog-tag-security { background: rgba(108, 92, 231, 0.2); color: var(--accent-light); }

/* Recent Activity */
.recent-activity-list { padding: 16px 24px; }
.recent-activity-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.recent-activity-row:last-child { border-bottom: none; }

/* Assets Viewer */
.asset-art-direction {
  margin: 16px 24px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.asset-art-label {
  font-size: 12px;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.asset-art-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.7;
}
.asset-section { margin: 24px 24px; }
.asset-section-title {
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.asset-section-count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: normal;
}
.asset-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
  table-layout: fixed;
}
.asset-col-thumb { width: 96px; }
.asset-col-name { width: 180px; }
.asset-col-path { width: 280px; }
.asset-col-desc { width: auto; }
.asset-table th, .asset-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.asset-table th {
  background: var(--bg-hover);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.asset-table tbody tr:last-child td { border-bottom: none; }
.asset-table tbody tr:hover { background: var(--bg-hover); }
.asset-thumb-cell { text-align: center; }
.asset-thumb {
  max-width: 72px;
  max-height: 72px;
  border-radius: 4px;
  background: #000;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.asset-no-thumb {
  display: inline-block;
  padding: 24px 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.asset-name-cell { font-weight: 600; color: var(--text); }
.asset-path-cell code {
  font-family: 'SF Mono', Menlo, Monaco, monospace;
  font-size: 12px;
  color: var(--accent-light);
  background: transparent;
  padding: 0;
}
.asset-desc-cell { color: var(--text-dim); line-height: 1.5; }
.asset-thumb { cursor: zoom-in; transition: transform 0.15s; }
.asset-thumb:hover { transform: scale(1.05); }

.asset-preview {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.asset-preview-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.asset-preview-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}
.asset-preview-close:hover { background: var(--bg-hover); }
.asset-preview-meta {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  max-width: 90vw;
}
.asset-preview-name { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.asset-preview-path {
  font-family: 'SF Mono', Menlo, Monaco, monospace;
  font-size: 12px;
  color: var(--accent-light);
  word-break: break-all;
}

/* 3D / Spine inline buttons */
.asset-3d-btn {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  vertical-align: middle;
}
.asset-3d-btn:hover { background: var(--accent); border-color: var(--accent); }
.asset-spine-btn { font-size: 12px; }
.asset-spine-source {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
  font-family: 'SF Mono', Menlo, Monaco, monospace;
}
.asset-spine-section {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  background: rgba(108, 92, 231, 0.04);
  border-radius: var(--radius);
}
.asset-spine-section .btn-primary { padding: 6px 14px; font-weight: 600; }
.asset-spine-icon {
  display: inline-block;
  width: 72px;
  height: 72px;
  line-height: 72px;
  text-align: center;
  font-size: 32px;
  color: var(--accent-light);
  background: var(--bg-hover);
  border-radius: 4px;
}

/* 3D model preview modal */
.model-preview, .spine-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
  max-height: 92vh;
}
.model-viewer-host {
  width: 80vw;
  height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
model-viewer { width: 100%; height: 100%; --poster-color: transparent; }
.mv-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-dim);
  font-size: 14px;
  background: var(--bg-card);
}

/* Spine preview modal */
.spine-canvas {
  width: min(720px, 80vw);
  height: min(720px, 70vh);
  background: #11111a;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.spine-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
}
.spine-controls label { font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.spine-controls select {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .game-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .toolbar { flex-direction: column; }
  .stats-bar { gap: 20px; }
  .header { flex-direction: column; gap: 12px; }
  .asset-table { font-size: 12px; }
  .asset-col-name { width: 120px; }
  .asset-col-path { width: 180px; }
}
