:root {
  color-scheme: light;
  --ink: #181b22;
  --muted: #626b7a;
  --line: #d9dee8;
  --panel: #ffffff;
  --canvas: #eef2f7;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --accent-3: #374151;
  --good: #15803d;
  --shadow: 0 12px 38px rgba(24, 27, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f6f9;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover:not(:disabled),
button:focus-visible {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.14);
  outline-offset: 1px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(268px, 320px) 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  padding: 24px;
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h2,
.prediction p {
  margin: 0;
}

.brand h1 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.brand p,
.eyebrow,
.prediction .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.panel.compact {
  box-shadow: none;
}

.panel h2 {
  font-size: 0.96rem;
  margin-bottom: 12px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 138px;
  border: 1px dashed #aeb7c7;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  padding: 16px;
}

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

.drop-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
}

.source-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
  min-height: 38px;
  padding: 0 8px;
}

.segmented button.active {
  background: var(--accent-3);
  color: #fff;
}

.toggle-row,
.range-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.range-row {
  margin-top: 16px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 8px;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 24px;
  min-width: 0;
}

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

.topbar h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.6rem);
  line-height: 1.05;
}

.topbar button {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
}

.visualizer {
  display: grid;
  gap: 12px;
  min-height: 360px;
}

canvas {
  width: 100%;
  min-height: 174px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.prediction {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 360px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 24px;
  box-shadow: var(--shadow);
}

.prediction strong {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.95;
  word-break: break-word;
}

.prediction span {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metrics-grid div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  min-height: 82px;
}

.metrics-grid span,
.score-name {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.metrics-grid strong {
  display: block;
  margin-top: 9px;
  font-size: 1.18rem;
}

.score-list {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: 92px 1fr 54px;
  align-items: center;
  gap: 12px;
}

.score-track {
  height: 10px;
  border-radius: 999px;
  background: #e9edf5;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 220ms ease;
}

.score-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .prediction,
  .visualizer {
    min-height: 260px;
  }
}

@media (max-width: 620px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

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

  .topbar button {
    width: 100%;
  }

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

  .score-row {
    grid-template-columns: 76px 1fr 46px;
  }
}
