:root { --ink: #23262b; --muted: #5d6670; --line: #d5dbe0; --accent: #d42a1e; --bg: #f3f5f6; --card: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.45rem; margin: 4px 0 4px; }
h2 { font-size: 1.1rem; margin: 18px 0 6px; }
.lead { color: var(--muted); margin: 0 0 12px; }
.small, small { color: var(--muted); font-size: .85rem; }
#pad { width: 100%; aspect-ratio: 4 / 3; background: #fff; border: 1px solid var(--line); border-radius: 12px; touch-action: none; display: block; cursor: crosshair; }
#stage { width: 100%; aspect-ratio: 16 / 10; border-radius: 12px; display: block; background: #dde7ec; }
@media (max-width: 520px) { #stage { aspect-ratio: 4 / 3.4; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.lbl { min-width: 5.5em; color: var(--muted); font-size: .9rem; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 9px 14px; cursor: pointer; min-height: 44px; }
button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; width: 100%; font-size: 1.1rem; padding: 12px; }
button.ghost { background: transparent; }
.ink { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.ink.on { box-shadow: 0 0 0 3px var(--ink); }
#inks { display: flex; gap: 6px; margin-right: auto; }
#samples { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sample { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; }
.sample canvas { width: 100%; height: auto; border-radius: 6px; }
#readinfo { margin: 10px 0 0; }
#readinfo small { display: block; margin-top: 2px; }
#result { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
#result.win { border-color: #2c8f45; }
#result-text { margin: 0 0 6px; font-weight: 600; }
#tries { margin: 0; padding-left: 1.3em; color: var(--muted); font-size: .9rem; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 10px; overflow: hidden; font-size: .92rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
#steps li { margin: 4px 0; }
#courses { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
#courses button { padding: 6px 2px; min-height: 52px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .78rem; }
#courses button .ic { font-size: 1.25rem; line-height: 1; }
#courses button.done { border-color: #2c8f45; }
#courses button.done::after { content: '✓'; color: #2c8f45; font-weight: 700; font-size: .8rem; }
#goal { margin: 4px 0 8px; font-weight: 600; }
#clicks { display: flex; gap: 6px; }
#clicks button { min-width: 44px; }
#warnings { margin: 6px 0 0; color: #b0261b; font-weight: 600; font-size: .92rem; }
#warnings:empty { display: none; }
#builder { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 10px 0; }
#palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin: 6px 0; }
#palette button { padding: 4px 2px; font-size: .75rem; min-height: 40px; display: flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.1; }
#palette canvas { width: 64px; height: 32px; }
#palette button.remove { color: #b0261b; }
#board { width: 100%; aspect-ratio: 22 / 11.2; display: block; border: 1px solid var(--line); border-radius: 8px; touch-action: none; cursor: crosshair; }
#hint { min-height: 1.3em; margin: 6px 0 0; }
main:has(#test:not([hidden])) { max-width: 1240px; }
#split { display: grid; gap: 12px; }
#readinfo { margin: 0 0 4px; font-size: .92rem; }
#builder { margin: 0; }
@media (min-width: 900px) {
  #split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  #look { position: sticky; top: 8px; }
}
#question { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; }
#goal { margin: 2px 0 4px; font-weight: 400; color: var(--muted); }
#level { margin: 4px 0 8px; gap: 6px; }
#level button { min-height: 36px; padding: 5px 10px; font-size: .9rem; }
#level button.done { border-color: #2c8f45; }
#level button.done::after { content: ' ✓'; color: #2c8f45; }
#courses button.final { background: #fff6dc; border-color: #d9a42b; }
@media (max-width: 520px) { #courses { grid-template-columns: repeat(4, 1fr); } }
#steps { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 14px; }
@media (min-width: 900px) { #steps { grid-template-columns: 1fr 1fr; } }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.step img { width: 100%; height: auto; display: block; border-radius: 8px; }
.step p { margin: 6px 0 0; font-size: .92rem; }
.step-head { display: flex; gap: 12px; align-items: flex-start; }
.step-no { font-size: 1.6rem; font-weight: 800; line-height: 1; min-width: 1.4em; }
.take { list-style: none; margin: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fa; font-size: .85rem; display: grid; gap: 2px; }
.take li { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.warn { color: #b0261b; font-weight: 600; }
#all-parts { margin: 8px 0 14px; }
#all-parts summary { cursor: pointer; font-weight: 600; }
#how { list-style: none; counter-reset: how; padding: 0; margin: 4px 0 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#how li { counter-increment: how; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 8px 38px; position: relative; font-size: .88rem; color: var(--muted); }
#how li::before { content: counter(how); position: absolute; left: 10px; top: 7px; font-weight: 800; font-size: 1.2rem; color: var(--accent); }
#how b { color: var(--ink); }
@media (max-width: 620px) { #how { grid-template-columns: 1fr; } }
#coach { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff6dc; border: 1px solid #e9c46a; font-weight: 600; }
#builder.pulse { animation: pulse 1.2s ease-in-out 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 42, 30, 0); } 50% { box-shadow: 0 0 0 6px rgba(212, 42, 30, .35); } }
