/* AMPLE Lite: a small page. The colours are the design tokens of Studio (/styles/tokens.css); nothing else of Studio's stylesheets is used. */
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
body { display: grid; grid-template-rows: auto 1fr minmax(120px, 28vh); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lite-dim { color: var(--dim); }
.lite-gap { flex: 1; }
button, .button, select, input[type="search"], input[type="text"] { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 4px 10px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--line-strong); }
button:focus-visible, .button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: none; box-shadow: var(--focus); }
button:disabled, .button[aria-disabled="true"] { opacity: .45; cursor: default; }
.primary { background: var(--acc); color: var(--on-accent); border-color: var(--acc); font-weight: 600; }
.danger:hover { border-color: #f07178; color: #f07178; }

#lite-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--head-grad); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lite-brand { letter-spacing: .04em; } .lite-brand span { color: var(--acc); }
#lite-status { color: var(--dim); font-size: 12px; min-width: 8em; text-align: right; }

#lite-main { display: grid; grid-template-columns: minmax(180px, 250px) 1fr; min-height: 0; }
#lite-files { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.lite-files-bar { display: flex; gap: 6px; padding: 8px; }
#lite-tree { overflow: auto; flex: 1; padding: 0 4px 8px; }
#lite-usage { margin: 0; padding: 6px 10px; font-size: 12px; border-top: 1px solid var(--line); }
.lite-row { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: var(--r-s); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.lite-row:hover { background: var(--panel2); }
.lite-row[aria-selected="true"] { background: color-mix(in srgb, var(--acc) 22%, transparent); }
.lite-row .ic { width: 1.3em; text-align: center; color: var(--dim); }
.lite-row.folder { color: var(--dim); }

#lite-work { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#lite-filebar { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 2.2em; }
#lite-filename { font-weight: 600; }
#lite-editor { flex: 1; min-height: 0; position: relative; background: var(--panel3); }
#lite-editor .cm-editor { height: 100%; }
#lite-binary { padding: 20px; }
.lite-empty { position: absolute; inset: 2.4em 0 0 0; display: grid; place-content: center; text-align: center; gap: 10px; background: var(--bg); }
.lite-empty[hidden] { display: none; }

.lite-complete { position: absolute; z-index: 20; max-height: 220px; min-width: 200px; max-width: 360px; overflow: auto; background: var(--panel2); border: 1px solid var(--line-strong); border-radius: var(--r-s); box-shadow: var(--shadow-2); }
.lite-complete-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 8px; cursor: pointer; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.lite-complete-row small { color: var(--dim); overflow: hidden; text-overflow: ellipsis; }
.lite-complete-row.on { background: color-mix(in srgb, var(--acc) 30%, transparent); }
.lite-tip { position: absolute; z-index: 20; max-width: 340px; padding: 6px 9px; background: var(--panel2); border: 1px solid var(--line-strong); border-radius: var(--r-s); box-shadow: var(--shadow-2); font-size: 12px; white-space: pre-wrap; pointer-events: none; }
.lite-diag-error { text-decoration: underline wavy #f07178; text-underline-offset: 3px; }
.lite-diag-warning { text-decoration: underline wavy #f5c542; text-underline-offset: 3px; }
.lite-diag-info { text-decoration: underline dotted var(--dim); text-underline-offset: 3px; }
.ag-error { color: #f07178; } .ag-warning { color: #f5c542; } .ag-info { color: var(--acc); }

#lite-foot { display: grid; grid-template-columns: 1fr 1fr minmax(240px, 28%); border-top: 1px solid var(--line); background: var(--panel); min-height: 0; }
#lite-foot section { padding: 6px 10px; overflow: auto; min-height: 0; }
#lite-foot h2 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); }
#lite-problems { list-style: none; margin: 0; padding: 0; font-size: 13px; }
#lite-problems li { padding: 2px 4px; border-radius: var(--r-s); cursor: pointer; }
#lite-problems li:hover { background: var(--panel2); }
#lite-problems li::before { content: "● "; } #lite-problems li.error::before { color: #f07178; } #lite-problems li.warning::before { content: "▲ "; color: #f5c542; } #lite-problems li.info::before { content: "ℹ "; color: var(--acc); }
#lite-log { font: 12px/1.4 ui-monospace, Consolas, monospace; color: var(--dim); white-space: pre-wrap; overflow: auto; max-height: 100%; } #lite-log div:last-child { color: var(--text); }
#lite-progress { vertical-align: middle; width: 8em; margin-left: 8px; accent-color: var(--acc); }
#lite-output { width: 100%; } #lite-output-info { margin: 4px 0 0; font-size: 12px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 16px; max-width: min(720px, 94vw); box-shadow: var(--shadow-2); }
dialog::backdrop { background: var(--backdrop); }
dialog h2 { margin: 0 0 10px; font-size: 16px; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 14px 0 0; }
dialog input[type="text"] { width: 100%; box-sizing: border-box; }
#lite-demo-dialog { width: min(820px, 94vw); max-height: 86vh; } #lite-demo-dialog[open] { display: flex; flex-direction: column; }
.lite-demo-head { display: flex; gap: 10px; align-items: center; } .lite-demo-head h2 { margin: 0; } .lite-demo-head input { flex: 1; }
.lite-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.lite-chips button[aria-pressed="true"] { background: var(--acc); color: var(--on-accent); border-color: var(--acc); }
#lite-demo-list { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 8px; }
#lite-demo-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-s); }
#lite-demo-list h3 { margin: 0; font-size: 14px; } #lite-demo-list p { margin: 0; color: var(--dim); font-size: 13px; grid-column: 1; }
#lite-demo-list .meta { grid-column: 1; font-size: 11px; color: var(--dim); } #lite-demo-list button { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
#lite-roll { width: min(1600px, 98vw); height: 94vh; max-width: none; max-height: none; padding: 14px 16px; box-sizing: border-box; } #lite-roll[open] { display: flex; flex-direction: column; gap: 10px; }
.lite-roll-head, .lite-roll-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; } .lite-roll-head h2 { margin: 0 6px 0 0; font-size: 17px; }
.lite-roll-field { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; } .lite-roll-field select, .lite-roll-field input { text-transform: none; letter-spacing: 0; font-size: 14px; }
.lite-roll-field input[type="range"] { width: 110px; padding: 0; accent-color: var(--acc); }
.lite-roll-tools { padding: 8px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r-s); gap: 6px; } .lite-roll-tools button { padding: 4px 9px; }
.lite-roll-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; } .lite-roll-help { flex: 1 1 100%; font-size: 12px; margin-top: 2px; }
#lite-roll-scroll { overflow: auto; flex: 1 1 auto; min-height: 220px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel3); }
#lite-roll-velwrap { overflow: hidden; flex: 0 0 auto; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel3); }
#lite-roll-canvas, #lite-roll-vel { display: block; touch-action: none; } #lite-roll-canvas { cursor: crosshair; } #lite-roll-vel { cursor: ns-resize; }
#lite-toasts { position: fixed; right: 12px; bottom: 12px; display: grid; gap: 6px; z-index: 50; max-width: min(420px, 90vw); }
#lite-toasts div { background: var(--panel2); border: 1px solid var(--line-strong); border-left: 4px solid var(--acc); padding: 8px 12px; border-radius: var(--r-s); box-shadow: var(--shadow-2); }
#lite-toasts div.error { border-left-color: #f07178; }

/* A phone: the page scrolls as a whole, the editor gets a real height, and Build & play floats at the bottom right where a thumb reaches it. */
@media (max-width: 760px) {
  html, body { height: auto; }
  body { display: block; font-size: 15px; }
  body { padding-bottom: 84px; }
  #lite-bar { gap: 6px; padding: 6px 8px; }
  .lite-brand { order: 1; font-size: 15px; }
  .lite-project { order: 2; flex: 1 1 calc(100% - 110px); min-width: 0; }
  .lite-project select { width: 100%; }
  #lite-build { position: fixed; right: 12px; bottom: 12px; z-index: 6; padding: 14px 22px; font-size: 17px; border-radius: 28px; box-shadow: 0 4px 16px rgba(0, 0, 0, .55); }
  #lite-cancel { position: fixed; left: 12px; bottom: 12px; z-index: 6; padding: 14px 20px; font-size: 16px; border-radius: 28px; background: var(--panel2); box-shadow: 0 4px 16px rgba(0, 0, 0, .55); }
  #lite-stop { order: 4; padding: 6px 12px; font-size: 13px; }
  #lite-new-project, #lite-demos-btn, #lite-share, #lite-download, #lite-download-flac, #lite-download-mp3, #lite-reset { order: 5; padding: 6px 10px; font-size: 13px; }
  #lite-bar .lite-gap { display: none; }
  #lite-status { order: 6; flex: 1 1 100%; min-width: 0; text-align: left; font-size: 12px; }
  #lite-status:empty { display: none; }
  #lite-main { display: block; }
  #lite-files { max-height: 22vh; border-right: 0; border-bottom: 1px solid var(--line); }
  #lite-usage { display: none; }
  #lite-work { display: block; }
  #lite-filebar { flex-wrap: wrap; gap: 6px; }
  #lite-filename { flex: 1 1 100%; font-weight: 600; overflow-wrap: anywhere; }
  #lite-filebar button { padding: 5px 9px; font-size: 13px; white-space: nowrap; }
  #lite-filebar .lite-gap { display: none; }
  #lite-editor { height: 58vh; min-height: 300px; flex: none; }
  #lite-foot { display: block; }
  #lite-foot section { max-height: 24vh; }
  #lite-output-pane { max-height: none; }
  #lite-output { width: 100%; }
}
