:root {
  color-scheme: dark;
  --bg: #0b0d0b;
  --paper: #f4ecd8;
  --ink: #efe7d2;
  --muted: #9f998a;
  --panel: #151713;
  --panel-2: #1b1e18;
  --line: #36392f;
  --line-hot: #d4a84f;
  --green: #9ed36a;
  --amber: #e2ad50;
  --red: #d96b5d;
  --shadow: rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family: "IBM Plex Mono", "Cascadia Mono", "Noto Sans Mono", ui-monospace, monospace;
  background:
    linear-gradient(rgba(244, 236, 216, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 236, 216, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 12% 18%, rgba(158, 211, 106, 0.18), transparent 34rem),
    radial-gradient(circle at 88% 80%, rgba(226, 173, 80, 0.14), transparent 32rem),
    var(--bg);
  background-size: 22px 22px, 22px 22px, auto, auto, auto;
}

button, textarea, input { font: inherit; }

.app-frame {
  height: 100vh;
  padding: 14px;
  display: grid;
  grid-template-rows: 72px 1fr;
  gap: 12px;
}

.topbar, .panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.01)), var(--panel);
  box-shadow: 0 18px 60px var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.brand-block, .top-status, .panel-head, .button-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: #10110e;
  font-weight: 900;
  font-size: 24px;
  border-radius: 3px;
}

.product-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.product-subtitle, #status-detail, .kicker, .meta {
  color: var(--muted);
  font-size: 12px;
}

.top-status {
  min-width: 330px;
  justify-content: flex-end;
  text-align: right;
}

#status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 18px var(--amber);
}

#status-dot.ok { background: var(--green); box-shadow: 0 0 18px var(--green); }
#status-dot.bad { background: var(--red); box-shadow: 0 0 18px var(--red); }

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(420px, 1fr) 390px;
  gap: 12px;
}

.panel {
  min-height: 0;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head.compact { margin-bottom: 8px; }

.kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--line-hot);
  margin-bottom: 3px;
}

h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.03em;
}

.main-column {
  min-height: 0;
  display: grid;
  grid-template-rows: 250px 1fr;
  gap: 12px;
}

textarea {
  width: 100%;
  resize: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #0f110e;
  padding: 12px;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--line-hot);
  box-shadow: inset 0 0 0 1px rgba(212, 168, 79, 0.25);
}

button {
  border: 1px solid #d7b15d;
  background: #d7b15d;
  color: #11120f;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 900;
  border-radius: 2px;
}

button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.55; cursor: wait; }

button.secondary, button.mini {
  background: #20241c;
  color: var(--ink);
  border-color: var(--line);
}

button.mini { padding: 7px 9px; font-size: 12px; }
button.danger { color: #ffd5cf; border-color: rgba(217, 107, 93, 0.55); }

.terminal, .answer, .library {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  background: #0c0e0b;
  padding: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.terminal {
  margin-top: 10px;
  flex: 1;
  color: #c8d9b6;
}

.answer {
  margin-top: 10px;
  flex: 1;
}

.file-output { margin-top: 10px; }
.empty { color: var(--muted); }

.library {
  flex: 1;
  padding: 0;
  line-height: 1.2;
  white-space: normal;
}

.source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 15px 14px;
  column-gap: 8px;
  align-items: center;
  padding: 3px 7px;
  border-bottom: 1px solid var(--line);
}

.source:last-child { border-bottom: 0; }
.source strong {
  display: block;
  grid-column: 1 / 2;
  line-height: 1;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source a {
  display: block;
  grid-column: 1 / 3;
  color: var(--green);
  text-decoration: none;
  word-break: break-word;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source .meta {
  grid-column: 2 / 3;
  font-size: 9px;
  line-height: 1;
  color: #827d70;
  white-space: nowrap;
}

.right-column textarea { margin-top: 10px; }

.dropzone {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed #5a604f;
  background: repeating-linear-gradient(-45deg, #11140f, #11140f 8px, #151912 8px, #151912 16px);
  color: var(--muted);
  text-align: center;
  padding: 18px;
  cursor: pointer;
}

.dropzone input { display: none; }
.dropzone.has-file { color: var(--ink); border-color: var(--line-hot); }

.native-audio-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #10130f;
  padding: 10px;
}

.inline-head { margin-bottom: 6px; }
.hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

#native-audio-player {
  width: 100%;
  height: 34px;
}

@media (max-width: 1100px) {
  body { overflow: auto; height: auto; }
  .app-frame { height: auto; min-height: 100vh; }
  .workspace { grid-template-columns: 1fr; }
  .main-column { grid-template-rows: auto auto; }
  .panel { min-height: 260px; }
  .topbar { align-items: flex-start; flex-direction: column; height: auto; }
  .top-status { min-width: 0; text-align: left; justify-content: flex-start; }
}
