:root {
  --bg: #f3efe7;
  --ink: #161616;
  --muted: #5c574f;
  --accent: #0a5c48;
  --accent-soft: #d5eae2;
  --side-a: #1d4ed8;
  --side-b: #b45309;
  --diag: #9f1239;
  --paper: #fffdf8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(ellipse at 15% 0%, #ebe4d6 0%, transparent 55%),
    radial-gradient(ellipse at 90% 100%, #dde8e3 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
}
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px 14px 36px;
}
.crumb {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  margin: 0 0 12px;
  color: var(--muted);
}
.crumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.crumb a:hover { text-decoration: underline; }
header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 3.2vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: "Segoe UI", system-ui, sans-serif;
}
header .lead {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 48rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.98rem;
}
.stage {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid #ddd5c6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset;
}
.canvas-wrap {
  position: relative;
  order: 2;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.035) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  background-color: #faf8f2;
}
canvas {
  display: block;
  width: 100%;
  height: auto;
}
.live-bar {
  order: 1;
  border-bottom: 1px solid #1a2e28;
  background: #0f1714;
  color: #f4faf7;
  padding: 14px 18px;
  font-family: "Segoe UI", system-ui, sans-serif;
  min-height: 4.2rem;
}
.live-bar .live-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8fd0b8;
  margin-bottom: 4px;
}
.live-bar .live-text {
  display: block;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  line-height: 1.45;
  font-weight: 650;
}
.panel {
  order: 3;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid #ebe3d6;
  font-family: "Segoe UI", system-ui, sans-serif;
}
@media (min-width: 820px) {
  .panel { grid-template-columns: 1.35fr 0.9fr; }
}
.caption { padding: 14px 18px 10px; }
.step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.caption h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  font-weight: 750;
}
.caption p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}
.checklist {
  padding: 14px 18px;
  background: #f7f3ea;
  border-top: 1px solid #ebe3d6;
  font-size: 0.88rem;
  color: var(--muted);
}
@media (min-width: 820px) {
  .checklist { border-top: 0; border-left: 1px solid #ebe3d6; }
}
.checklist strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.checklist ol {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.45;
}
.checklist li { margin: 3px 0; }
.checklist li.done { color: var(--accent); font-weight: 600; }
.checklist li.current {
  color: var(--ink);
  font-weight: 700;
  background: #fff;
  margin-left: -6px;
  padding: 2px 6px;
  border-radius: 6px;
}
.controls {
  order: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #ebe3d6;
  background: #f7f3ea;
  font-family: "Segoe UI", system-ui, sans-serif;
}
button {
  appearance: none;
  border: 1px solid #d2caba;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  font-size: 0.92rem;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
button:hover { filter: brightness(0.97); }
button:disabled { opacity: 0.4; cursor: default; }
.progress {
  flex: 1;
  min-width: 120px;
  height: 7px;
  background: #e6dfd2;
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}
.speed {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}
.speed select {
  font: inherit;
  border: 1px solid #d2caba;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 12px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  margin-right: 7px;
  vertical-align: middle;
}
.legend .a::before { background: var(--side-a); }
.legend .b::before { background: var(--side-b); }
.legend .p::before { background: var(--diag); }
.note {
  margin-top: 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}
