:root {
  color-scheme: dark;
  --bg: #07131c;
  --panel: #0b1c28;
  --panel2: #102633;
  --line: #244354;
  --text: #e8f4f8;
  --muted: #91aab5;
  --accent: #28d7e6;
  --accent2: #12a8b7;
  --danger: #ff6b6b;
  --ok: #6fe3a1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at top, #102533 0, var(--bg) 42rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, select, textarea, input { font: inherit; }
button, select, .file-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
  min-height: 40px;
}
button, .file-button { cursor: pointer; padding: .55rem .85rem; }
button:hover, .file-button:hover { border-color: var(--accent2); }
button:focus-visible, select:focus-visible, textarea:focus-visible, #terminal:focus-visible, .file-button:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--accent); color: #031114; border-color: transparent; font-weight: 750; }
.primary:hover { background: #56e5ef; }
.big { padding: .85rem 1.25rem; min-width: 12rem; }
.topbar {
  max-width: 1500px; margin: auto; padding: 1.2rem 1.4rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.topbar h1 { margin: 0; font-size: 1.8rem; letter-spacing: .02em; }
.topbar p { margin: .2rem 0 0; color: var(--muted); }
nav { display: flex; gap: 1rem; flex-wrap: wrap; }
a { color: var(--accent); }
main { max-width: 1500px; margin: auto; padding: 0 1.4rem 2rem; }
.hero {
  border: 1px solid var(--line); background: linear-gradient(135deg, rgba(16,38,51,.9), rgba(7,19,28,.8));
  border-radius: 14px; padding: 1.25rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1.4rem;
}
.hero h2 { margin: 0 0 .35rem; }
.hero p { color: var(--muted); margin: 0; max-width: 850px; line-height: 1.5; }
.toolbar, .audio-panel, .state-panel {
  margin-top: .9rem; display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  border: 1px solid var(--line); background: rgba(11,28,40,.88); border-radius: 10px; padding: .7rem;
}
.toolbar label, .audio-panel label { display: flex; align-items: center; gap: .5rem; color: var(--muted); }
select { padding: .45rem .65rem; }
.file-button input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
#status { margin-left: auto; color: var(--muted); }
#status[data-kind="error"] { color: var(--danger); }
#status[data-kind="ok"] { color: var(--ok); }
#status[data-kind="wait"] { color: #ffd166; }
.workspace { display: grid; grid-template-columns: minmax(320px, .82fr) minmax(480px, 1.18fr); gap: .9rem; margin-top: .9rem; }
.editor-panel, .terminal-panel { min-width: 0; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .75rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.panel-head strong { color: var(--text); }
#source {
  display: block; width: 100%; min-height: 580px; resize: vertical; border: 0; border-radius: 0;
  background: #061018; color: #dcecf2; padding: .8rem; line-height: 1.35;
  font: 14px/1.35 "SFMono-Regular", Consolas, "Liberation Mono", monospace; tab-size: 4;
}
#terminal {
  margin: 0; min-height: 580px; max-height: 760px; overflow: auto; padding: .8rem;
  background: #160616; color: #16d8e8; white-space: pre; font: 16px/1.34 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.audio-help, #audio-state { color: var(--muted); }
.state-panel code { color: #b9eaf0; white-space: pre-wrap; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; margin-top: .9rem; }
.about-grid article { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: rgba(11,28,40,.72); }
.about-grid h3 { margin: 0 0 .4rem; }
.about-grid p { color: var(--muted); margin: 0; line-height: 1.5; }
footer { max-width: 1500px; margin: auto; padding: 0 1.4rem 1.5rem; color: var(--muted); }
.term-default { color: #16d8e8; }
.term-black { color: #050505; }
.term-red { color: #ff5252; }
.term-green { color: #62df8c; }
.term-yellow { color: #ffe066; }
.term-blue { color: #4fa8ff; }
.term-cyan { color: #16d8e8; }
.term-white { color: #f7fbff; }
.bg-default { background: transparent; }
.bg-black { background: #000; }
.bg-red { background: #b92535; }
.bg-yellow { background: #f4df52; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  #source { min-height: 330px; }
  #terminal { min-height: 520px; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar, .hero { align-items: flex-start; flex-direction: column; }
  main, .topbar, footer { padding-left: .75rem; padding-right: .75rem; }
  #status { width: 100%; margin-left: 0; }
  #terminal { font-size: 12px; }
}
