/* Ball Playground — Dark Theme */
:root {
  --bg-primary: #1e1e1e;
  --bg-secondary: #252526;
  --bg-tertiary: #2d2d30;
  --bg-hover: #3e3e42;
  --border: #3e3e42;
  --text-primary: #d4d4d4;
  --text-secondary: #9d9d9d;
  --text-muted: #6a6a6a;
  --accent: #4ec966;
  --accent-hover: #3da854;
  --error: #f14c4c;
  --warning: #cca700;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 6px;
  --transition: 150ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 14px;
  margin-left: 6px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
  font-weight: 600;
}

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

.btn kbd {
  font-size: 11px;
  opacity: 0.7;
  font-family: var(--font-mono);
}

select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
}

select:focus {
  border-color: var(--accent);
}

/* ── Main Layout ────────────────────────────────────────────────────── */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.pane-header {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.divider {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background var(--transition);
}

.divider:hover, .divider.dragging {
  background: var(--accent);
}

/* ── Editor ─────────────────────────────────────────────────────────── */
.editor-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}

.line-numbers {
  width: 48px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  padding: 16px 8px 16px 0;
  text-align: right;
  overflow: hidden;
  user-select: none;
  border-right: 1px solid var(--border);
}

#editor {
  flex: 1;
  height: 100%;
  resize: none;
  border: none;
  outline: none;
  padding: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

#editor::placeholder {
  color: var(--text-muted);
}

/* ── Output ─────────────────────────────────────────────────────────── */
.output-container {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

.output-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.output-error {
  color: var(--error);
}

.output-info {
  color: var(--text-muted);
  font-style: italic;
}

.output-success {
  color: var(--accent);
}

/* ── Status Bar ─────────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  padding: 4px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  gap: 16px;
  flex-shrink: 0;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.status-dot.error {
  background: var(--error);
}

/* ── Share Modal ────────────────────────────────────────────────────── */
.share-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-primary);
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
  pointer-events: none;
  z-index: 1000;
}

.share-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main {
    flex-direction: column;
  }
  .divider {
    width: auto;
    height: 4px;
    cursor: row-resize;
  }
  .toolbar .btn kbd {
    display: none;
  }
  .header {
    flex-wrap: wrap;
  }
}
