/* ── arena.css — AI Arena Tabs + Chat + Visualizer UI ──────── */

#arena { background: var(--bg-primary); }

.arena-wrapper {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* ── Tab Bar ─────────────────────────────────────────────────── */
.arena-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-x: auto;
  scrollbar-width: none;
}
.arena-tabs::-webkit-scrollbar { display: none; }

.arena-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
}

.arena-tab:hover {
  color: var(--text-secondary);
  background: var(--glass);
}

.arena-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--tab-color, var(--accent-cyber));
}

.arena-tab .tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tab-color, var(--accent-cyber));
  transition: box-shadow var(--transition);
}
.arena-tab.active .tab-dot {
  box-shadow: 0 0 8px var(--tab-color, var(--accent-cyber));
}

/* ── Tab Panels ─────────────────────────────────────────────── */
.arena-panel {
  display: none;
  height: calc(100vh - 200px);
  min-height: 400px;
  flex-direction: column;
}

.arena-panel.active { display: flex; }


/* ── Math Tools Guide ───────────────────────────────────────── */
.math-tools-guide {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  overflow-y: auto;
}

.math-tools-header { text-align: center; }

.math-tools-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.math-tools-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}

.math-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 12px;
}

.math-tool-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
}

.math-tool-card:hover {
  border-color: rgba(110,84,148,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.math-tool-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.math-tool-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.math-tool-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.math-tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.math-tool-tag {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  background: rgba(110,84,148,0.1);
  border: 1px solid rgba(110,84,148,0.25);
  color: #a78bfa;
  letter-spacing: 0.04em;
}

.math-tool-desc {
  font-size: 0.79rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  flex: 1;
}

.math-tool-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
}

.math-tool-open-btn {
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.73rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.math-tool-open-btn:hover {
  border-color: var(--accent-cyber);
  color: var(--accent-cyber);
}

.math-tool-ask-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.73rem;
  font-weight: 600;
  border: 1px solid rgba(110,84,148,0.35);
  background: rgba(110,84,148,0.1);
  color: #a78bfa;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.math-tool-ask-btn:hover {
  background: #6e5494;
  border-color: #6e5494;
  color: #fff;
}

.math-tool-ask-btn.copied {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

/* Footer ask box */
.math-tools-footer { margin-top: 4px; }

.math-tools-ask-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(0,212,255,0.04);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.math-tools-ask-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 2px; }

.math-tools-ask-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.math-tools-ask-box p {
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.math-tools-prompt-preview {
  font-family: var(--font-code);
  font-size: 0.74rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.math-tools-copy-prompt {
  padding: 8px 16px;
  background: var(--accent-cyber);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.math-tools-copy-prompt:hover { background: #fff; }

@media (max-width: 640px) {
  .math-tools-grid { grid-template-columns: 1fr; }
  .math-tools-guide { padding: 16px; }
}

/* ── Tool Launcher ──────────────────────────────────────────── */
.launcher-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  height: 100%;
  overflow-y: auto;
}

.launcher-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--lc, var(--accent-cyber));
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  flex-wrap: wrap;
}

.launcher-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.launcher-info {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.launcher-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.launcher-tagline {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.launcher-free-badge {
  font-size: 0.72rem;
  color: #22c55e;
  font-weight: 600;
  margin-top: 2px;
}

.launcher-open-btn {
  padding: 12px 24px;
  background: var(--lc, var(--accent-cyber));
  color: #000;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.launcher-open-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.launcher-prompts-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 2px;
}

.launcher-prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 10px;
}

.launcher-prompt-btn {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.launcher-prompt-btn:hover {
  border-color: var(--accent-cyber);
  color: var(--text-primary);
  background: var(--accent-cyber-dim);
  transform: translateY(-2px);
}

.launcher-prompt-btn.copied {
  border-color: #22c55e;
  color: #22c55e;
}

/* ── Compare (Arena.ai) panel extras ──── */
.launcher-compare-info {
  background: rgba(168,85,247,0.05);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.compare-how {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compare-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.compare-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  background: rgba(168,85,247,0.2);
  border: 1px solid rgba(168,85,247,0.4);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  color: #a855f7;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .arena-tab { padding: 10px 12px; font-size: 0.78rem; }
  .msg { max-width: 95%; }
  .panel-header { flex-wrap: wrap; gap: 8px; }
  .key-bar { flex-wrap: wrap; }
  .model-selector { max-width: 160px; }
  /* Launcher panel */
  .launcher-panel { padding: 20px 16px; }
  .launcher-hero { padding: 16px; gap: 12px; flex-wrap: wrap; }
  .launcher-info { min-width: unset; }
  .launcher-icon { font-size: 2rem; }
}

@media (max-width: 600px) {
  /* Chat panel: don't let calc go negative on short screens */
  .arena-panel { height: auto; min-height: 340px; }
  .chat-messages { min-height: 200px; }
  .model-selector { max-width: 100%; width: 100%; }
  .panel-header { gap: 6px; }
  .launcher-hero { flex-direction: column; align-items: flex-start; }
  .launcher-open-btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .arena-tab { padding: 8px 10px; font-size: 0.72rem; }
  .viz-input-row { flex-direction: column; }
  .viz-run-btn { width: 100%; justify-content: center; }
  .arena-tabs { gap: 2px; }
  .launcher-panel { padding: 16px 12px; }
}
