:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --text: #16181d;
  --muted: #666d7a;
  --border: #d9dce2;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-text: #ffffff;
  --notice-bg: #fff4d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --border: #2e333c;
    --accent: #5b9bff;
    --accent-text: #0b1220;
    --danger: #ff8a80;
    --danger-text: #1a0b0a;
    --notice-bg: #3a3012;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: clip; }
body {
  margin: 0;
  /* viewport-fit=cover: on a notched phone on its side nothing sits under the notch. */
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-wrap: anywhere;
}
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.site-header {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; border-bottom: 1px solid var(--border);
  padding: 10px max(16px, calc((100% - 960px) / 2 + 16px));
}
.site-tabs { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.site-tab { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.site-tab:hover { color: var(--text); background: var(--surface); }
.site-tab.active { color: var(--text); background: var(--surface); }
.profile-field { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 8px 0; }
.profile-field dt { color: var(--muted); }
.profile-field dd { margin: 0; }
.nickname-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.nickname-form input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 220px; }
.mark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.mark img { border-radius: 6px; }
.account { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--muted); }
h1 { font-size: 1.4rem; margin: 8px 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* A link that acts like a button (Upload here, Open folder). */
a.button { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.centered { text-align: center; padding: 48px 0; }
.notice { background: var(--notice-bg); border-radius: 8px; padding: 12px 14px; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
.session-link { display: block; color: var(--text); text-decoration: none; font-weight: 500; }
.session-link:hover { text-decoration: underline; }
.version-list { list-style: none; padding: 0; margin: 0; }
.version-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.meta { color: var(--muted); font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.download-project { margin: 4px 0 12px; }
.download-project .actions { align-items: center; }
select {
  font: inherit; padding: 8px 10px; border-radius: 8px; color-scheme: light dark;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropdown { border-bottom: 1px solid var(--border); }
.dropdown > summary { display: flex; align-items: center; gap: 10px; padding: 12px 4px; cursor: pointer; list-style: none; }
.dropdown > summary::-webkit-details-marker, .file-folder > summary::-webkit-details-marker { display: none; }
.dropdown > summary::before, .file-folder > summary .file-name::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 4px 0 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg);
}
.dropdown[open] > summary::before, .file-folder[open] > summary .file-name::before { transform: rotate(45deg); }
.dropdown > summary h2 { margin: 0; }
.dropdown > summary:hover h2 { color: var(--accent); }
.dropdown > summary:focus-visible, .file-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.dropdown-body { padding: 0 0 16px; }
.file-browser { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 88px; column-gap: 12px; align-items: center; padding: 5px 12px; font-size: 0.92rem; list-style: none; }
.file-row:hover, .file-row.menu-open { background: color-mix(in srgb, var(--accent) 12%, transparent); }
summary.file-row { cursor: pointer; }
.file-browser-head { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.file-browser-head:hover { background: none; }
.file-name { --depth: 0; display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: calc(var(--depth) * 20px); }
div.file-row .file-name { padding-left: calc(var(--depth) * 20px + 19px); }
.file-icon { flex: none; width: 16px; height: 16px; background: var(--muted); }
.file-icon.folder {
  background: var(--accent);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 3.5A1.5 1.5 0 0 1 2.5 2h3.6l1.6 1.8h5.8A1.5 1.5 0 0 1 15 5.3v7.2a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 1 12.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.file-icon.file {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 1h6.5L13 4.5V15H3zm6 1v3h3z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
}
.file-kind { color: var(--muted); }
.file-size { color: var(--muted); text-align: right; white-space: nowrap; }
.file-browser-head span:last-child { text-align: right; }
.file-status { margin-left: 8px; flex: none; }
.file-action { grid-column: 1 / -1; padding: 4px 0 2px calc(var(--depth) * 20px + 41px); }
.file-action:empty { display: none; }
.file-row.not-in-cloud .file-name > span:nth-child(2) { color: var(--muted); }
.file-menu {
  position: fixed; z-index: 20; min-width: 160px; padding: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.file-menu button { display: block; width: 100%; padding: 6px 10px; text-align: left; border: 0; border-radius: 5px; background: none; color: var(--text); font-size: 0.92rem; }
.file-menu button:not(:disabled):hover, .file-menu button:not(:disabled):focus-visible { background: var(--accent); color: var(--accent-text); outline: none; }
@media (max-width: 600px) {
  .file-row { grid-template-columns: minmax(0, 1fr) 76px; }
  .file-kind, .file-browser-head span:nth-child(2) { display: none; }
}
.danger { margin-top: 40px; padding-top: 16px; border-top: 2px solid var(--danger); }
.danger h2 { color: var(--danger); margin-top: 0; }
.members { margin-top: 32px; }
.members-list { list-style: none; padding: 0; margin: 0 0 12px; }
.members-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 4px 0; }
.members input[type="text"] {
  flex: 1 1 auto; min-width: 0; padding: 8px 10px; font: inherit;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.danger input[type="text"] {
  display: block; width: 100%; max-width: 100%; margin: 8px 0; padding: 8px 10px; font: inherit;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
button.danger-button:not(:disabled) { background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
@media (max-width: 600px) {
  table.stack thead { position: absolute; left: -9999px; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.stack td { border: 0; padding: 2px 0; text-align: left; }
  table.stack td.num { text-align: left; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem; }
}
.session-thumb img { display: block; width: 320px; max-width: calc(100vw - 32px); height: auto; border-radius: 4px; }
.session-thumb { margin: 8px 0; }
[hidden] { display: none !important; }
.export-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 10px 12px; margin: 8px 0; }
.export-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--notice-bg); color: var(--text); border: 1px solid var(--border); }
.export-files { margin-top: 8px; }
.export-files > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; font-weight: 600; list-style: none; }
.export-files > summary::-webkit-details-marker { display: none; }
.export-files > summary::before {
  content: ""; flex: none; width: 6px; height: 6px; margin: 0 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg);
}
.export-files[open] > summary::before { transform: rotate(45deg); }
.export-files .file-browser { margin-top: 4px; }
.export-files .file-row:not(.file-browser-head) { cursor: context-menu; }
.export-share-panel:not(:empty) { margin-top: 6px; }
.export-play { margin: 6px 0 0; align-items: center; }
.export-player-host:not(:empty) { margin-top: 6px; }
.export-player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.export-player-bar[hidden] { display: none; }
.export-source-switch { display: inline-flex; }
.export-source-switch button { border-radius: 0; margin-left: -1px; }
.export-source-switch button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.export-source-switch button:last-child { border-radius: 0 6px 6px 0; }
.export-source-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.export-player-status { flex: 1 1 12rem; }
.export-clips { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; }
.export-clips > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.clip-row { padding: 6px 0; border-bottom: 1px solid var(--border); }
.clip-row:last-child { border-bottom: 0; }
.clip-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.clip-row-text { flex: 1 1 14rem; min-width: 0; }
.clip-row-name { overflow-wrap: anywhere; }
.clip-row-head .actions { margin: 0; }
.clip-row-panel:not(:empty) { margin-top: 6px; }
.clip-row-status:empty { display: none; }
.clip-confirm { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; background: var(--bg); }
.clip-confirm p { margin: 0 0 6px; }
.clip-confirm .actions { margin: 6px 0 0; }
.clip-share-label { display: block; }
.clip-share-url { width: 100%; box-sizing: border-box; padding: 6px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; }
.export-player { display: block; width: 100%; max-width: 100%; }
video.export-player { max-height: 60vh; background: #000; }
.kind-badge { margin-left: 8px; }
.tabs { display: flex; gap: 4px; margin: 8px 0 4px; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.practice-host { margin-top: 12px; }
.jam-link { color: var(--text); text-decoration: none; font-weight: 500; }
.jam-link:hover { text-decoration: underline; }
.video-player { position: relative; background: #000; border-radius: 6px; overflow: hidden; color: #e8eaee; }
.video-rotor { display: flex; flex-direction: column; }
.video-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.video-player video.export-player { display: block; width: 100%; max-height: 60vh; background: #000; }
.video-controls { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #15171c; }
.video-controls button, .clip-cropper button { padding: 6px 10px; font-size: 0.85rem; background: #2a2e37; border-color: #3a3f4a; color: #e8eaee; white-space: nowrap; }
.video-controls button.primary, .clip-cropper button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.video-controls button.video-fullscreen { font-size: 1.1rem; line-height: 1; padding: 5px 8px; }
.video-time { flex: 1 1 auto; font-size: 0.8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .video-time { display: none; } }
.video-player.fullscreen { position: fixed; inset: 0; z-index: 50; border-radius: 0; }
.video-player.fullscreen .video-rotor { position: absolute; inset: 0; }
.video-player.fullscreen video.export-player { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.video-player.fullscreen.rotated .video-rotor { inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(90deg); }
.video-player.fullscreen .clip-cropper { padding: 4px 8px; gap: 3px; }
html.video-fullscreen-open, html.video-fullscreen-open body { overflow: hidden; }
.clip-cropper { padding: 8px; background: #15171c; border-top: 1px solid #2e333c; display: grid; gap: 6px; }
.clip-range { position: relative; height: 56px; touch-action: none; user-select: none; -webkit-user-select: none; }
.clip-range-track { position: absolute; left: 16px; right: 16px; top: 4px; height: 48px; display: flex; overflow: hidden; background: #1a1d23; border-radius: 4px; }
.clip-thumb { display: block; flex: none; height: 48px; background: #1a1d23; }
.clip-waveform { position: absolute; left: 16px; right: 16px; top: 4px; width: calc(100% - 32px); height: 48px; pointer-events: none; mix-blend-mode: normal; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9)); }
.clip-dim { position: absolute; top: 4px; height: 48px; background: rgba(10, 12, 16, 0.7); pointer-events: none; }
.clip-range-span { position: absolute; top: 4px; height: 48px; box-sizing: border-box; border-top: 3px solid var(--accent); border-bottom: 3px solid var(--accent); pointer-events: none; }
.clip-playhead { position: absolute; top: 0; width: 2px; height: 56px; margin-left: -1px; background: #fff; pointer-events: none; z-index: 3; }
.clip-handle { position: absolute; top: 4px; z-index: 2; width: 16px; height: 48px; background: var(--accent); cursor: ew-resize; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.clip-handle::after { content: ""; width: 3px; height: 18px; border-radius: 2px; background: var(--accent-text); }
.clip-handle.in { border-radius: 6px 0 0 6px; }
.clip-handle.out { border-radius: 0 6px 6px 0; }
.clip-handle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.clip-range-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: #9aa1ad; font-variant-numeric: tabular-nums; }
.clip-cropper-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.clip-cropper-row .clip-times { font-size: 0.85rem; font-variant-numeric: tabular-nums; margin-right: auto; }
.clip-status { color: #9aa1ad; font-size: 0.85rem; min-height: 1.2em; }
.clip-watertag { flex: 0 1 13rem; min-width: 8rem; padding: 4px 8px; border-radius: 4px; border: 1px solid #2e333c; background: #1a1d23; color: #e8eaee; font: inherit; font-size: 0.85rem; }
.clip-watertag:disabled { opacity: 0.6; }
.clip-crop { padding: 4px 6px; border-radius: 4px; border: 1px solid #2e333c; background: #1a1d23; color: #e8eaee; font: inherit; font-size: 0.85rem; }
.clip-crop:disabled { opacity: 0.6; }
.clip-crop-zoom { width: 6rem; }
.clip-picture-preview { position: absolute; pointer-events: none; }
.clip-picture-preview.movable { pointer-events: auto; cursor: grab; touch-action: none; }
/* minmax(0, 1fr): WebKit sizes a textarea wider than a phone, and an auto track would grow to fit it. */
.message-board { position: relative; }
/* Sits on the summary's row, at its right edge; the summary keeps clear of it. */
.message-board > summary { padding-right: 11rem; }
/* 1rem: iOS zooms the page into any control with smaller text when it is tapped. */
.message-timezone { position: absolute; top: 7px; right: 0; max-width: 10.5rem; padding: 4px 8px; font-size: 1rem; }
@media (max-width: 420px) {
  .message-board > summary { padding-right: 8.5rem; }
  .message-timezone { max-width: 8rem; }
}
.message-board > .dropdown-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.message-board > .dropdown-body.dropping { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 8px; }
.message-scroll-frame { position: relative; }
.message-scroll {
  height: min(60vh, 440px); overflow-y: auto; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.message-older { text-align: center; padding: 4px 0 8px; font-size: 0.8rem; }
.message-empty { text-align: center; margin: 24px 0; }
.message-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.message { display: grid; gap: 2px; justify-items: start; max-width: 85%; }
.message.mine { justify-self: end; justify-items: end; }
.message-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 0.85rem; }
.message-delete { padding: 0 6px; font-size: 0.75rem; border: 0; background: none; color: var(--muted); }
.message-delete:hover, .message-delete[data-armed="yes"] { color: var(--danger); }
.message-bubble {
  display: grid; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
  max-width: 100%; min-width: 0;
}
.message.mine .message-bubble { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.message-text { white-space: pre-wrap; }
.message-attachment { display: grid; gap: 4px; min-width: 0; }
.message-attachment img { display: block; max-width: min(100%, 360px); max-height: 320px; border-radius: 8px; cursor: zoom-in; background: var(--surface); min-height: 60px; }
.message-attachment video { display: block; width: min(100%, 480px); max-height: 360px; border-radius: 8px; background: #000; }
.message-attachment audio { display: block; width: min(100%, 360px); min-width: 240px; }
.message-file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.message-file-name { font-weight: 500; overflow-wrap: anywhere; }
.message-download { padding: 2px 10px; font-size: 0.8rem; }
.message-newer {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 4px 12px; font-size: 0.85rem;
  border-radius: 999px; background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.message-composer { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.message-pending:empty { display: none; }
.message-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.message-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 0.85rem; max-width: 100%; }
.message-chip.failed { border-color: var(--danger); }
.message-chip-remove { padding: 0 8px; border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; }
.message-input-row { display: flex; gap: 8px; align-items: flex-end; }
.message-input-row > button { flex: none; white-space: nowrap; overflow-wrap: normal; }
.message-input-row textarea {
  flex: 1 1 auto; width: 0; min-width: 0; resize: none; font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); line-height: 1.4;
}
.message-input-row textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.message-status:empty { display: none; }
@media (max-width: 600px) {
  .message { max-width: 100%; }
  .message-attachment audio { min-width: 0; width: 100%; }
}

.fork-source { margin-left: 0.5rem; }
.redeem-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.redeem-form input { flex: 1 1 260px; min-width: 0; font: 0.95rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.redeem-result { min-height: 1.4em; margin: 8px 0; }
.redeem-result.error { color: var(--danger); }
.code-request { margin: 8px 0 16px; }
.code-request summary { cursor: pointer; color: var(--muted); }
.code-request-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.code-request-form input { flex: 1 1 200px; min-width: 0; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.code-request-confirmation { white-space: pre-wrap; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; }
.grant-list { padding-left: 1.2em; }

.jar-detail-picture, .jar-hero {
  aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.jar-detail-picture img, .jar-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jar-picture-initial { font-size: 3rem; font-weight: 600; color: var(--muted); }
.jar-picture-section { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 8px 0 16px; }
.jar-detail-picture { width: 160px; max-width: 100%; }
.jar-hero { width: 120px; max-width: 100%; flex: none; }
.mark img.band-art { object-fit: cover; }
.section-heading { display: flex; align-items: center; gap: 10px; }
.section-heading-icon { font-size: 1.4em; line-height: 1; }
/* The five sections: one row across a portrait phone, every tile shrinking to fit, never scrolled. */
.jar-sections { display: grid; grid-template-columns: repeat(5, minmax(0, 88px)); justify-content: center; gap: 6px; }
/* The ‹ / › tile: a run's previous / next song. */
.step-tile {
  display: flex; align-items: center; justify-content: center; min-width: 0; padding: 4px 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--muted); font: inherit; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.step-tile:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.step-tile:disabled { opacity: 0.35; cursor: default; }
.jar-sections[hidden] { display: none; }
.jar-section {
  display: grid; justify-items: center; gap: 1px; min-width: 0; padding: 4px 2px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--muted); text-decoration: none; font-size: 0.74rem; font-weight: 500; line-height: 1.2;
}
.jar-section-label, .jar-section-hint { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jar-section:hover { color: var(--text); border-color: var(--accent); }
.jar-section.active { color: var(--text); border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }

/* A JAR's setlists */
.setlist-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.setlist-new input[type="text"], .setlist-new select { flex: 1 1 220px; min-width: 0; padding: 6px 8px; font: inherit; }
.setlist-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.setlist-jams { padding-left: 1.6em; margin: 16px 0; }
.setlist-jam { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--border, rgba(127,127,127,0.25)); }
.setlist-jam .jam-link { font-weight: 600; }
.setlist-jam-actions { margin-left: auto; display: flex; gap: 4px; }
.setlist-jam-actions button { padding: 2px 10px; }
.setlist-footer { margin-top: 32px; }
.setlist-footer button { color: var(--danger); border-color: var(--danger); }
.run-start { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
/* A run's song row: ‹  1/10 Song  ›, with "(next Song)" small on a second line under the title. */
.run-bar { display: flex; align-items: stretch; gap: 8px; margin: 0; min-width: 0; }
.run-bar .step-tile { flex: 0 0 44px; min-height: 40px; }
.run-now { flex: 1 1 0; min-width: 0; display: grid; grid-template-columns: auto minmax(0, max-content); justify-content: center; align-items: baseline; column-gap: 8px; align-self: center; white-space: nowrap; overflow: hidden; }
.run-count { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.run-song { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.run-next { grid-column: 1 / -1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: center; font-size: 0.72rem; line-height: 1.2; }
/* The song line is a button: press and hold it for the whole setlist, unfolded under the sticky header as the mixer is. */
button.run-now { padding: 2px 6px; border: 0; border-radius: 8px; background: none; color: inherit; }
button.run-now[aria-expanded="true"] { background: var(--surface); }
.run-setlist { margin: 8px 0; border-radius: 8px; background: var(--bg); max-height: min(60dvh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.site-header > .run-setlist {
  position: absolute; top: calc(100% + 8px); z-index: 40; margin: 0; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  left: max(16px, calc((100% - 960px) / 2 + 16px)); right: max(16px, calc((100% - 960px) / 2 + 16px));
}
.run-setlist-songs { list-style: none; margin: 0; padding: 4px; }
button.run-setlist-song { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 6px; background: none; }
button.run-setlist-song:hover, button.run-setlist-song.current { background: var(--surface); }
.run-setlist-song.current .run-song { font-weight: 600; }
.run-setlist-song .run-count { min-width: 2ch; text-align: right; }
/* The header's title, above the transport. */
.player-heading { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
.player-heading:empty { display: none; }
.player-heading-title { margin: 0; font-size: 1.35rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The practice player's transport, seated in the sticky header while a player is open */
.player-transport { margin-left: auto; }
.player-transport .pp-transport-row { padding: 0; }
.player-transport.practice-player .pp-seek-row { margin: 8px 0 0; padding: 0; background: none; }
/* The unfolded mixer floats under the header over the page, scrolled or not: in flow it pushed the videos down at the top. */
.player-transport.practice-player { position: relative; }
.player-transport.practice-player .pp-mix-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40; border-radius: 8px; background: var(--bg); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55); }
.player-transport:has(.pp-seek-row) { min-width: min(100%, 360px); }

/* The JAR's sticky header holds only the transport and the seek bar under it, while a player is open; the band,
   its badges and the sections ride a sticky footer. */
.jar-header { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
.jar-header:not(:has(.player-transport:not([hidden]))):not(:has(.player-heading:not(:empty))) { display: none; }
.jar-header .player-transport { margin-left: 0; }
.jar-header .player-transport .pp-transport-row { justify-content: center; }
.jar-footer {
  position: sticky; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: minmax(0, 1fr); row-gap: 6px;
  padding: 6px max(16px, calc((100% - 960px) / 2 + 16px)) calc(6px + env(safe-area-inset-bottom, 0px));
}
.jar-footer[hidden] { display: none; }
/* The page is at least a screen tall, so the footer sits at the bottom edge even while the content is short (loading). */
body:has(> .jar-footer:not([hidden])) { display: flex; flex-direction: column; min-height: 100dvh; }
body:has(> .jar-footer:not([hidden])) > main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.jar-footer .mark { justify-self: start; }
/* The account badge is at the footer's left end, so its menu opens upward and rightward. */
.jar-footer .account-popover { top: auto; bottom: calc(100% + 6px); right: auto; left: 0; }
/* A phone on its side has little height. */
@media (max-height: 500px) {
  .jar-header, .jar-footer { row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
}

/* The JAR footer's bottom row never moves: the account left of the band, Messages and the menu toggle at its right end;
   the sections open in the row above it. */
.round-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; padding: 0; border-radius: 50%; line-height: 1;
}
.round-badge[hidden] { display: none; }
.round-badge.active { border-color: var(--accent); color: var(--accent); }
/* Back and forward bookend the footer row. */
.history-step { font-size: 1.35rem; padding-bottom: 2px; }
.history-step:disabled { opacity: 0.35; cursor: default; }
/* A portrait phone swipes back and forward instead (jar.js PORTRAIT_PHONE_QUERY). */
@media (orientation: portrait) and (max-width: 600px) {
  .history-step { display: none; }
}
.jar-header-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.jar-header-badges { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.jar-header-top .mark { min-width: 0; }
.jar-menu[hidden] { display: none; }
.account-anchor { position: relative; flex: none; }
.account-popover {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 200px; max-width: calc(100vw - 32px);
  display: grid; gap: 10px; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); font-size: 0.9rem; color: var(--muted);
}
.account-popover[hidden] { display: none; }
.account-popover-name { overflow-wrap: anywhere; }
.kept-on-device { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kept-on-device[hidden] { display: none; }
.message-panel {
  position: fixed; z-index: 34; left: max(env(safe-area-inset-left, 0px), calc((100% - 960px) / 2)); right: max(env(safe-area-inset-right, 0px), calc((100% - 960px) / 2));
  bottom: 0; height: min(72vh, 680px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box;
  display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-bottom: none;
  border-radius: 12px 12px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  transform: translateY(calc(100% + 40px)); visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}
.message-panel.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
.message-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 4px; }
.message-panel-head h2 { margin: 0; font-size: 1.1rem; }
.message-panel-close { font-size: 1.4rem; line-height: 1; padding: 2px 10px; }
.message-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 12px; }
.message-panel .message-board { border: none; margin: 0; }
.message-panel .message-board > summary { display: none; }
.message-panel .message-timezone { position: static; display: block; margin: 0 0 6px auto; }
.message-panel .message-board > .dropdown-body { padding: 0; }
/* The panel's height less its head, the time zone row and the composer. */
.message-panel .message-scroll { height: calc(min(72vh, 680px) - 200px); min-height: 120px; }

/* Every section icon sits in the same box, so the traced JAMs symbol and the emoji line up. */
.jar-section-icon { height: 1.15rem; font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.jar-section-icon svg.jams-icon, .jar-section-icon svg.section-line-icon { display: block; height: 100%; width: auto; }
.jar-section-hint { font-size: 0.62rem; color: var(--muted); opacity: 0.8; }
.jar-section.active .jar-section-hint { color: var(--accent); opacity: 0.85; }

/* The one tile: JARs, mixdowns, setlists and projects. 150px floor = two across a portrait phone. */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.tile {
  display: grid; align-content: start; gap: 2px; min-width: 0; padding: 8px 8px 10px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); text-decoration: none; text-align: center; font: inherit;
}
a.tile:hover, button.tile:hover { border-color: var(--accent); }
button.tile { cursor: pointer; }
.tile-picture {
  aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg); margin-bottom: 4px;
  display: flex; align-items: center; justify-content: center;
}
.tile-picture img, .tile-picture video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-glyph { font-size: 2.2rem; line-height: 1; font-weight: 600; color: var(--muted); }
.tile-glyph svg { display: block; height: 2.4rem; width: auto; }
.tile-label, .tile-meta { padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-label { font-weight: 600; }
.tile-meta { color: var(--muted); font-size: 0.82rem; }
.tile-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 2px 2px 0; }
.tile-badges .badge { margin: 0; }
.tile-new { border-style: dashed; background: transparent; color: var(--muted); cursor: pointer; }
.tile-new .tile-picture { background: transparent; }
.tile-new .tile-glyph { font-weight: 300; }
.tile-new:hover { color: var(--accent); }
.tile-holdable { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.tile.editing { cursor: default; border-style: solid; border-color: var(--accent); color: inherit; gap: 6px; }
.tile.editing input { width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; }
.tile.editing button { width: 100%; }

/* A tile for something not built yet: shown, never pressable. */
.tile-placeholder, .tile-placeholder:hover { cursor: default; color: var(--muted); opacity: 0.6; }

/* One chat file on its own page. */
.chat-media-title { overflow-wrap: anywhere; }
.chat-media-view { display: block; max-width: 100%; max-height: 70vh; border-radius: 10px; background: var(--surface); }
video.chat-media-view { width: 100%; background: #000; }
audio.chat-media-view { width: 100%; background: none; }

/* A JAR's calendar. One colour per tag, read by every chip, event and filter. */
:root { --tag-practice: #1f6feb; --tag-gig: #d1242f; --tag-release: #8250df; --tag-deadline: #bf8700; --tag-post: #0a7d6e; }
@media (prefers-color-scheme: dark) {
  :root { --tag-practice: #5b9bff; --tag-gig: #ff7b72; --tag-release: #c297ff; --tag-deadline: #e3b341; --tag-post: #3fc2ad; }
}
.tag-practice { --tag: var(--tag-practice); }
.tag-gig { --tag: var(--tag-gig); }
.tag-release { --tag: var(--tag-release); }
.tag-deadline { --tag: var(--tag-deadline); }
.tag-post { --tag: var(--tag-post); }
.calendar-post { display: grid; gap: 8px; }
.calendar-post[hidden] { display: none; }
.calendar-post select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.calendar-post-count { justify-self: end; margin-top: -4px; }
.calendar-post-count.over { color: var(--danger); }
.calendar-post-networks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.calendar-form .calendar-post-network { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 0.9rem; }
.calendar-post-outcome { margin: 0; }
.calendar-form .calendar-post-network input { width: auto; margin: 0; }
.calendar-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.calendar-heading h1 { margin: 0.4em 0; }
.calendar-toolbar { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.calendar-toolbar .round-badge { font-size: 1.3rem; }
.calendar-month { margin: 0; font-size: 1.15rem; min-width: 0; flex: 0 1 auto; text-align: center; }
.calendar-toolbar > button:last-child { margin-left: auto; }
.calendar-filters, .calendar-form-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.calendar-tag {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.5;
  color: var(--tag); background: color-mix(in srgb, var(--tag) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tag) 45%, transparent);
}
button.calendar-tag { cursor: pointer; }
.calendar-tag.off { color: var(--muted); background: transparent; border-color: var(--border); text-decoration: line-through; }
.calendar-form-tags .calendar-tag.off { text-decoration: none; }
.calendar-grid-holder { overflow-x: auto; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; min-width: 300px; }
.calendar-weekday { font-size: 0.72rem; color: var(--muted); text-align: center; padding: 2px 0; }
.calendar-day {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 76px; padding: 3px; border-radius: 6px;
  background: var(--surface); cursor: pointer; border: 1px solid transparent;
}
.calendar-day:hover, .calendar-day:focus-visible { border-color: var(--accent); outline: none; }
.calendar-day.outside { opacity: 0.45; }
.calendar-day-number { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.calendar-day.today .calendar-day-number {
  align-self: flex-start; background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 0 6px; font-weight: 600;
}
.calendar-event {
  display: flex; gap: 3px; min-width: 0; padding: 1px 4px; border: none; border-left: 3px solid var(--tag); border-radius: 3px;
  background: color-mix(in srgb, var(--tag) 16%, var(--bg)); color: var(--text); font: inherit; font-size: 0.7rem; line-height: 1.35;
  text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.calendar-event-time { color: var(--muted); flex: none; }
.calendar-event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) {
  .calendar-day { min-height: 58px; padding: 2px; }
  .calendar-event { font-size: 0.62rem; padding: 0 2px; }
  .calendar-event-time { display: none; }
}
.calendar-upcoming h2 { font-size: 1.05rem; margin: 20px 0 6px; }
.calendar-upcoming-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.calendar-upcoming-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 4px 10px; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.calendar-upcoming-row:hover { border-color: var(--accent); }
.calendar-upcoming-when { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.calendar-upcoming-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-upcoming-notes { grid-column: 1 / -1; color: var(--muted); font-size: 0.85rem; white-space: pre-wrap; }
@media (max-width: 480px) {
  .calendar-upcoming-row { grid-template-columns: auto minmax(0, 1fr); }
  .calendar-upcoming-when { grid-column: 1 / -1; }
}
.calendar-form { display: grid; gap: 10px; margin: 8px 0 16px; padding: 14px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); }
.calendar-form h2 { margin: 0; font-size: 1.05rem; }
.calendar-form label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.calendar-form input, .calendar-form textarea {
  font: inherit; color: var(--text); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); width: 100%; min-width: 0;
}
.calendar-form textarea { resize: vertical; }
.calendar-form-when { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.calendar-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.calendar-delete { color: var(--danger); border-color: var(--danger); }

/* Home's folders sit in the same grid as its other tiles. */
.tiles-contents { display: contents; }
.folder-name-form { display: grid; gap: 6px; align-content: center; min-height: 100%; }
.folder-name-form input, .folder-rename { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 0; }
.folder-select { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); max-width: 100%; }
.upload-folder { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); }
.upload-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.upload-item .upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item progress { grid-column: 1 / -1; width: 100%; }
.upload-item.failed .meta { color: var(--danger); }
.upload-link { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin: 4px 0 8px; }
.upload-link label { display: grid; gap: 4px; flex: 1 1 260px; color: var(--muted); font-size: 0.9rem; }
.upload-link input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); min-width: 0; }
.upload-item:not(.done):not(.failed) progress:not([value]) { accent-color: var(--accent); }

/* Phones: iOS Safari zooms into any text box under 16px on focus, and a double tap zooms the page; pinch still works. */
html, body { touch-action: manipulation; }
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}
.calendar-event-link { display: inline-block; font-size: 0.85rem; margin: 2px 0 0 4px; }
.drive-connection { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
