/* Codel UI — dark studio, no external fonts or assets. */

:root {
  --bg: #090b10;
  --bg-2: #10141c;
  --panel: #141824;
  --panel-2: #1a2030;
  --line: #2a3142;
  --text: #e8edf5;
  --muted: #8b93a7;
  --teal: #2ee6c8;
  --teal-dim: #1a8f80;
  --teal-bg: rgba(46, 230, 200, 0.12);
  --amber: #ffb020;
  --pink: #ff5d73;
  --green: #6ee7a8;
  --gold: #f0d889;
  --violet: #b4a0ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Liberation Sans", sans-serif;
  font-size: 15px;
}

body {
  background-image:
    radial-gradient(ellipse at top, rgba(46, 230, 200, 0.07), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(180, 160, 255, 0.06), transparent 50%);
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 42px;
  height: 42px;
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.tag {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pill-dim {
  color: var(--muted);
}

.pill-live {
  border-color: var(--teal-dim);
  background: var(--teal-bg);
  color: var(--teal);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--teal-dim);
}

.btn-play {
  background: var(--teal);
  color: #06211c;
  border-color: var(--teal);
  min-width: 76px;
}

.btn-play:hover {
  filter: brightness(1.05);
}

.btn-stop {
  background: #2a1b22;
  border-color: #5a3040;
}

.btn-ghost {
  background: transparent;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

.field input {
  width: 80px;
}

.field-grow {
  flex: 1;
  min-width: 180px;
}

.field-grow select {
  flex: 1;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 0;
  min-height: 0;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.editor {
  flex: 1;
  display: flex;
  min-height: 360px;
  position: relative;
  background: #0c1018;
}

.gutter {
  margin: 0;
  padding: 16px 8px 16px 14px;
  min-width: 42px;
  text-align: right;
  color: #4a5266;
  font-family: "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  user-select: none;
  border-right: 1px solid #1b2130;
  background: #0a0e14;
}

.code {
  position: relative;
  flex: 1;
  min-width: 0;
}

.highlight,
#editor {
  margin: 0;
  padding: 16px 16px 16px 12px;
  font-family: "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}

.highlight {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: var(--text);
}

#editor {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--teal);
  outline: none;
  -webkit-text-fill-color: transparent;
}

.tok-comment { color: #6ee7a8; }
.tok-string { color: #f0d889; }
.tok-kw { color: var(--teal); }
.tok-fn { color: var(--violet); }
.tok-num { color: #9fd0ff; }
.tok-track { color: #ffb020; }

.error-panel {
  border-top: 1px solid var(--line);
  padding: 8px 16px;
  font-size: 13px;
  min-height: 40px;
  background: #100e12;
  color: var(--muted);
}

.error-panel.ok {
  color: var(--green);
}

.error-panel.bad {
  color: var(--pink);
  background: #221016;
}

.side {
  padding: 14px 16px 24px;
  background: var(--bg-2);
  overflow: auto;
}

.side h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.preset-btn {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}

.preset-btn small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.preset-btn:hover,
.preset-btn.active {
  border-color: var(--teal-dim);
  background: var(--teal-bg);
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 3px;
  margin: 0 0 18px;
}

.step {
  height: 16px;
  border-radius: 3px;
  background: #1c2332;
}

.step.on {
  background: var(--teal-dim);
}

.step.now {
  background: var(--teal);
  box-shadow: 0 0 8px rgba(46, 230, 200, 0.6);
}

.now-playing {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  background: #0c1018;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  min-height: 92px;
  white-space: pre-wrap;
}

.keys {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.62);
  z-index: 20;
  display: flex;
  justify-content: flex-end;
}

.drawer[hidden] {
  display: none;
}

.drawer-panel {
  width: min(560px, 100%);
  height: 100%;
  background: #12161f;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-body {
  padding: 8px 20px 32px;
  overflow: auto;
  line-height: 1.55;
  color: #d5dbe6;
}

.drawer-body h3 {
  margin: 22px 0 8px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
}

.drawer-body code,
.help-code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  background: #0c1018;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.drawer-body code {
  padding: 1px 5px;
}

.drawer-body pre {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  background: #0c1018;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  color: var(--gold);
}

.drawer-body ol,
.drawer-body ul {
  padding-left: 20px;
}

.drawer-body li {
  margin: 0 0 6px;
}

.map-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
}

.map-table th,
.map-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.map-table input {
  width: 100%;
  background: #0c1018;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
}

.map-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }
  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .editor {
    min-height: 280px;
  }
}
