:root {
  --ink: #1d2327;
  --muted: #5d6870;
  --line: #d8dde1;
  --soft: #f4f6f5;
  --accent: #1f6a47;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }

header { border-bottom: 1px solid var(--line); }
header .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 14px; padding-bottom: 14px; }
.site-name { font-weight: 700; color: var(--ink); text-decoration: none; }
nav a { color: var(--muted); text-decoration: none; margin-left: 18px; }
nav a:hover, nav a.active { color: var(--accent); }
nav a.active { font-weight: 600; }

main { padding: 28px 0 40px; }
h1 { font-size: 28px; line-height: 1.25; margin: 0 0 10px; }
h2 { font-size: 21px; margin: 34px 0 10px; }
h3 { font-size: 17px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.lead { color: var(--muted); max-width: 720px; }
a { color: var(--accent); }

.projects { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
.project { border: 1px solid var(--line); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; }
.project p { color: var(--muted); }
.project .btn { margin-top: auto; align-self: flex-start; }
.num { color: var(--accent); font-weight: 700; }

.btn {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 8px 16px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #18573a; }
.btn.outline { background: #fff; color: var(--accent); }
.btn.outline:hover { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.demo { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; align-items: start; margin-top: 12px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.controls input[type=file] { display: none; }

.stage { position: relative; background: #e9ecee; border-radius: 4px; overflow: hidden; min-height: 240px; }
.stage video, .stage img { display: none; width: 100%; height: auto; }
.stage canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.stage .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); }

.status { font-size: 14px; color: var(--muted); margin-top: 8px; }
.status.error { color: #a12b2b; }

.panel { border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.big { font-size: 26px; font-weight: 700; }
.small { font-size: 14px; color: var(--muted); }

.bar-row { display: grid; grid-template-columns: 80px 1fr 46px; gap: 8px; align-items: center; font-size: 14px; margin: 6px 0; }
.bar { height: 10px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .15s; }
.bar-row .pct { text-align: right; color: var(--muted); }
.bar-row.top { font-weight: 600; }

.bin { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.bin-color { width: 34px; height: 42px; border-radius: 3px 3px 6px 6px; border: 1px solid rgba(0,0,0,.25); }

ol.steps { padding-left: 20px; }
ol.steps li { margin-bottom: 6px; }
table { border-collapse: collapse; margin: 8px 0 12px; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }
th { background: var(--soft); }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { padding-top: 16px; padding-bottom: 24px; }

@media (max-width: 760px) {
  .projects, .demo { grid-template-columns: 1fr; }
  nav a { margin: 0 14px 0 0; }
}
