:root {
  --bg: #07111f;
  --bg-soft: rgba(17, 26, 43, 0.82);
  --panel: rgba(12, 20, 34, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #ecf3ff;
  --muted: #9eb0cf;
  --primary: #4f8cff;
  --primary-2: #6d5efc;
  --success: #23c483;
  --warning: #f4b740;
  --danger: #ff6b6b;
  --editor-bg: #0b1220;
  --input-bg: #0b1424;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.35);
}

body.light-theme {
  --bg: #eef4ff;
  --bg-soft: rgba(255, 255, 255, 0.88);
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(11, 18, 32, 0.08);
  --text: #122033;
  --muted: #5b6d89;
  --primary: #2d6cf6;
  --primary-2: #6f4ef6;
  --success: #179a66;
  --warning: #bf840d;
  --danger: #df5151;
  --editor-bg: #f7faff;
  --input-bg: #f8fbff;
  --shadow: 0 20px 60px rgba(28, 55, 90, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(109, 94, 252, 0.15), transparent 25%),
    linear-gradient(180deg, var(--bg) 0%, #09111d 100%);
  color: var(--text);
}

.page-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 50px;
}

.hero {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 34px;
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.28), transparent 65%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(79, 140, 255, .12);
  border: 1px solid rgba(79, 140, 255, .24);
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(34px, 4.8vw, 62px);
  line-height: 1.03;
  margin: 0 0 14px;
  max-width: 900px;
}

.hero p {
  max-width: 860px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 26px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-btn,
.run-btn,
.small-btn,
.text-btn {
  border: none;
  cursor: pointer;
  transition: .22s ease;
  font-family: inherit;
}

.hero-btn {
  text-decoration: none;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 700;
}

.hero-btn.primary,
.run-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 14px 30px rgba(79, 140, 255, .25);
}

.hero-btn.primary:hover,
.run-btn:hover {
  transform: translateY(-2px);
}

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

.workspace {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 320px 1.2fr 1fr;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 24px;
  padding: 22px;
  backdrop-filter: blur(16px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.panel-header h2 {
  font-size: 22px;
  margin: 0;
}

.status-pill {
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(244,183,64,.16);
  color: var(--warning);
  border: 1px solid rgba(244,183,64,.28);
  white-space: nowrap;
}

.status-pill.ready {
  background: rgba(35,196,131,.16);
  color: var(--success);
  border-color: rgba(35,196,131,.28);
}

.status-pill.error {
  background: rgba(255,107,107,.16);
  color: var(--danger);
  border-color: rgba(255,107,107,.28);
}

.control-grid,
.quick-actions {
  display: grid;
  gap: 12px;
}

.control-grid { grid-template-columns: 1fr; }
.quick-actions { grid-template-columns: 1fr 1fr; margin-top: 18px; }

.field label,
.io-block label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.field select,
#stdinInput,
#codeEditor {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

.field select {
  padding: 14px 16px;
  font-size: 15px;
}

.small-btn {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid var(--panel-border);
  font-weight: 700;
}

.small-btn:hover,
.text-btn:hover,
.hero-btn.secondary:hover {
  background: rgba(255,255,255,.08);
}

.tips-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--panel-border);
}

.tips-box h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.tips-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}

.editor-panel,
.io-panel {
  min-height: 640px;
}

.editor-panel {
  display: flex;
  flex-direction: column;
}

.editor-head {
  margin-bottom: 14px;
}

.editor-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.editor-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--editor-bg);
}

.editor-toolbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(255,255,255,.02);
}

.editor-dots {
  display: flex;
  gap: 8px;
}

.editor-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.editor-dots span:nth-child(1) { background: #ff5f57; }
.editor-dots span:nth-child(2) { background: #febc2e; }
.editor-dots span:nth-child(3) { background: #28c840; }

.editor-title {
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

#codeEditor,
#stdinInput,
#outputBox {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  line-height: 1.65;
}

#codeEditor {
  flex: 1;
  resize: none;
  padding: 22px;
  outline: none;
  border: none;
  background: var(--editor-bg);
}

.io-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.io-block {
  display: flex;
  flex-direction: column;
}

#stdinInput {
  min-height: 140px;
  padding: 16px;
  resize: vertical;
  outline: none;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.output-actions {
  display: flex;
  gap: 8px;
}

.text-btn {
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.run-btn {
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
}

#outputBox {
  margin: 0;
  min-height: 320px;
  border-radius: 18px;
  padding: 18px;
  background: var(--editor-bg);
  border: 1px solid var(--panel-border);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

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

  .editor-panel,
  .io-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1400px);
    padding-top: 18px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .output-head {
    flex-direction: column;
    align-items: flex-start;
  }
}