
:root {
  --bg: #0b0c0f;
  --panel: #15171c;
  --panel2: #1c1f26;
  --text: #f2f3f5;
  --muted: #9ca3af;
  --line: #30343e;
  --accent: #4f8cff;
  --danger: #ff4d5e;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100dvh; padding: calc(10px + var(--safe-top)) 12px calc(10px + var(--safe-bottom)); display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 10px; max-width: 1500px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.28); }
.brand { font-weight: 900; letter-spacing: .02em; font-size: clamp(18px, 3.7vw, 30px); }
.version { color: var(--muted); font-size: 12px; margin-top: 2px; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; width: 48px; height: 48px; font-size: 23px; cursor: pointer; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.transport { display: flex; gap: 10px; align-items: stretch; justify-content: space-between; flex-wrap: wrap; }
.transport-main { display: flex; gap: 8px; flex-wrap: wrap; }
.transport-settings { display: flex; gap: 8px; flex-wrap: wrap; }
.transport-settings label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.transport-settings input, .transport-settings select, .settings-card select, .settings-card input[type="text"] { background: #0f1116; color: var(--text); border: 1px solid var(--line); border-radius: 10px; min-height: 40px; padding: 7px 10px; }
.transport-btn { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); padding: 0 15px; font-weight: 800; cursor: pointer; }
.transport-btn.record { border-color: rgba(255,77,94,.5); }
.transport-btn.record.active { background: var(--danger); border-color: var(--danger); color: white; }
.transport-btn.subtle { color: var(--muted); }
.transport-btn:disabled { opacity: .35; cursor: default; }
.timeline { padding-bottom: 6px; }
.timeline-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
#timelineCanvas { display: block; width: 100%; height: 150px; background: #0d0f13; border-radius: 10px; }
.pads { display: grid; gap: 10px; align-content: stretch; grid-template-columns: repeat(var(--pad-cols, 4), minmax(0, 1fr)); min-height: 0; }
.pad { position: relative; min-height: 112px; border: none; border-radius: 20px; color: white; cursor: pointer; padding: 12px; text-align: left; overflow: hidden; box-shadow: inset 0 -5px 0 rgba(0,0,0,.16), 0 4px 10px rgba(0,0,0,.25); user-select: none; touch-action: none; transition: transform .045s ease, filter .045s ease; }
.pad::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.24), transparent 38%); pointer-events: none; }
.pad.hit { transform: scale(.97); filter: brightness(1.35); }
.pad-name { position: relative; z-index: 1; font-weight: 900; font-size: clamp(17px, 3vw, 25px); text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.pad-sound { position: absolute; z-index: 1; left: 12px; bottom: 10px; font-size: 11px; opacity: .88; letter-spacing: .04em; }
.footer-status { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; padding: 0 4px; gap: 12px; }
.settings-dialog { width: min(980px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); border: none; padding: 0; border-radius: 18px; background: transparent; color: var(--text); }
.settings-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.settings-card { background: #111318; border: 1px solid var(--line); border-radius: 18px; padding: 14px; max-height: calc(100dvh - 16px); overflow: auto; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-head h2 { margin: 0; }
.settings-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.settings-tabs { display: flex; gap: 6px; margin: 14px 0; position: sticky; top: -14px; background: #111318; padding: 8px 0; z-index: 2; }
.tab { flex: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 10px; cursor: pointer; }
.tab.active { border-color: var(--accent); background: #18233b; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-grid label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.library-box { display: grid; gap: 5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; align-content: center; }
.library-box strong { color: var(--text); }
.note { color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 14px; font-size: 13px; line-height: 1.4; }
.pad-settings { display: grid; gap: 8px; }
.pad-setting-row { display: grid; grid-template-columns: 42px 1fr 1.55fr; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.pad-setting-row input[type="color"] { width: 42px; height: 42px; padding: 2px; border-radius: 9px; border: 1px solid var(--line); background: transparent; }
.about-box { display: grid; gap: 10px; }
.version-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wide-btn, .save-btn, .danger-btn { border: 1px solid var(--line); border-radius: 11px; min-height: 44px; padding: 9px 14px; cursor: pointer; background: var(--panel2); }
.wide-btn.accent, .save-btn { background: var(--accent); border-color: var(--accent); color: white; font-weight: 800; }
.danger-btn { color: #ff9ca7; }
.changelog { display: grid; gap: 8px; }
.changelog-entry { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.changelog-entry strong { display: block; margin-bottom: 5px; }
.changelog-entry ul { margin: 5px 0 0 18px; color: #cfd3db; padding: 0; }
.settings-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

@media (max-width: 700px) {
  .app-shell { padding-left: 8px; padding-right: 8px; gap: 7px; }
  .panel { border-radius: 13px; padding: 8px; }
  .transport { display: grid; }
  .transport-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transport-btn { min-height: 42px; padding: 0 9px; font-size: 13px; }
  .transport-settings { display: grid; grid-template-columns: 100px 1fr; }
  #timelineCanvas { height: 112px; }
  .pad { min-height: 92px; border-radius: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .pad-setting-row { grid-template-columns: 40px 1fr; }
  .pad-setting-row select { grid-column: 2; }
  .footer-status { font-size: 10px; }
  .brand-logo { width: 40px; height: 40px; }
  .brand { font-size: 19px; }
}

body.profile-fold-outer .timeline { padding-top: 7px; }
body.profile-fold-outer #timelineCanvas { height: 96px; }
body.profile-fold-outer .pad { min-height: 84px; }
body.profile-fold-outer .brand { font-size: 18px; }
body.profile-fold-outer .transport-btn { min-height: 40px; }
body.profile-lenovo .pad { min-height: 128px; }
