:root { --g: #3dff7a; --bg: #0a0a0a; --line: #262626; --mut: #a8a8a8; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); overscroll-behavior: none; }
body { font-family: 'Martian Mono', ui-monospace, monospace; color: #f2f2f2; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; touch-action: manipulation; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* header */
.hdr { display: grid; grid-template-columns: 72px minmax(0, 1fr) 56px; grid-template-areas: "play lcd logo" "tabs tabs tabs"; gap: 10px; padding: 10px 14px 12px; background: linear-gradient(#141414, #0d0d0d); border-bottom: 1px solid #1f1f1f; }
.play { grid-area: play; height: 56px; border-radius: 12px; border: 1px solid #2c2c2c; background: #1a1a1a; font-size: 22px; }
.play.on { background: var(--g); border-color: var(--g); color: #0a0a0a; }
.lcd { grid-area: lcd; min-width: 0; text-align: left; background: #050605; border: 0; border-radius: 10px; padding: 8px 12px; box-shadow: inset 0 2px 8px rgba(0,0,0,.9); display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.lcd-top { font-size: 13px; letter-spacing: .12em; color: var(--g); text-shadow: 0 0 6px rgba(61,255,122,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.lcd-bot { font-size: 10px; letter-spacing: .1em; color: var(--mut); white-space: nowrap; }
.logo { grid-area: logo; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: 'Anybody', sans-serif; font-weight: 900; font-variation-settings: 'wdth' 150; font-size: 15px; line-height: .9; }
.logo b { color: var(--g); font-weight: 900; }
.tabs { grid-area: tabs; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tabs button { font-size: 11px; letter-spacing: .14em; min-height: 44px; border-radius: 8px; background: #1a1a1a; color: #d6d6d6; border: 1px solid var(--line); }
.tabs button.on { background: var(--g); border-color: var(--g); color: #0a0a0a; font-weight: 600; }

main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; min-height: 0; }
.view.on { display: flex; }
.cap { font-size: 10px; letter-spacing: .14em; color: var(--mut); }
.cap.row { display: flex; justify-content: space-between; }
.card { border-radius: 14px; background: #121212; border: 1px solid #222; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

/* steps */
.rotate { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px; text-align: center; }
.rotate strong { font-family: 'Anybody', sans-serif; font-weight: 900; font-variation-settings: 'wdth' 150; font-size: 30px; line-height: 1; }
.rotate span { font-size: 11px; line-height: 1.7; letter-spacing: .06em; color: var(--mut); max-width: 280px; }
.rot-ico { width: 120px; height: 120px; color: #f2f2f2; animation: tilt 2.6s ease-in-out infinite; transform-origin: 50% 55%; }
@keyframes tilt { 0%, 25% { transform: rotate(0); } 60%, 85% { transform: rotate(90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .rot-ico { animation: none; } }
.beats { display: flex; gap: 3px; padding: 8px 14px 0 91px; }
.beats i { flex: 1; display: flex; justify-content: center; }
.beats i::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #2c2c2c; }
.beats i.b::after { background: #555; }
.beats i.ph::after { background: var(--g); box-shadow: 0 0 8px var(--g); }
.grid { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px 14px 12px; touch-action: none; }
.row { flex: 1; min-height: 0; display: flex; gap: 3px; }
.nm { width: 70px; flex: none; margin-right: 4px; border-radius: 7px; border: 1px solid var(--line); background: #151515; color: #d6d6d6; font-size: 9px; letter-spacing: .1em; text-align: left; padding: 0 8px; white-space: nowrap; overflow: hidden; touch-action: none; }
.nm.flash { background: #f2f2f2; border-color: #f2f2f2; color: #0a0a0a; }
.row.cut .nm { color: #6a6a6a; text-decoration: line-through; }
.st { flex: 1; min-width: 0; border-radius: 5px; border: 1px solid #000; background: linear-gradient(#2a2a2a, #191919); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); touch-action: none; }
.st.alt { background: linear-gradient(#1c1c1c, #121212); }
.st.on { background: linear-gradient(#5dff95, #22c95a); box-shadow: 0 0 10px rgba(61,255,122,.45), inset 0 1px 0 rgba(255,255,255,.45); }
.row.cut .st.on { background: linear-gradient(#1f4a2c, #14301d); box-shadow: none; }
.st.ph { outline: 2px solid #f2f2f2; outline-offset: -1px; }
.conf { display: none; flex: 1; gap: 6px; align-items: stretch; border-radius: 8px; background: #1f140c; border: 1px solid #ff8a3d; padding: 3px 3px 3px 12px; }
.conf span { flex: 1; display: flex; align-items: center; font-size: 10px; letter-spacing: .12em; color: #ffb07a; white-space: nowrap; }
.conf button { padding: 0 16px; border-radius: 6px; border: 1px solid #3a3a3a; background: #1a1a1a; font-size: 10px; letter-spacing: .12em; }
.conf button.yes { border: 0; background: #ff8a3d; color: #0a0a0a; font-weight: 600; }
.row.ask > .nm, .row.ask > .st { display: none; }
.row.ask > .conf { display: flex; }

/* pads */
.hint { margin: 0; padding: 12px 16px 0; display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .14em; color: var(--mut); }
.pads { flex: 1; min-height: 0; padding: 10px 14px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; }
.pad { position: relative; border-radius: 16px; border: 1px solid var(--g); background: linear-gradient(#5dff95, #22c95a); box-shadow: 0 0 18px rgba(61,255,122,.3), inset 0 1px 0 rgba(255,255,255,.45); color: #0a0a0a; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 12px 14px; text-align: left; touch-action: none; transition: filter .08s, transform .08s; min-height: 0; overflow: hidden; }
.pad .top { display: flex; width: 100%; justify-content: space-between; align-items: center; font-size: 10px; letter-spacing: .12em; opacity: .75; }
.pad .top i { width: 10px; height: 10px; border-radius: 50%; background: #0a0a0a; }
.pad .name { font-family: 'Anybody', sans-serif; font-weight: 900; font-variation-settings: 'wdth' 140; font-size: 22px; line-height: 1; }
.pad .state { font-size: 10px; letter-spacing: .12em; opacity: .8; }
.pad.cut { background: #101010; border-color: #1e1e1e; color: #8a8a8a; box-shadow: inset 0 2px 8px rgba(0,0,0,.8); }
.pad.cut .top i { background: #2a2a2a; }
.pad.hit { filter: brightness(1.35); transform: scale(.985); }
.pad.press { transform: scale(.97); }

/* knobs */
.knobs { display: grid; gap: 18px 8px; justify-items: center; }
.knobs.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.knobs.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 4px; }
.kb { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.knob { position: relative; width: var(--s, 84px); height: var(--s, 84px); border: 0; border-radius: 50%; background: transparent; touch-action: none; }
.knob .arc { position: absolute; inset: 0; border-radius: 50%; -webkit-mask: radial-gradient(circle, transparent 0 66%, #000 67%); mask: radial-gradient(circle, transparent 0 66%, #000 67%); }
.knob .capn { position: absolute; inset: 12%; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #4b4b4b, #141414 70%); box-shadow: 0 6px 12px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.25); }
.knob .ptr { position: absolute; inset: 12%; border-radius: 50%; }
.knob .ptr::after { content: ''; position: absolute; left: 50%; top: 7%; width: 3px; height: 24%; margin-left: -1.5px; border-radius: 2px; background: #f2f2f2; }
.knob.sel .capn { box-shadow: 0 0 0 2px var(--g), 0 6px 12px rgba(0,0,0,.6); }
.kb.off .knob { opacity: .4; }
.kl { font-size: 10px; letter-spacing: .12em; color: #e8e8e8; text-transform: uppercase; }
.kv { font-size: 11px; color: var(--g); min-height: 14px; }
.sw { width: 76px; max-width: 100%; height: 40px; border-radius: 10px; border: 1px solid #2c2c2c; background: #1a1a1a; color: #d6d6d6; font-size: 10px; letter-spacing: .12em; }
.sw.on { background: var(--g); border-color: var(--g); color: #0a0a0a; }

/* mixer */
#v-mixer { padding: 12px 14px 14px; gap: 10px; }
.chans { flex: 1; }
.faders { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.fd { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; }
.fd .track { flex: 1; min-height: 60px; width: 100%; max-width: 44px; border-radius: 9px; background: #1c1c1c; position: relative; touch-action: none; }
.fd .fill { position: absolute; left: 0; right: 0; bottom: 0; height: var(--p, 50%); border-radius: 9px; background: linear-gradient(#5dff95, #1fa64c); }
.fd .cap2 { position: absolute; left: -3px; right: -3px; bottom: calc(var(--p, 50%) - 8px); height: 16px; border-radius: 5px; background: #f2f2f2; box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.fd.cut .fill { background: #2a2a2a; }
.fd .m { width: 100%; max-width: 44px; height: 40px; border-radius: 8px; border: 1px solid #2c2c2c; background: #1a1a1a; color: #d6d6d6; font-size: 10px; }
.fd.cut .m { background: var(--g); border-color: var(--g); color: #0a0a0a; }
.fd .lb { font-size: 8px; letter-spacing: .06em; color: #c8c8c8; white-space: nowrap; }

/* fx */
#v-fx { padding: 16px 14px 16px; gap: 14px; overflow-y: auto; }
.fxA, .fxB { display: flex; flex-direction: column; gap: 12px; }
.fxB { flex: 1; min-height: 0; }
.hold { flex: 1; min-height: 84px; border-radius: 18px; border: 1px solid #2e2e2e; background: linear-gradient(#262626, #171717); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 4px 10px rgba(0,0,0,.5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; touch-action: none; }
.hold strong { font-family: 'Anybody', sans-serif; font-weight: 900; font-variation-settings: 'wdth' 150; font-size: 28px; line-height: 1; }
.hold span { font-size: 10px; letter-spacing: .14em; opacity: .8; }
.hold.on { background: linear-gradient(#5dff95, #22c95a); border-color: var(--g); color: #0a0a0a; box-shadow: 0 0 30px rgba(61,255,122,.45); }
.seg3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.seg3 button { height: 46px; border-radius: 10px; border: 1px solid var(--line); background: #151515; color: #d6d6d6; font-size: 12px; letter-spacing: .1em; }
.seg3.tall button { height: 54px; border-radius: 12px; }
.seg3 button.on { background: var(--g); border-color: var(--g); color: #0a0a0a; }
.meterwrap { display: flex; flex-direction: column; gap: 8px; }
.meter { height: 14px; border-radius: 4px; background: #0c0d0d; box-shadow: inset 0 1px 4px rgba(0,0,0,.9); position: relative; overflow: hidden; }
.meter::before { content: ''; position: absolute; inset: 3px; background: repeating-linear-gradient(90deg, #232323 0 8px, transparent 8px 11px); }
.meter i { position: absolute; inset: 3px; transform-origin: 0 50%; transform: scaleX(0); background: repeating-linear-gradient(90deg, var(--g) 0 8px, transparent 8px 11px); }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 94dvh; overflow-y: auto; border-radius: 26px 26px 0 0; background: #121212; border-top: 1px solid #2a2a2a; box-shadow: 0 -20px 40px rgba(0,0,0,.6); padding: 10px 16px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.sheet .grab { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: #3a3a3a; flex: none; }
.sheet .head { display: flex; align-items: center; gap: 10px; }
.sheet h2 { flex: 1; margin: 0; font-family: 'Anybody', sans-serif; font-weight: 900; font-variation-settings: 'wdth' 150; font-size: 28px; line-height: 1; text-transform: uppercase; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid #2c2c2c; background: #1a1a1a; font-size: 11px; letter-spacing: .12em; }
.btn.on { background: var(--g); border-color: var(--g); color: #0a0a0a; }
.btn.x { width: 44px; padding: 0; font-size: 18px; }
.btn.big { min-height: 54px; font-size: 12px; letter-spacing: .14em; }
.btn.warn { border-color: #ff8a3d; color: #ffb07a; }
.sl { display: flex; flex-direction: column; gap: 10px; }
.sl .track { height: 30px; position: relative; touch-action: none; }
.sl .track::before { content: ''; position: absolute; left: 0; right: 0; top: 10px; height: 10px; border-radius: 5px; background: #222; }
.sl .fill { position: absolute; left: 0; top: 10px; height: 10px; width: var(--p, 50%); border-radius: 5px; background: var(--g); }
.sl .cap2 { position: absolute; left: var(--p, 50%); top: 1px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: #f2f2f2; box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.plist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.plist button { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: #171717; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 0 10px; }
.plist button.on { background: var(--g); border-color: var(--g); color: #0a0a0a; font-weight: 600; }
.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.banner { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: 14px; background: #161616; border: 1px solid var(--g); box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 10px; letter-spacing: .08em; line-height: 1.6; }
.banner span { flex: 1; }

/* phone upright: the grid needs width, so ask for a rotate */
@media (orientation: portrait) {
  #v-steps .rotate { display: flex; }
  #v-steps .beats, #v-steps .grid { display: none; }
}

/* phone sideways */
@media (orientation: landscape) {
  .hdr { grid-template-columns: 64px minmax(140px, 230px) minmax(0, 1fr) 50px; grid-template-areas: "play lcd tabs logo"; gap: 8px; padding: 8px 14px; }
  .play { height: 46px; font-size: 18px; }
  .lcd { padding: 4px 12px; gap: 2px; }
  .lcd-top { font-size: 12px; }
  .tabs button { min-height: 46px; font-size: 10px; }
  .hint { padding-top: 8px; }
  .pads { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 8px; }
  .pad .name { font-size: 18px; }
  #v-mixer { flex-direction: row; padding: 10px 14px; }
  .master { width: 36%; justify-content: center; }
  .master .knob { --s: 52px !important; }
  .master .kl { font-size: 8px; }
  .knobs.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #v-fx { flex-direction: row; padding: 10px 14px; }
  .fxA { width: 46%; justify-content: space-between; }
  .fxA .knob { --s: 54px !important; }
  .fxA .knobs.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 4px; }
  .fxA .sw { width: 64px; height: 34px; }
  .fxA .kl { font-size: 8px; }
  .fxB { gap: 8px; }
  .seg3 button { height: 40px; }
  .seg3.tall button { height: 44px; }
  .hold { min-height: 56px; }
  .hold strong { font-size: 22px; }
  .sheet { left: 50%; right: auto; width: min(640px, 100%); transform: translateX(-50%); gap: 12px; }
  .sheet .knob { --s: 66px !important; }
  .sheet .knobs { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .plist { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .plist button { min-height: 46px; font-size: 10px; }
}
@media (orientation: landscape) and (min-height: 520px) {
  .sheet .knob { --s: 84px !important; }
}
