@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('/styles/playabl-tokens.css');
@import url('/styles/fonts.css');

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: none; background: none; }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ── Top nav ──────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.topnav-title {
  font-family: var(--font-nordique);
  font-size: 1.05rem;
  color: var(--text-h);
  letter-spacing: 0.03em;
}

.topnav-spacer { flex: 1; }

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-h);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Page shell ───────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem clamp(1rem, 4vw, 2rem) 4rem;
}

/* ── App shell (sidebar + content + panel) ─────────────────── */
.app-shell {
  display: flex;
  min-height: calc(100vh - 56px);
}

.app-shell--discover {
  height: calc(100vh - 56px);
  overflow: hidden;
}

.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--surface-sunken);
  transition: width 0.18s ease, padding 0.18s ease, border-color 0.18s ease;
}

@media (min-width: 761px) {
  .app-sidebar {
    position: sticky;
    top: 56px;
    align-self: flex-start;
    height: calc(100vh - 56px);
    overflow-y: auto;
  }

  .app-shell--sidebar-collapsed .app-sidebar {
    width: 0;
    padding-right: 0;
    padding-left: 0;
    overflow: hidden;
    border-right-color: transparent;
  }
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.5rem 0.75rem;
}

.app-sidebar-title {
  font-family: var(--font-nordique);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-h);
  letter-spacing: 0.03em;
}

.app-sidebar-spacer {
  flex: 1;
  min-height: 0.5rem;
}

.app-sidebar-footer {
  padding: 0.65rem 0.5rem 0.25rem;
  line-height: 1.45;
  border-top: 1px solid var(--border);
}

.app-sidebar-footer-sep {
  margin: 0 0.25rem;
  opacity: 0.45;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.app-nav .page-tab {
  display: flex;
  align-items: center;
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: none;
  text-align: left;
  justify-content: flex-start;
  font-size: 0.82rem;
}

.app-nav .page-tab:hover {
  background: var(--glass-hover);
}

.app-nav .page-tab.active {
  color: var(--text-h);
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  box-shadow: inset 3px 0 0 var(--primary);
}

.page-tab-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-tab-badge-new {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--primary);
}

.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg, #0d0d0d);
}

.app-content-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
  flex-shrink: 0;
}

.app-content-header--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
}

.app-content-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.project-admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  width: 100%;
  padding-top: 0.65rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.project-admin-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.project-featured-sync-btn {
  color: var(--yellow-500);
}

.project-featured-sync-btn:hover:not(:disabled) {
  color: var(--yellow-500);
  background: color-mix(in srgb, var(--yellow-500) 12%, var(--surface));
}

.featured-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--yellow-500) 35%, var(--border));
  background: color-mix(in srgb, var(--yellow-500) 10%, var(--surface));
  color: var(--yellow-500);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-content-header-start {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.app-sidebar-backdrop {
  display: none;
}

.app-content-title {
  margin: 0;
  font-family: var(--font-nordique);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-h);
  letter-spacing: 0.02em;
}

.app-content-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.app-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 3vw, 1.75rem) 2rem;
}

.app-content--discover {
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 5%, transparent) 0%, transparent 65%),
    var(--bg, #0d0d0d);
}

/* ── Experimental Agent Hub ──────────────────────────────── */
.app-shell--agent-hub {
  height: calc(100vh - 56px);
  overflow: hidden;
}

.app-shell--agent-hub .app-content {
  padding: 0;
  overflow: hidden;
}

.agent-hub-section {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.agent-hub-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.agent-hub-notice p {
  margin: 0.2rem 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.agent-hub-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--agent-project-width, 260px) 6px minmax(0, 1fr);
  background: var(--bg);
}

.agent-hub-projects {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0.85rem 0.85rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-sunken) 96%, var(--primary));
}

.agent-projects-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0 0.15rem;
}

.agent-projects-heading > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.agent-projects-heading span {
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-projects-heading strong {
  color: var(--text-h);
  font-size: 0.9rem;
}

.agent-projects-heading small {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-project-search {
  position: relative;
}

.agent-project-search > span {
  position: absolute;
  top: 50%;
  left: 0.72rem;
  z-index: 1;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
  transform: translateY(-50%);
}

.agent-project-search input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  padding: 0.4rem 0.75rem 0.4rem 2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  color-scheme: dark;
  font-size: 0.78rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.agent-project-search input::-webkit-search-cancel-button {
  display: none;
}

.agent-project-search input::placeholder {
  color: var(--text-muted);
}

.agent-project-search input:focus {
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border));
  background: var(--surface-elevated);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}

.agent-project-list {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0.15rem;
}

.agent-workspace-location {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.agent-project-status-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.agent-project-status-filter select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 1.65rem 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: 0;
  background-color: var(--surface);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 12px) 50%,
    calc(100% - 8px) 50%;
  background-repeat: no-repeat;
  background-size: 4px 4px;
  color: var(--text);
  color-scheme: dark;
  font-size: 0.76rem;
  cursor: pointer;
}

.agent-project-status-filter select:focus {
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}

.agent-workspace-location > summary {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  color: var(--text-muted);
  font-size: 0.65rem;
  cursor: pointer;
}

.agent-workspace-location > summary:hover {
  background: var(--glass-hover);
}

.agent-workspace-location > summary strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-workspace-location > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  padding: 0 0.5rem 0.5rem;
}

.agent-workspace-location input {
  grid-column: 1 / -1;
  width: 100%;
  height: 32px;
  min-width: 0;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--surface-sunken);
  color: var(--text);
  font-size: 0.72rem;
}

.agent-workspace-location input:focus {
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border));
}

.agent-workspace-location p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

.agent-project-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.agent-project-item > span {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.15rem;
}

.agent-project-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.agent-project-title-row > strong {
  min-width: 0;
  flex: 1 1 100px;
}

.agent-project-item .agent-project-campaign-badge,
.agent-project-item .agent-project-claim-badge,
.agent-project-item .agent-project-import-badge {
  flex: 0 0 auto;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
}

.agent-project-item .agent-project-campaign-badge {
  border: 1px solid color-mix(in srgb, var(--success, #43c59e) 45%, var(--border));
  color: var(--success, #43c59e);
  background: color-mix(in srgb, var(--success, #43c59e) 10%, transparent);
}

.agent-project-item .agent-project-claim-badge.mine {
  border: 1px solid color-mix(in srgb, var(--yellow-500) 55%, var(--border));
  color: var(--yellow-500);
  background: color-mix(in srgb, var(--yellow-500) 12%, transparent);
}

.agent-project-item .agent-project-claim-badge.claimed {
  border: 1px solid color-mix(in srgb, var(--danger, #ef4444) 55%, var(--border));
  color: var(--danger, #ef4444);
  background: color-mix(in srgb, var(--danger, #ef4444) 11%, transparent);
}

.agent-project-item .agent-project-import-badge {
  border: 1px solid color-mix(in srgb, var(--primary) 50%, var(--border));
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 11%, transparent);
}

.agent-project-status {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-muted);
}

.agent-project-status.running {
  background: var(--yellow-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow-500) 16%, transparent);
}

.agent-project-status.finished {
  background: var(--success, #43c59e);
}

.agent-project-status.error {
  background: var(--danger, #ef4444);
}

.agent-project-item:hover {
  background: var(--glass-hover);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  transform: translateY(-1px);
}

.agent-project-item.active {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.agent-projects-splitter {
  position: relative;
  z-index: 4;
  min-width: 6px;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.agent-projects-splitter::before {
  position: absolute;
  inset: 0 2px;
  content: '';
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.agent-projects-splitter:hover::before,
.agent-projects-splitter:active::before,
.is-resizing-agent-projects .agent-projects-splitter::before {
  background: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 16%, transparent);
}

.is-resizing-agent-projects {
  cursor: col-resize;
  user-select: none;
}

.agent-project-item strong,
.agent-project-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-project-item small {
  color: var(--text-muted);
}

.agent-project-item .agent-project-activity {
  color: var(--text-muted);
  font-size: 0.68rem;
  opacity: 0.85;
}

.agent-hub-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-hub-empty {
  margin: auto;
  max-width: 34rem;
  padding: 2rem;
  text-align: center;
}

.agent-hub-empty h2 {
  margin: 0 0 0.5rem;
}

.agent-hub-empty p {
  color: var(--text-muted);
}

.agent-hub-empty code {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0.5rem auto;
  padding: 0.55rem 0.75rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-sunken);
  text-align: left;
}

.agent-workspace-header,
.agent-photopea-toolbar,
.agent-assets-toolbar,
.agent-composer-toolbar,
.agent-composer-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.agent-workspace-header {
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.agent-workspace-header h2,
.agent-workspace-header p {
  margin: 0;
}

.agent-workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.agent-workbench {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, var(--agent-chat-width)) 5px minmax(260px, 1fr);
  overflow: hidden;
}

.agent-workbench.chat-collapsed {
  grid-template-columns: 0 0 minmax(260px, 1fr);
}

.agent-workbench.chat-collapsed .agent-chat-pane,
.agent-workbench.chat-collapsed .agent-splitter {
  visibility: hidden;
  overflow: hidden;
}

.agent-chat-pane,
.agent-preview-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.agent-chat-pane {
  border-right: 1px solid var(--border);
}

.agent-pane-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}

.agent-pane-header > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.agent-pane-header span {
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-pane-header strong {
  overflow: hidden;
  color: var(--text-h);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagnostics-section {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.diagnostics-toolbar,
.diagnostics-detail-toolbar,
.diagnostics-report-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.diagnostics-toolbar,
.diagnostics-detail-toolbar {
  justify-content: space-between;
}

.diagnostics-toolbar h2,
.diagnostics-toolbar p,
.diagnostics-detail-toolbar strong,
.diagnostics-detail-toolbar span {
  display: block;
  margin: 0;
}

.diagnostics-toolbar label {
  display: grid;
  gap: 0.25rem;
  min-width: 12rem;
  font-size: 0.75rem;
}

.diagnostics-report-list {
  display: grid;
  gap: 0.6rem;
}

.diagnostics-report-card {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagnostics-report-card > div {
  display: grid;
  flex: 1;
  gap: 0.2rem;
  min-width: 0;
}

.diagnostics-report-card span,
.diagnostics-report-card small {
  color: var(--text-muted);
}

.diagnostics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.diagnostics-block {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.diagnostics-block h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.diagnostic-log-table {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface-sunken);
  font-size: 0.72rem;
}

.diagnostic-log-row {
  display: grid;
  grid-template-columns: 11.5rem 3.5rem minmax(20rem, 1fr);
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.diagnostic-log-row:last-child {
  border-bottom: 0;
}

.diagnostic-log-row time,
.diagnostic-log-row > span {
  color: var(--text-muted);
}

.diagnostic-log-row code {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.diagnostic-log-row--error code {
  color: var(--error);
}

.diagnostic-log-row--warn code {
  color: var(--warning);
}

.agent-pane-meta {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-hub-empty .agent-pane-meta {
  white-space: normal;
}

/* The workspace header can carry three actions in a pane the user is free to
   drag narrow, so let them wrap instead of overflowing. */
.agent-pane-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
}

.agent-chat-pane-content,
.agent-preview-content,
.agent-chat,
.agent-assets,
.agent-photopea {
  flex: 1;
  min-height: 0;
}

.agent-chat-pane-content,
.agent-preview-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agent-preview-mode-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-preview-mode-panel[hidden] {
  display: none;
}

.agent-splitter {
  position: relative;
  z-index: 2;
  background: var(--border);
  cursor: col-resize;
  touch-action: none;
}

.agent-splitter:hover,
.agent-splitter:active {
  background: var(--primary);
}

.agent-preview-pane {
  background: #080a0d;
}

.agent-preview-tabs {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}

.agent-preview-tabs button {
  min-height: 28px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.agent-preview-tabs button:hover:not(:disabled) {
  background: var(--glass-hover);
  color: var(--text-h);
}

.agent-preview-tabs button.active {
  border-color: color-mix(in srgb, var(--accent-blue) 35%, var(--border));
  background: color-mix(in srgb, var(--accent-blue) 16%, var(--surface));
  color: var(--accent-blue);
  box-shadow: none;
}

.agent-preview-tabs button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.agent-preview-game {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.agent-preview-toolbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.45rem;
  border-bottom: 1px solid var(--border);
  background: #0d1014;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-preview-toolbar select {
  min-width: 0;
  flex: 1;
}

.agent-preview-toolbar select,
.agent-preview-toolbar input {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.7rem;
}

.agent-preview-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.agent-preview-toolbar input {
  width: 62px;
  padding: 0 0.35rem;
}

.agent-preview-toolbar output {
  min-width: 38px;
  text-align: right;
}

.agent-preview-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--primary) 5%, transparent), transparent 60%),
    #080a0d;
}

.agent-device-wrap {
  position: relative;
  flex: 0 0 auto;
  margin: 10px auto;
}

.agent-device-wrap.responsive {
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

.agent-device-frame {
  position: absolute;
  top: 0;
  left: 0;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #303640;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 16px 48px rgb(0 0 0 / 38%);
  transform: scale(var(--agent-preview-scale, 1));
  transform-origin: top left;
}

.agent-device-frame.responsive {
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  transform: none;
}

.agent-preview-zoom-label {
  min-width: 130px;
}

.agent-preview-zoom-label input {
  width: 82px;
}

.agent-device-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.agent-preview-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.6rem;
  padding: 2rem;
  background: rgb(8 10 13 / 88%);
  color: var(--text-muted);
  text-align: center;
}

.agent-preview-state.is-error p {
  color: var(--danger, #ef4444);
}

.agent-chat {
  display: flex;
  flex-direction: column;
}

.agent-prompt-suggestions {
  flex: 0 0 auto;
  max-height: 170px;
  overflow-y: auto;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}

.agent-prompt-suggestions-title {
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-prompt-suggestion {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 0.5rem;
  margin-top: 0.3rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agent-prompt-suggestion:hover {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--glass-hover);
}

.agent-prompt-suggestion > strong {
  font-size: 0.7rem;
}

.agent-prompt-suggestion > span:not(.agent-guidance-images) {
  grid-column: 1;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-guidance-images {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  gap: 0.25rem;
}

.agent-guidance-images img {
  width: 44px;
  height: 36px;
  border-radius: 5px;
  object-fit: cover;
}

.agent-message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.agent-message {
  max-width: min(48rem, 88%);
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.agent-message--user {
  margin-left: auto;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.agent-message.is-error {
  border-color: color-mix(in srgb, var(--danger, #ef4444) 55%, var(--border));
}

.agent-message header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-message-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.agent-streaming {
  color: var(--primary);
  text-transform: none;
}

.agent-message-attachments,
.agent-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.agent-message-attachments span,
.agent-attachment-list button {
  padding: 0.25rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 0.7rem;
}

.agent-chat-welcome {
  padding: 2rem;
  color: var(--text-muted);
  text-align: center;
}

.agent-queue {
  flex: 0 0 auto;
  max-height: 30%;
  overflow-y: auto;
  margin: 0 0.65rem;
  padding: 0.5rem 0.6rem;
  border: 1px dashed color-mix(in srgb, var(--primary) 35%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.agent-queue-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.agent-queue-heading strong {
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-queue-heading small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-queued-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: var(--surface);
}

.agent-queued-message + .agent-queued-message {
  margin-top: 0.3rem;
}

.agent-queued-text {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-queued-attachments {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-queued-remove {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
}

.agent-queued-remove:hover:not(:disabled) {
  background: var(--glass-hover);
  color: var(--text-h);
}

.agent-queued-remove:disabled {
  opacity: 0.4;
  cursor: default;
}

.agent-composer {
  position: relative;
  margin: 0.65rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, black);
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}

.agent-composer-toolbar {
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.agent-model-controls {
  min-width: 0;
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.agent-composer-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
}

.agent-model-controls select {
  min-width: 0;
  max-width: 150px;
}

.agent-model-toggle {
  flex: 0 0 auto;
  color: var(--text-muted);
  white-space: nowrap;
}

.agent-model-toggle input {
  margin: 0;
}

.agent-composer.is-dragging {
  box-shadow: inset 0 0 0 2px var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-sunken));
}

.agent-composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  max-height: 240px;
  padding: 0.65rem 0.7rem;
  border: 0;
  outline: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.agent-drop-hint {
  padding: 0.1rem 0.7rem 0.35rem;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.agent-attachment-list button small {
  color: var(--primary);
  font-size: 0.62rem;
}

.agent-attachment-list {
  padding: 0 0.55rem;
}

.agent-attachment-list .agent-attachment-card {
  position: relative;
  width: 74px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border-radius: 9px;
  background: #0b0c0f;
}

.agent-attachment-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-attachment-card > .agent-attachment-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.15rem 0.25rem;
  overflow: hidden;
  background: rgb(0 0 0 / 68%);
  color: white;
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-file-glyph {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, #0b0c0f);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.agent-attachment-card > i {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / 76%);
  color: white;
  font-style: normal;
}

.agent-cursor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
}

.agent-cursor-bar-left,
.agent-cursor-bar-right {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.35rem;
}

.agent-mode-pill,
.agent-model-picker > summary,
.agent-icon-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--glass-hover);
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.agent-mode-pill select {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.agent-model-picker {
  position: relative;
  min-width: 0;
}

.agent-model-picker > summary {
  max-width: 240px;
  overflow: hidden;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-model-picker > summary::-webkit-details-marker {
  display: none;
}

.agent-model-picker[open] > summary,
.agent-mode-pill:hover,
.agent-icon-button:hover {
  border-color: var(--border);
  color: var(--text-h);
}

.agent-model-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(360px, 80vw);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-sunken);
  box-shadow: 0 18px 50px rgb(0 0 0 / 45%);
}

.agent-model-popover label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-model-popover select {
  width: 100%;
  min-width: 0;
}

.agent-model-popover .agent-model-toggle {
  flex-direction: row;
  align-items: center;
}

.agent-icon-button {
  width: 32px;
  justify-content: center;
  padding: 0;
  font-size: 1rem;
}

.agent-send-circle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--text-h);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.agent-send-circle.is-stop span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--bg);
}

.agent-message-attachments a {
  width: 92px;
  height: 72px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  text-decoration: none;
}

.agent-message-attachments img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-message-attachments a > small {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.15rem;
  overflow: hidden;
  background: rgb(0 0 0 / 68%);
  color: white;
  font-size: 0.56rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-activity {
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-sunken);
}

.agent-activity > summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
}

.agent-activity > summary small {
  margin-left: auto;
}

.agent-activity-spinner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success, #43c59e);
}

.agent-activity-spinner.is-running {
  border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-top-color: var(--primary);
  background: transparent;
  animation: discover-spin 0.75s linear infinite;
}

.agent-activity-body {
  padding: 0 0.6rem 0.55rem;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-thought p,
.agent-tool-row p {
  margin: 0.25rem 0;
  white-space: pre-wrap;
}

.agent-plan {
  margin: 0.4rem 0;
  padding-left: 1.25rem;
}

.agent-tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--border);
}

.agent-tool-row p {
  grid-column: 1 / -1;
}

.agent-composer-actions {
  justify-content: space-between;
  margin-top: 0.55rem;
}

.agent-error {
  margin: 0.75rem;
  padding: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--danger, #ef4444) 50%, var(--border));
  border-radius: 8px;
  color: var(--danger, #ef4444);
}

.agent-assets {
  display: flex;
  flex-direction: column;
}

.agent-assets-toolbar {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.agent-assets-toolbar input {
  flex: 1;
  min-width: 10rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

.agent-asset-grid {
  display: grid;
  flex: 1;
  min-height: 0;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.7rem;
  padding: 1rem;
  overflow-y: auto;
}

.agent-asset-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.agent-asset-card:hover {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  transform: translateY(-1px);
}

.agent-asset-card > span {
  display: grid;
  place-items: center;
  aspect-ratio: 1.3;
  background:
    linear-gradient(45deg, #bbb 25%, transparent 25%),
    linear-gradient(-45deg, #bbb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #bbb 75%),
    linear-gradient(-45deg, transparent 75%, #bbb 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.agent-asset-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.agent-asset-card strong,
.agent-asset-card small {
  display: block;
  padding: 0.25rem 0.55rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-asset-card small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.agent-photopea {
  display: flex;
  flex-direction: column;
}

.agent-photopea-toolbar {
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.agent-photopea-frame {
  flex: 1;
  min-height: 0;
}

.agent-photopea-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #181818;
}

@media (max-width: 780px) {
  .app-shell--agent-hub {
    height: auto;
    min-height: calc(100vh - 56px);
    overflow: visible;
  }

  .app-shell--agent-hub .app-content {
    overflow: visible;
  }

  .agent-hub-layout {
    grid-template-columns: 1fr;
  }

  .agent-projects-splitter {
    display: none;
  }

  .agent-hub-projects {
    max-height: 16rem;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .agent-hub-main {
    min-height: 65vh;
  }

  .agent-workbench,
  .agent-workbench.chat-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(28rem, 45vh) minmax(32rem, 55vh);
    overflow: visible;
  }

  .agent-workbench.chat-collapsed {
    grid-template-rows: 0 minmax(36rem, 75vh);
  }

  .agent-splitter {
    display: none;
  }

  .agent-preview-toolbar {
    flex-wrap: wrap;
  }

  .agent-workspace-header,
  .agent-hub-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

.app-panel {
  width: min(280px, 28vw);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface-sunken);
  overflow-y: auto;
  padding: 1rem;
}

.app-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-panel-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-panel-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.app-panel-stat {
  margin: 0;
}

.app-panel-meta .discover-viewer-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.app-panel-meta .discover-viewer-sub {
  margin: 0;
}

.app-panel-nav-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.page-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-header h1 {
  font-family: var(--font-nordique);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-h);
  letter-spacing: 0.02em;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.page-tab {
  height: 30px;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.page-tab:hover {
  color: var(--text-h);
  background: var(--glass-hover);
}

.page-tab.active {
  color: var(--text-h);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

/* ── Admin analytics ──────────────────────────────────────── */
.analytics-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.analytics-range {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytics-range select {
  height: 32px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-h);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.stat-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1.1;
}

.stat-card-sub {
  margin-top: 0.25rem;
}

.analytics-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.analytics-block--hero {
  border-color: color-mix(in srgb, var(--yellow-500) 35%, var(--border));
}

.analytics-snapshot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.analytics-snapshot-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 7rem;
}

.analytics-snapshot-item--primary .analytics-snapshot-value {
  color: var(--yellow-500);
}

.analytics-snapshot-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-h);
}

.analytics-snapshot-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.analytics-snapshot-detail {
  margin-top: 0.1rem;
}

.analytics-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.analytics-compare-grid .analytics-block {
  margin-bottom: 0;
}

.analytics-block-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.analytics-block-header .analytics-heading {
  margin: 0;
}

.analytics-featured-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.analytics-featured-toggle:hover {
  color: var(--text-h);
}

@media (max-width: 900px) {
  .analytics-compare-grid {
    grid-template-columns: 1fr;
  }
}

.analytics-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-h);
  margin-bottom: 0.25rem;
}

.analytics-desc,
.analytics-footnote {
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

.analytics-footnote {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  min-height: 160px;
  padding: 0.5rem 0 0;
  width: 100%;
}

.daily-chart--full {
  overflow-x: visible;
}

.daily-chart--full .daily-bar-col {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}

.daily-bar-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.daily-bar-col:hover,
.daily-bar-col:focus-visible {
  z-index: 3;
}

.daily-bar-col:hover .daily-bar-track,
.daily-bar-col:focus-visible .daily-bar-track {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent);
}

.daily-bar-tooltip {
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 0.1rem;
  min-width: max-content;
  max-width: 11rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--text-h);
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}

.daily-bar-col:hover .daily-bar-tooltip,
.daily-bar-col:focus-visible .daily-bar-tooltip {
  opacity: 1;
}

.analytics-user-filter select {
  min-width: 9rem;
}

.analytics-submissions-user-filter {
  margin-left: auto;
}

.analytics-submissions-user-filter select {
  min-width: 9rem;
}

.daily-bar-track {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: flex-end;
  background: color-mix(in srgb, var(--border) 35%, transparent);
  border-radius: 4px 4px 0 0;
}

.daily-bar-track--stacked {
  flex-direction: column;
  justify-content: flex-end;
  gap: 0;
}

.daily-bar-track--empty {
  background: color-mix(in srgb, var(--border) 22%, transparent);
}

.daily-bar-col--empty .daily-bar-label {
  opacity: 0.55;
}

.analytics-empty-chart {
  margin-top: 0.65rem;
  margin-bottom: 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--border) 18%, transparent);
  border: 1px dashed color-mix(in srgb, var(--border) 55%, transparent);
}

.daily-bar-fill {
  width: 100%;
  min-height: 0;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: height 0.2s ease;
}

.daily-bar-fill--discover {
  background: var(--yellow-500);
  border-radius: 0;
}

.daily-bar-fill--audit {
  background: color-mix(in srgb, var(--accent-blue) 75%, #fff);
  border-radius: 4px 4px 0 0;
}

.daily-bar-fill--completed {
  background: color-mix(in srgb, var(--success, #22c55e) 72%, #fff);
  border-radius: 4px 4px 0 0;
}

.daily-bar-fill--first-submit {
  background: color-mix(in srgb, var(--primary) 78%, #fff);
  border-radius: 4px 4px 0 0;
}

.daily-bar-fill--resubmit {
  background: color-mix(in srgb, #a78bfa 70%, #fff);
  border-radius: 0;
}

.daily-chart--submissions .daily-bar-track {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.daily-chart--completed .daily-bar-track {
  background: color-mix(in srgb, var(--success, #22c55e) 10%, transparent);
}

.daily-chart--featured .daily-bar-track {
  background: color-mix(in srgb, var(--yellow-500) 8%, transparent);
}

.featured-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.75rem;
}

.featured-legend-swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
}

.featured-legend-swatch--discover {
  background: var(--yellow-500);
}

.featured-legend-swatch--audit {
  background: color-mix(in srgb, var(--accent-blue) 75%, #fff);
}

.featured-legend-swatch--first-submit {
  background: color-mix(in srgb, var(--primary) 78%, #fff);
}

.featured-legend-swatch--resubmit {
  background: color-mix(in srgb, #a78bfa 70%, #fff);
}

.daily-bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
}

.daily-bar-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-h);
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-table th,
.analytics-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.analytics-table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.analytics-table th.num,
.analytics-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.analytics-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Admin model reports (bake-off viewer) ───────────────── */
.app-shell--reports .app-content--reports {
  padding: 1rem clamp(0.75rem, 2vw, 1.25rem) 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.reports-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
}

.reports-week-label {
  flex-shrink: 0;
  padding: 0 0.25rem;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  flex: 1;
  min-height: min(520px, 55vh);
}

.reports-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.reports-column-header {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}

.reports-column-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-h);
}

.reports-column-filename {
  margin-top: 0.15rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.reports-column .markdown-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem 1.25rem;
  font-size: 0.82rem;
  line-height: 1.55;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--text-h);
  line-height: 1.25;
  margin: 1.1rem 0 0.55rem;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body h1 { font-size: 1.15rem; }
.markdown-body h2 { font-size: 1rem; }
.markdown-body h3 { font-size: 0.92rem; }
.markdown-body h4 { font-size: 0.88rem; }

.markdown-body p {
  margin: 0 0 0.75rem;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
}

.markdown-body li {
  margin-bottom: 0.35rem;
}

.markdown-body li:last-child {
  margin-bottom: 0;
}

.markdown-body blockquote {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
}

.markdown-body strong {
  color: var(--text-h);
  font-weight: 600;
}

.markdown-body em {
  color: var(--text);
}

.reports-verdict {
  flex-shrink: 0;
  margin-top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.reports-verdict-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface-sunken);
  border: none;
  text-align: left;
  color: inherit;
  transition: background 0.15s ease;
}

.reports-verdict-toggle:hover {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-sunken));
}

.reports-verdict-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.reports-verdict-chevron {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.reports-verdict:not(.is-open) .reports-verdict-chevron {
  transform: rotate(0deg);
}

.reports-verdict-toggle-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-h);
}

.reports-verdict-toggle-sub {
  display: none;
}

@media (min-width: 720px) {
  .reports-verdict-toggle-sub {
    display: inline;
  }
}

.verdict-winner-pill {
  flex-shrink: 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--success, #3ecf8e) 90%, white);
  background: color-mix(in srgb, var(--success, #3ecf8e) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--success, #3ecf8e) 35%, var(--border));
}

.reports-verdict-body {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid var(--border);
}

.verdict-callout {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--success, #3ecf8e) 30%, var(--border));
  background: color-mix(in srgb, var(--success, #3ecf8e) 8%, var(--surface));
}

.verdict-callout-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--success, #3ecf8e) 75%, var(--text));
  margin-bottom: 0.4rem;
}

.verdict-callout-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-h);
}

.verdict-block-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-h);
  margin: 0 0 0.55rem;
}

.verdict-block p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
}

.verdict-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
}

.verdict-block--method {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
}

.verdict-criteria {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.verdict-criterion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
  overflow: hidden;
}

.verdict-criterion-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--text-h);
  user-select: none;
}

.verdict-criterion-summary::-webkit-details-marker {
  display: none;
}

.verdict-criterion-summary::after {
  content: '+';
  margin-left: auto;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

.verdict-criterion[open] .verdict-criterion-summary::after {
  content: '−';
}

.verdict-criterion-num {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--text-h);
  flex-shrink: 0;
}

.verdict-criterion-title {
  font-size: 0.84rem;
}

.verdict-criterion-body {
  padding: 0 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.verdict-criterion-intro,
.verdict-criterion-sub {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text);
}

.verdict-model-reviews {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.verdict-model-review {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
}

.verdict-model-name {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.verdict-model-review p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
}

.verdict-model-review--claude {
  border-left: 3px solid color-mix(in srgb, #c084fc 55%, var(--border));
}

.verdict-model-review--claude .verdict-model-name {
  color: color-mix(in srgb, #c084fc 85%, white);
}

.verdict-model-review--gpt5 {
  border-left: 3px solid color-mix(in srgb, #60a5fa 55%, var(--border));
}

.verdict-model-review--gpt5 .verdict-model-name {
  color: color-mix(in srgb, #60a5fa 85%, white);
}

.verdict-model-review--kimi {
  border-left: 3px solid color-mix(in srgb, #fbbf24 55%, var(--border));
}

.verdict-model-review--kimi .verdict-model-name {
  color: color-mix(in srgb, #fbbf24 85%, white);
}

.verdict-ranking {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.verdict-rank-card {
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
}

.verdict-rank-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.verdict-rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-h);
}

.verdict-rank-model {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-h);
}

.verdict-rank-tagline {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.verdict-rank-summary {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
}

.verdict-rank-card--claude {
  border-color: color-mix(in srgb, #c084fc 35%, var(--border));
  background: color-mix(in srgb, #c084fc 6%, var(--surface-sunken));
}

.verdict-rank-card--claude .verdict-rank-badge {
  background: color-mix(in srgb, #c084fc 18%, var(--surface));
  border-color: color-mix(in srgb, #c084fc 35%, var(--border));
}

.verdict-rank-card--gpt5 {
  border-color: color-mix(in srgb, #60a5fa 30%, var(--border));
}

.verdict-rank-card--kimi {
  border-color: color-mix(in srgb, #fbbf24 30%, var(--border));
}

.verdict-caveat {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .verdict-ranking {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .reports-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .reports-column {
    min-height: 420px;
    max-height: 70vh;
  }

  .app-shell--reports .app-content--reports {
    overflow-y: auto;
  }
}

/* ── Project filters ──────────────────────────────────────── */
.project-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.project-controls-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.project-controls-search .project-search {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.project-controls-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
}

.project-controls-filters .filter-pills {
  flex: 1 1 auto;
}

.project-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.75rem;
  margin-bottom: 1rem;
}

.project-search {
  position: relative;
  flex: 1 1 14rem;
  min-width: 11rem;
  max-width: 24rem;
}

.project-search-input {
  width: 100%;
  padding: 0.38rem 2rem 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-blue) 18%, transparent);
}

.project-search-input::-webkit-search-cancel-button {
  display: none;
}

.project-search-clear {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.project-search-clear:hover {
  background: color-mix(in srgb, var(--muted) 24%, transparent);
  color: var(--text);
}

.project-filters-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-pill:hover {
  background: var(--glass-hover);
  color: var(--text-h);
}

.filter-pill.active {
  background: color-mix(in srgb, var(--accent-blue) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--accent-blue) 35%, var(--border));
  color: var(--accent-blue);
}

.filter-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
}

.project-filter-summary {
  flex-shrink: 0;
  white-space: nowrap;
}

.filter-pill-featured {
  border-color: color-mix(in srgb, var(--yellow-500) 45%, var(--border));
  color: var(--yellow-500);
}
.filter-pill-featured:hover {
  background: color-mix(in srgb, var(--yellow-500) 14%, var(--surface));
  color: var(--yellow-500);
}
.filter-pill-featured.active {
  background: color-mix(in srgb, var(--yellow-500) 22%, var(--surface));
  border-color: var(--yellow-500);
  color: var(--yellow-500);
}

.show-featured-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.show-featured-toggle:hover { color: var(--text-h); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.9rem;
  height: 34px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  border: 1px solid transparent;
  cursor: pointer;
}

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

.btn-sm { height: 28px; padding: 0 0.65rem; font-size: 0.8rem; }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 85%, #fff);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text-h);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--glass-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--glass-hover); color: var(--text-h); }

.btn-warning {
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
}
.btn-warning:hover:not(:disabled) {
  background: color-mix(in srgb, var(--warning) 28%, var(--surface));
}

.btn-danger {
  background: color-mix(in srgb, var(--error) 15%, var(--surface));
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 30%, transparent);
}
.btn-danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--error) 25%, var(--surface));
}

.btn-success {
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, transparent);
}
.btn-success:hover:not(:disabled) {
  background: color-mix(in srgb, var(--success) 25%, var(--surface));
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 1.1rem;
  line-height: 1;
}
.btn-icon:hover { background: var(--glass-hover); color: var(--text-h); border-color: var(--border); }
.btn-icon.danger { color: var(--error); }
.btn-icon.danger:hover { background: color-mix(in srgb, var(--error) 12%, transparent); }

/* Nav menu toggles the sidebar on desktop and opens its drawer on mobile. */
.btn.topnav-menu {
  display: inline-flex;
  flex-shrink: 0;
  min-width: 2.25rem;
  padding: 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-open {
  background: color-mix(in srgb, var(--accent-blue) 18%, transparent);
  color: var(--accent-blue);
}
.badge-in_progress {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}
.badge-needs_review {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: color-mix(in srgb, var(--primary) 55%, var(--text-h));
}
.badge-completed {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}
.badge-needs_revision {
  background: color-mix(in srgb, var(--purple-500) 18%, transparent);
  color: var(--purple-500);
}

.badge-archived {
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  color: var(--muted);
}

.archived-intro {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.badge-action {
  cursor: pointer;
  transition: filter 0.12s, transform 0.12s;
}

.badge-action:hover {
  filter: brightness(1.12);
}

.badge-action:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 2px;
}

.badge-admin {
  background: color-mix(in srgb, var(--purple-500) 18%, transparent);
  color: var(--purple-500);
}

.badge-pending {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}

.badge-approved {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.badge-rejected {
  background: color-mix(in srgb, var(--error) 15%, transparent);
  color: var(--error);
}

.badge-dismissed {
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  color: var(--text-muted);
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* ── Project table ────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.project-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.project-table thead {
  background: var(--surface-sunken);
}

.project-table th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.project-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.project-table tbody tr:last-child td { border-bottom: none; }

.project-table tbody tr {
  transition: background 0.1s;
}
.project-table tbody tr:hover { background: color-mix(in srgb, var(--glass-hover) 50%, transparent); }

.col-title { width: 34%; }
.col-notes { width: 28%; }
.col-status { width: 10%; }
.col-assigned { width: 12%; }
.col-updated { width: 10%; }
.col-actions { width: 6%; text-align: right; }

.project-title {
  color: var(--text-h);
  font-weight: 600;
  font-size: 0.9rem;
}

.latest-upload-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.upload-note-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 0.25rem;
  color: var(--dim);
  font-size: 0.78rem;
  line-height: 1.35;
  cursor: pointer;
}

.upload-note-preview.expanded {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
}

.notes-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
}

.notes-preview.expanded {
  -webkit-line-clamp: unset;
}

.notes-expand-btn {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  margin-top: 0.2rem;
  display: block;
}

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 0.8rem; }

/* ── 3-dot dropdown ───────────────────────────────────────── */
.dropdown-wrap {
  display: inline-flex;
}

.dropdown-menu {
  position: fixed;
  min-width: 192px;
  max-height: calc(100dvh - 16px);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  z-index: 500;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: dropdown-in 0.1s ease;
}

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-menu.dropdown-menu-up {
  animation: dropdown-in-up 0.1s ease;
}

@keyframes dropdown-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-h);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.dropdown-item:hover { background: var(--glass-hover); }
.dropdown-item.danger { color: var(--error); }
.dropdown-item.danger:hover { background: color-mix(in srgb, var(--error) 12%, transparent); }

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

.dropdown-icon {
  font-size: 0.8rem;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.6;
  font-style: normal;
}

/* ── Modals ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: min(100%, 560px);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: modal-in 0.15s ease;
}

.modal-lg { width: min(100%, 720px); }

.modal {
  font-family: var(--font-sans);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h2 {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-h);
  font-weight: 600;
  letter-spacing: normal;
}

.modal-body { padding: 1.25rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Forms ────────────────────────────────────────────────── */
.field + .field { margin-top: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dim);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-h);
  transition: border-color 0.12s;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.field textarea { min-height: 90px; resize: vertical; }

.field-hint {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--dim);
  cursor: pointer;
  margin-top: 0.75rem;
}

/* ── Drop zone ────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface-sunken);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-sunken));
}

.drop-zone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone-icon { font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.5; }

.drop-zone-label {
  font-size: 0.9rem;
  color: var(--dim);
  font-weight: 500;
}

.drop-zone-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 6%, var(--surface-sunken));
}

.drop-zone.has-file .drop-zone-icon::before { content: '✓ '; color: var(--success); }

/* ── Upload history ───────────────────────────────────────── */
.history-list { display: grid; gap: 0.65rem; margin-top: 0.75rem; }

.history-item {
  padding: 0.85rem 1rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.history-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.version-chip {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-h);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-family: monospace;
}

/* ── Publish wizard ──────────────────────────────────────── */
.publish-helper-banner {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.publish-helper-ok {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  color: var(--success);
}
.publish-helper-off {
  border-color: color-mix(in srgb, var(--error) 35%, var(--border));
  color: var(--error);
}

.publish-run-all-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.publish-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.publish-step {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 8px);
  padding: 0.65rem 0.85rem;
  background: var(--surface);
}
.publish-step-active {
  border-color: color-mix(in srgb, var(--accent-blue) 45%, var(--border));
}
.publish-step-done, .publish-step-noop {
  opacity: 0.85;
}

.publish-step-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.publish-step-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}
.publish-step-title {
  flex: 1;
}
.publish-step-error {
  margin-top: 0.45rem;
  color: var(--error);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.publish-step-warning {
  margin-top: 0.45rem;
  color: var(--warning);
  font-size: 0.82rem;
  white-space: pre-wrap;
}

.publish-step-controls {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.publish-message-input {
  flex: 1;
  min-width: 12rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text-h);
  font-size: 0.82rem;
}

/* Bold and solid on purpose — this is Playabl's real production featured status,
   not our internal nomination queue, so it should read as a strong highlight. */
.featured-playabl-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--yellow-500);
  color: var(--near-black);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-top: 0.3rem;
  width: fit-content;
}

.live-featured-check-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.live-featured-missing {
  display: inline-flex;
  align-items: center;
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 600;
}

.live-featured-missing-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.live-featured-approx-note {
  font-size: 0.75rem;
  color: var(--warning);
  cursor: help;
}

.history-note {
  font-size: 0.83rem;
  color: var(--dim);
  line-height: 1.45;
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}

/* ── Notifications (toast) ────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: grid;
  gap: 0.5rem;
  max-width: 360px;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toast-in 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.toast-success {
  background: color-mix(in srgb, var(--success) 15%, var(--surface-elevated));
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  color: var(--success);
}

.toast-error {
  background: color-mix(in srgb, var(--error) 15%, var(--surface-elevated));
  border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
  color: var(--error);
}

.toast-warning {
  background: color-mix(in srgb, var(--warning) 15%, var(--surface-elevated));
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--warning);
}

/* ── Login ────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--background-deep);
}

.login-card {
  width: min(100%, 400px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.login-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.login-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-brand h1 {
  font-family: var(--font-nordique);
  font-size: 1.5rem;
  color: var(--text-h);
  letter-spacing: 0.03em;
}

.login-brand p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.login-error {
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--error) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--error) 30%, transparent);
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.maintenance-wrap .maintenance-card {
  width: min(100%, 440px);
}

.maintenance-notice {
  text-align: center;
  padding: 0.5rem 0 1.25rem;
}

.maintenance-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.maintenance-notice h2 {
  font-family: var(--font-nordique);
  font-size: 1.25rem;
  color: var(--text-h);
  margin-bottom: 0.5rem;
}

.maintenance-notice p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.maintenance-admin-entry {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.maintenance-login {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.25rem;
}

.maintenance-banner {
  padding: 0.55rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 28%, transparent);
  color: var(--warning);
}

.hidden { display: none !important; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ── Detail section inside modal ─────────────────────────── */
.detail-section + .detail-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.detail-notes {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.55;
  white-space: pre-wrap;
}

.assignee-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assignee-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.admin-status-select {
  margin-top: 0.25rem;
  min-width: 10rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

.revision-section {
  scroll-margin-top: 1rem;
}

.revision-section-highlight {
  animation: revision-highlight 2s ease;
}

@keyframes revision-highlight {
  0%, 100% { background: transparent; }
  15%, 45% { background: color-mix(in srgb, var(--purple-500) 10%, transparent); }
}

.revision-thread {
  display: grid;
  gap: 1rem;
  margin-top: 0.65rem;
}

.revision-comment {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
}

.revision-comment-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.revision-comment-body {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text);
}

.revision-paragraph {
  margin: 0 0 0.65rem;
}

.revision-paragraph:last-child {
  margin-bottom: 0;
}

.revision-inline-image {
  display: block;
  width: 280px;
  max-width: 100%;
  height: 180px;
  object-fit: contain;
  margin: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
}

.revision-image-thumb {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: var(--radius-sm);
  line-height: 0;
  transition: transform 0.12s, box-shadow 0.12s;
}

.revision-image-thumb:hover {
  transform: translateY(-1px);
}

.revision-image-thumb:hover .revision-inline-image {
  border-color: color-mix(in srgb, var(--purple-500) 55%, var(--border-subtle));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.revision-image-thumb:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 2px;
}

.revision-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
}

.revision-lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: default;
}

.revision-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
}

.revision-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.revision-composer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background 0.12s, box-shadow 0.12s;
}

.revision-composer.revision-composer-dragover {
  background: color-mix(in srgb, var(--purple-500) 10%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--purple-500) 45%, transparent);
}

.revision-composer-hint {
  margin: 0 0 0.5rem;
}

.revision-comment-input {
  width: 100%;
  min-height: 7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
}

.revision-composer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.55rem;
  justify-content: flex-end;
}

/* ── Help modal ───────────────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 520px;
}

.help-nav {
  border-right: 1px solid var(--border);
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.help-nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s, color 0.1s;
}

.help-nav-btn:hover { background: var(--glass-hover); color: var(--text-h); }
.help-nav-btn.active { color: var(--text-h); background: color-mix(in srgb, var(--primary) 12%, transparent); font-weight: 600; }

.help-content {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 620px;
}

.help-content h3 {
  font-size: 1rem;
  color: var(--text-h);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.help-content h4 {
  font-size: 0.85rem;
  color: var(--text-h);
  margin: 1.25rem 0 0.4rem;
  font-weight: 600;
}

.help-content p {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.help-content ul, .help-content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.help-content li {
  font-size: 0.85rem;
  color: var(--dim);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.help-content strong { color: var(--text-h); font-weight: 600; }

.help-content code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  background: var(--code-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--accent-blue);
}

.help-codeblock {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 0.5rem 0 0.9rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.82rem;
}

.help-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.help-table td {
  padding: 0.5rem 0.75rem;
  color: var(--dim);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.help-table tr:last-child td { border-bottom: none; }

.help-table td:first-child { color: var(--text-h); font-weight: 500; white-space: nowrap; }

.help-checklist {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.help-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--dim);
  border-bottom: 1px solid var(--border-subtle);
}

.help-checklist li:last-child { border-bottom: none; }

.help-checklist li::before {
  content: '○';
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.help-tip {
  background: color-mix(in srgb, var(--accent-blue) 10%, var(--surface-sunken));
  border: 1px solid color-mix(in srgb, var(--accent-blue) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.83rem;
  color: var(--dim);
  margin: 0.5rem 0 1rem;
  line-height: 1.5;
}

.help-tip strong { color: var(--accent-blue); }

.fix-category {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.fix-category-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.fix-category-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-h);
  margin-bottom: 0.35rem;
}

.fix-category-desc {
  font-size: 0.82rem;
  color: var(--dim);
  line-height: 1.5;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 760px) {
  .app-shell {
    min-height: calc(100dvh - 56px);
  }

  .app-shell--discover {
    height: calc(100dvh - 56px);
  }

  .btn.topnav-menu {
    display: inline-flex;
  }

  .app-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 45;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 44;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .app-sidebar-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .app-content {
    padding: 1rem;
  }

  .app-content-header {
    padding: 0.75rem 1rem;
  }

  .diagnostics-toolbar,
  .diagnostics-detail-toolbar,
  .diagnostics-report-card {
    align-items: stretch;
    flex-direction: column;
  }

  .diagnostics-toolbar label {
    width: 100%;
  }

  .diagnostics-report-card > button,
  .diagnostics-detail-toolbar > button {
    align-self: flex-start;
  }

  .project-controls-search {
    flex-direction: column;
    align-items: stretch;
  }

  .project-filter-summary {
    text-align: right;
  }

  .app-content-title {
    font-size: 1rem;
  }

  /* Discover: immersive mobile feed layout */
  .app-shell--discover .app-content-header {
    display: none;
  }

  .app-shell--discover .app-panel {
    display: none;
  }

  .app-shell--discover .app-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .app-shell--discover .app-content {
    padding: 0;
  }

  .app-shell--discover .app-content--discover {
    background: var(--bg, #0d0d0d);
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .app-shell--discover .discover-view {
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .discover-player-area {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    display: block;
    position: relative;
  }

  .app-shell--discover .discover-player-resize-frame {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    resize: none !important;
  }

  .app-shell--discover .discover-player-resize-frame::after {
    display: none !important;
  }

  .app-shell--discover .discover-player-shell {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    resize: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .app-shell--discover .discover-player {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .discover-mobile-bar {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
  }

  .discover-mobile-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .discover-mobile-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-h);
  }

  .discover-mobile-stat-icon {
    font-size: 0.72rem;
    opacity: 0.75;
  }

  .discover-mobile-nav-compact,
  .discover-mobile-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }

  .discover-mobile-toolbar .btn {
    height: 2rem;
    padding: 0 0.55rem;
    font-size: 0.78rem;
  }

  .discover-mobile-bar--compact {
    padding-top: 0.5rem;
  }

  .discover-mobile-nav-icon {
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface, #121212);
    color: var(--text-h);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }

  .discover-mobile-nav-icon:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }

  .discover-mobile-position-inline {
    font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--muted);
    min-width: 3rem;
    text-align: center;
  }

  .discover-mobile-identity {
    align-items: flex-start;
  }

  .discover-mobile-identity-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
  }

  .discover-mobile-title {
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .discover-mobile-open {
    flex-shrink: 0;
    color: var(--muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
  }

  .discover-mobile-open:hover {
    color: var(--accent, #7c6cff);
  }

  .discover-mobile-pool-stat {
    margin: 0;
  }

  .discover-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
  }

  .discover-mobile-actions .btn {
    justify-content: center;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    font-size: 0.78rem;
  }

  .discover-stage-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 0;
  }

  .table-wrap { border-radius: 0; border-left: 0; border-right: 0; }

  .project-table { min-width: unset; }
  .project-table thead { display: none; }

  .project-table tr {
    display: block;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
  }

  .project-table td {
    display: block;
    border: none;
    padding: 0.2rem 0;
  }

  .project-table td::before {
    content: attr(data-label) ': ';
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  .col-actions { text-align: left; }
}

/* ── Local dev helper panel ───────────────────────────────── */
.helper-panels-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1100px) {
  .helper-panels-row {
    grid-template-columns: 1fr;
  }
}

.helper-panels-row .helper-panel {
  margin-bottom: 0;
}

.admin-helper-panel.helper-panel-online {
  border-color: color-mix(in srgb, #6366f1 35%, var(--border));
}

.publish-queue-summary {
  margin-bottom: 0.65rem;
}

.publish-queue-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.publish-queue-featured-toggle {
  display: block;
  margin-bottom: 0.75rem;
}

.publish-queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 280px;
  overflow: auto;
}

.publish-queue-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-elevated));
}

.publish-queue-item--running {
  border-color: color-mix(in srgb, #6366f1 45%, var(--border));
}

.publish-queue-item--failed {
  border-color: color-mix(in srgb, var(--error, #ef4444) 45%, var(--border));
}

.publish-queue-item--done {
  opacity: 0.72;
}

.publish-queue-item-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
}

.publish-queue-item-meta {
  margin-top: 0.2rem;
}

.publish-queue-error {
  margin-top: 0.35rem;
  color: var(--error, #ef4444);
}

.publish-queue-remove-btn {
  margin-top: 0.35rem;
}

.helper-panel {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}

.helper-panel-offline {
  border-color: color-mix(in srgb, var(--muted) 35%, var(--border));
}

.helper-panel-online {
  border-color: color-mix(in srgb, var(--success, #22c55e) 35%, var(--border));
}

.helper-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.helper-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.helper-dot-on {
  background: #22c55e;
  box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent);
}

.helper-dot-off {
  background: var(--muted);
}

.helper-panel-copy {
  margin-bottom: 0.5rem;
  line-height: 1.55;
}

.helper-connect-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
}

.helper-connect-hint {
  color: var(--warning, #d97706);
}

.helper-connect-details {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--muted) 8%, var(--surface-elevated));
}

.helper-connect-details summary {
  cursor: pointer;
  font-weight: 600;
}

.helper-connect-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  line-height: 1.55;
}

.helper-cmd {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.82rem;
}

.helper-workspace {
  margin-bottom: 0.75rem;
}

.helper-empty {
  margin: 0;
}

.helper-running-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.helper-running-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.helper-running-meta {
  flex: 1 1 140px;
  min-width: 0;
}

.helper-phone-url {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  word-break: break-all;
}

.helper-phone-url a {
  color: var(--accent-blue);
  text-decoration: none;
}

.helper-phone-url a:hover {
  text-decoration: underline;
}

.preview-phone-sep {
  margin: 0 0.25rem;
  color: var(--muted);
}

.preview-phone-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.preview-phone-link:hover {
  color: var(--text-h);
}

.helper-version-warning {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  font-size: 0.8rem;
  line-height: 1.45;
}

.helper-version-warning a {
  color: var(--warning);
  font-weight: 600;
}

.helper-version-ok {
  margin: 0 0 0.65rem;
}

.modal-phone-preview {
  max-width: 28rem;
}

.phone-preview-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
}

.phone-preview-wifi {
  margin: 0;
  line-height: 1.45;
  text-align: left;
  width: 100%;
}

.phone-preview-qr-wrap {
  padding: 0.65rem;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.phone-preview-qr {
  display: block;
}

.phone-preview-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.phone-preview-url {
  word-break: break-all;
  font-size: 0.75rem;
}

.helper-running-link {
  font-weight: 600;
  color: var(--text-h);
  text-decoration: none;
}

.helper-running-link:hover {
  text-decoration: underline;
}

.helper-running-id {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  margin-top: 0.15rem;
  word-break: break-all;
}

.helper-running-actions {
  display: flex;
  gap: 0.4rem;
}

.helper-index-link {
  margin-left: auto;
}

.preview-live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.preview-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.preview-live-chip a {
  color: var(--accent-blue);
  text-decoration: none;
}

.preview-live-chip a:hover {
  text-decoration: underline;
}

tr.row-preview-active {
  background: color-mix(in srgb, #22c55e 6%, transparent);
}

.quick-preview-btn {
  display: inline-flex;
}
.quick-preview-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.preview-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.preview-only-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.add-from-link-existing {
  margin-top: 0.25rem;
}

.add-from-link-replace-check {
  display: block;
  margin-top: 0.85rem;
}

.helper-workspace-row {
  margin-bottom: 0.85rem;
}

.helper-workspace-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.helper-workspace-input {
  flex: 1 1 220px;
  min-width: 0;
  height: 32px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-h);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.helper-workspace-hint {
  margin-top: 0.45rem;
}

.helper-games-details {
  margin-bottom: 0.85rem;
}

.helper-games-details summary {
  cursor: pointer;
  margin-bottom: 0.45rem;
}

.helper-games-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 160px;
  overflow: auto;
}

.helper-games-item {
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
}

.helper-games-item-known {
  border-color: color-mix(in srgb, #22c55e 30%, var(--border));
}

.helper-games-label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
}

.helper-games-id {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  word-break: break-all;
}

.project-id-line {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  margin-top: 0.2rem;
  word-break: break-all;
}

.workspace-ready-chip {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: color-mix(in srgb, #22c55e 15%, transparent);
  color: #16a34a;
  border: 1px solid color-mix(in srgb, #22c55e 35%, transparent);
}

.helper-setup-steps {
  margin: 0 0 0.75rem 1.1rem;
  line-height: 1.55;
}

.upload-note-field {
  margin-bottom: 0.75rem;
}

.upload-project-id,
.project-id-inline {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.upload-workspace-block {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.upload-footer-hint {
  flex: 1;
  margin: 0;
  text-align: left;
  line-height: 1.35;
}

.modal-footer:has(.upload-footer-hint) {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}

.upload-or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-or-divider::before,
.upload-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Discover viewer ─────────────────────────────────────── */
.discover-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@media (min-width: 761px) {
  .discover-mobile-bar {
    display: none;
  }
}

.discover-player-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.discover-stage-message {
  text-align: center;
  padding: 2rem;
}

.discover-stage-message-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
}

.discover-stage-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid color-mix(in srgb, var(--muted) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: discover-spin 0.75s linear infinite;
}

@keyframes discover-spin {
  to { transform: rotate(360deg); }
}

.discover-stage-loading {
  text-align: center;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
}

.discover-viewer-position {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-h);
}

.discover-viewer-link {
  color: var(--muted);
  word-break: break-all;
}

.discover-viewer-link:hover {
  color: var(--accent, #7c6cff);
}

.discover-size-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.discover-size-value {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  color: var(--text-h);
}

.discover-size-hint {
  margin: 0;
  line-height: 1.4;
}

.discover-player-resize-frame {
  position: relative;
  box-sizing: content-box;
  flex-shrink: 0;
}

@media (min-width: 761px) {
  .discover-player-resize-frame {
    resize: both;
    overflow: hidden;
    padding: 0 var(--discover-resize-gutter, 18px) var(--discover-resize-gutter, 18px) 0;
    min-width: 200px;
    min-height: 280px;
    max-width: calc(100% - 1rem);
    max-height: calc(100% - 1rem);
  }

  .discover-player-resize-frame::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 14px;
    height: 14px;
    border-right: 2px solid color-mix(in srgb, var(--muted) 70%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--muted) 70%, transparent);
    pointer-events: none;
    z-index: 3;
  }
}

.discover-player-shell {
  position: relative;
  overflow: hidden;
  background: #0a0a0a;
  width: 100%;
  height: 100%;
}

@media (min-width: 761px) {
  .discover-player-shell {
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  }
}

.discover-player {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a0a;
}

.discover-player-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.discover-player-poster-only {
  opacity: 0.55;
}

.discover-player-poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.discover-player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.discover-player-iframe.is-loaded {
  opacity: 1;
}

.discover-player-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
}

.discover-player-open {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
}

.discover-player-open:hover {
  background: rgba(0, 0, 0, 0.55);
}

.discover-player-open-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: var(--accent, #7c6cff);
  color: #fff;
  font-size: 1.25rem;
}

.discover-queue-section {
  margin-top: 0.5rem;
}

.discover-queue-filters {
  margin-bottom: 1rem;
}

.discover-ignore-hint {
  margin: 0.35rem 0 0;
  line-height: 1.35;
}

.discover-ignore-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.discover-ignored-note-cell {
  max-width: 18rem;
  vertical-align: top;
}

.discover-ignored-note {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.discover-filters-block {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.discover-filters-active {
  margin: 0;
  line-height: 1.4;
}

.discover-filters-active.is-live {
  color: var(--text-h);
  font-weight: 600;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.discover-filters-hint {
  margin: 0 0 0.35rem;
  line-height: 1.35;
}

.discover-filters-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.discover-filter-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.discover-filter-preset {
  flex: 1 1 calc(50% - 0.2rem);
  min-width: 0;
  font-size: 0.72rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 8%, var(--surface));
  color: var(--muted);
  opacity: 0.72;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.discover-filter-preset:hover:not(:disabled) {
  opacity: 0.9;
  color: var(--text);
  background: var(--glass-hover);
}

.discover-filter-preset.is-active {
  opacity: 1;
  font-weight: 600;
  color: var(--text-h);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.discover-filter-field-active label {
  color: var(--text-h) !important;
  font-weight: 600;
}

.discover-filter-field-active .discover-filter-input {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.discover-filter-check-active {
  color: var(--text-h);
  font-weight: 600;
}

.discover-filter-check-active input {
  accent-color: var(--accent);
}

.discover-country-combobox {
  position: relative;
}

.discover-country-combobox-hint {
  margin: 0.25rem 0 0;
}

.discover-country-combobox-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.discover-country-combobox-input {
  padding-right: 2rem;
}

.discover-country-combobox-clear {
  position: absolute;
  right: 0.35rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
}

.discover-country-combobox-clear:hover {
  color: var(--text-h);
  background: var(--glass-hover);
}

.discover-country-combobox-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 0.2rem);
  max-height: min(280px, 45vh);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  -webkit-overflow-scrolling: touch;
}

.discover-country-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}

.discover-country-option:hover,
.discover-country-option:focus-visible {
  background: var(--glass-hover);
  color: var(--text-h);
}

.discover-country-option[hidden] {
  display: none;
}

.discover-country-option-name {
  flex: 1;
  min-width: 0;
}

.discover-country-option-code {
  flex-shrink: 0;
}

.discover-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.discover-filter-input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}

.discover-filter-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
}

.discover-filter-check-locked {
  opacity: 0.85;
  cursor: default;
}

.discover-mobile-filters {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.35rem;
  padding-bottom: 0.35rem;
}

.discover-mobile-filters-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.35rem 0.15rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.discover-mobile-filters-title {
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.discover-mobile-filters-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-mobile-filters-chevron {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.discover-mobile-filters-body {
  padding: 0.5rem 0 0.15rem;
}

.discover-mobile-filters.is-expanded .discover-mobile-filters-body {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.discover-queue-game {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.discover-queue-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.discover-queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  white-space: nowrap;
}

/* ── App version footer ──────────────────────────────────── */
.app-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.app-footer-version {
  font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
  color: var(--muted);
}

.app-footer-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

.login-wrap + .app-footer,
.app-footer {
  border-top: 1px solid var(--border);
  margin-top: 0;
}

/* ── Games list ──────────────────────────────────────────── */
.games-list-section {
  display: grid;
  gap: 1rem;
}

.games-list-toolbar {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.games-list-toolbar-head {
  display: grid;
  gap: 0.25rem;
}

.games-list-toolbar-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.games-list-filters-form {
  max-width: 28rem;
}

.games-list-count {
  margin: 0;
}

.games-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.games-list-card {
  display: grid;
  gap: 0;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.games-list-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.games-list-card-media {
  background: color-mix(in srgb, var(--border) 35%, transparent);
  overflow: hidden;
  line-height: 0;
}

.games-list-card-thumb {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

.games-list-card-thumb--fallback {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 140px;
  line-height: normal;
  font-size: 0.85rem;
}

.games-list-card-body {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem 0.9rem;
}

.games-list-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.games-list-card-meta {
  line-height: 1.2;
}

.games-list-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.82rem;
}

.games-list-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.games-list-card-country {
  color: var(--muted);
}

.games-list-empty {
  padding: 2rem 0;
  text-align: center;
}

.games-list-load-more {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1rem;
}

@media (max-width: 640px) {
  .games-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .games-list-filters-form {
    max-width: none;
  }
}

/* ── Bug groups ──────────────────────────────────────────── */
.bug-groups-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bug-group-list {
  display: grid;
  gap: 0.75rem;
}

.bug-group-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
}

.bug-group-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.bug-group-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.bug-group-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.bug-group-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.bug-group-detail-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.25rem;
}

.bug-group-entries {
  display: grid;
  gap: 0.75rem;
}

.bug-group-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
}

.bug-group-entry-main {
  min-width: 0;
  flex: 1;
}

.bug-group-entry-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.bug-group-entry-note {
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 0.35rem;
}

.bug-group-entry-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex-shrink: 0;
}

.bug-group-attachment-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.bug-group-thumb-wrap {
  position: relative;
}

.bug-group-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sunken);
  overflow: hidden;
}

.bug-group-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bug-group-thumb-file {
  background: color-mix(in srgb, var(--muted) 10%, var(--surface-sunken));
}

.bug-group-thumb-icon {
  font-size: 1.3rem;
}

.bug-group-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 1;
  font-size: 0.65rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bug-group-thumb-remove:hover {
  background: color-mix(in srgb, var(--error) 15%, var(--surface-elevated));
}

/* ── Bug groups: download-all-to-folder panel ───────────── */
.bug-group-download-all {
  margin-bottom: 0.5rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
}

/* ── Bug groups: status tracking ─────────────────────────── */
.bug-status-badge {
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.bug-status-badge--open {
  background: color-mix(in srgb, var(--warning, #d97706) 18%, transparent);
  color: var(--warning, #d97706);
}

.bug-status-badge--fixed {
  background: color-mix(in srgb, var(--success, #22c55e) 18%, transparent);
  color: var(--success, #22c55e);
}

.bug-group-card--fixed {
  opacity: 0.85;
}

.bug-fixed-meta {
  margin: 0.15rem 0 0.35rem;
}
