/* Shared visual language for Web, iPhone, iPad and Android.
   The Web keeps its dense desktop score editor and collapses into task modes on small screens. */
:root {
  --page: #f7f9fc;
  --paper: #ffffff;
  --ink: #142033;
  --muted: #66748a;
  --line: #dce2eb;
  --blue: #315cca;
  --blue-deep: #2349a6;
  --blue-soft: #e8eefc;
  --wave: #008c8a;
  --playhead: #f27a45;
  --dark: #162238;
  --verified: #18755d;
  --web-control-height: 44px;
  --web-touch-target: 44px;
  --web-control-gap: 8px;
}

body { background: var(--page); color: var(--ink); }
button, select, input, textarea { border-radius: 12px; }
button { min-height: 44px; }

header {
  height: 68px;
  padding: 0 24px;
  border-bottom-color: #e7ebf1;
  box-shadow: none;
}
.brand { color: var(--ink); font-size: 20px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: #fff !important;
  background: var(--blue);
  font-size: 16px !important;
  font-weight: 800;
}
.engine-pill {
  color: var(--wave);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
header .primary { padding-inline: 18px; font-weight: 700; }

body:not([data-screen="workspace"]) main {
  max-width: 1180px;
  padding: 54px 52px 80px;
}
.flow-page { max-width: 1040px; }
#welcome { max-width: 1040px; padding: 24px 0; }
.home-greeting {
  margin: 0 0 8px !important;
  color: var(--muted);
  font-size: 14px;
}
#welcome h2 {
  max-width: 750px;
  margin: 0 0 14px;
  color: var(--ink);
  font-size: clamp(38px, 5vw, 66px);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: .98;
}
#welcome .home-lede {
  max-width: 680px;
  margin: 20px 0 34px;
  font-size: 16px;
  line-height: 1.8;
}
.home-score { display: none; }
.home-choices {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, .94fr);
  gap: 14px;
  margin: 0 0 34px;
}
.choice {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 2px 14px;
  min-height: 104px;
  padding: 20px 22px;
  border-color: var(--line);
  border-radius: 20px;
  background: var(--paper);
}
.choice:hover { background: #fbfcff; border-color: #9fb3e6; }
.choice-primary {
  grid-row: span 2;
  min-height: 222px;
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}
.choice-primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.choice-symbol {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 24px;
}
.choice-primary .choice-symbol { color: #fff; background: #ffffff1c; }
.choice strong { align-self: end; font-size: 18px; letter-spacing: -.015em; }
.choice > span:nth-of-type(2) { align-self: start; color: var(--muted); font-size: 13px; }
.choice-primary > span:nth-of-type(2) { color: #dfe7ff; }
.choice i { grid-column: 3; grid-row: 1 / 3; font-size: 28px; font-style: normal; }
.home-recent { margin-top: 12px; }
.home-recent > div:first-child { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.home-recent h3 { font-size: 21px; }
#home-all-records { border: 0; color: var(--blue); background: transparent; }
#home-record-list { display: grid; gap: 9px; }
#home-record-list > button {
  display: grid;
  grid-template-columns: 1fr auto 24px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 17px 19px;
  text-align: left;
  color: #fff;
  border: 0;
  border-radius: 17px;
  background: var(--dark);
}
#home-record-list span { display: grid; gap: 3px; }
#home-record-list b { font-size: 16px; }
#home-record-list small { color: #b9c4d5; }
#home-record-list time { color: #cbd4e1; font-variant-numeric: tabular-nums; }
#home-record-list i { font-size: 24px; font-style: normal; }
.home-foot { margin-top: 22px !important; }

.back-home, #process-home { color: var(--blue); font-weight: 650; }
.flow-steps { margin: 18px 0 30px; }
.flow-page h2 { color: var(--ink); font-size: clamp(32px, 4.5vw, 52px); line-height: 1.05; }
.file-drop {
  min-height: 210px;
  border-radius: 20px;
  border-color: #9eb0cc;
  background: var(--paper);
}
.file-drop:hover, .file-drop.dragging { background: var(--blue-soft); border-color: var(--blue); }
.link-import {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}
.link-import input { min-height: 48px; border-radius: 12px; }

.analysis-wave {
  overflow: hidden;
  padding: 22px;
  border-radius: 20px;
  border-color: var(--line);
}
#processing-status, #target-options {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}
#live-progress { accent-color: var(--wave); }
.goal-choices label { border-radius: 16px; }
.live-stem canvas { border-radius: 5px; background: #f0f4f7; }

main { margin-top: 68px; }
#library { top: 68px; }
.workspace-heading { align-items: end; }
.workspace-heading h2 { max-width: 760px; font-size: 32px; }
.workspace-heading nav {
  display: flex !important;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: #e5eaf1;
}
.workspace-heading nav button {
  min-width: 72px;
  margin: 0;
  padding: 9px 15px;
  justify-content: center;
  border: 0;
  border-radius: 10px;
}
.workspace-heading nav button span { display: none; }
.workspace-heading nav button.active { color: var(--blue-deep); background: var(--paper); box-shadow: 0 2px 8px #17243b12; }
.workspace-switch { display: none; }
body[data-mode="listen"] #advanced { display: none; }
body[data-has-score="true"] #score-entry,
body[data-mode="listen"]:not([data-split-only="true"]) #score-entry { display: none; }
body[data-mode="export"] #workspace { display: flex; flex-direction: column; }
body[data-mode="export"] .workspace-heading { order: 0; }
body[data-mode="export"] #exports { order: 1; }
body[data-mode="export"] .score-tools { order: 2; }
body[data-mode="export"] .workbench { order: 3; }
body[data-mode="export"] #save-status { order: 4; }
body[data-mode="export"] #output-path { order: 5; }
body[data-mode="export"] .listening-bar,
body[data-mode="export"] #result-notice { display: none; }

.timeline {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}
.track-heading { margin-bottom: 12px; }
#tracks .track {
  margin: 8px 0;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
}
#tracks .track.selected { border-color: #b8c7ed; border-left-color: var(--blue); border-left-width: 3px; }
#tracks .wave { border-radius: 8px; background: #edf3f5; }
.track-actions button { border-radius: 10px; }
.include-button.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.listening-bar {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

#practice, #exports {
  padding: 22px;
  border: 0;
  border-radius: 16px;
  background: var(--blue-soft);
}
.paper { border-radius: 18px; }
.note-panel { border-radius: 0; }
.transport { border-top-color: #e4e8ef; }

@media (max-width: 820px) {
  header { height: 60px; padding: 0 14px; }
  header .engine-pill { margin-left: auto; }
  header #import { width: 42px; padding: 0; font-size: 0; }
  header #import::after { content: '+'; font-size: 24px; }
  body:not([data-screen="workspace"]) main { padding: 30px 18px 110px; }
  #welcome { padding-top: 10px; }
  #welcome h2 { font-size: clamp(38px, 10vw, 58px); }
  #welcome .home-lede { font-size: 15px; }
  .home-choices { grid-template-columns: 1fr; }
  .choice-primary { grid-row: auto; min-height: 132px; }
  .flow-steps { overflow: hidden; }
  .flow-steps li { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

  main { margin-top: 60px; margin-bottom: 126px; }
  .workspace-heading { gap: 18px; margin-bottom: 18px; }
  .workspace-heading h2 { font-size: 28px; }
  .workspace-heading nav {
    position: sticky;
    top: 66px;
    z-index: 7;
    width: 100%;
  }
  .workspace-heading nav button { flex: 1; min-width: 0; }
  .timeline { padding: 14px; border-radius: 16px; }
  .track-heading h2 { font-size: 22px; }
  #tracks .track { padding: 13px 10px; }
  .score-tools { padding: 12px; border-radius: 14px; background: var(--paper); }
  .paper { border-radius: 14px; }
  .transport {
    height: 118px;
    color: #fff;
    background: var(--dark);
    border: 0;
  }
  .transport select, .transport button { color: var(--ink); background: #fff; }
  .transport #play { color: var(--dark); }
  .transport-practice { border-top-color: #ffffff20; }
  #seek { accent-color: var(--playhead); }
  #toast { bottom: 136px; }
}

@media (max-width: 560px) {
  .brand { font-size: 0; }
  .brand-mark { width: 29px; height: 29px; font-size: 15px !important; }
  body[data-screen="workspace"] .engine-pill { display: none; }
  #library-toggle { padding-inline: 9px; font-size: 12px; }
  .engine-pill { font-size: 11px; }
  #welcome h2 { font-size: 42px; }
  .choice { grid-template-columns: 44px minmax(0,1fr) 18px; padding: 17px; border-radius: 16px; }
  .choice-symbol { width: 44px; height: 44px; }
  #home-record-list > button { padding: 16px; }
  .flow-page h2 { font-size: 36px; }
  .goal-choices label { padding: 17px; }
  #processing-status, #target-options { padding: 17px; }
  .workspace-heading h2 { font-size: 25px; }
  .workspace-heading nav button { padding: 9px 4px; font-size: 13px; }
  #tracks .track { grid-template-columns: 1fr; }
  .track-actions { grid-column: 1; }
  .track-actions button { min-height: 46px; }
  .listening-bar { padding: 14px; }
  .score-column { width: 100%; max-width: 100%; overflow: hidden; }
  .paper { width: 100%; max-width: 100%; overflow-x: auto; }
  #score { width: 760px; max-width: none; overflow: visible; }
  #score svg { max-width: none; }
}

@media print {
  .engine-pill, .home-recent { display: none !important; }
}

/* Platform metrics: 44 CSS-pixel targets and safe-area aware mobile chrome. */
button,
select,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
textarea,
summary {
  min-block-size: var(--web-control-height);
}

button,
summary,
label[for],
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  touch-action: manipulation;
}

.track-label button,
.track-actions button,
.more-actions > summary,
.more-actions > div button,
.pagination button,
.score-tools button,
.listening-bar button,
.loop-range button,
.transport #play,
#advanced,
#library-toggle,
#close,
#dialog button,
.back-home,
#process-home {
  min-block-size: var(--web-touch-target);
}

#advanced,
.pagination button,
.transport #play,
#close {
  min-inline-size: var(--web-touch-target);
}

.goal-choices label,
#target-stems label,
.follow-score,
.loop-toggle,
.export-check {
  min-block-size: var(--web-touch-target);
}

.goal-choices label,
#target-stems label,
.follow-score,
.loop-toggle {
  display: flex;
  align-items: center;
}

input[type="checkbox"],
input[type="radio"] {
  inline-size: 20px;
  block-size: 20px;
  flex: 0 0 20px;
}

#seek,
input[type="range"] {
  min-block-size: var(--web-touch-target);
  margin-block: 0;
}

.track-actions,
.score-entry-actions,
.export-buttons,
.process-actions,
.listening-bar > div,
.score-tools-main,
.transport-practice,
.loop-range {
  gap: var(--web-control-gap);
}

dialog {
  max-block-size: min(88dvh, 900px);
  overflow: auto;
}

@media (pointer: coarse) {
  button,
  select,
  input:not([type="checkbox"]):not([type="radio"]),
  summary,
  [role="button"] {
    min-block-size: var(--web-touch-target);
  }

  .track-name,
  #home-record-list > button,
  #projects > button,
  #record-list > button {
    min-block-size: 48px;
  }
}

@media (max-width: 820px) {
  header {
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(60px + env(safe-area-inset-top, 0px));
  }

  header #import,
  header #advanced,
  header #library-toggle {
    min-inline-size: var(--web-touch-target);
    min-block-size: var(--web-touch-target);
  }

  main { margin-top: calc(60px + env(safe-area-inset-top, 0px)); }
  #library { top: calc(60px + env(safe-area-inset-top, 0px)); }
  .workspace-heading nav { top: calc(66px + env(safe-area-inset-top, 0px)); }
  .transport {
    height: calc(118px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (max-width: 560px) {
  header #import { width: var(--web-touch-target); }
  .brand-mark { width: 32px; height: 32px; }
  .workspace-heading nav button { min-block-size: 48px; }
  .track-name { min-block-size: 48px; }
  .score-tools-main > *,
  .export-buttons > *,
  .process-actions > * { width: 100%; }
}

@media (max-width: 360px) {
  body:not([data-screen="workspace"]) main { padding-inline: 12px; }
  #welcome h2 { font-size: clamp(34px, 11vw, 42px); }
  .flow-page h2 { font-size: clamp(30px, 10vw, 36px); }
  .choice { grid-template-columns: 40px minmax(0, 1fr) 16px; padding-inline: 14px; }
  .choice-symbol { width: 40px; height: 40px; }
  .workspace-heading nav button { font-size: 12px; }
  .engine-pill { display: none; }
}

@media (forced-colors: active) {
  button,
  .choice,
  .track,
  .timeline { border: 1px solid ButtonText; }
}
