/* ── Editor topbar ── */
.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 52px;
  background: #000;
  flex-shrink: 0;
}
.editor-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.editor-back {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}
.editor-title {
  font-size: 13px;
  font-weight: 600;
}
.editor-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #333;
  border: none;
  color: #eee;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.editor-scale-select {
  background: #333;
  border: none;
  border-radius: 16px;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 6px 10px;
  outline: none;
  cursor: pointer;
  height: 32px;
}
.editor-scale-select option { background: #1a1a1a; }
.editor-icon-btn:hover { background: #444; }
.editor-icon-btn svg { width: 14px; height: 14px; }
.editor-icon-btn.linked { background: #2a5a2a; }
.editor-icon-btn.active-toggle { background: #c9a0dc; color: #111; }
.editor-icon-btn.active-toggle:hover { background: #d4b3e6; }

/* ── Tab layout ── */
.editor-tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.editor-tab-panel.active {
  display: flex;
}

.editor-bottomnav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  border-top: 1px solid #222;
  background: #111;
  flex-shrink: 0;
}
.editor-bottomnav button {
  background: none;
  border: none;
  color: #555;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
}
.editor-bottomnav button.active { color: #eee; }

/* ── Files tab: Tree ── */
.file-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #111;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Header row */
.ft-header {
  display: flex;
  align-items: center;
  padding: 4px 4px 10px;
  gap: 6px;
}
.ft-header-icon { color: #888; font-size: 14px; }
.ft-header-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1.2px;
}
.ft-header-spacer { flex: 1; }
.ft-header-count {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #444;
}

/* Root file row */
.ft-file {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  gap: 0;
}
.ft-file:hover { background: #1a1a1a; }
.ft-file.active { background: #1e1e1e; }
.ft-file-icon { width: 16px; height: 16px; flex-shrink: 0; color: #555; font-size: 16px; }
.ft-file-icon.main { color: #6c6; }
.ft-file-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}
.ft-file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ft-file .ft-file-name { font-weight: 600; }
.ft-file-desc {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ft-file-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: #6c6;
  flex-shrink: 0;
}

/* Sub-file row (inside open folder) */
.ft-subfile {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 10px 0 34px;
  border-radius: 8px;
  cursor: pointer;
}
.ft-subfile:hover { background: #1a1a1a; }
.ft-subfile .ft-file-icon { width: 14px; height: 14px; font-size: 14px; }
.ft-subfile .ft-file-name {
  font-size: 11px;
  font-weight: 400;
  color: #ccc;
}

/* Folder row */
.ft-folder {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  gap: 6px;
}
.ft-folder:hover { background: #1a1a1a; }
.ft-folder-chev { color: #666; font-size: 14px; width: 14px; text-align: center; }
.ft-folder-icon { color: #c9a0dc; font-size: 16px; }
.ft-folder-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #c9a0dc;
}
.ft-folder.closed .ft-folder-name { color: #999; }
.ft-folder-count {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  color: #444;
}

/* Empty state */
.ft-empty {
  text-align: center;
  padding: 40px 20px;
  color: #555;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

/* ── Files tab: Bottom sheet ── */
.file-sheet {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  flex-direction: column;
}
.file-sheet.open { display: flex; }
.file-sheet-dim {
  flex: 1;
  background: rgba(0,0,0,0.53);
}
.file-sheet-panel {
  background: #1a1a1a;
  border-radius: 16px 16px 0 0;
  height: 70vh;
  display: flex;
  flex-direction: column;
}
.file-sheet-handle {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 24px;
  flex-shrink: 0;
}
.file-sheet-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #444;
}
.file-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.file-sheet-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-sheet-icon { color: #6c6; font-size: 16px; }
.file-sheet-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #eee;
}
.file-sheet-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  color: #ccc;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.file-sheet-edit:hover { background: #333; }
.file-sheet-edit svg { width: 12px; height: 12px; }
.file-sheet-code {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #111;
  border-radius: 8px;
  margin: 0 12px 12px;
  padding: 12px 14px;
}
.file-sheet-code pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: #ccc;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
/* Basic syntax highlight classes */
.sh-kw { color: #c9a0dc; }
.sh-cm { color: #555; }
.sh-str { color: #a8d8a8; }

/* ── Files tab: Edit mode (fullscreen) ── */
.file-edit-full {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #1a1a1a;
}
.file-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
}
.file-edit-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-edit-badge {
  font-family: 'Inter', sans-serif;
  font-size: 8px;
  font-weight: 700;
  color: #c9a0dc;
  letter-spacing: 0.8px;
  background: #2a1a2a;
  padding: 3px 8px;
  border-radius: 6px;
}
.file-edit-actions {
  display: flex;
  gap: 6px;
}
.file-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.file-edit-btn:hover { background: #333; }
.file-edit-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  cursor: pointer;
}
.file-edit-icon-btn:hover { background: #333; }
.file-edit-icon-btn:disabled { color: #555; cursor: default; }
.file-edit-icon-btn:disabled:hover { background: #2a2a2a; }
.file-edit-area {
  flex: 1;
  min-height: 0;
  margin: 0 12px 12px;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
}
.file-edit-area textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #ccc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  padding: 12px 14px;
  tab-size: 2;
}

/* ── Files tab: Sync confirmation ── */
.sync-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sync-group-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1px;
  padding: 10px 0 4px;
}
.sync-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #aaa;
  padding: 4px 8px;
  border-radius: 4px;
}
.sync-item.add { color: #6c6; background: #0a1a0a; }
.sync-item.modify { color: #cc6; background: #1a1a0a; }
.sync-item.delete { color: #f66; background: #1a0a0a; }
.sync-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.sync-cancel, .sync-confirm {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.sync-cancel {
  background: #2a2a2a;
  color: #ccc;
}
.sync-cancel:hover { background: #333; }
.sync-confirm {
  background: #eee;
  color: #111;
}
.sync-confirm:hover { background: #fff; }
.sync-confirm:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
}

/* ── Play tab: Canvas stage ── */
.play-stage {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  flex-shrink: 0;
}
.play-screen {
  width: 320px;
  height: 240px;
  background: #1a1a1a;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  image-rendering: pixelated;
}

/* ── Play tab: Gamepad (always visible) ── */
.play-gamepad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #050505;
  padding: 10px 24px 14px;
  flex-shrink: 0;
}
.play-select-start {
  display: flex;
  justify-content: center;
  gap: 28px;
}
.play-pill {
  height: 22px;
  border-radius: 11px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  color: #666;
  font-family: 'Inter', sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 0 12px;
}
.play-pill:first-child { width: 64px; }
.play-pill:last-child { width: 60px; }
.play-pill:active { background: #333; color: #eee; }

.play-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex: 1;
}
.play-dpad {
  position: relative;
  width: 120px;
  height: 120px;
  touch-action: none;
}
.play-dpad-c {
  position: absolute;
  top: 40px; left: 40px;
  width: 40px; height: 40px;
  background: #222;
  border-radius: 4px;
}
.play-dpad-btn {
  position: absolute;
  width: 40px; height: 40px;
  background: #333;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.play-dpad-btn:active { background: #555; }
.play-dpad-up    { top: 0;   left: 40px; }
.play-dpad-down  { top: 80px; left: 40px; }
.play-dpad-left  { top: 40px; left: 0; }
.play-dpad-right { top: 40px; left: 80px; }

.play-ab {
  position: relative;
  width: 120px;
  height: 120px;
}
.play-btn-b {
  position: absolute;
  left: 0; top: 50px;
  width: 42px; height: 42px;
  border-radius: 21px;
  background: #444;
  border: none;
  cursor: pointer;
}
.play-btn-b:active { background: #666; }
.play-btn-a {
  position: absolute;
  right: 0; top: 10px;
  width: 52px; height: 52px;
  border-radius: 26px;
  background: #eee;
  border: none;
  cursor: pointer;
}
.play-btn-a:active { background: #fff; }

/* ── Play tab: Console ── */
.play-console {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #0a0a0a;
  padding: 8px 12px;
}
.play-console-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
}
.play-console-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #666;
  letter-spacing: 1.2px;
}
.play-console-clear {
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
}
.play-console-clear:hover { color: #888; }
.play-console-divider {
  height: 1px;
  background: #1a1a1a;
}
.play-console-lines {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 4px;
}
.play-console-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #aaa;
  line-height: 1.4;
}
.play-console-line.success { color: #6c6; }
.play-console-line.warn { color: #c93; }
.play-console-line.error { color: #f66; }

/* ── AI tab: Chat area ── */
.ai-chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #141414;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* User message card */
.ai-card-user {
  background: #1e1e1e;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-card-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.ai-card-retry {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0;
  display: flex;
}
.ai-card-retry:hover { color: #ccc; }
.ai-card-retry svg { width: 12px; height: 12px; }
.ai-card-body {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #eee;
  line-height: 1.5;
}

/* AI response card */
.ai-card-mono {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ai-card-mono.working {
  border-color: #3a3a3a;
}
.ai-card-status {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 1.2px;
}
.ai-card-status.working { color: #eee; }
.ai-card-response {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: #ccc;
  line-height: 1.5;
}
.ai-card-response p {
  margin: 0 0 6px;
}
.ai-card-response p:last-child { margin-bottom: 0; }
.ai-card-response .md-h {
  font-family: 'Inter', sans-serif;
  color: #eee;
  font-weight: 700;
  margin: 8px 0 3px;
  letter-spacing: 0.2px;
}
.ai-card-response h2.md-h { font-size: 14px; }
.ai-card-response h3.md-h { font-size: 13px; }
.ai-card-response h4.md-h { font-size: 12px; color: #bbb; }
.ai-card-response .md-h:first-child { margin-top: 0; }
.ai-card-response .md-ul {
  margin: 3px 0 6px;
  padding-left: 16px;
  list-style: disc;
}
.ai-card-response .md-ul li {
  margin: 2px 0;
}
.ai-card-response strong {
  color: #eee;
  font-weight: 600;
}
.ai-card-response code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 3px;
  padding: 0 4px;
  color: #c9a0dc;
}
.ai-card-file {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #777;
}
.ai-card-file.active { color: #aaa; }
/* Live trace container — interleaves reasoning / tool / token events
   in the working agent card. Each block coalesces consecutive deltas
   of the same kind and finalizes when a different event arrives. */
.ai-agent-live {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.ai-agent-live:empty { display: none; }
.ai-agent-reasoning {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  white-space: pre-wrap;
  line-height: 1.4;
}
.ai-agent-text {
  font-size: 12px;
  color: #ccc;
  white-space: pre-wrap;
  line-height: 1.45;
}

/* Collapsed trace on completed agent cards — mirrors Claude.ai-style
   "Thought for N iterations" pull-down. Default hidden; expanded shows
   the full reasoning + tool log in the same compact style used during
   the working phase. */
.ai-trace-toggle {
  display: block;
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: #888;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.ai-trace-toggle:hover { color: #c9a0dc; }
.ai-trace {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 2px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* The `hidden` attribute's UA default (display:none) is outranked by
   .ai-trace's explicit display:flex above, so a class-specificity rule
   is required to actually hide the trace when collapsed. */
.ai-trace[hidden] { display: none; }
.ai-trace-reasoning {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  white-space: pre-wrap;
  line-height: 1.4;
}
.ai-trace-text {
  font-size: 12px;
  color: #ddd;
  white-space: pre-wrap;
  line-height: 1.4;
}
.ai-tool-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #888;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ai-tool-line .ai-tool-spin {
  display: inline-block;
  width: 10px;
  color: #c9a0dc;
}
.ai-tool-line.working .ai-tool-spin { animation: ai-tool-pulse 1s ease-in-out infinite; }
.ai-tool-line.ok  .ai-tool-spin { color: #7bcf7b; }
.ai-tool-line.err .ai-tool-spin { color: #e48686; }
.ai-tool-line.err .ai-tool-text { color: #c97878; }
@keyframes ai-tool-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1;   }
}
.ai-card-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 26px;
  padding: 0 12px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ddd;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
}
.ai-card-stop:hover { background: #333; }
.ai-card-stop svg { width: 10px; height: 10px; }

/* AI error card (inline in chat) */
.ai-card-error {
  background: #1a0000;
  border: 1px solid #662222;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-card-error .ai-card-status { color: #ff6666; }
.ai-card-error .ai-card-response {
  color: #ff6666;
  font-family: monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
}
.ai-card-error .ai-card-fix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 12px;
  background: #ff6666;
  border: none;
  border-radius: 6px;
  color: #111;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
}
.ai-card-error .ai-card-fix:hover { background: #ff8888; }

/* Fix confirmation popup (reuses file-sheet panel) */
.fix-confirm-body {
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.fix-confirm-label {
  color: #888;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fix-confirm-textarea {
  flex: 1;
  min-height: 140px;
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 10px 12px;
  color: #ddd;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  outline: none;
  white-space: pre-wrap;
}
.fix-confirm-textarea:focus {
  border-color: #555;
}

/* ── AI tab: TopBar provider pill ── */
.ai-provider-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #222;
  border: none;
  border-radius: 16px;
  padding: 6px 10px;
  cursor: pointer;
  color: #aaa;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
}
.ai-provider-pill:hover { background: #333; }
.ai-provider-pill .pill-icon { color: #c9a0dc; }
.ai-provider-pill .pill-icon svg,
.ai-provider-pill .pill-chev svg { width: 10px; height: 10px; }
.ai-provider-pill .pill-chev { color: #666; display: flex; }
.ai-provider-pill.empty {
  background: transparent;
  border: 1px dashed #555;
  color: #ff9a4a;
}
.ai-provider-pill.empty:hover { background: #221a10; }
.ai-provider-pill.empty .pill-icon { color: #ff9a4a; }

/* Provider dropdown (custom, not native <select>) */
.provider-menu-pop {
  position: fixed;
  min-width: 180px;
  max-width: 280px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 4px;
  z-index: 1000;
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.provider-menu-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #ccc;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.provider-menu-row:hover { background: #262626; color: #fff; }
.provider-menu-row.active { color: #c9a0dc; }
.provider-menu-row.active .provider-menu-dot { color: #c9a0dc; }
.provider-menu-dot {
  display: inline-block;
  width: 10px;
  text-align: center;
  color: #555;
  font-size: 9px;
}
.provider-menu-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.provider-menu-sep {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 2px;
}
.provider-menu-row.manage {
  color: #6c6;
  justify-content: center;
}
.provider-menu-row.manage:hover { color: #8d8; }

/* Add Provider form — model list fetch */
.apf-model-name-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.apf-model-name-row input { flex: 1; }
.apf-fetch-btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 12px;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #ccc;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.apf-fetch-btn:hover { background: #333; color: #fff; }
.apf-fetch-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.apf-fetch-status {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  min-height: 14px;
}
.apf-fetch-status.success { color: #6c6; }
.apf-fetch-status.error   { color: #f66; }
.apf-fetch-status.warn    { color: #fa3; }

/* ── AI tab: Input bar ── */
.ai-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  background: #000;
  flex-shrink: 0;
}
.ai-input-field {
  flex: 1;
  min-width: 0;
}
.ai-input-field textarea {
  width: 100%;
  height: 38px;
  max-height: 38px;
  background: #1e1e1e;
  border: none;
  border-radius: 19px;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 10px 14px;
  outline: none;
  resize: none;
  line-height: 1.4;
}
.ai-input-field textarea::placeholder { color: #666; }
.ai-send {
  width: 38px;
  height: 38px;
  border-radius: 19px;
  background: #eee;
  border: none;
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-send:hover { background: #fff; }
/* While a chat request is in flight the send button morphs into a
   stop button. Dark fill + light glyph so it reads as "active /
   destructive" against the otherwise light input bar. */
.ai-send.is-stop { background: #2a2a2a; color: #fff; }
.ai-send.is-stop:hover { background: #1a1a1a; }

/* Hidden model selector */
.ai-model-select { position: absolute; opacity: 0; pointer-events: none; }

/* ── Game tab ── */
.game-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
.game-section + .game-section {
  border-top: 1px solid #222;
}
.game-section-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.game-section-label.danger { color: #ff6666; }

.game-card {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 14px 16px;
}
.game-card-label {
  font-size: 10px;
  color: #666;
  margin-bottom: 4px;
}
.game-card-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #333;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 4px 0;
  outline: none;
}
.game-card-input:focus { border-color: #666; }
.game-card-textarea {
  resize: none;
  height: 48px;
  line-height: 1.4;
}
.game-save-btn {
  width: 100%;
  height: 40px;
  background: #333;
  color: #eee;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.game-save-btn:hover { background: #444; }
.game-danger-text {
  font-size: 12px;
  color: #888;
  line-height: 1.5;
}

/* ── Game tab: Publish ── */
.publish-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.publish-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.publish-badge.draft {
  background: #2a2a2a;
  color: #888;
}
.publish-badge.published {
  background: #1a2e1a;
  color: #6c6;
}
.publish-version {
  font-size: 11px;
  color: #555;
}
.game-publish-btn {
  width: 100%;
  height: 40px;
  background: #eee;
  color: #111;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.game-publish-btn:hover { background: #fff; }
.game-publish-btn:disabled { background: #555; color: #888; cursor: not-allowed; }
.game-publish-btn.unpublish {
  background: transparent;
  border: 1px solid #333;
  color: #888;
}
.game-publish-btn.unpublish:hover { border-color: #555; color: #ccc; }
.game-publish-btn.update {
  background: #2a5a2a;
  color: #eee;
}
.game-publish-btn.update:hover { background: #3a7a3a; }

.btn-delete-game {
  width: 100%;
  height: 48px;
  background: transparent;
  border: 1px solid #662222;
  border-radius: 8px;
  color: #ff6666;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-delete-game:hover { background: #1a0000; border-color: #ff6666; }
.btn-delete-game:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  border-color: #442222;
}
.btn-delete-game:disabled:hover { background: transparent; border-color: #442222; }

/* ── Game tab: AI Provider row ── */
.game-provider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 8px;
}
.game-provider-name { font-size: 13px; }
.game-provider-link {
  background: none; border: none; color: #555;
  font-family: 'Inter', sans-serif; font-size: 11px;
  cursor: pointer; text-decoration: underline;
}
.game-provider-link:hover { color: #aaa; }

/* ── AI Providers view ── */
.aip-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 56px;
  background: #000;
  flex-shrink: 0;
}
.aip-topbar button {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 20px;
}
.aip-topbar span { font-size: 15px; font-weight: 600; }
.aip-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.aip-passphrase-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aip-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.aip-sublabel { font-size: 11px; color: #555; }
.aip-input {
  width: 100%;
  height: 40px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #eee;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 0 12px;
  outline: none;
}
.aip-input:focus { border-color: #555; }
.aip-input::placeholder { color: #444; }
.aip-strength {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 4px;
  height: 14px;
}
.aip-strength.weak { color: #f66; }
.aip-strength.fair { color: #fa3; }
.aip-strength.good { color: #cc6; }
.aip-strength.strong { color: #6c6; }
.aip-mk-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aip-mk-row .aip-input { flex: 1; }
.aip-mk-btn {
  height: 40px;
  padding: 0 14px;
  background: #333;
  border: none;
  border-radius: 8px;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.aip-mk-btn:hover { background: #444; }
.aip-mk-btn.danger { background: transparent; border: 1px solid #662222; color: #ff6666; }
.aip-mk-btn.danger:hover { background: #1a0000; }
.aip-mk-save-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  margin-top: 2px;
}
.aip-mk-save-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6c6;
  cursor: pointer;
  flex-shrink: 0;
}
.aip-mk-save-hint { font-size: 11px; color: #555; }
.aip-mk-status {
  font-size: 11px;
  margin-top: 4px;
}
.aip-mk-status.error { color: #ff6666; }
.aip-mk-status.success { color: #6c6; }
.aip-mk-status.warn { color: #fa3; }
.aip-divider { height: 1px; background: #222; }
.apf-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: #888;
  text-decoration: none;
}
.apf-link:hover { color: #c9a0dc; }
.aip-reset-banner {
  background: #3a2a1a;
  color: #e6c08a;
  border-left: 3px solid #c08a3a;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.45;
  border-radius: 4px;
}
.aip-provider-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #1a1a1a;
  border-radius: 8px;
  cursor: pointer;
  gap: 12px;
}
.aip-provider-card:hover { background: #222; }
.aip-provider-name { font-size: 14px; font-weight: 600; }
.aip-provider-model { font-size: 11px; color: #666; margin-top: 2px; }
.aip-provider-badge {
  font-size: 9px;
  font-weight: 600;
  color: #888;
  background: #333;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}
.aip-add-btn {
  width: 100%;
  height: 48px;
  background: transparent;
  border: 1px dashed #333;
  border-radius: 8px;
  color: #666;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.aip-add-btn:hover { border-color: #555; color: #aaa; }

/* ── Add Provider form ── */
.apf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: #000;
  flex-shrink: 0;
}
.apf-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.apf-topbar button {
  background: none;
  border: none;
  color: #eee;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}
.apf-topbar .apf-back { font-size: 20px; color: #ccc; }
.apf-topbar .apf-save { font-weight: 600; }
.apf-topbar span { font-size: 15px; font-weight: 600; }
.apf-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.apf-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.apf-field label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.apf-field .apf-hint { font-size: 11px; color: #444; }
.apf-field input, .apf-field select {
  width: 100%;
  height: 48px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 0 16px;
  outline: none;
}
.apf-field input:focus, .apf-field select:focus { border-color: #555; }
.apf-field input::placeholder { color: #555; }
.apf-field select { cursor: pointer; }
.apf-field select option { background: #1a1a1a; }
.apf-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.apf-toggle {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: #333;
  border: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.apf-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #888;
  transition: all 0.2s;
}
.apf-toggle.on { background: #eee; }
.apf-toggle.on::after { left: 18px; background: #111; }
.apf-toggle-label { font-size: 13px; color: #888; }
.apf-test-btn {
  width: 100%;
  height: 44px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.apf-test-btn:hover { border-color: #555; color: #eee; }
.apf-test-result {
  padding: 12px 16px;
  border-radius: 8px;
  display: none;
}
.apf-test-result.show { display: block; }
.apf-test-result.success { background: #0a1a0a; border: 1px solid #1a3a1a; }
.apf-test-result.fail { background: #1a0a0a; border: 1px solid #3a1a1a; }
.apf-test-result-title { font-size: 12px; font-weight: 600; }
.apf-test-result-detail { font-size: 11px; color: #555; margin-top: 4px; }
.apf-delete-btn {
  width: 100%;
  height: 40px;
  background: transparent;
  border: 1px solid #662222;
  border-radius: 8px;
  color: #ff6666;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: none;
}
.apf-delete-btn.show { display: block; }
.apf-delete-btn:hover { background: #1a0000; }
.apf-duplicate-btn {
  width: 100%;
  height: 40px;
  background: transparent;
  border: 1px solid #2f4a66;
  border-radius: 8px;
  color: #6cb6ff;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: none;
  margin-bottom: 8px;
}
.apf-duplicate-btn.show { display: block; }
.apf-duplicate-btn:hover { background: #0f1a26; }

/* ── Dev Settings view ── */
.devsettings-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  background: #000;
  flex-shrink: 0;
  position: relative;
}
.devsettings-topbar span { font-size: 15px; font-weight: 600; }
.devsettings-back {
  position: absolute;
  left: 16px;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 20px;
}
.devsettings-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.devsettings-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.devsettings-profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 24px;
  background: #555;
}
.devsettings-profile-name { font-size: 15px; font-weight: 700; }
.devsettings-profile-email { font-size: 11px; color: #666; }
.devsettings-profile-meta { font-size: 10px; color: #555; }
.devsettings-section-label {
  font-size: 10px;
  font-weight: 600;
  color: #666;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 12px 0 4px;
}
.devsettings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 8px;
  cursor: pointer;
  gap: 12px;
}
.devsettings-item:hover { background: #222; }
.devsettings-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.devsettings-item-left svg { width: 16px; height: 16px; color: #aaa; }
.devsettings-item-text { display: flex; flex-direction: column; gap: 2px; }
.devsettings-item-label { font-size: 12px; }
.devsettings-item-sub { font-size: 10px; color: #888; }
.devsettings-item-arrow { color: #555; font-size: 14px; }
.devsettings-signout {
  width: 100%;
  height: 48px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 8px;
  color: #eee;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.devsettings-signout:hover { border-color: #555; }
