/* MAGWIC42 Studio. The colours, font and blueprint grid come from /static/design.css (shared with the website). */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line2); background: var(--surface); border-radius: var(--radius-s); padding: 8px 14px; min-height: 40px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .12s, border-color .12s, box-shadow .12s; }
button:hover { border-color: var(--ink3); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent); }
button.primary:hover { background: var(--brand2); border-color: var(--brand2); }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
button.ghost:hover { background: var(--surface2); }
button.danger { color: var(--bad); }
button.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
button.iconbtn { width: 40px; min-height: 40px; padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=number], input[type=search], input[type=email], select, textarea { background: var(--surface); border: 1px solid var(--line2); border-radius: var(--radius-s); padding: 8px 10px; width: 100%; min-height: 40px; }
input[type=range] { accent-color: var(--brand); }
textarea { resize: vertical; line-height: 1.45; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); font-weight: 600; }
.hint { color: var(--ink3); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* shell: top bar, side rail, the space */
.app { display: grid; grid-template-columns: 84px 1fr; grid-template-rows: 60px 1fr; height: 100vh; height: 100dvh; padding-top: env(safe-area-inset-top); }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -.2px; text-decoration: none; color: var(--ink); padding-right: 6px; }
.crumbs { color: var(--ink2); font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.crumbs a { color: var(--ink2); text-decoration: none; cursor: pointer; } .crumbs a:hover { color: var(--brand); }
.crumbs b { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save { font-size: 13px; color: var(--ink3); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.save i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.save.saving i { background: var(--amber); } .save.bad i { background: var(--bad); } .save.bad { color: var(--bad); }
.tbtns { display: flex; gap: 4px; align-items: center; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; text-decoration: none; }
.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; overflow-y: auto; }
.rail button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--ink2); padding: 9px 2px 7px; border-radius: 14px; min-height: 62px; box-shadow: none; }
.rail button .icon { width: 24px; height: 24px; }
.rail button.on { background: var(--brand-soft); color: var(--brand); }
.rail button:hover { color: var(--ink); background: var(--surface2); } .rail button.on:hover { color: var(--brand); background: var(--brand-soft); }
.rail .sep { flex: 1; }
main { overflow: auto; position: relative; min-width: 0; }
.page { max-width: 1320px; margin: 0 auto; padding: 32px 32px 64px; }
h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.6px; font-weight: 800; }
h2 { font-size: 19px; margin: 30px 0 12px; letter-spacing: -.2px; }
.sub { color: var(--ink2); margin: 0 0 20px; font-size: 16px; }

/* the work areas sit on the blueprint grid */
.map, .blocks, .artstage, .sndmain, .stagearea, .mechspace .bwork {
  background-color: var(--grid-bg);
  background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: calc(var(--gs, 20px) * 5) calc(var(--gs, 20px) * 5), calc(var(--gs, 20px) * 5) calc(var(--gs, 20px) * 5), var(--gs, 20px) var(--gs, 20px), var(--gs, 20px) var(--gs, 20px);
  background-position: var(--gx, 0) var(--gy, 0);
}

/* phones: the friendly "bigger screen" page (the size gate in app.js) */
.toosmall { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px 22px; gap: 8px; overflow: auto; }
.toosmall img { border-radius: 50%; box-shadow: var(--shadow-l); }
.toosmall h1 { font-size: 26px; margin-top: 10px; }
.toosmall p { max-width: 420px; margin: 0; color: var(--ink2); font-size: 16px; }
.toosmall .row { justify-content: center; margin: 12px 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 700; color: #fff; background: var(--brand); border-radius: 12px; padding: 10px 18px; min-height: var(--tap); }
.btn.alt { background: var(--surface); color: var(--brand); border: 2px solid var(--brand); }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column; }
.card:hover { border-color: var(--line2); transform: translateY(-1px); }
.card .cover { height: 120px; background: linear-gradient(135deg, var(--brand-soft), var(--amber-soft)); position: relative; }
.card .cover b { position: absolute; left: 14px; bottom: 10px; right: 14px; font-size: 20px; line-height: 1.1; color: var(--ink); }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card .meta { color: var(--ink3); font-size: 13px; }
.card.new { border-style: dashed; align-items: center; justify-content: center; min-height: 190px; color: var(--brand); font-weight: 800; background: transparent; box-shadow: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface2); color: var(--ink2); border: 1px solid transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); }
button.chip { min-height: 32px; padding: 4px 12px; font-size: 13px; cursor: pointer; border: 1px solid var(--line2); background: var(--surface); }
button.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kind { padding: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.kind .ic { font-size: 28px; }
.kind b { font-size: 17px; }
.soon { font-size: 11px; font-weight: 800; color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 99px; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; max-width: 720px; box-shadow: var(--shadow); }
.picks { display: flex; gap: 8px; flex-wrap: wrap; }
.pick { min-width: 64px; text-align: center; font-weight: 700; }
.pick.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.switch { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.switch input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); }

/* builder: map + panel */
.builder { display: grid; grid-template-columns: 1fr 380px; height: 100%; }
.map { position: relative; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.map.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.links path { fill: none; stroke: var(--ink3); stroke-width: 2; }
.links path.on { stroke: var(--brand); stroke-width: 3; }
.links path.drag { stroke: var(--brand); stroke-dasharray: 6 6; }
.links path.locked { stroke-dasharray: 4 5; }
.scard { position: absolute; width: 240px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); cursor: default; }
.scard.sel { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow); }
.scard.drop { border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.scard .h { padding: 10px 12px 6px; font-weight: 800; display: flex; gap: 6px; align-items: center; cursor: move; }
.scard .h span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: .3px; }
.tag.start { background: var(--brand-soft); color: var(--brand); }
.tag.good { background: var(--good-soft); color: var(--good); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.neutral { background: var(--surface2); color: var(--neutral); }
.tag.gm { background: var(--amber-soft); color: #a86b00; }
.scard .t { padding: 0 12px 8px; color: var(--ink2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scard .opts { border-top: 1px solid var(--line); }
.scard .opt { display: flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 13px; position: relative; }
.scard .opt + .opt { border-top: 1px dashed var(--line); }
.scard .opt span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .opt .if { color: #a86b00; font-size: 11px; }
.port { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink3); position: absolute; right: -11px; top: 50%; margin-top: -9px; cursor: crosshair; }
.port.set { border-color: var(--brand); background: var(--brand); }
.scard .add { padding: 6px 12px 10px; } .scard .add button { width: 100%; font-size: 13px; min-height: 30px; padding: 2px; border-style: dashed; color: var(--ink2); }
.roles { display: flex; gap: 3px; } .roles i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.maptools { position: absolute; left: 14px; top: 14px; display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); }
.maptools button { min-height: 34px; padding: 4px 10px; }
.maphint { position: absolute; left: 14px; bottom: 14px; color: var(--ink3); font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.panel { background: var(--surface); border-left: 1px solid var(--line); overflow: auto; padding: 18px 18px 80px; display: flex; flex-direction: column; gap: 14px; }
.panel h3 { margin: 0; font-size: 18px; }
.panel h4 { margin: 10px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); display: flex; align-items: center; gap: 6px; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.rule { background: var(--amber-soft); border-radius: var(--radius-s); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rule .row select, .rule .row input { width: auto; min-width: 0; flex: 1; min-height: 32px; padding: 4px 8px; }
.qa { width: 22px; height: 22px; min-height: 22px; padding: 0; border-radius: 50%; font-size: 12px; font-weight: 800; color: var(--ink3); border: 1px solid var(--line2); background: var(--surface); flex: none; }
.pop { position: fixed; z-index: 40; max-width: 300px; background: var(--ink); color: var(--bg); padding: 10px 12px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 700; z-index: 50; box-shadow: var(--shadow); }
.problems { display: flex; flex-direction: column; gap: 6px; }
.problem { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); cursor: pointer; }
.problem.error { background: var(--bad-soft); color: var(--bad); }
.banner { margin: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--amber-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* player */
.player { max-width: 960px; margin: 0 auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.stage { position: relative; aspect-ratio: 16 / 9; background: #0f1115; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stage canvas { position: absolute; }
.words { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; font-size: 17px; }
.words .who { font-weight: 800; color: var(--brand); margin-right: 6px; }
.words .sys { color: var(--ink3); font-size: 14px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices button { text-align: left; font-size: 16px; padding: 12px 16px; min-height: 48px; }
.choices button .tm { float: right; color: var(--amber); font-weight: 800; }
.ending { text-align: center; padding: 30px 20px; border-radius: var(--radius); }
.ending.good { background: var(--good-soft); } .ending.bad { background: var(--bad-soft); } .ending.neutral { background: var(--surface2); }
.devices { display: flex; gap: 8px; flex-wrap: wrap; }
.dev { font-size: 13px; padding: 6px 10px; border-radius: 99px; background: var(--surface2); }

@media (max-width: 900px) {
  .builder { grid-template-columns: 1fr; grid-template-rows: 1fr 45%; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .app { grid-template-columns: 1fr; grid-template-rows: 56px 1fr 64px; }
  .rail { grid-row: 3; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; }
  .rail button { min-width: 64px; }
  .rail .sep { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.shade { position: fixed; inset: 0; background: rgba(20, 20, 30, .35); display: grid; place-items: center; z-index: 60; padding: 16px; }
.dialog { background: var(--surface); border-radius: 16px; padding: 22px; max-width: 460px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 10px; }
.dialog h3 { margin: 0; font-size: 19px; } .dialog p { margin: 0; color: var(--ink2); }
details.box summary { cursor: pointer; } details.box p { margin: 8px 0 0; color: var(--ink2); }
a { color: var(--brand); }
.links path.back { opacity: .45; }
.links path.back.on { opacity: 1; }
.logo span { white-space: nowrap; }
.crumbs { overflow: hidden; white-space: nowrap; }
@media (max-width: 760px) { .logo span { display: none; } .top { gap: 6px; padding: 0 10px; } }

/* Art: tools | canvas | side, timeline below */
.art { display: grid; grid-template-columns: 84px 1fr 300px; grid-template-rows: 1fr auto; height: 100%; min-height: 0; }
.arttools { grid-row: 1; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; overflow: auto; align-items: stretch; }
.arttools button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; min-height: 52px; border-radius: 10px; color: var(--ink2); }
.arttools button .ic { font-size: 19px; line-height: 1.1; } .arttools button small { font-size: 10px; font-weight: 700; }
.arttools button.on { background: var(--brand-soft); color: var(--brand); }
.arttools .qa { align-self: center; }
.artstage { position: relative; overflow: hidden; touch-action: none; }
.artcanvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.artside { grid-row: 1; background: var(--surface); border-left: 1px solid var(--line); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.artside h4 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); display: flex; gap: 6px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.swatches .sw { width: 100%; aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 8px; border: 2px solid var(--line2); }
.swatches .sw.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.swatches input[type=color] { width: 100%; height: 100%; min-height: 30px; padding: 0; border: 2px solid var(--line2); border-radius: 8px; background: none; }
.artside input[type=range] { width: 100%; accent-color: var(--brand); }
.layers { display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.layer.on { border-color: var(--brand); background: var(--brand-soft); } .layer.target { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.layer canvas { background: #fff; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.layer input { flex: 1; min-width: 0; min-height: 30px; padding: 2px 6px; font-size: 13px; }
.layer button { min-height: 28px; padding: 2px 6px; }
.grip { cursor: grab; color: var(--ink3); font-weight: 800; padding: 0 2px; touch-action: none; user-select: none; }
.timeline { grid-column: 1 / -1; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.frames { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.frame { padding: 3px; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 0; }
.frame canvas { background: #fff; border-radius: 4px; } .frame.on { border-color: var(--brand); background: var(--brand-soft); }
.frame small { font-size: 11px; color: var(--ink3); }
.hint.bad { color: var(--bad); }
.cover.art { background: #fff; display: grid; place-items: center; height: 150px; overflow: hidden; }
.cover.art canvas { max-width: 100%; max-height: 150px; }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.stars { display: flex; } .star { border: 0; background: transparent; min-height: 30px; padding: 0 2px; color: var(--amber); font-size: 18px; }
.star:hover ~ .star { color: var(--line2); }
.dialog.wide { max-width: 620px; }
.terms { color: var(--ink2); padding-left: 18px; margin: 0; display: grid; gap: 4px; }
@media (max-width: 900px) {
  .art { grid-template-columns: 64px 1fr; grid-template-rows: 1fr auto auto; }
  .artside { grid-column: 1 / -1; grid-row: 3; max-height: 34vh; border-left: 0; border-top: 1px solid var(--line); }
  .timeline { grid-row: 2; }
}
.arttools { grid-column: 1; grid-row: 1; } .artstage { grid-column: 2; grid-row: 1; } .artside { grid-column: 3; grid-row: 1; } .timeline { grid-row: 2; }
.swatches .sw { max-width: 40px; }
.swatches { grid-template-columns: repeat(6, minmax(0, 40px)); }
@media (max-width: 900px) { .arttools { grid-column: 1; grid-row: 1; } .artstage { grid-column: 2; grid-row: 1; } .artside { grid-column: 1 / -1; grid-row: 3; } .timeline { grid-row: 2; } }

/* the stage */
.stagearea { flex: 1; overflow: auto; padding: 16px; }
.stagewrap { display: flex; flex-direction: column; gap: 12px; max-width: 1100px; margin: 0 auto; }
.stageframe { aspect-ratio: 16 / 9; width: 100%; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stagecanvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: move; }
.drawer { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.dpiece { padding: 4px; display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-height: 0; }
.dpiece.on { border-color: var(--brand); background: var(--brand-soft); }
.dpiece small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dthumb { background: #fff; border-radius: 6px; height: 70px; display: grid; place-items: center; overflow: hidden; }
.dthumb canvas { max-width: 100%; max-height: 70px; }
.builder > div { min-width: 0; }
.stagecanvas { max-width: 100%; }
.stageframe { max-height: calc(100vh - 220px); }
.stageframe { max-height: none; width: min(100%, calc((100vh - 220px) * 16 / 9)); align-self: center; }
.pentypes { display: flex; flex-wrap: wrap; gap: 5px; }
.pentypes .chip { min-height: 30px; }
details.adjust { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; gap: 6px; }
details.adjust summary { cursor: pointer; font-weight: 700; font-size: 13px; }

/* Sound: library | timeline | properties */
.snd { display: grid; grid-template-columns: 270px 1fr 290px; height: 100%; min-height: 0; }
.sndlib, .sndprops { background: var(--surface); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sndlib { border-right: 1px solid var(--line); } .sndprops { border-left: 1px solid var(--line); }
.sndprops h3 { margin: 0; font-size: 17px; } .sndprops h4 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); display: flex; gap: 6px; align-items: center; }
.sndprops input[type=range] { width: 100%; accent-color: var(--brand); }
.sndlist { display: flex; flex-direction: column; gap: 2px; }
.sndrow { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; font-size: 14px; } .sndrow:hover { background: var(--surface2); }
.sndrow button { min-height: 30px; }
.sndmain { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sndbar { position: sticky; left: 0; }
.tracks { position: relative; display: flex; flex-direction: column; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.trackrow { display: flex; gap: 6px; align-items: stretch; }
.trackhead { width: 120px; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; cursor: pointer; position: sticky; left: 0; z-index: 2; }
.trackhead.on { border-color: var(--brand); background: var(--brand-soft); }
.ruler { position: relative; height: 22px; flex: none; } .ruler span { position: absolute; top: 2px; font-size: 11px; color: var(--ink3); border-left: 1px solid var(--line2); padding-left: 3px; cursor: pointer; }
.lane { position: relative; height: 58px; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.lane.on { border-color: var(--brand); }
.clip { position: absolute; top: 6px; bottom: 6px; border-radius: 8px; background: #d8ccff; border: 2px solid #9b82ff; color: #2a1a66; font-size: 12px; font-weight: 700; padding: 3px 14px 3px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: grab; touch-action: none; user-select: none; }
.clip.rec { background: #ffe0c7; border-color: #ff9a52; color: #6b2e00; } .clip.beat { background: #cdeedd; border-color: #3fb97a; color: #0d4a2c; }
.clip.on { box-shadow: 0 0 0 3px var(--brand); }
.clip em { margin-left: 4px; font-style: normal; opacity: .7; }
.clip .grab { position: absolute; right: 0; top: 0; bottom: 0; width: 10px; cursor: ew-resize; background: rgba(0,0,0,.08); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); margin-left: 126px; pointer-events: none; z-index: 3; }
.meter { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; } .meter .level { display: block; height: 100%; width: 0; background: var(--good); }
.composer { gap: 8px; } .beatgrid { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.beatrow { display: flex; gap: 6px; align-items: center; } .beatrow select { width: 130px; flex: none; min-height: 32px; padding: 2px 6px; }
.steps { display: flex; gap: 3px; } .step { width: 28px; height: 28px; min-height: 28px; padding: 0; border-radius: 6px; background: var(--surface); }
.step.beat { border-color: var(--ink3); } .step.on { background: var(--brand); border-color: var(--brand); }
.cover.sound { display: grid; place-items: center; font-size: 48px; color: var(--brand); }
@media (max-width: 1000px) { .snd { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .sndlib, .sndprops { max-height: 30vh; border: 0; } }

/* mechanics: palette | blocks */
.mechwrap { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.mechwrap > .row input { max-width: 320px; font-weight: 700; }
.mechbody { display: grid; grid-template-columns: 210px 1fr; gap: 10px; flex: 1; min-height: 420px; }
.palette { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.palette h4 { margin: 8px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); }
.pblock { text-align: left; font-size: 13px; min-height: 32px; padding: 4px 10px; border-left-width: 5px; }
.pblock.trigger, .mblock.trigger { border-left-color: #ffb020; } .pblock.flow, .mblock.flow { border-left-color: #6d4aff; } .pblock.action, .mblock.action { border-left-color: #1f9d6b; }
.blocks { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); touch-action: none; cursor: grab; }
.blocks .links path { stroke: var(--ink3); } .blocks .links path.then { stroke: var(--good); } .blocks .links path.else { stroke: var(--bad); } .blocks .links path.body { stroke: var(--brand); stroke-dasharray: 5 4; } .blocks .links path.on { stroke-width: 3; }
.mblock { position: absolute; width: 230px; background: var(--surface); border: 2px solid var(--line); border-left-width: 6px; border-radius: 12px; box-shadow: var(--shadow); user-select: none; }
.mblock.sel { box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow); border-color: var(--brand); }
.mblock .mh { padding: 8px 10px; font-weight: 700; font-size: 13px; cursor: move; }
.mports { display: flex; gap: 6px; padding: 0 10px 8px; }
.mport { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--ink2); cursor: crosshair; touch-action: none; }
.mport.set { background: var(--brand-soft); color: var(--brand); }

.logo img { width: 30px; height: 30px; border-radius: 50%; display: block; }

/* people */
.pfp { border-radius: 50%; overflow: hidden; background: var(--brand-soft); display: grid; place-items: center; flex: none; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.pfp canvas { width: 100%; height: 100%; object-fit: cover; }
.personhead { gap: 18px; align-items: center; } .personhead h1 { margin: 0; }
.feed { display: flex; flex-direction: column; gap: 6px; } .feeditem { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: var(--ink); }
.pubbox { background: var(--brand-soft); border-color: var(--brand); }
.coverpick canvas { max-width: 160px; border-radius: 8px; display: block; margin-bottom: 6px; }
.shotbtn { padding: 2px; border: 3px solid var(--line, #ddd); border-radius: 10px; background: #120d22; width: 120px; height: 72px; overflow: hidden; display: grid; place-items: center; } .shotbtn.on { border-color: #7c3aed; } .shotbtn canvas { max-width: 100%; max-height: 100%; } .shotpick { color: #fff; font-size: 12px; }
.tour-shade { position: fixed; inset: 0; background: rgba(20,12,40,.45); z-index: 90; }
.tour-ring { position: fixed; z-index: 91; border: 3px solid #06b6d4; border-radius: 14px; box-shadow: 0 0 0 4px rgba(6,182,212,.3); pointer-events: none; transition: all .2s; }
.tour-card { position: fixed; z-index: 92; width: 320px; background: var(--surface, #fff); color: var(--ink, #1d1530); border-radius: 16px; padding: 16px 18px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.tour-card h3 { margin: 4px 0 6px; } .tour-card small { color: #8b82a3; font-weight: 700; } .tour-card .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.trydlg { width: min(1000px, 96vw); max-width: 96vw; } .trycols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; } .trycols h4 { margin: 12px 0 6px; }
.trywords { background: rgba(124,58,237,.08); border-radius: 10px; padding: 10px 12px; min-height: 40px; } .trybtns { display: flex; flex-wrap: wrap; gap: 6px; }
.trylog { max-height: 260px; overflow: auto; margin: 0; padding-left: 22px; font-size: 14px; } .trylog li.you { font-weight: 800; color: #7c3aed; } .trylog li.bad { color: #d64545; }
.trymem td { padding: 2px 8px; font-size: 14px; } @media (max-width: 800px) { .trycols { grid-template-columns: 1fr; } }
.ruleslist { padding-left: 22px; margin: 0; max-height: 46vh; overflow: auto; } .ruleslist li { margin: 6px 0; }
.dialog .drow { display: flex; gap: 8px; align-items: center; } .dialog label.check { display: flex; gap: 8px; align-items: flex-start; } .dialog.warn { border-top: 6px solid #ff8a1f; } .dialog .err { color: #d64545; font-weight: 700; }
.dialog fieldset.born { border: 0; padding: 0; display: flex; gap: 8px; } .dialog .m { color: #8b82a3; } .dialog .small { font-size: 14px; }
.uppreview { width: 140px; height: 140px; object-fit: contain; background: #f2ecfb; border-radius: 12px; } .warnbox { background: #fff1d6; color: #5a3200; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.revimg { width: 100%; max-height: 260px; object-fit: contain; background: #f2ecfb; } .row.wrap { flex-wrap: wrap; gap: 6px; } .row.wrap input[type=text] { flex: 1; min-width: 180px; }

/* ---- parts: the controls players use, over the stage */
.stage { position: relative; }
.partlayer { position: absolute; inset: 0; pointer-events: none; container-type: size; }
.partlayer > * { position: absolute; pointer-events: auto; box-sizing: border-box; font: 700 clamp(11px, 1.6cqw, 18px)/1.2 var(--font, system-ui); color: #fff; }
.part { border: 0; border-radius: 14px; background: rgba(20, 12, 40, .72); backdrop-filter: blur(4px); padding: 6px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; min-height: 0; }
button.part { cursor: pointer; } button.part:focus-visible, .part button:focus-visible, .part input:focus-visible { outline: 3px solid #06b6d4; outline-offset: 2px; }
.part-button.round { border-radius: 999px; background: linear-gradient(135deg, #7c3aed, #d946ef); }
.part-button.square { border-radius: 10px; background: linear-gradient(135deg, #7c3aed, #d946ef); }
.part-button.plain { background: rgba(255,255,255,.14); }
.part-button.invisible { background: transparent; backdrop-filter: none; }
.part-hold .progress, .part .mtrack { display: block; width: 90%; height: 10px; border-radius: 99px; background: rgba(255,255,255,.18); overflow: hidden; }
.part-hold .progress i, .part .mtrack b, .part .mtrack i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #06b6d4, #7c3aed); }
.part-mash { background: linear-gradient(135deg, #ff8a1f, #d946ef); } .part-mash b { font-size: 1.4em; }
.part-timing { position: absolute; background: rgba(20,12,40,.55); border-radius: 50%; overflow: hidden; }
.part-timing .target, .part-timing .ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; }
.part-timing .target { width: 80%; height: 80%; transform: translate(-50%, -50%); border: 4px dashed rgba(255,255,255,.6); }
.part-timing .ring { width: 100%; height: 100%; border: 5px solid #ff8a1f; transform: translate(-50%, -50%) scale(.5); }
.part-meter { background: rgba(20,12,40,.55); }
.part-meter.m-bar .mtrack { height: 40%; min-height: 10px; }
.part-meter.m-bottle .mtrack { width: 45%; height: 85%; border-radius: 10px 10px 16px 16px; display: flex; align-items: flex-end; border: 3px solid rgba(255,255,255,.6); }
.part-meter.m-bottle .mtrack b { width: 100%; background: linear-gradient(0deg, #0ea5e9, #67e8f9); }
.part-meter .mring { width: 70%; aspect-ratio: 1; border-radius: 50%; }
.part .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.part-knob input[type=range] { width: 90%; accent-color: #d946ef; }
.part-knob.k-knob .knob { width: 55%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #6b5b95, #2a1d52); border: 3px solid #d946ef; position: relative; }
.part-knob.k-knob .knob::after { content: ""; position: absolute; left: 50%; top: 6%; width: 4px; height: 30%; background: #fff; transform: translateX(-50%); border-radius: 2px; }
.part-keypad .kdisplay { background: #0b0816; border-radius: 6px; width: 90%; min-height: 1.4em; letter-spacing: .3em; font-family: ui-monospace, monospace; }
.part-keypad .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 92%; }
.part-keypad .keys button, .part-text button, .part-mic button, .part-screen .sopts button { border: 0; border-radius: 8px; background: rgba(255,255,255,.18); color: #fff; font: inherit; padding: 4px; min-height: 0; cursor: pointer; }
.part-keypad .keys .ok { background: #22c55e; }
form.part-text { flex-direction: row; flex-wrap: wrap; } .part-text input { flex: 1; min-width: 0; border-radius: 8px; border: 0; padding: 4px 8px; font: inherit; color: #1d1530; }
.part-drag { background: #fff; color: #1d1530; border-radius: 12px; cursor: grab; touch-action: none; }
.part-sequence .pads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 92%; flex: 1; }
.part-sequence .pad { border: 0; border-radius: 10px; opacity: .45; min-height: 0; cursor: pointer; } .part-sequence .pad.lit { opacity: 1; box-shadow: 0 0 18px #fff; }
.part-mic .mtrack { height: 8px; }
.part-screen { align-items: stretch; justify-content: flex-start; padding: 8px; overflow: hidden; }
.part-screen .stitle { text-align: center; } .part-screen .slines { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.part-screen .slines p { margin: 0; background: rgba(255,255,255,.14); border-radius: 10px; padding: 4px 8px; text-align: left; font-weight: 600; }
.part-screen .sopts { display: flex; flex-direction: column; gap: 4px; }
.part-screen.s-phone { border-radius: 22px; border: 4px solid #1d1530; background: #f3f4f6; color: #1d1530; }
.part-screen.s-phone .slines p { background: #e5e7eb; color: #1d1530; } .part-screen.s-phone .sopts button { background: #3b82f6; }
.part-screen.s-radio { background: #2b2b2b; border: 3px solid #888; font-family: ui-monospace, monospace; color: #9effa0; }
.part-screen.s-note { background: #fff8dc; color: #3b2f1e; border-radius: 4px; transform: rotate(-1deg); } .part-screen.s-note .slines p { background: transparent; }
@media (prefers-reduced-motion: reduce) { .part-timing .ring { transition: none; } }
.ctrls { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; } .ctrls button { font-size: 12px; }
.kitform { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow: auto; }
.mechbody > .stackbox { grid-column: 1 / -1; min-width: 0; } .stack { width: min(440px, 100%); } .stk .stktext { min-width: 0; overflow-wrap: anywhere; }

/* ======================================================================= the redesign (2026-12-01) */
/* cards and covers */
.card { border-radius: var(--radius); transition: transform .15s, box-shadow .15s, border-color .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); }
.card .cover { height: auto; aspect-ratio: 16 / 10; background: var(--grad); overflow: hidden; }
.card .cover.autocover canvas, .autocover canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cover.sound { display: grid; place-items: center; color: #fff; } .card .cover.sound .icon { width: 44px; height: 44px; }
.card.new { gap: 8px; } .card.new .icon { width: 28px; height: 28px; }
.kind .ic .icon { width: 30px; height: 30px; color: var(--brand); }
.chip.fn { background: color-mix(in srgb, #e64980 14%, transparent); color: #c2255c; }
.chip.good { background: var(--good-soft); color: var(--good); display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; }

/* big menus inside the editors (Drawings, Sounds, Kits) */
.dialog.sheet { max-width: min(1040px, 96vw); width: 100%; max-height: 90vh; overflow: auto; border-radius: var(--radius-l); padding: 22px 24px 26px; }
.dialog.sheet .sub { margin: 4px 0 6px; }
.sheeth { margin: 18px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink3); }
.dialog.sheet .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card.pick.on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.menubtn { border: 0; background: var(--brand-soft); color: var(--brand); flex-direction: column; gap: 2px; min-height: 56px; border-radius: 12px; font-weight: 700; }
.menubtn small { font-size: 10.5px; } .menubtn .icon { width: 22px; height: 22px; }
.menubtn.wide { flex-direction: row; justify-content: flex-start; min-height: 42px; width: 100%; padding: 6px 12px; gap: 8px; }
.tsep { height: 1px; background: var(--line); margin: 4px 6px; flex: none; }

/* Art */
.art { grid-template-columns: 88px 1fr 312px; }
.arttools button { min-height: 54px; }
.artside { gap: 12px; }
.timeline.folded { padding: 6px 12px; }
.timeline .row b { font-size: 14px; }
.cpick { display: flex; flex-direction: column; gap: 8px; }
.cwheelbox { display: grid; place-items: center; padding: 4px 0; }
.cwheel { touch-action: none; cursor: crosshair; border-radius: 50%; }
.cnow { width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line2); flex: none; box-shadow: inset 0 0 0 2px var(--surface); }
.chex { font-family: var(--mono); text-transform: lowercase; flex: 1; min-width: 0; }
.ctitle { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); margin-top: 2px; display: flex; gap: 6px; align-items: center; }
.cswatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.csw { aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 8px; border: 2px solid var(--line2); width: 100%; }
.csw.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.csw.add { background: var(--surface2); color: var(--ink2); font-weight: 800; font-size: 16px; border-style: dashed; }
.cswatches .hint { grid-column: 1 / -1; }

/* Sound: big coloured tracks that fill the screen */
.snd { grid-template-columns: 280px 1fr 300px; }
.sndmain { padding: 16px; gap: 14px; }
.sndbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; box-shadow: var(--shadow); }
.trackhead { width: 140px; border-radius: 12px; padding: 8px 10px; border-left: 6px solid var(--tc, var(--brand)); }
.lane { height: 84px; border-radius: 12px; background: color-mix(in srgb, var(--tc, var(--brand)) 7%, var(--surface)); border-color: color-mix(in srgb, var(--tc, var(--brand)) 25%, var(--line)); }
.lane.on { border-color: var(--tc, var(--brand)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc, var(--brand)) 30%, transparent); }
.lanehint { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink3); font-size: 13px; pointer-events: none; white-space: nowrap; }
.clip, .clip.rec, .clip.beat { background: color-mix(in srgb, var(--tc, #8b5cf6) 28%, var(--surface)); border-color: var(--tc, #8b5cf6); color: var(--ink); border-radius: 10px; }
.playhead { margin-left: 146px; width: 3px; border-radius: 2px; }
.sndlib .sndrow { font-size: 15px; padding: 6px; }

/* the block editor (inside an experience, and in the Mechanics space) */
.mechwrap { display: flex; flex-direction: column; height: 100%; min-height: 0; gap: 0; }
.stagearea:has(.mechwrap) { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.mechbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mechbar input { max-width: 300px; font-weight: 700; }
.bwork { flex: 1; min-height: 360px; position: relative; }
.bwork .blocklySvg { background: transparent; }
.blocklyToolboxDiv { padding-top: 6px; border-right: 1px solid var(--line); }
.blocklyTreeRow { border-radius: 0 10px 10px 0 !important; margin-bottom: 2px; height: 36px !important; line-height: 36px !important; padding-right: 12px !important; }
.blocklyTreeLabel { font: 700 14px var(--font) !important; }
.blocklyFlyoutButton .blocklyText { font-family: var(--font) !important; }
.blocklyWidgetDiv .blocklyMenu, .blocklyDropDownDiv { font-family: var(--font) !important; border-radius: 12px !important; }
.tips { margin: 0; padding-left: 18px; color: var(--ink2); font-size: 13px; display: grid; gap: 4px; }

/* the Mechanics space: list | blocks */
.mechspace { display: grid; grid-template-columns: 290px 1fr; height: 100%; min-height: 0; }
.mslist { background: var(--surface); border-right: 1px solid var(--line); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.mslist h4 { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); display: flex; gap: 6px; align-items: center; }
.mslist-items { display: flex; flex-direction: column; gap: 3px; }
.msitem { justify-content: flex-start; border: 1px solid transparent; background: transparent; min-height: 40px; padding: 6px 10px; text-align: left; font-weight: 600; box-shadow: none; }
.msitem:hover { background: var(--surface2); } .msitem.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.msitem .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mswork { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.msempty { flex: 1; display: grid; place-items: center; padding: 24px; }
.msempty-in { text-align: center; display: grid; gap: 8px; justify-items: center; max-width: 420px; }
.msempty-in .icon.big { width: 56px; height: 56px; color: var(--brand); }
.msempty .row { justify-content: center; }
.msabout { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.msabout h3 { font-size: 16px; margin: 0; }
.msabout h4 { margin: 4px 0 0; }
.learnbtn { justify-content: flex-start; text-align: left; gap: 10px; background: var(--grad); color: #fff; border: 0; padding: 10px 12px; border-radius: 14px; min-height: 56px; }
.learnbtn .icon { width: 26px; height: 26px; } .learnbtn small { opacity: .85; font-weight: 600; }
.lesson { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.lesson h3 { margin: 0; font-size: 18px; display: flex; align-items: center; }
.lesson .goal { margin: 0; font-weight: 600; }
.lesson ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--ink2); }
.lesson .challenge { margin: 0; font-size: 14px; background: var(--amber-soft); border-radius: 10px; padding: 8px 10px; }
.focus { display: flex; gap: 6px; flex-wrap: wrap; }
.fblock { font-size: 12px; font-weight: 700; color: #fff; background: var(--brand); padding: 4px 10px; border-radius: 8px 8px 8px 2px; }
.kitgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.kitcard { padding: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; }
.kitic { font-size: 26px; }

/* tablets held upright and narrow windows: work on top, tools in drawers */
@media (max-width: 1000px) {
  .mechspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .mslist { max-height: 34vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .art { grid-template-columns: 76px 1fr; }
  .artside { max-height: 38vh; }
}
@media (min-width: 1500px) { .page { max-width: 1480px; } .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }

/* dialogs and messages sit above the block editor (its drawer is z-index 70) */
.shade { z-index: 1000; } .toast { z-index: 1010; } .pop { z-index: 1020; } .installbar { z-index: 990; } .toosmall { z-index: 2000; }
.tour-shade { z-index: 1100; } .tour-ring { z-index: 1101; } .tour-card { z-index: 1102; }

/* Art on shorter screens (iPad sideways): the tools fit without scrolling */
@media (max-height: 860px) { .arttools { gap: 2px; padding: 6px 5px; } .arttools button { min-height: 44px; padding: 3px 2px; } .arttools button .icon, .arttools button .ic { font-size: 17px; } .arttools button small { font-size: 9.5px; } .menubtn { min-height: 46px; } }

.cover.workic { display: grid; place-items: center; background: var(--grad); color: #fff; } .cover.workic .icon { width: 46px; height: 46px; }
.newer { display: flex; gap: 8px; align-items: center; background: var(--amber-soft); border-radius: 10px; padding: 6px 8px; font-size: 13px; }
.switch.tick span { font-size: 14px; }

/* the Write space: outline | the page | about the story */
.write { display: grid; grid-template-columns: 250px 1fr 300px; height: 100%; min-height: 0; }
.woutline, .wside { background: var(--surface); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.woutline { border-right: 1px solid var(--line); } .wside { border-left: 1px solid var(--line); }
.woutline h4, .wside h4 { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink3); display: flex; gap: 6px; align-items: center; }
.wlist { display: flex; flex-direction: column; gap: 2px; }
.witem { justify-content: flex-start; text-align: left; border: 1px solid transparent; background: transparent; min-height: 36px; padding: 4px 8px; font-weight: 600; box-shadow: none; gap: 6px; }
.witem:hover { background: var(--surface2); } .witem.on { background: var(--brand-soft); color: var(--brand); }
.witem small { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.wend { font-size: 10px; } .wend.good { color: var(--good); } .wend.bad { color: var(--bad); } .wend.neutral { color: var(--ink3); }
.wwarn { color: #fff; background: var(--amber); border-radius: 99px; width: 18px; height: 18px; display: grid; place-items: center; font-size: 11px; font-weight: 800; flex: none; }
.wjoin { font-size: 12px; color: var(--ink3); padding: 2px 0; }
.weditor { overflow: auto; padding: 28px clamp(16px, 4vw, 56px); display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.weditor > * { max-width: 760px; width: 100%; margin-left: auto; margin-right: auto; }
.wtitle { font-size: 24px; font-weight: 800; border: 0; background: transparent; padding: 4px 0; flex: 1; }
.wtitle:focus { outline: none; border-bottom: 2px solid var(--brand); }
.wwords { min-height: 320px; font: 17px/1.7 Georgia, "Iowan Old Style", serif; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.wchoices { display: flex; flex-direction: column; gap: 6px; }
.wchoice { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 6px; align-items: center; }
.wchoice select, .wchoice input { min-height: 38px; font-size: 14px; }
.reader { max-width: 640px; }
.readwords p { font: 17px/1.7 Georgia, serif; margin: 0 0 10px; }
.reader .choices { margin-top: 12px; }
@media (max-width: 1100px) { .write { grid-template-columns: 220px 1fr; } .wside { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; } .wchoice { grid-template-columns: 1fr 1fr; } }
/* the writer's notes on a scene (made by Build this) */
.todo { display: flex; flex-direction: column; gap: 4px; }
.todo .row { background: var(--amber-soft); border-radius: 10px; padding: 6px 8px; font-size: 13px; }

/* teams */
.teambox { display: flex; flex-direction: column; gap: 8px; } .members { display: flex; flex-direction: column; gap: 4px; }
.teamnotes { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 6px; background: var(--surface2); border-radius: 12px; padding: 8px; }
.tnote { background: var(--surface); border-radius: 10px; padding: 6px 10px; } .tnote.mine { background: var(--brand-soft); } .tnote p { margin: 2px 0 0; font-size: 14px; } .tnote small { color: var(--ink3); font-size: 11px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink3); text-decoration: underline; font-size: 12px; }

.kitpick { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; } .kitpick input[type=text] { width: 180px; flex: none; }

/* the empty Mechanics area sits on the grid too */
.msempty { background-color: var(--grid-bg); background-image: linear-gradient(var(--grid-major) 1px, transparent 1px), linear-gradient(90deg, var(--grid-major) 1px, transparent 1px), linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px; }
