﻿:root {
  --pyide-bg: rgba(9, 10, 13, 0.7);
  --pyide-panel: rgba(14, 15, 20, 0.9);
  --pyide-panel-soft: rgba(18, 20, 28, 0.8);
  --pyide-glow: rgba(245, 158, 11, 0.22);
  --pyide-border: rgba(245, 158, 11, 0.22);
}

.pyide {
  display: grid;
  gap: 16px;
}

.pyide-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.pyide-title h2 {
  margin: 0 0 6px 0;
  font-size: 28px;
  letter-spacing: 0.01em;
}

.pyide-title .eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.pyide-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pyide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
}

.pyide-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--pyide-panel);
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.pyide-panel--code {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 24px 60px rgba(245, 158, 11, 0.08);
}

.pyide-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--pyide-panel-soft);
  font-weight: 700;
}

.pyide-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pyide .btn-sm {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: none;
}

.pyide-lines {
  font-size: 12px;
  color: var(--muted);
}

.pyide-lines.is-limit {
  color: #fca5a5;
}

.pyide-hint {
  font-size: 12px;
  color: var(--muted);
}

.pyide-output {
  margin: 0;
  padding: 14px;
  min-height: 360px;
  max-height: 60vh;
  overflow: auto;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: radial-gradient(circle at 15% 10%, rgba(249, 115, 22, 0.08), transparent 40%),
              rgba(8, 9, 12, 0.9);
}

.pyide-out--stdout { color: #e5e7eb; }
.pyide-out--stderr { color: #fca5a5; }
.pyide-out--system { color: #93c5fd; }

.pyide-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.pyide-textarea {
  display: none;
}

/* CodeMirror theme */
.pyide .CodeMirror {
  height: 100%;
  min-height: 520px;
  background: #0d0f14;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.pyide .CodeMirror-gutters {
  background: #0b0d12;
  border-right: 1px solid #1f232c;
  color: #6b7280;
}

.pyide .CodeMirror-cursor {
  border-left: 2px solid var(--accent);
}

.pyide .CodeMirror-selected {
  background: rgba(245, 158, 11, 0.18);
}

.pyide .cm-s-pyide .cm-keyword { color: #f59e0b; }
.pyide .cm-s-pyide .cm-def { color: #f8e3a1; }
.pyide .cm-s-pyide .cm-string { color: #a5f3fc; }
.pyide .cm-s-pyide .cm-number { color: #fca5a5; }
.pyide .cm-s-pyide .cm-comment { color: #6b7280; }

.pyide .btn {
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.18);
}

.pyide .pill-muted {
  border-color: var(--pyide-border);
  background: rgba(245, 158, 11, 0.08);
  color: var(--text);
}
.pyide .pill-warn {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.16);
}
.pyide .pill-error {
  border-color: rgba(251, 113, 133, 0.7);
  background: rgba(251, 113, 133, 0.18);
  color: #fecdd3;
}

@media (max-width: 1100px) {
  .pyide-layout {
    grid-template-columns: 1fr;
  }
  .pyide .CodeMirror {
    min-height: 420px;
  }
  .pyide-output {
    min-height: 240px;
  }
}

@media (max-width: 640px) {
  .pyide,
  .pyide-header,
  .pyide-layout,
  .pyide-panel {
    min-width: 0;
    max-width: 100%;
  }
  .pyide-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .pyide-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--pyide-panel-soft);
    -webkit-overflow-scrolling: touch;
  }
  .pyide-actions > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .pyide-actions::-webkit-scrollbar {
    height: 8px;
  }
  .pyide-actions::-webkit-scrollbar-track {
    background: transparent;
  }
  .pyide-actions::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.35);
    border-radius: 999px;
  }
  .pyide .CodeMirror {
    min-height: 360px;
  }
  .pyide-output {
    white-space: pre-wrap;
    word-break: break-word;
  }
}
