:root {
  --bg-dark: #030712;
  --bg-card: rgba(15, 23, 42, 0.75);
  --border-color: rgba(255, 255, 255, 0.1);
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-amber: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(56, 189, 248, 0.1) 0%, transparent 50%);
}

.app-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.app-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-tags {
  display: flex;
  gap: 8px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
}

.tag-accent { color: #f43f5e; border-color: rgba(244, 63, 94, 0.3); background: rgba(244, 63, 94, 0.08); }
.tag-blue { color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); background: rgba(56, 189, 248, 0.08); }
.tag-green { color: #10b981; border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.08); }

/* Main Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.panel h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.panel-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

/* Avatar Presets */
.avatar-presets {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.avatar-card.active {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.1);
}

.avatar-card img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.avatar-info {
  display: flex;
  flex-direction: column;
}

.avatar-info .name {
  font-size: 0.85rem;
  font-weight: 600;
}

.avatar-info .role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.custom-upload-btn {
  border-style: dashed;
}

.upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text-muted);
}

/* Textarea & Inputs */
textarea {
  width: 100%;
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  margin-bottom: 16px;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

select {
  width: 100%;
  background: rgba(3, 7, 18, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.85rem;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #fff;
  flex: 1;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

/* Viewer Panel */
.viewer-panel {
  display: flex;
  flex-direction: column;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.live-pill.active {
  background: #ef4444;
  color: #fff;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.fps-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.canvas-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #030712;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Chiron */
.broadcast-chiron {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(3, 7, 18, 0.8) 0%, rgba(3, 7, 18, 0.98) 100%);
  border-top: 2px solid var(--accent-cyan);
  padding: 8px 16px;
  backdrop-filter: blur(8px);
}

.chiron-top {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.badge-live {
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
}

.badge-network {
  color: var(--text-muted);
  font-size: 0.55rem;
  font-weight: 700;
}

.chiron-bottom {
  display: flex;
  flex-direction: column;
}

.presenter-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
}

.presenter-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.04em;
}

/* Equalizer */
.equalizer-bar {
  display: flex;
  gap: 4px;
  height: 24px;
  margin-top: 14px;
  align-items: flex-end;
}

.eq-col {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.eq-fill {
  width: 100%;
  height: 10%;
  background: var(--accent-cyan);
  transition: height 0.05s ease;
}

/* Docs Section */
.docs-section {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.docs-section h3 {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.doc-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.doc-card h4 {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.doc-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
