/* Music Logic Pro - pro DAW layout (Logic/Ableton-style), fiery blue theme */
:root {
  --bg: #06080e; --panel: #0b1020; --raised: #111a2e; --hover: #18233d; --lcd: #03050a;
  --line: #1c2741; --line-dark: #020308; --hi: rgba(140, 190, 255, 0.05);
  --text: #e8eeff; --text2: #9aa8c7; --muted: #5d6a88; --disabled: #36405a;
  --accent: #2f7bff; --accent-hot: #39d0ff; --accent-core: #e6f7ff;
  --fire: linear-gradient(180deg, #e6f7ff 0%, #39d0ff 30%, #2f7bff 65%, #1a2dff 100%);
  --melody: #39d0ff; --bass: #6d7bff; --chords: #8fb4ff; --piano: #c9d6ff; --strings: #2f9bff; --kick: #ff6b3d; --snare: #ffb547; --hat: #3ee6b5;
  --rec: #ff3b30; --m-green: #3ddc84; --m-yellow: #f5c542; --m-red: #ff453a;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --lane: 64px; --head: 168px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid; grid-template-rows: 52px 1fr 26px; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 1px; }
.lbl { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- transport ---------- */
.transport {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line-dark);
  box-shadow: inset 0 -1px 0 var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand b { font-weight: 600; font-size: 14px; white-space: nowrap; }
.brand .ver { color: var(--accent-hot); font-weight: 500; }
.center { display: flex; align-items: center; gap: 10px; }
.tbtns { display: flex; gap: 4px; }
.tb {
  width: 34px; height: 32px; border-radius: 4px; border: 1px solid var(--line); background: var(--raised);
  display: grid; place-items: center; box-shadow: inset 0 1px 0 var(--hi); transition: background .12s, border-color .12s;
}
.tb:hover:not(:disabled) { background: var(--hover); }
.tb svg { width: 15px; height: 15px; fill: var(--text); }
.tb.on { background: var(--accent); border-color: var(--accent); }
.tb.rec svg { fill: var(--rec); }
.tb.rec.on { background: var(--rec); border-color: var(--rec); animation: armed 1.2s infinite; }
.tb.rec.on svg { fill: #fff; }
@keyframes armed { 50% { box-shadow: 0 0 0 4px rgba(255, 59, 48, .2); } }
.lcd {
  display: flex; background: var(--lcd); border: 1px solid var(--line); border-radius: 5px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.7); height: 38px;
}
.lcd > div { padding: 3px 12px 0; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.lcd > div:first-child { border-left: 0; }
.lcd .lbl { font-size: 8.5px; line-height: 1; }
.lcd .v { font: 500 17px/1.15 var(--mono); color: var(--accent-hot); font-variant-numeric: tabular-nums; white-space: nowrap; text-shadow: 0 0 8px rgba(57, 208, 255, .35); }
.meter { display: flex; gap: 2px; height: 32px; align-items: flex-end; }
.meter i { width: 5px; height: 100%; background: #0f1628; border-radius: 1px; position: relative; overflow: hidden; }
.meter i b { position: absolute; left: 0; right: 0; bottom: 0; height: 0%;
  background: linear-gradient(0deg, var(--m-green) 0 70%, var(--m-yellow) 70% 88%, var(--m-red) 88%); background-size: 100% 32px; background-position: bottom; }
.heat { width: 92px; }
.heat .bar { height: 6px; background: #0f1628; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.heat .bar i { display: block; height: 100%; width: 0%; background: var(--fire); background-size: 100% 100%; transition: width .08s; }
.right { display: flex; justify-content: flex-end; gap: 6px; }
.btn {
  height: 30px; padding: 0 12px; border-radius: 4px; border: 1px solid var(--line); background: var(--raised);
  box-shadow: inset 0 1px 0 var(--hi); font-weight: 500; transition: background .12s;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #4a8dff; }

/* ---------- main ---------- */
main { display: grid; grid-template-columns: 1fr 290px; min-height: 0; }
.arrange { display: grid; grid-template-rows: auto 1fr; min-height: 0; border-right: 1px solid var(--line-dark); position: relative; }
.ruler-row { display: grid; grid-template-columns: var(--head) 1fr; height: 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ruler-row .corner { border-right: 1px solid var(--line); display: flex; align-items: center; padding-left: 10px; }
#ruler { width: 100%; height: 24px; display: block; }
.lanes { overflow: auto; position: relative; }
.lane { display: grid; grid-template-columns: var(--head) 1fr; height: var(--lane); border-bottom: 1px solid var(--line-dark); }
.lane:nth-child(odd) .clips { background: #080c18; }
.th {
  display: flex; align-items: center; gap: 8px; padding: 0 8px 0 0; background: var(--panel);
  border-right: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--hi); position: relative;
}
.th::before { content: ""; width: 4px; align-self: stretch; background: var(--c); }
.th .nm { flex: 1; min-width: 0; }
.th .nm b { display: block; font-size: 12px; font-weight: 500; }
.th .nm span { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--line); background: var(--raised); font: 600 9px var(--mono); color: var(--text2); padding: 0; }
.ms.m.on { background: #ffb547; color: #000; border-color: #ffb547; }
.ms.s.on { background: var(--accent-hot); color: #000; border-color: var(--accent-hot); }
.clips { position: relative; }
.clips canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--accent-hot); box-shadow: 0 0 8px var(--accent-hot); pointer-events: none; display: none; z-index: 3; }

/* empty / recording stage */
.stage {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at 50% 60%, rgba(47,123,255,.10), transparent 60%), var(--bg); z-index: 4; padding: 20px;
}
.stage[hidden] { display: none; }
.bigrec {
  width: 112px; height: 112px; border-radius: 50%; border: 2px solid rgba(255,59,48,.6); background: rgba(255,59,48,.08);
  display: grid; place-items: center; transition: transform .12s;
}
.bigrec:hover { transform: scale(1.04); }
.bigrec i { width: 60px; height: 60px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 30px rgba(255,59,48,.45); transition: all .2s; }
.bigrec.on i { width: 36px; height: 36px; border-radius: 6px; }
.stage h2 { margin: 0; font-size: 17px; font-weight: 600; }
.stage p { margin: 0; color: var(--text2); max-width: 460px; text-align: center; }
.stage .live { display: flex; gap: 18px; align-items: baseline; }
.stage .live .v { font: 500 26px var(--mono); color: var(--accent-hot); text-shadow: 0 0 12px rgba(57,208,255,.4); min-width: 90px; text-align: center; }
#liveCanvas { width: min(720px, 92%); height: 120px; background: var(--lcd); border: 1px solid var(--line); border-radius: 5px; }
.stage .alt { color: var(--muted); font-size: 12px; }
.stage .alt label { color: var(--text2); text-decoration: underline dotted; cursor: pointer; }
.stage .alt input { display: none; }

.stage .alt a { color: var(--accent-hot); }
.ruler-row .corner { padding-left: 6px; }
.views { margin: 0; height: 20px; }
.views button { height: 18px; font-size: 10.5px; padding: 0 8px; }

/* ---------- studio (MIDI editor) ---------- */
.studio { position: absolute; inset: 24px 0 0 0; z-index: 5; background: var(--bg); display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.studio[hidden] { display: none; }
.st-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.st-bar .seg { margin: 0; }
.st-bar .seg button { padding: 0 10px; height: 28px; }
.st-bar select { background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: 4px; height: 26px; margin-left: 4px; font: inherit; }
.st-sp { flex: 1; }
.st-main { display: grid; grid-template-columns: 150px 1fr; min-height: 0; }
.st-mixer { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; }
.mx { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 5px 10px; border-top: 1px solid var(--line-dark); font-size: 11.5px; }
.mx input[type=range] { width: 100%; accent-color: var(--accent); height: 14px; }
.mx input.pan { accent-color: var(--accent-hot); }
.st-gridwrap { overflow: auto; min-height: 0; }
#stGrid { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.st-keys { background: var(--panel); border-top: 1px solid var(--line); padding: 6px 10px 10px; }
.st-kbinfo { display: flex; gap: 10px; align-items: baseline; color: var(--text2); font-size: 11.5px; margin-bottom: 6px; }
.st-piano { display: flex; gap: 3px; height: 74px; }
.pk { flex: 1; border: 1px solid var(--line); border-radius: 0 0 5px 5px; background: linear-gradient(#dfe7ff, #b9c6ea); color: #18213a; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 0 5px; min-width: 0; transition: transform .05s; }
.pk span { font: 600 11px var(--mono); } .pk small { font-size: 9px; opacity: .7; }
.pk.blk { background: linear-gradient(#1c2741, #0b1020); color: var(--text2); height: 62%; }
.pk.down, .pk:active { background: var(--fire); color: #04060c; transform: translateY(2px); box-shadow: 0 0 18px rgba(57,208,255,.6); }
.pk[class*="pad-"] { flex: 0 0 120px; height: 74px; border-radius: 6px; background: var(--raised); color: var(--text); }
.pk.pad-kick { box-shadow: inset 0 -4px 0 var(--kick); } .pk.pad-snare { box-shadow: inset 0 -4px 0 var(--snare); } .pk.pad-hi-hat { box-shadow: inset 0 -4px 0 var(--hat); }

/* ---------- inspector ---------- */
.inspector { background: var(--panel); overflow: auto; min-height: 0; }
.sec { border-bottom: 1px solid var(--line-dark); box-shadow: inset 0 -1px 0 var(--line); }
.sec > summary { list-style: none; padding: 9px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "▾"; color: var(--muted); font-size: 10px; }
.sec:not([open]) > summary::after { content: "▸"; }
.sec .body { padding: 0 12px 12px; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .k { color: var(--muted); font-size: 11.5px; }
.row .v { text-align: right; font-weight: 500; }
.row .v.mono { color: var(--accent-hot); }
.brain .big { font: 500 20px var(--mono); color: var(--accent-hot); }
.brain .bar { height: 6px; background: #0f1628; border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.brain .bar i { display: block; height: 100%; background: var(--fire); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.seg button { flex: 1; height: 26px; border: 0; background: var(--raised); color: var(--text2); font-size: 11.5px; }
.seg button.on { background: var(--accent); color: #fff; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.saved li:first-child { border-top: 0; }
.saved li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved li small { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.saved .btn { height: 24px; padding: 0 8px; font-size: 11.5px; }
.note { color: var(--muted); font-size: 11px; margin: 8px 0 0; }

/* ---------- status bar ---------- */
.status { display: flex; align-items: center; gap: 16px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.stages { display: flex; gap: 6px; align-items: center; }
.stages span { font-size: 10px; font-weight: 600; letter-spacing: .08em; }
.stages span.on { color: var(--accent-hot); text-shadow: 0 0 8px rgba(57,208,255,.5); }
.stages span.done { color: var(--text2); }
.stages span.done::before { content: "✓ "; color: var(--m-green); }
.stages i { color: var(--disabled); font-style: normal; }
.status .msg { flex: 1; overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: transparent; z-index: 6; }
.progress i { display: block; height: 100%; width: 0; background: var(--fire); transition: width .3s; }

/* ---------- INTENSE / EXTREME flash ---------- */
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 50; display: grid; place-items: center; opacity: 0; }
.flash .word {
  font: italic 900 clamp(48px, 12vw, 150px)/1 Inter, system-ui, sans-serif; letter-spacing: -.02em;
  background: var(--fire); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(57,208,255,.85)) drop-shadow(0 0 50px rgba(47,123,255,.7));
}
.flash::before { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 120px 30px rgba(47,123,255,.55); }
.flash.go { animation: flash 1.1s cubic-bezier(.2,.9,.3,1) forwards; }
.flash.go .word { animation: slam 1.1s cubic-bezier(.2,.9,.3,1) forwards; }
.flash.extreme::before { box-shadow: inset 0 0 180px 60px rgba(57,208,255,.75); animation: strobe .12s 5 alternate; }
.flash.extreme .word { filter: drop-shadow(0 0 22px #e6f7ff) drop-shadow(0 0 70px rgba(57,208,255,.95)); }
@keyframes flash { 0% { opacity: 0 } 8% { opacity: 1 } 70% { opacity: 1 } 100% { opacity: 0 } }
@keyframes slam { 0% { transform: scale(2.4) skewX(-8deg); } 14% { transform: scale(.94) skewX(-8deg); } 22% { transform: scale(1.04) skewX(-8deg); } 100% { transform: scale(1.12) skewX(-8deg); } }
@keyframes strobe { from { opacity: .35 } to { opacity: 1 } }
body.shake main { animation: shake .45s; }
body.shake-hard main { animation: shake-hard .6s; }
@keyframes shake { 20% { transform: translate(-4px, 2px) } 40% { transform: translate(4px, -2px) } 60% { transform: translate(-3px, 1px) } 80% { transform: translate(2px, -1px) } }
@keyframes shake-hard { 10% { transform: translate(-9px, 4px) rotate(-.4deg) } 25% { transform: translate(8px, -5px) rotate(.4deg) } 40% { transform: translate(-7px, 3px) } 55% { transform: translate(6px, -3px) } 70% { transform: translate(-4px, 2px) } 85% { transform: translate(2px, -1px) } }
.arrange.hot .lanes { box-shadow: inset 0 0 60px rgba(47,123,255,.25); transition: box-shadow .2s; }
@media (prefers-reduced-motion: reduce) { .flash.go, .flash.go .word, body.shake main, body.shake-hard main { animation-duration: .01s; } }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  body { grid-template-rows: auto 1fr 26px; overflow: auto; height: auto; min-height: 100%; }
  .transport { grid-template-columns: 1fr auto; grid-template-areas: "brand right" "center center"; padding: 8px 12px; row-gap: 8px; }
  .brand { grid-area: brand; } .right { grid-area: right; } .center { grid-area: center; justify-content: space-between; flex-wrap: wrap; }
  .lcd > div { padding: 3px 8px 0; } .lcd .v { font-size: 14px; } .heat, .meter { display: none; }
  main { grid-template-columns: 1fr; }
  :root { --head: 64px; --lane: 52px; }
  .th .nm span, .th .ms { display: none; }
  .arrange { min-height: 480px; }
  .inspector { border-top: 1px solid var(--line); }
  .status .msg { display: none; }
  .st-main { grid-template-columns: 1fr; } .st-mixer { display: none; }
  .st-piano { height: 60px; } .pk small { display: none; }
}
