.sp-page { width: var(--page); margin: 0 auto; }
.sp-page [hidden] { display: none !important; }
.sp-page.page-columns, .sp-page .page-columns, #sp-explorer.page-columns { display: block !important; }
.sp-page .page-columns > * { grid-column: auto !important; }
.sp-heading { max-width: 800px; margin: 3rem 0 1.5rem; }
.sp-heading .eyebrow { color: var(--gold); margin-bottom: .7rem; }
.sp-heading h1 { color: var(--paper); font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 1.06; margin: 0 0 1rem; }
.sp-heading h1 em { color: var(--gold); }
.sp-heading > p:last-child { color: var(--soft); font-size: 1.05rem; max-width: 64ch; }
.sp-loading { color: var(--soft); }
.sp-page button { font-family: var(--sans); }
.sp-page button:focus-visible, .sp-page input:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }

.sp-panel { position: relative; margin-bottom: 1.5rem; padding: clamp(1.25rem, 3vw, 1.9rem); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.sp-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: var(--radius) var(--radius) 0 0; background: var(--rainbow); }
.sp-panel .eyebrow { margin-bottom: .3rem; }
.sp-panel h2 { margin: 0 0 .5rem; padding: 0; border: 0; color: var(--ink); font-size: clamp(1.7rem, 3vw, 2.3rem); }
.sp-sub { max-width: 80ch; margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }
.sp-note { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; max-width: 80ch; }

/* Machines */
.sp-machines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.sp-machine { display: grid; gap: .7rem; padding: 1.1rem 1.2rem; border-radius: 12px; background: #231c2e; color: #fff5e1; border-top: 5px solid var(--c); }
.sp-machine-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.sp-machine h3 { margin: 0; color: #fff5e1; font-size: 1.5rem; }
.sp-machine-head p { margin: .15rem 0 0; color: #b9adc9; font-family: var(--mono); font-size: .7rem; }
.sp-feel { margin: 0; color: #cfc4dc; font-size: .85rem; }
.sp-beat { flex: none; width: 18px; height: 18px; margin-top: .3rem; border-radius: 50%; border: 2px solid var(--c); transition: background .05s; }
.sp-beat.is-on { background: var(--c); box-shadow: 0 0 12px var(--c); }
.sp-listen { justify-self: start; padding: .45rem 1.2rem; border: 1.5px solid var(--c); border-radius: 999px; background: transparent; color: #fff5e1; font-size: .85rem; cursor: pointer; }
.sp-listen[aria-pressed="true"] { background: var(--c); color: #1f1830; }
.sp-speed { display: grid; gap: .3rem; font-size: .75rem; color: #b9adc9; }
.sp-speed span { font-family: var(--mono); letter-spacing: .05em; text-transform: uppercase; }
.sp-speed output { margin-left: .4rem; color: #fff5e1; text-transform: none; }
.sp-speed input { width: 100%; accent-color: var(--c); }
.sp-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; }
.sp-read div { padding: .5rem .6rem; border-radius: 8px; background: #2f2640; }
.sp-read dt { color: #b9adc9; font-family: var(--mono); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; }
.sp-read dd { margin: .15rem 0 0; color: #fff5e1; font-family: var(--sans); font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 560px) { .sp-read div { padding: .45rem .5rem; } .sp-read dd { font-size: .85rem; white-space: normal; } }

/* Rulers */
.sp-rulers { display: grid; gap: .9rem; margin: 1.3rem 0 .4rem; }
.sp-ruler { display: grid; grid-template-columns: 4rem minmax(0, 1fr); align-items: center; gap: .6rem; }
.sp-ruler-k { color: var(--muted); font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.sp-track { position: relative; height: 46px; border-radius: 8px; background: #fffaf0; box-shadow: inset 0 0 0 1px var(--paper-line); }
.sp-ticks span { position: absolute; bottom: 4px; transform: translateX(-50%); color: var(--muted); font-family: var(--mono); font-size: .66rem; }
.sp-ticks span::before { content: ""; position: absolute; left: 50%; bottom: 15px; width: 1px; height: 9px; background: #d8ccb7; }
.sp-mark { position: absolute; top: 4px; transform: translateX(-50%); display: grid; place-items: center; min-width: 26px; height: 20px; padding: 0 .3rem; border-radius: 5px; color: #1f1830; font-family: var(--mono); font-size: .7rem; font-style: normal; font-weight: 600; transition: left .08s linear; }
.sp-mark.is-t7 { background: #1fb5a9; transform: translateX(-100%); border-radius: 5px 0 0 5px; }
.sp-mark.is-t26 { background: #f2792b; transform: none; border-radius: 0 5px 5px 0; }
.sp-mark::after { content: ""; position: absolute; top: 100%; width: 2px; height: 8px; background: currentColor; }
.sp-mark.is-t7::after { right: -1px; background: #1fb5a9; }
.sp-mark.is-t26::after { left: -1px; background: #f2792b; }
.sp-gap { margin: .6rem 0 0; padding: .55rem .8rem; border-radius: 8px; background: #fbe3e3; font-size: .9rem; font-weight: 500; }
.sp-gap.is-near { background: #fdf0cf; }
.sp-gap.is-good { background: #d7f2ec; }
.sp-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.sp-btn { padding: .5rem 1rem; border: 1.5px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); font-size: .85rem; cursor: pointer; }
.sp-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.sp-play { min-width: 10rem; padding: .65rem 1.4rem; border: 0; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 1rem; font-weight: 600; cursor: pointer; }
.sp-play[aria-pressed="true"] { background: var(--ink); color: var(--gold); }

/* The deck: the tape, its bars, and the transport */
.sp-how { margin: .2rem 0 1.2rem; padding-left: 1.3rem; max-width: 80ch; color: var(--muted); font-size: .92rem; }
.sp-how li { margin: .25rem 0; }
.sp-how strong { color: var(--ink); }
.sp-deck { margin: 0 0 1.4rem; padding: 1rem 1.1rem 1.1rem; border-radius: 12px; background: #231c2e; color: #fff5e1; }
.sp-tape { position: relative; display: flex; align-items: stretch; height: 64px; border-radius: 6px; overflow: hidden; background: #3b2a1f; box-shadow: inset 0 0 0 2px #2a1d15; }
.sp-seg { display: flex; align-items: center; padding: 0 .7rem; flex-basis: 0; min-width: 0; overflow: hidden; white-space: nowrap; color: #1f1830; font-family: var(--mono); font-size: .75rem; font-weight: 600; }
.sp-seg.is-t7 { background: repeating-linear-gradient(90deg, #1fb5a9 0 18px, #1aa498 18px 20px); }
.sp-seg.is-t26 { background: repeating-linear-gradient(90deg, #f2792b 0 18px, #e06c22 18px 20px); }
.sp-splice { flex: none; display: grid; place-items: center; width: 28px; background: linear-gradient(105deg, #1fb5a9 0 45%, #fff5e1 45% 55%, #f2792b 55%); color: #1f1830; font-size: 1.1rem; }
.sp-dim { position: absolute; top: 0; bottom: 0; width: 0; background: rgba(20, 14, 28, .62); pointer-events: none; }
.sp-dim.is-l { left: 0; } .sp-dim.is-r { right: 0; }
.sp-head { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; margin-left: -1px; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.9); pointer-events: none; }
.sp-rewind { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 14, 28, .55); color: #fff5e1; font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: 0; transition: opacity .15s; pointer-events: none; }
.sp-tape.is-rewinding .sp-rewind { opacity: 1; }
.sp-bars { position: relative; height: 1.3rem; margin-top: .25rem; }
.sp-bars span { position: absolute; top: 0; padding-left: 4px; border-left: 1px solid #6d5f80; color: #b9adc9; font-family: var(--mono); font-size: .66rem; line-height: 1.3rem; }
.sp-bars span:first-child { border-left-color: transparent; }
.sp-transport { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin-top: .7rem; }
.sp-scope { display: inline-flex; border: 1.5px solid #b9adc9; border-radius: 999px; overflow: hidden; }
.sp-scope button { padding: .45rem .9rem; border: 0; background: transparent; color: #fff5e1; font-size: .82rem; cursor: pointer; }
.sp-scope button[aria-pressed="true"] { background: #fff5e1; color: #1f1830; }
.sp-cutline { display: grid; gap: .2rem; flex: 1 1 220px; max-width: 360px; font-size: .8rem; color: #b9adc9; }
.sp-cutline output { color: #fff5e1; font-weight: 600; }
.sp-cutline input { accent-color: #fff5e1; }
.sp-deck .sp-gap { margin-top: .9rem; color: var(--ink); }
.sp-deck .sp-status { color: #b9adc9; }
.sp-machine { transition: box-shadow .2s; }
.sp-machine.is-playing { box-shadow: 0 0 0 2px var(--c), 0 0 22px color-mix(in srgb, var(--c) 45%, transparent); }
.sp-status { margin: .8rem 0 0; color: var(--muted); font-size: .85rem; }
@media (max-width: 560px) { .sp-tape { height: 56px; } .sp-transport .sp-play { flex: 1 1 100%; } }

/* Story */
.sp-story > p:not(.eyebrow) { max-width: 80ch; }
.sp-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0 1.2rem; }
.sp-step { padding: 1rem 1.1rem; border: 1px solid var(--paper-line); border-radius: 10px; background: #fffaf0; font-size: .9rem; }
.sp-step h3 { margin: .4rem 0 .3rem; color: var(--ink); font-size: 1.15rem; }
.sp-step p { margin: 0; }
.sp-n { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--ink); color: var(--gold); font-family: var(--mono); font-size: .85rem; }
.sp-story a { color: var(--pink-ink); }
.sp-method { max-width: 90ch; margin: 1.75rem 0; color: var(--soft); font-size: .82rem; }
.sp-method a { color: var(--gold); }
.sp-signoff { margin: 2rem 0; text-align: center; font-family: var(--serif); font-size: 1.2rem; }

@media (max-width: 1000px) { .sp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .sp-machines { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .sp-steps { grid-template-columns: minmax(0, 1fr); }
  .sp-ruler { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .sp-seg { font-size: .62rem; padding: 0 .4rem; }
}

/* grab the drawing: the take markers slide along the rulers, and the splice slides along the tape */
.sp-mark { z-index: 1; }
.sp-mark.is-grabbing { z-index: 2; transition: none; }
.sp-mark::before { content: ""; position: absolute; inset: -10px -4px; }   /* a bigger catch for a fingertip */
.sp-tape .sp-seg, .sp-tape .sp-splice { pointer-events: none; }
.sp-tape { cursor: ew-resize; }
@media (prefers-reduced-motion: reduce) { .sp-mark { transition: none; } }
