/* AEMDAW — tutorial.css (v1.5)
 * A página do tutorial usa as cores de style.css (modo claro e escuro); o palco usa as
 * cores do estúdio (daw.css, .daw-skin), para a réplica ser igual ao que se vê no estúdio.
 */

.tut { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }
.tut-head { padding: 2.4rem 0 1.2rem; }
.tut-head h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.1; }
.tut-head .lede { max-width: 46rem; }

/* ---------- capítulos ---------- */
.chapters ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem; }
.chapters button {
  display: inline-flex; align-items: center; gap: .45rem;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: .35rem .8rem .35rem .4rem; cursor: pointer; color: var(--text-soft); font-size: .9rem;
}
.chapters button:hover { border-color: var(--ochre-soft); }
.chapters .ch-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--well); font-family: var(--serif); font-weight: 600; font-size: .85rem; }
.chapters button[aria-current=step] { border-color: var(--ochre); color: var(--text); }
.chapters button[aria-current=step] .ch-n { background: var(--ochre); color: var(--on-accent); }
.chapters button.done .ch-n { background: var(--ochre-soft); color: var(--on-accent); }

/* ---------- legenda e controlos ---------- */
.player { border-top: 1px solid var(--line); padding-top: 1rem; }
.progress { height: 3px; background: var(--line-soft); margin-top: .6rem; }
.progress span { display: block; height: 100%; width: 0; background: var(--ochre); }
.caption { padding: .2rem 0 .9rem; min-height: 10.5rem; }
.scene-kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: var(--ochre); margin: 0 0 .3rem; }
.caption h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); margin-bottom: .3rem; }
.caption p#scene-text { font-family: var(--serif); font-size: 1.08rem; color: var(--text-soft); max-width: 52rem; }
.scene-sound { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }
.scene-sound .btn[aria-pressed=true] { border-color: var(--ochre); background: var(--bg-2); }
.tut-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem 0; border-top: 1px solid var(--line-soft); }
.tut-opts { display: inline-flex; flex-wrap: wrap; gap: .4rem 1rem; margin-left: auto; }
.tut-keys { margin: 0 0 1.4rem; }

/* ---------- guião em texto ---------- */
.guiao { padding-left: 0; padding-right: 0; }
.guiao h3 { font-size: 1.2rem; margin: 1.4rem 0 .5rem; }
.script-list { padding-left: 1.6rem; margin: 0; max-width: 52rem; }
.script-list li { margin: .5rem 0 .9rem; padding-left: .3rem; }
.script-list li::marker { font-family: var(--serif); color: var(--ochre); }
.script-list strong { font-family: var(--serif); font-size: 1.05rem; }
.script-list p { margin: .2rem 0; color: var(--text-soft); }
.linkish { background: none; border: 0; padding: 0; color: var(--ochre); text-decoration: underline; cursor: pointer; font-size: .9rem; }

/* ==================================================================
 * Palco: a réplica do estúdio
 * ================================================================== */
.stage-wrap { border: 1px solid var(--line); background: var(--bg); padding: .6rem; border-radius: 4px; }
.stage {
  position: relative; min-height: 280px; overflow: hidden;
  display: flex; flex-direction: column; gap: .5rem;
  font: 12.5px/1.3 var(--sans); color: var(--text);
  user-select: none;
}
.stage.tall { min-height: 470px; }
.m-off { display: none !important; }

/* zonas: só aparecem as que a cena pede */
.m-zone { display: none; transition: opacity .3s, box-shadow .3s; }
.show-top .m-top, .show-hint .m-hint, .show-seq .m-seq, .show-piano .m-piano-win, .show-rec .m-rec,
.show-tl .m-tl, .show-mix .m-mix, .show-master .m-master { display: flex; }
.stage.dim .m-zone:not(.focus) { opacity: .3; }
.m-zone.focus { box-shadow: 0 0 0 2px var(--ochre); }

/* controlos genéricos */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  padding: .22rem .55rem; border: 1px solid var(--line); border-radius: 3px; white-space: nowrap;
  background: linear-gradient(var(--btn-hi), var(--btn-lo)); color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08); transition: transform .12s;
}
.m-btn.sm { padding: .14rem .45rem; font-size: 11.5px; }
.m-btn.icon { width: 28px; padding: .22rem 0; font-size: 12px; }
.m-btn.play { color: var(--green); }
.m-btn.rec, .m-btn.recb { color: var(--terra); }
.m-btn.strong { border-color: var(--ochre-soft); }
.m-btn.primary { background: linear-gradient(var(--ochre-hi), var(--ochre)); border-color: var(--ochre-soft); color: var(--on-accent); font-weight: 600; }
.m-btn.on { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green), 0 0 6px color-mix(in srgb, var(--green) 40%, transparent); }
.m-btn.rec.on, .m-btn.recb.on { border-color: var(--terra); background: var(--rec-bg); box-shadow: 0 0 6px color-mix(in srgb, var(--terra) 50%, transparent); }
.m-lcd {
  display: inline-block; background: var(--lcd-bg); color: var(--lcd-text); border: 1px solid #000; border-radius: 2px;
  padding: .14rem .4rem; font: 600 12px/1.2 var(--mono); letter-spacing: .03em; white-space: nowrap;
  text-shadow: 0 0 5px color-mix(in srgb, var(--lcd-text) 45%, transparent);
}
.m-lcd.small { font-size: 9.5px; padding: .08rem .2rem; }
.m-lab { color: var(--muted); font-size: 11.5px; }
.m-field { display: inline-flex; align-items: center; gap: .3rem; }
.m-check { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.m-check::before { content: ""; display: inline-block; width: 11px; height: 11px; border: 1px solid var(--line); border-radius: 2px; margin-right: .3rem; vertical-align: -1px; background: var(--well); }
.m-check.checked::before { background: var(--ochre); border-color: var(--ochre); box-shadow: inset 0 0 0 2px var(--well); }
.m-select { border: 1px solid var(--line); border-radius: 2px; padding: .12rem .4rem; background: var(--well); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-select::after { content: " ▾"; color: var(--muted); }
.m-input { display: inline-block; min-width: 9rem; min-height: 1.4em; border: 1px solid var(--line); border-radius: 2px; padding: .12rem .4rem; background: var(--well); }
.m-input::after { content: "|"; color: var(--ochre); animation: m-blink 1s steps(1) infinite; }
@keyframes m-blink { 50% { opacity: 0; } }
.m-srow { display: inline-flex; align-items: center; gap: .35rem; }
.m-slider { display: inline-block; position: relative; height: 6px; width: 90px; background: var(--well); border: 1px solid var(--line); border-radius: 3px; vertical-align: middle; }
.m-slider i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ochre); border-radius: 3px; transition: width .2s; }
.m-slider i::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--ochre); border: 2px solid var(--panel); }
.m-val { font: 11px var(--mono); text-align: right; min-width: 3.4rem; background: var(--lcd-bg); color: var(--lcd-text); border: 1px solid #000; border-radius: 2px; padding: .05rem .25rem; white-space: nowrap; }
.m-meter { display: inline-block; position: relative; width: 140px; height: 8px; background: var(--lcd-bg); border: 1px solid #000; overflow: hidden; vertical-align: middle; }
.m-meter.thin { height: 5px; width: 120px; }
.m-meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--green) 0 65%, #e6d23c 85%, var(--danger)); transition: width .15s; }
.m-lamp { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #000; background: #3a2a2a; flex: none; }
.m-lamp.on { background: radial-gradient(circle at 35% 35%, #d6ff9c, var(--green) 55%, #3e6a1c); box-shadow: 0 0 6px var(--green); }
.m-lamp.rec { background: var(--terra); animation: m-pulse 1s infinite; }
@keyframes m-pulse { 50% { opacity: .3; } }
.m-led { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid #000; background: radial-gradient(circle at 35% 35%, #59636a, #2a3035); flex: none; }
.m-led.on { background: radial-gradient(circle at 35% 35%, #d6ff9c, var(--green) 55%, #3e6a1c); box-shadow: 0 0 5px color-mix(in srgb, var(--green) 70%, transparent); }

/* barra de ferramentas e barra de dicas */
.m-top {
  flex-wrap: wrap; align-items: center; gap: .35rem .7rem; padding: .35rem .5rem;
  background: linear-gradient(var(--title-hi), var(--title-bg)); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow);
}
.m-brand { font-weight: 700; letter-spacing: .1em; font-size: 12px; color: var(--title-text); }
.m-group { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.m-views .m-btn { font-size: 11px; }
.m-right { margin-left: auto; }
.m-clock { min-width: 7.6rem; text-align: center; }
.m-hint {
  align-items: center; padding: .25rem .6rem; background: var(--lcd-bg); color: var(--lcd-text); border: 1px solid #000; border-radius: 2px;
  font: 11.5px/1.3 var(--mono); min-height: 1.9em;
}
.m-hint::before { content: "›"; margin-right: .45rem; color: var(--lcd-dim); }

/* janelas */
.m-win { flex-direction: column; gap: .35rem; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 0 .55rem .5rem; }
.m-whead {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem;
  margin: 0 -.55rem; padding: .25rem .5rem; border-bottom: 1px solid var(--line); border-radius: 4px 4px 0 0;
  background: linear-gradient(var(--title-hi), var(--title-bg));
}
.m-arrow { width: 0; height: 0; border-style: solid; border-width: 5px 4px 0; border-color: var(--title-text) transparent transparent; }
.m-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--title-text); }
.m-alias { font-size: 11px; color: var(--muted); margin-right: auto; }
.m-wtools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-left: auto; }
.m-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; padding: .3rem .4rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px; }
.m-midi { margin-left: auto; }

/* sequenciador */
.m-tabs { display: inline-flex; background: var(--lcd-bg); border: 1px solid #000; border-radius: 2px; overflow: hidden; }
.m-tabs-l { padding: .12rem .4rem; color: var(--lcd-dim); font: 11px var(--mono); }
.m-tab { padding: .12rem .5rem; border-left: 1px solid #000; font: 700 11px var(--mono); color: var(--lcd-dim); }
.m-tab.on { color: var(--lcd-text); text-shadow: 0 0 5px color-mix(in srgb, var(--lcd-text) 50%, transparent); }
.m-rack { background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px; padding: .1rem .4rem; }
.m-empty { margin: .7rem 0; color: var(--muted); text-align: center; }
.m-track { display: grid; grid-template-columns: minmax(170px, 230px) minmax(0, 1fr); gap: .25rem .7rem; align-items: center; padding: .25rem 0; border-top: 1px solid var(--line); animation: m-rise .3s ease-out; }
.m-track:nth-child(2) { border-top: 0; }
.m-tctl { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.m-tname {
  flex: 0 0 auto; padding: .15rem .45rem; border: 1px solid var(--line); border-radius: 3px; font-weight: 600;
  background: linear-gradient(var(--btn-hi), var(--btn-lo)); white-space: nowrap; max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis;
}
.m-tsound { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); }
.m-mini { border: 1px solid var(--line); border-radius: 3px; padding: 0 .35rem; font-weight: 600; background: linear-gradient(var(--btn-hi), var(--btn-lo)); }
.m-mini.on { background: var(--mute-bg); border-color: var(--ochre); color: var(--ochre-hi); }
.m-grid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m-steps, .m-notes { display: grid; grid-template-columns: repeat(16, minmax(0, 26px)); gap: 3px; }
.m-step { height: 22px; border: 1px solid var(--step-edge); border-radius: 3px; background: var(--step-a); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); transition: background-color .12s; }
.m-steps > .m-step:nth-child(8n+5), .m-steps > .m-step:nth-child(8n+6), .m-steps > .m-step:nth-child(8n+7), .m-steps > .m-step:nth-child(8n+8) { background: var(--step-b); }
.m-steps > .m-step.on { background: var(--step-on); box-shadow: 0 0 4px color-mix(in srgb, var(--step-on) 35%, transparent); }
.m-steps > .m-step.soft { background: var(--step-soft); }
.m-step.now { box-shadow: inset 0 0 0 2px var(--ochre); }
.m-notes { display: none; }
.m-notes.open { display: grid; }
.m-note { font: 9px var(--mono); text-align: center; border: 1px solid #000; border-radius: 2px; padding: .1rem 0; background: var(--lcd-bg); color: var(--lcd-text); opacity: .3; white-space: nowrap; overflow: hidden; }
.m-note.on { opacity: 1; }

/* piano */
.m-piano-win .m-wtools .m-btn { font-size: 11px; }
.m-piano {
  position: relative; display: flex; height: 112px; padding: 5px 5px 0; border: 1px solid var(--line); border-radius: 3px;
  background: linear-gradient(#20262a, #14181b); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
}
.m-key { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; transition: background .08s; }
.m-key.white { flex: 1 1 0; min-width: 0; margin-right: 1px; padding-bottom: 6px; border-radius: 0 0 3px 3px; background: linear-gradient(#f4f4f0, #fff 70%, #e4e4de); box-shadow: inset 0 -4px 0 #cfcfc8; }
.m-key.white:last-child { margin-right: 0; }
.m-key.black { position: absolute; top: 5px; height: 60%; z-index: 2; padding-bottom: 4px; border-radius: 0 0 2px 2px; background: linear-gradient(#3a3f44, #111417 85%); box-shadow: inset 0 -3px 0 #000, 0 2px 3px rgba(0, 0, 0, .5); }
.m-key.white.down { background: linear-gradient(#ffd18f, #f6ae4c); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .25); }
.m-key.black.down { background: linear-gradient(#c87a1c, #8a4f0a 85%); }
.m-key.middle::before { content: ""; position: absolute; top: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #b8650a; }
.m-kn { font: 600 9px var(--sans); color: #6b6f73; }
.m-kl { display: none; font: 700 9px var(--mono); padding: 1px 3px; border-radius: 2px; color: #3b4045; background: rgba(0, 0, 0, .07); border: 1px solid rgba(0, 0, 0, .15); }
.m-key.black .m-kl { color: #e6ebee; background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); }
.stage.kbd .m-kl { display: inline-block; }

/* gravação */
.m-reclive { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; padding-top: .2rem; }
.m-review { display: none; flex-wrap: wrap; align-items: center; gap: .45rem .7rem; padding-top: .2rem; }
.m-review.open { display: flex; }
.m-audio { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 999px; padding: .14rem .6rem .14rem .4rem; background: var(--well); }
.m-count { display: none; position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); z-index: 9; font: 700 54px/1 var(--mono); color: var(--lcd-text); background: var(--lcd-bg); border: 1px solid #000; border-radius: 4px; padding: .2rem .8rem; text-shadow: 0 0 10px var(--lcd-text); }
.m-count.shown { display: block; animation: m-pop .5s ease-out; }
@keyframes m-pop { from { transform: translateY(-50%) scale(1.4); opacity: .3; } }

/* linha do tempo */
.m-tl-body { position: relative; border: 1px solid var(--line); background: var(--bg-2); border-radius: 2px; }
.m-ruler { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); background: linear-gradient(var(--title-hi), var(--title-bg)); border-bottom: 1px solid var(--line); }
.m-ruler span { padding: 0 .3rem; font: 600 10px var(--sans); color: var(--title-text); border-left: 1px solid var(--line); }
.m-arr { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px; padding: 3px; background: var(--well); border-bottom: 1px solid var(--line); }
.m-cell { text-align: center; font-weight: 700; padding: .14rem 0; color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .5); border: 1px solid rgba(0, 0, 0, .45); border-radius: 3px; transition: background-color .15s; }
.m-cell.pA { background: var(--pat-a); }
.m-cell.pB { background: var(--pat-b); }
.m-cell.pC { background: var(--pat-c); }
.m-cell.pD { background: var(--pat-d); }
.m-cell.px { background: repeating-linear-gradient(135deg, transparent 0 5px, var(--hatch) 5px 7px); color: var(--faint); text-shadow: none; }
.m-cell.now { box-shadow: 0 0 0 2px var(--ochre); }
.m-lanes { position: relative; background-color: var(--panel); background-image: repeating-linear-gradient(90deg, var(--grid-bar) 0 1px, transparent 1px 12.5%); }
.m-lane { position: relative; height: 38px; border-bottom: 1px solid var(--line); }
.m-lane:last-of-type { border-bottom: 0; }
.m-lname { position: absolute; left: 4px; top: 2px; font: 600 9px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.m-clip { position: absolute; top: 4px; bottom: 4px; background: linear-gradient(color-mix(in srgb, var(--clip-bg) 85%, #fff), var(--clip-bg)); border: 1px solid rgba(0, 0, 0, .5); border-radius: 3px; color: var(--clip-text); overflow: hidden; transition: left .5s, width .5s; animation: m-rise .35s ease-out; }
.m-clip.is-piano { background: linear-gradient(color-mix(in srgb, var(--pat-c) 80%, #fff), var(--pat-c)); color: #fff; }
.m-clip.sel { box-shadow: 0 0 0 2px var(--ochre); }
.m-clip-name { position: absolute; left: 4px; top: 1px; font-size: 9.5px; font-weight: 600; z-index: 1; white-space: nowrap; }
.m-wave { position: absolute; left: 0; right: 0; bottom: 1px; width: 100%; height: 22px; fill: var(--wave); }
.m-clip.is-piano .m-wave { fill: rgba(255, 255, 255, .6); }
.m-playhead { position: absolute; top: 0; bottom: 0; width: 2px; left: 0; background: var(--ochre); box-shadow: 0 0 6px var(--ochre); display: none; z-index: 3; }
.m-playhead.shown { display: block; }
.m-fadeshade { position: absolute; top: 0; bottom: 0; right: 0; width: 12.5%; display: none; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .45)); pointer-events: none; }
.m-fadeshade.shown { display: block; }
.m-fadeshade.shown::after { content: "desvanece"; position: absolute; right: 4px; bottom: 2px; font-size: 9.5px; color: #fff; }

/* misturador */
.m-strips { display: flex; gap: 3px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px; padding: 3px; }
.m-strip { flex: 0 0 66px; display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .3rem .2rem .35rem; border: 1px solid var(--line); border-radius: 3px; background: linear-gradient(var(--title-hi), var(--panel) 30%); }
.m-strip.master { margin-left: auto; border-color: var(--ochre-soft); }
.m-sname { font-size: 10px; font-weight: 600; color: var(--title-text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-fbox { display: flex; gap: 6px; height: 84px; }
.m-fader { position: relative; width: 6px; height: 100%; background: var(--well); border: 1px solid var(--line); border-radius: 3px; }
.m-fader i { position: absolute; left: 50%; bottom: 72%; width: 22px; height: 10px; margin: 0 0 -5px -11px; border-radius: 2px; border: 1px solid var(--line); background: linear-gradient(var(--btn-hi), var(--btn-lo)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .4); transition: bottom .12s; }
.m-fader i::after { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; height: 1px; background: var(--ochre); }
.m-vmeter { position: relative; width: 6px; height: 100%; background: var(--lcd-bg); border: 1px solid #000; overflow: hidden; }
.m-vmeter i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, var(--green) 0 65%, #e6d23c 82%, var(--danger)); transition: height .1s; }

/* master */
.m-master { flex-direction: row !important; flex-wrap: wrap; gap: .5rem; padding-top: 0; }
.m-master > .m-whead { flex: 0 0 calc(100% + 1.1rem); }
.m-panel { flex: 1 1 260px; display: flex; flex-direction: column; gap: .3rem; padding: 0 .5rem .45rem; border: 1px solid var(--line); border-radius: 3px; background: var(--bg-2); }
.m-ptitle { margin: 0 -.5rem .1rem; padding: .2rem .5rem; font: 700 10px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--title-text); background: linear-gradient(var(--title-hi), var(--title-bg)); border-bottom: 1px solid var(--line); border-radius: 3px 3px 0 0; }
.m-panel .m-srow { display: grid; grid-template-columns: 7.2rem minmax(0, 1fr) auto; }
.m-panel .m-slider { width: 100%; }
.m-readout { align-self: flex-start; }

/* diálogos e avisos */
.m-dialog, .m-perm, .m-download, .m-toast, .m-finale, .m-callout { position: absolute; z-index: 10; }
.m-dialog {
  display: none; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94%, 340px);
  flex-direction: column; gap: .35rem; padding: 0 .7rem .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.m-dialog.open { display: flex; animation: m-in .25s ease-out; }
@keyframes m-in { from { opacity: 0; transform: translate(-50%, -46%); } }
.m-dialog-top { top: .5rem; transform: translateX(-50%); }
.m-dialog-top.open { animation: m-rise .25s ease-out; }
.m-dtitle { margin: 0 -.7rem .2rem; padding: .35rem .7rem; font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--title-text); background: linear-gradient(var(--title-hi), var(--title-bg)); border-bottom: 1px solid var(--line); border-radius: 4px 4px 0 0; }
.m-dgroup { margin-top: .25rem; font: 700 10px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ochre-hi); }
.m-radio { padding: .15rem 0 .15rem 1.3rem; position: relative; }
.m-radio::before { content: ""; position: absolute; left: 0; top: .28rem; width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--line); background: var(--well); }
.m-radio.checked::before { background: var(--ochre); border-color: var(--ochre); box-shadow: inset 0 0 0 2px var(--well); }
.m-drow { display: flex; justify-content: flex-end; gap: .4rem; margin-top: .3rem; }
.m-fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .6rem; }
.m-fgrid .m-srow { flex-direction: column; align-items: stretch; gap: .1rem; }
.m-result { color: var(--green); font-size: 11.5px; min-height: 1em; }
.m-perm {
  display: none; left: 50%; top: .5rem; transform: translateX(-50%); width: min(94%, 360px);
  flex-direction: column; gap: .4rem; padding: .6rem .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.m-perm.open { display: flex; animation: m-drop .25s ease-out; }
@keyframes m-drop { from { opacity: 0; transform: translate(-50%, -8px); } }
.m-download {
  display: none; right: .6rem; bottom: .6rem; align-items: center; gap: .6rem;
  background: var(--panel); border: 1px solid var(--green); border-radius: 4px; padding: .5rem .7rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.m-download.shown { display: flex; animation: m-rise .35s ease-out; }
.m-download strong { display: block; }
.m-download span span { color: var(--muted); font-size: 11px; }
.m-dlicon { display: inline-grid; place-items: center; width: 28px; height: 32px; border: 1px solid var(--line); background: var(--well); color: var(--green); font-weight: 700; }
@keyframes m-rise { from { opacity: 0; transform: translateY(10px); } }
.m-toast {
  left: 50%; bottom: .6rem; transform: translateX(-50%); max-width: 90%;
  background: var(--lcd-bg); color: var(--lcd-text); border: 1px solid #000; padding: .4rem .8rem; border-radius: 3px; font: 12px var(--mono);
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
.m-toast.shown { opacity: 1; }
.m-callout { display: none; background: var(--ochre); color: var(--on-accent); padding: .3rem .6rem; border-radius: 3px; font-weight: 600; font-size: 12px; max-width: 90%; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.m-callout.shown { display: block; animation: m-in2 .3s ease-out; }
@keyframes m-in2 { from { opacity: 0; transform: translateY(-6px); } }
.m-finale { display: none; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; text-align: center; padding: 1rem; background: var(--bg); }
.m-finale.open { display: flex; animation: m-rise .6s ease-out; }
.m-finale-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 30px; color: var(--lcd-text); background: var(--lcd-bg); border: 1px solid #000; text-shadow: 0 0 10px var(--lcd-text); }
.m-finale strong { font-size: clamp(20px, 4vw, 30px); }
.m-finale span:last-child { color: var(--muted); }
.stage:not([class*="show-"]) { min-height: 280px; }

/* cenas com muitas janelas: versão mais baixa para caber no ecrã */
.compact .m-step { height: 13px; }
.compact .m-track { padding: .1rem 0; }
.compact .m-lane { height: 22px; }
.compact .m-piano { height: 70px; }
.compact .m-kn { display: none; }
.compact .m-fbox { height: 46px; }
.compact .m-strip { flex-basis: 54px; }
.compact .m-panel .m-srow:nth-of-type(n+4), .compact .m-sub .m-midi, .compact .m-panel .m-meter { display: none; }

/* ponteiro */
.m-pointer {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; z-index: 20; pointer-events: none;
  margin: -3px 0 0 -3px; opacity: 0; transition: transform .55s cubic-bezier(.5, 0, .2, 1), opacity .2s;
}
.m-pointer.shown { opacity: 1; }
.m-pointer::before {
  content: ""; position: absolute; left: 0; top: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 0 18px 11px; border-color: transparent transparent transparent #fff;
  transform: rotate(-20deg); transform-origin: 0 0; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .8)) drop-shadow(0 0 1px rgba(0, 0, 0, .9));
}
.m-pointer::after {
  content: ""; position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ochre); opacity: 0; transform: scale(.4);
}
.m-pointer.pressed::after { animation: m-ripple .4s ease-out; }
@keyframes m-ripple { 0% { opacity: .9; transform: scale(.4); } 100% { opacity: 0; transform: scale(1.8); } }
.pressed { transform: scale(.94); }
.m-pointer.pressed { transform: none; }

@media (max-width: 760px) {
  .tut { padding: 0 .75rem; }
  .stage-wrap { padding: .35rem; }
  .stage { font-size: 11.5px; gap: .4rem; }
  .m-views, .m-alias { display: none !important; }
  .m-right { margin-left: 0; }
  .m-track { grid-template-columns: 1fr; gap: .15rem; }
  .m-steps, .m-notes { grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 2px; }
  .m-step { height: 16px; }
  .m-note { font-size: 7px; }
  .m-tsound { font-size: 10px; }
  .m-tname { max-width: 6rem; }
  .m-piano { height: 90px; }
  .m-kl { font-size: 8px; padding: 0 2px; }
  .m-kn { font-size: 8px; }
  .m-strip { flex-basis: 50px; }
  .m-fbox { height: 60px; }
  .m-panel .m-srow { grid-template-columns: 5.6rem minmax(0, 1fr) auto; }
  .m-midi { margin-left: 0; }
  .tut-opts { margin-left: 0; width: 100%; }
  .caption { min-height: 0; }
  .m-toast { white-space: normal; text-align: center; }
  .m-val { min-width: 0; font-size: 10px; }
}
@media (max-width: 380px) {
  .m-step { height: 13px; }
  .m-clock { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .m-pointer { display: none; }
  .m-track, .m-clip { animation: none; }
}
