/* Turn the Crank - sweet-shop counter: cream paper, tomato-red enamel, mint and yolk. */
:root { --bg: #fff8ec; --panel: #fffdf7; --ink: #2a1d12; --sub: #6d5a48; --line: #ecd9bd; --accent: #d23b2f; --accent-ink: #ffffff; --mint: #1d7444; --pause-ink: #ffffff; --yolk: #f2b632; --sky: #2f77b8;
  --warn-bg: #fdeceb; --warn-ink: #8f2018; --info-bg: #eaf3fb; --info-ink: #1d4f7a; --shadow: 0 2px 0 #ecd9bd; color-scheme: light; }
:root[data-theme="dark"] { --bg: #16181d; --panel: #1f2229; --ink: #f1ece4; --sub: #c9c1b4; --line: #3a3f49; --accent: #ef6a5e; --accent-ink: #1b0e0c; --mint: #6fd29b; --pause-ink: #10202e; --yolk: #f5c95a; --sky: #7db8ec;
  --warn-bg: #3a1f1d; --warn-ink: #ffb4ac; --info-bg: #1c2b3a; --info-ink: #a9d1f5; --shadow: 0 2px 0 #0c0d10; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif; overflow-x: hidden; }
a { color: var(--accent); }
.hidden { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 0.88rem; } .muted { color: var(--sub); } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 3px solid var(--accent); }
.back { text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 26px; height: 26px; flex: none; } .lg-a { fill: var(--sky); opacity: .35; stroke: var(--sky); stroke-width: 1.4; } .lg-b { fill: var(--accent); }
.session { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; }
.pill:hover:not(:disabled) { background: var(--line); }
.pill.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill.solid:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.pill.ghost { border-color: var(--line); cursor: default; } .pill.tiny { padding: 3px 10px; font-size: 0.8rem; } .pill.big { padding: 10px 22px; font-size: 1.05rem; }
.pill:disabled { opacity: .45; cursor: not-allowed; }
main { max-width: 1060px; margin: 0 auto; padding: 8px 16px 32px; }
.hero { padding: 22px 0 6px; }
.kicker { margin: 0; color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .82rem; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.05; margin: 6px 0 10px; letter-spacing: -0.02em; }
.h1b { display: block; font-size: clamp(1rem, 2.6vw, 1.35rem); color: var(--sub); font-weight: 600; letter-spacing: 0; margin-top: 6px; }
.lede { max-width: 62ch; margin: 0 0 12px; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 2px dashed var(--sub); background: transparent; color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .88rem; cursor: pointer; }
.chip.on { border-style: solid; border-color: var(--mint); background: var(--panel); }
.panel { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 16px; margin: 16px 0; box-shadow: var(--shadow); }
.ph { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 1.2rem; margin: 0 0 12px; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.free { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--mint); border: 2px solid var(--mint); border-radius: 999px; padding: 1px 8px; }
.fld { margin: 0 0 12px; } .lab { display: block; font-weight: 700; margin-bottom: 4px; } .lenshint { display: block; font-weight: 400; font-size: .84rem; color: var(--sub); }
.inp { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px; }
.inp:focus { outline: 3px solid var(--yolk); outline-offset: 1px; } .inp.short { max-width: 140px; } .inp.drop { border-color: var(--mint); border-style: dashed; }
textarea.inp { resize: vertical; }
.twocol { display: grid; grid-template-columns: 1fr 200px; gap: 12px; }
.cardrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; } .cardrow.center { justify-content: center; }
.filebtn { cursor: pointer; }
.note { background: var(--info-bg); color: var(--info-ink); border-radius: 10px; padding: 8px 10px; }
.srcbadge { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; border-radius: 999px; padding: 2px 10px; background: var(--line); color: var(--ink); }
.srcbadge.made { background: var(--mint); color: var(--bg); }
.playgrid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
.machine { width: 100%; max-width: 360px; margin: 0 auto; } .machine svg { width: 100%; height: auto; display: block; }
.machine .crank { cursor: pointer; transform-box: fill-box; transform-origin: center; }
.machine .crank.hot { animation: nudge 1.6s ease-in-out infinite; }
.machine .crank.spin { animation: spin .8s cubic-bezier(.3, .7, .3, 1); }
.machine .ball.drop { animation: drop .45s cubic-bezier(.5, 0, .7, 1.4); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes nudge { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-14deg); } }
@keyframes drop { from { transform: translateY(-70px); opacity: .2; } to { transform: translateY(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .machine .crank.hot, .machine .crank.spin, .machine .ball.drop { animation: none; } }
.capsule-card { margin: 10px auto 0; max-width: 360px; border-radius: 16px; padding: 10px 14px; border: 3px solid var(--yolk); background: var(--bg); animation: pop .35s ease-out; }
.capsule-card.k-pause { border-color: var(--sky); } .capsule-card p { margin: 4px 0 0; font-weight: 700; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ckind { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; border-radius: 999px; padding: 1px 8px; background: var(--yolk); color: #2a1d12; }
.k-pause .ckind { background: var(--sky); color: var(--pause-ink); }
.pitch { margin: 0 0 10px; font-weight: 600; }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.move { display: flex; gap: 6px; align-items: stretch; }
.movebtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; }
.movebtn:hover { border-color: var(--ink); } .movebtn:active { transform: translateY(1px); }
.sw { flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .18); }
.mtext { flex: 1; min-width: 0; overflow-wrap: anywhere; } .mcount { flex: none; font-weight: 800; color: var(--sub); font-size: .85rem; }
.ptchip { flex: none; min-width: 50px; font: inherit; font-weight: 800; border-radius: 14px; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); cursor: pointer; }
.cheer { min-height: 1.5em; margin: 10px 0 6px; color: var(--mint); font-weight: 700; }
.tallyrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stopline { border-left: 4px solid var(--yolk); padding-left: 10px; }
.donebox { margin-top: 14px; border-top: 2px dashed var(--line); padding-top: 10px; } .donebox h3 { margin: 0 0 4px; } .donelist { margin: 6px 0 0; padding-left: 20px; }
.runrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.gate { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 10px; }
.steps { list-style: none; padding: 0; margin: 8px 0; } .step { padding: 3px 0; color: var(--sub); } .step.done { color: var(--mint); } .step.active { color: var(--ink); font-weight: 700; }
.step-ic { display: inline-block; width: 1.2em; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 10px; max-height: 300px; overflow: auto; }
.res-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-kick { margin: 0; font-weight: 700; color: var(--sub); }
.badge { font-size: .74rem; font-weight: 800; letter-spacing: .06em; border-radius: 999px; padding: 3px 10px; background: var(--line); color: var(--ink); }
.badge.on { background: var(--mint); color: var(--bg); }
.result h4 { margin: 16px 0 6px; }
.rpitch { font-size: 1.05rem; font-weight: 600; margin: 10px 0 0; }
.rmoves, .rcaps, .recon, .saved { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rmove { border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.rmhead { display: flex; align-items: center; gap: 8px; } .rmhead b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ptag { flex: none; font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 1px 8px; border: 2px solid var(--ink); }
.ptag.p3 { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); } .ptag.p1 { border-style: dashed; }
.rcheer { margin: 4px 0 0 26px; color: var(--sub); }
.rcap { display: flex; gap: 8px; align-items: baseline; } .rcap .ckind { flex: none; }
.recon li { border-radius: 10px; padding: 6px 10px; } .recon .warn { background: var(--warn-bg); color: var(--warn-ink); } .recon .info { background: var(--info-bg); color: var(--info-ink); }
li.none { color: var(--sub); font-style: italic; list-style: none; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; flex-wrap: wrap; }
.hinfo { display: flex; flex-direction: column; min-width: 0; } .hbtns { display: flex; gap: 6px; }
.foot { max-width: 1060px; margin: 0 auto; padding: 16px 16px 40px; color: var(--sub); font-size: .88rem; border-top: 2px solid var(--line); }
.toasts { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 20; width: min(92vw, 440px); }
.toast { background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 12px; transition: opacity .5s; font-size: .92rem; }
.toast.err { background: var(--warn-ink); } .toast.ok { background: var(--mint); color: var(--bg); } .toast a { color: inherit; font-weight: 700; } .toast.gone { opacity: 0; }
@media (max-width: 760px) { .playgrid { grid-template-columns: 1fr; } .twocol { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .back-t { display: none; } .bar { gap: 6px; padding: 8px 10px; } .session { gap: 4px; } .session .pill { padding: 5px 9px; font-size: .82rem; } .brand strong { font-size: .95rem; } .panel { padding: 13px; } }
@media print { .bar, .samples, .formpanel, .askbox, .histbox, .exports, .toasts, .cardrow { display: none !important; } .panel { box-shadow: none; } }
.vh-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) { .machine { max-width: 250px; } .capsule-card { margin-top: 6px; } }
