:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f6f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #ffffff 0%, #f6f7fb 45%, #eef1f7 100%);
}

button, input, select { font: inherit; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 40px;
}

.hero {
  max-width: 820px;
  margin-bottom: 28px;
}

.eyebrow, .section-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #52627a;
}
h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.1rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 720px;
  margin: 22px 0 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.6;
  color: #4b5563;
}

.runtime-note {
  display: inline-flex;
  margin-top: 18px;
  padding: 8px 12px;
  border: 1px solid #dbe1ea;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #48566c;
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.45fr);
  gap: 20px;
  align-items: start;
}

.card {
  border: 1px solid #e0e5ed;
  border-radius: 22px;
  background: rgba(255,255,255,.93);
  box-shadow: 0 18px 50px rgba(26, 39, 63, 0.08);
}
.controls { padding: 24px; }
.result { padding: 24px; }

.step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.step-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: #111827;
  color: white;
  font-size: 0.82rem;
  font-weight: 750;
}

.grow { flex: 1; }
.control-label { font-weight: 700; }
.helper {
  margin: 6px 0 0;
  color: #667085;
  font-size: 0.92rem;
  line-height: 1.5;
}

.file-input {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  border: 1px dashed #bac3d2;
  border-radius: 14px;
  background: #fafbfc;
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: #eceff4;
}
.slider-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#threshold-value {
  min-width: 48px;
  text-align: right;
  color: #334155;
  font-variant-numeric: tabular-nums;
}

#threshold {
  width: 100%;
  margin-top: 13px;
  accent-color: #111827;
}

.run-button {
  width: 100%;
  margin-top: 24px;
  padding: 13px 18px;
  border: 0;
  border-radius: 14px;
  background: #111827;
  color: white;
  font-weight: 750;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.run-button:not(:disabled):hover { transform: translateY(-1px); }
.run-button:disabled { opacity: .38; cursor: not-allowed; }

.status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: #52627a;
  font-size: .9rem;
}

.progress-wrap {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}
.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #111827;
  transition: width .2s ease;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.result h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.badge {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #536176;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ready { background: #e8f7ef; color: #17623c; }
.badge.running { background: #fff4df; color: #805600; }
.badge.error { background: #fdecec; color: #9b2c2c; }

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border-radius: 16px;
  background: #101318;
}
#result-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.canvas-wrap.empty #result-canvas { display: none; }

#canvas-placeholder {
  margin: 0;
  padding: 32px;
  color: #9aa4b2;
  text-align: center;
}

.canvas-wrap:not(.empty) #canvas-placeholder { display: none; }

.summary {
  margin: 16px 0;
  padding: 13px 15px;
  border-radius: 13px;
  background: #f7f8fa;
  color: #344054;
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e8ebf0;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

th, td {
  padding: 11px 13px;
  border-bottom: 1px solid #edf0f4;
  text-align: left;
  vertical-align: top;
}

th {
  background: #fafbfc;
  color: #52627a;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tbody tr:last-child td { border-bottom: 0; }
.empty-row td { color: #7d899a; text-align: center; }

.explain {
  margin-top: 20px;
  padding: 22px 24px;
}

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.flow span:not(.arrow) {
  padding: 8px 11px;
  border-radius: 10px;
  background: #f2f4f7;
}

.arrow { color: #98a2b3; }

footer {
  padding: 22px 2px 0;
  color: #7a8595;
  font-size: .84rem;
}
@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 720px);
    padding-top: 34px;
  }

  .workspace { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: 280px; }
}

@media (max-width: 520px) {
  .card { border-radius: 17px; }
  .controls, .result, .explain { padding: 18px; }
  .result-head { align-items: center; }
  th, td { padding: 9px 10px; }
}

.or-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: #98a2b3;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.or-row::before, .or-row::after {
  content: '';
  height: 1px;
  flex: 1;
  background: #eceff4;
}

.sample-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.sample-title { margin: 0; }
.shuffle-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  color: #344054;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
}

.shuffle-button:hover { background: #f7f8fa; }
.sample-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.sample-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e0e5ed;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.sample-card:hover {
  transform: translateY(-1px);
  border-color: #aeb8c6;
  box-shadow: 0 8px 18px rgba(26,39,63,.08);
}
.sample-card.selected {
  border-color: #111827;
  box-shadow: 0 0 0 2px #111827;
}
.sample-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef1f5;
}

.sample-card span {
  display: block;
  padding: 8px 9px 9px;
  overflow: hidden;
  color: #475467;
  font-size: .78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .sample-head { align-items: center; }
  .sample-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* v1.0 teaching-flow refinements */
.lesson-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.lesson-strip span {
  padding: 8px 11px;
  border: 1px solid #dfe4ec;
  border-radius: 999px;
  background: rgba(255, 255, 255, .76);
  color: #52627a;
  font-size: .86rem;
}
.lesson-strip b {
  color: #111827;
  margin-right: 4px;
}

.coco-head {
  margin-top: 18px;
}
.input-kicker {
  margin: 0 0 4px;
  color: #344054;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.explain-title {
  max-width: 820px;
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.25;
  letter-spacing: -.025em;
}
.explain-copy {
  max-width: 900px;
  margin: 12px 0 18px;
  color: #536176;
  line-height: 1.65;
}
.extension-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid #eceff4;
  color: #5d6879;
  font-size: .92rem;
  line-height: 1.55;
}

.sample-card small {
  display: block;
  padding: 0 9px 9px;
  color: #8a94a4;
  font-size: .67rem;
  line-height: 1.2;
  letter-spacing: .01em;
}


/* v8 browser model selector */
.model-select {
  width: 100%;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid #cfd7e3;
  border-radius: 12px;
  background: #fff;
  color: #111827;
}
.model-select:focus {
  outline: 2px solid #111827;
  outline-offset: 2px;
}
