:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #1b1f24;
  --title: #18243a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #a15c07;
  --error: #b42318;
  --shadow: 0 18px 40px rgba(28, 37, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(164, 204, 249, 0.35), transparent 32%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 38%, #eef2f7 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

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

.panel,
.resultArea {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modeTabs {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.modeTab {
  height: 34px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.modeTab.active {
  color: #fff;
  background: var(--accent);
}

.modePanel {
  display: none;
}

.modePanel.active {
  display: block;
}

.heroHeader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 118px;
  padding: 10px 32px 20px;
  border-bottom: 1px solid rgba(39, 56, 88, 0.14);
}

.heroBrand {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.heroBrand img {
  width: clamp(180px, 20vw, 280px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 12px 24px rgba(15, 38, 67, 0.14));
}

.heroDivider {
  width: 1px;
  height: 58px;
  background: linear-gradient(180deg, transparent, rgba(34, 57, 91, 0.25), transparent);
}

.heroTitle {
  min-width: 0;
}

.heroTitle h1 {
  margin: 0;
  color: var(--title);
  font-size: clamp(32px, 4vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
}

.status {
  min-width: 92px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.status.ok {
  border-color: rgba(15, 118, 110, 0.3);
  color: var(--accent-strong);
  background: #ecfdf8;
}

.status.error {
  border-color: rgba(180, 35, 24, 0.3);
  color: var(--error);
  background: #fff3f1;
}

.panel {
  padding: 18px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span,
.toggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #fbfcfe;
  color: var(--ink);
}

.field input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.span-2 {
  grid-column: span 2;
}

.span-all {
  grid-column: 1 / -1;
}

.dropzone {
  display: flex;
  align-items: center;
  min-height: 76px;
  border: 1px dashed #b8c2d4;
  border-radius: 8px;
  padding: 14px 16px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.dropzone:hover,
.dropzone:focus,
.dropzone.dragging {
  outline: 0;
  border-color: var(--accent);
  background: #f2fbf8;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.dropzoneText {
  display: grid;
  min-width: 0;
}

.dropzoneText strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle {
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

button {
  height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.is-hidden {
  display: none !important;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 110px;
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  min-width: 92px;
  color: var(--ink);
  background: #eef2f6;
}

.danger {
  min-width: 92px;
  color: var(--error);
  background: #eef2f6;
}

.danger:hover:not(:disabled) {
  color: #9f1d14;
  background: #fff3f1;
}

.playIcon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.runtime {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.runtime.error {
  color: var(--error);
}

.runtime.warn {
  color: var(--warn);
}

.resultArea {
  min-height: 360px;
  overflow: hidden;
}

.resultHeader {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.resultHeader h2 {
  margin: 0;
  font-size: 15px;
}

.resultText {
  margin: 0;
  min-height: 294px;
  padding: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #111827;
  font-size: 17px;
  line-height: 1.7;
  background: #fff;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 760px);
    padding: 10px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .heroHeader {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
    padding: 16px 4px 18px;
  }

  .heroBrand {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .heroBrand img {
    width: min(220px, 70vw);
  }

  .heroDivider {
    display: none;
  }

  .heroTitle h1 {
    font-size: 30px;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .actions {
    flex-wrap: wrap;
  }

  .runtime {
    width: 100%;
    margin-left: 0;
  }
}
