:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --label: #1d1d1f;
  --secondary-label: #6e6e73;
  --tertiary-label: #86868b;
  --separator: rgba(60, 60, 67, 0.18);
  --fill: rgba(118, 118, 128, 0.12);
  --accent: #007aff;
  --accent-pressed: #0064d2;
  --danger: #d70015;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 32px;
}

.workspace {
  max-width: 980px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--secondary-label);
  font-size: 13px;
  font-weight: 600;
}

.statusline {
  margin-top: 8px;
  color: var(--secondary-label);
  font-size: 15px;
}

.drop-zone,
.run-panel,
.status-panel,
.result-panel {
  border: 1px solid var(--separator);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 210px;
  padding: 28px;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--separator));
  background: var(--surface-solid);
}

.drop-zone.is-dragging {
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  color: var(--label);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0;
}

.drop-subtitle {
  max-width: min(720px, calc(100vw - 80px));
  color: var(--secondary-label);
  font-size: 15px;
  overflow-wrap: anywhere;
  text-align: center;
}

.run-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
}

.mode-summary {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--fill);
}

.mode-kicker,
.mode-title {
  display: block;
}

.mode-kicker {
  color: var(--tertiary-label);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.mode-title {
  margin-top: 3px;
  color: var(--label);
  font-size: 16px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0;
  transition: background-color 140ms ease, opacity 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--accent-pressed);
}

button:active {
  transform: scale(0.99);
}

button:disabled {
  cursor: not-allowed;
  background: rgba(118, 118, 128, 0.28);
  color: rgba(60, 60, 67, 0.5);
}

button.secondary {
  border: 1px solid var(--separator);
  background: var(--surface-solid);
  color: var(--accent);
}

button.secondary:hover {
  background: rgba(0, 122, 255, 0.08);
}

button.ghost {
  min-height: 34px;
  border: 1px solid var(--separator);
  background: var(--surface-solid);
  color: var(--secondary-label);
  padding: 0 12px;
}

button.ghost:hover {
  background: var(--fill);
  color: var(--label);
}

.status-panel,
.result-panel {
  margin-top: 16px;
  padding: 16px;
}

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

#routeBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--separator);
  border-radius: 999px;
  background: var(--surface-solid);
  color: var(--secondary-label);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
}

#routeBadge::before {
  content: "";
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: #34c759;
}

#statusText {
  color: var(--secondary-label);
  overflow-wrap: anywhere;
}

progress {
  inline-size: 100%;
  block-size: 10px;
  margin-top: 14px;
  accent-color: var(--accent);
}

pre {
  min-height: 240px;
  max-height: 430px;
  overflow: auto;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #1c1c1e;
  color: #f5f5f7;
  padding: 16px;
  font: 13px/1.5 "SF Mono", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

@media (max-width: 720px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .run-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 30px;
  }

  .drop-zone {
    min-height: 180px;
  }

  .panel-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  #routeBadge,
  button.ghost {
    justify-self: start;
  }
}
