/* The board's one stylesheet. Tokens first; dark follows the system setting. */

:root {
  color-scheme: light dark;
  --bg: #f2f4f2;
  --surface: #ffffff;
  --sunken: #e9edea;
  --ink: #141d1a;
  --muted: #56645f;
  --line: #d4dbd6;
  --edge: #8a9690; /* borders of things you can press or type into */
  --accent: #0b6b58;
  --accent-strong: #095547;
  --on-accent: #ffffff;
  --accent-soft: #d9ede7;
  --danger: #b3261e;
  --on-danger: #ffffff;
  --danger-soft: #fbe6e3;
  --warn: #7a4d00;
  --warn-soft: #fcefd2;
  --stage: #0e1513;
  --radius: 14px;
  --gutter: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1312;
    --surface: #161c1a;
    --sunken: #212a27;
    --ink: #e7edea;
    --muted: #9dada7;
    --line: #2b3532;
    --edge: #6a7873;
    --accent: #5fcab0;
    --accent-strong: #7ad8c0;
    --on-accent: #06211a;
    --accent-soft: #17352e;
    --danger: #ff9a8d;
    --on-danger: #3b0b07;
    --danger-soft: #3b1b17;
    --warn: #efc266;
    --warn-soft: #352a0e;
    --stage: #000000;
  }
}

/* ---- base ---- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}

h1, h2, h3, p, ul, figure, table { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.muted { color: var(--muted); }
.prose { white-space: pre-wrap; }
.error { color: var(--danger); }
.error:empty, .message:empty { display: none; }
.message { color: var(--muted); font-size: 0.9375rem; }
.message.error { color: var(--danger); }
/* Above an empty state the message is centred like the state itself. */
.view > .message { margin-top: 12px; text-align: center; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.label {
  margin: 22px 0 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---- controls ---- */

.btn, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled, .chip:disabled { opacity: 0.5; cursor: default; }
.btn:active:not(:disabled), .chip:active:not(:disabled) { background: var(--sunken); }

.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.primary:active:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
.btn.danger { border-color: var(--danger); background: var(--danger); color: var(--on-danger); }
.btn.danger:active:not(:disabled) { background: var(--danger); }
.btn.danger-text { color: var(--danger); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }

.chip { border-radius: 999px; font-weight: 500; }

@media (hover: hover) {
  .btn:hover:not(:disabled), .chip:hover:not(:disabled) { background: var(--sunken); }
  .btn.primary:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
  .btn.danger:hover:not(:disabled) { background: var(--danger); }
}

input, select, textarea {
  max-width: 100%;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
input, select { min-height: 48px; padding: 0 12px; }
textarea { display: block; width: 100%; min-height: 96px; padding: 12px; resize: vertical; }

/* Key hints only where there is a keyboard to press them on. */
kbd { display: none; }
@media (hover: hover) and (pointer: fine) {
  .bar kbd {
    display: inline-block;
    margin-left: 10px;
    padding: 0 6px;
    border: 1px solid currentColor;
    border-radius: 5px;
    font: 600 0.75rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    opacity: 0.75;
  }
}

.mark {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.mark.good { background: var(--accent-soft); color: var(--accent); }
.mark.warn { background: var(--warn-soft); color: var(--warn); }
.mark.bad { background: var(--danger-soft); color: var(--danger); }

/* ---- start and sign-in ---- */

.boot { padding: 0 16px; }

.loading { padding: 16vh 16px; color: var(--muted); text-align: center; }

.state {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: 440px;
  margin: 12vh auto 0;
  padding: 0 8px 24px;
  text-align: center;
}
.state h2 { font-size: 1.25rem; line-height: 1.3; }

.signin { display: grid; justify-items: center; align-content: start; min-height: 100dvh; padding: 10vh 16px 24px; }
.signin-form {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.signin-form h1 { font-size: 1.5rem; line-height: 1.2; }
.signin-form label { margin-top: 8px; font-size: 0.875rem; font-weight: 650; }
.signin-form .btn { min-height: 52px; margin-top: 12px; }

/* ---- the frame: pack, tabs, user ---- */

.board { display: flex; flex-direction: column; min-height: 100dvh; }

.top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "pack user" "tabs tabs";
  align-items: center;
  column-gap: 12px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.top-pack { grid-area: pack; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-user { grid-area: user; display: flex; align-items: center; gap: 4px; }
.pack-name { display: block; min-width: 0; overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.pack-select { max-width: 100%; min-width: 0; min-height: 44px; margin: 6px 0; font-weight: 750; }
.pack-paused { flex: none; }
.user-name { max-width: 30vw; overflow: hidden; color: var(--muted); font-size: 0.875rem; text-overflow: ellipsis; white-space: nowrap; }
.top-user .btn { padding: 0 10px; font-size: 0.875rem; font-weight: 500; }

.tabs { grid-area: tabs; display: flex; align-items: stretch; justify-content: space-between; gap: 4px; }
.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 48px;
  margin-bottom: -1px;
  padding: 0 6px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); }
.tabs a:focus-visible { outline-offset: -3px; }

.count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.count.some { background: var(--accent-soft); color: var(--accent); }

.status { padding: 8px var(--gutter); background: var(--warn-soft); color: var(--warn); font-size: 0.875rem; text-align: center; }

.view-host { display: flex; flex: 1; flex-direction: column; }
.view {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--gutter) var(--gutter) 0;
}

/* ---- one card at a time ---- */

.deck-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.deck-top .pager { margin-bottom: 0; margin-left: auto; }
.new-idea-btn { font-size: 0.9375rem; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 8px; font-size: 0.875rem; }
.pager .btn { min-width: 44px; padding: 0; border-color: transparent; background: transparent; }

.card {
  margin-bottom: var(--gutter);
  padding: 20px 18px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
/* Focus lands here after a decision so the keyboard continues from the card; it is not a control. */
.card:focus { outline: none; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 0.875rem; }
.idea .meta > :last-child { margin-left: auto; }

/* The hook is what the viewer sees first, so it is what the person deciding sees first. */
.hook {
  margin-top: 16px;
  font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}
.title { margin-top: 14px; font-size: 1.0625rem; font-weight: 650; line-height: 1.35; }
.idea .prose { margin-top: 6px; }
.source-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: 12px; font-size: 0.9375rem; }

.kv { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.kv th, .kv td { padding: 8px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.kv th { width: 42%; padding-right: 12px; color: var(--muted); font-weight: 400; }
.source-line + .kv { margin-top: 12px; }

/* The decision buttons stay at the bottom of the screen, under the thumb. */
.bar {
  position: sticky;
  bottom: 0;
  margin: auto calc(-1 * var(--gutter)) 0;
  padding: 10px var(--gutter) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.bar .message { margin-bottom: 8px; }
.bar .message:last-child { margin-bottom: 0; }
.bar-buttons { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 10px; }
.bar-buttons .btn { min-height: 52px; padding: 0 8px; font-size: 1.0625rem; }
.bar-buttons .primary { grid-column: span 2; }
@media (max-width: 519px) {
  .bar-buttons .btn { font-size: 0.9375rem; }
}

/* ---- review ---- */

.piece { display: grid; grid-template-areas: "head" "media" "body"; gap: 16px; }
.piece-head { grid-area: head; min-width: 0; }
.piece-media { grid-area: media; min-width: 0; }
.piece-body { grid-area: body; min-width: 0; }
.piece-body > .label:first-child { margin-top: 4px; }
.piece .title { margin-top: 10px; font-size: 1.25rem; font-weight: 750; line-height: 1.25; }

.request { margin-top: 14px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); }
.request .label { margin: 0 0 4px; color: var(--warn); }
.request .muted { margin-top: 4px; font-size: 0.875rem; }

.media-shell { display: grid; gap: 10px; min-width: 0; }
.variant-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.variant-tab { max-width: 100%; padding: 0 9px; overflow: hidden; font-size: 0.8125rem; text-overflow: ellipsis; }
.variant-tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 650; }
@media (hover: hover) {
  .variant-tab[aria-selected="true"]:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
}

.stage { display: grid; place-items: center; }
.stage.dark { overflow: hidden; border-radius: 10px; background: var(--stage); }
.stage video, .stage img { display: block; max-width: 100%; max-height: min(58dvh, 620px); }
.stage img { border-radius: 10px; }
.stage audio { width: calc(100% - 24px); margin: 12px; }

.stage.reel-frame {
  width: min(100%, calc(min(54dvh, 520px) * 9 / 16));
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 12px;
  background: var(--stage);
}
.stage.reel-frame video,
.stage.reel-frame img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}

.media-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.media-info { flex: 1 1 160px; min-width: 0; }
.media-label { font-size: 0.9375rem; font-weight: 650; line-height: 1.3; }
.media-file { font-size: 0.8125rem; }
.download-btn { flex: none; font-size: 0.9375rem; text-decoration: none; }

.slides { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.slides figure { flex: 0 0 78%; scroll-snap-align: center; }
.slides img, .slides video { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--sunken); }
.slides figcaption { padding-top: 6px; color: var(--muted); font-size: 0.8125rem; text-align: center; }
.slides .slide-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  text-align: left;
}
.slide-download { padding: 0 12px; font-size: 0.8125rem; }

.caption + .caption { margin-top: 12px; }
.caption .muted { font-size: 0.875rem; }

.file { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 0.9375rem; }
.file-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.file .mark { margin-right: 6px; }
.file-name { font-weight: 650; }
.file-download { font-size: 0.875rem; font-weight: 650; text-decoration: none; }
@media (hover: hover) {
  .file-download:hover { text-decoration: underline; }
}

/* ---- activity ---- */

.view-activity { max-width: 760px; }
.scout { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.state .scout { flex-direction: column; }
.schedule-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.schedule-badge { max-width: 100%; white-space: normal; }
.lists { padding-bottom: 32px; }
.lists .btn.quiet { margin-top: 4px; }

.rows { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; font-size: 0.9375rem; }
.row-title { font-size: 1rem; font-weight: 650; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions .btn { padding: 0 12px; font-size: 0.875rem; }
@media (max-width: 519px) {
  .row { flex-direction: column; align-items: stretch; gap: 10px; }
  .row-side { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; width: 100%; }
  .row-actions { justify-content: flex-start; }
}
summary { min-height: 44px; padding: 12px 0; cursor: pointer; }

.job-stage { margin-top: 6px; }
.stage-badge, .live-stage { max-width: 100%; white-space: normal; }
.live-stage { display: inline-flex; align-items: center; gap: 6px; }
.live-stage::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.job-log { margin-top: 6px; }
.job-log summary { color: var(--muted); font-size: 0.875rem; font-weight: 600; }
.log-tail {
  margin: 4px 0 0;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 0.8125rem/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- the reason sheet ---- */

.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--ink);
}
.sheet::backdrop { background: rgb(8 14 12 / 0.6); }
.sheet[open] { animation: sheet-in 0.18s ease-out; }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px); }
}
.sheet-body { display: grid; gap: 12px; padding: 20px 16px 0; }
.sheet-body h2 { font-size: 1.25rem; line-height: 1.25; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* On a short screen the sheet scrolls; its buttons stay in reach at the bottom.
   The 6px that this box reaches into the gap leave room for the focus ring of the field above. */
.sheet-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: -6px;
  padding: 6px 0 max(16px, env(safe-area-inset-bottom));
  background: var(--surface);
}
.sheet-actions .btn { min-height: 52px; }

.sheet-form { max-width: 560px; overflow: hidden; }
.idea-form { display: flex; flex-direction: column; max-height: 92dvh; overflow: hidden; }
.modal-head { flex: none; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.25rem; line-height: 1.25; }
.modal-head .muted { margin-top: 2px; font-size: 0.9375rem; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; gap: 10px; padding: 14px 16px; }
.modal-body textarea { min-height: 64px; }
.modal-body #idea-pitch { min-height: 80px; }
.modal-foot {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal-foot .btn { min-height: 52px; }

.field { display: grid; gap: 4px; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
.field-label { font-size: 0.875rem; font-weight: 650; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 520px) {
  .field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.check-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 600;
}
.check-input {
  position: relative;
  flex: none;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.check-input::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 2px solid var(--edge);
  border-radius: 6px;
  background: var(--bg);
}
.check-input:checked::before {
  border-color: var(--accent);
  background: var(--accent);
}
.check-input:checked::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 15px;
  width: 6px;
  height: 11px;
  border: solid var(--on-accent);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.check-input:disabled { opacity: 0.5; cursor: default; }

/* ---- pack tab ---- */

.view-pack { max-width: 820px; padding-bottom: 32px; }
.pack-stack { display: grid; gap: 16px; }
.pack-card { display: grid; gap: 14px; margin-bottom: 0; }
.pack-schedule-head { display: grid; gap: 8px; min-width: 0; }
.pack-schedule-form, .library-list-host { min-width: 0; }
.pack-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pack-section-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.pack-card h2 { font-size: 1.25rem; line-height: 1.25; }
.pack-meta { font-size: 0.875rem; }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 0.9375rem; font-weight: 500; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

.pack-form { display: grid; gap: 12px; }
.pack-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.preset-btn { padding: 0 12px; font-size: 0.875rem; }
.preset-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 650; }
@media (hover: hover) {
  .preset-btn[aria-pressed="true"]:hover:not(:disabled) { border-color: var(--accent-strong); background: var(--accent-strong); }
}

.next-runs { padding-top: 8px; border-top: 1px solid var(--line); }
.next-runs > .label { margin-top: 4px; }
.next-runs-groups { display: grid; gap: 10px; }
.next-runs-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.9375rem; font-weight: 600; }
.next-runs-list { display: grid; gap: 4px; margin-top: 6px; padding-left: 16px; list-style: disc; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

.file-input { padding: 8px 10px; font-size: 0.9375rem; }
.library-upload { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.library-list { display: grid; gap: 14px; }
.library-item { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.library-item:first-child { padding-top: 0; border-top: 0; }
.library-media { display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--sunken); }
.library-media.dark { background: var(--stage); }
.library-media.audio { padding: 8px; }
.library-media video, .library-media img { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; }
.library-media audio { width: 100%; }
.library-body { display: grid; gap: 6px; min-width: 0; align-content: start; }
.library-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.inline-confirm { display: flex; flex-wrap: wrap; gap: 8px; }
.library-empty { padding: 4px 0; }

.doc-list { display: grid; border-top: 1px solid var(--line); }
.doc-block { border-bottom: 1px solid var(--line); }
.doc-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-weight: 650; list-style: none; }
.doc-summary::-webkit-details-marker { display: none; }
.doc-title { min-width: 0; }
.doc-title::before { content: "▸ "; color: var(--muted); }
.doc-block[open] .doc-title::before { content: "▾ "; }
.doc-text {
  margin: 0 0 14px;
  padding: 12px 14px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 0.8125rem/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.doc-missing { padding: 0 0 12px; }

/* ---- wider screens ---- */

@media (min-width: 760px) {
  :root { --gutter: 24px; }

  .top { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "pack tabs user"; }
  .top-user { justify-self: end; }
  .tabs { display: grid; grid-template-columns: repeat(4, auto); gap: 0; }
  .tabs a { gap: 8px; min-height: 56px; padding: 0 18px; font-size: 1rem; }

  .card { padding: 32px 36px 36px; }

  .bar {
    margin-inline: 0;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .bar-buttons { grid-auto-columns: 150px; justify-content: end; }

  .sheet { margin: auto; border-radius: 16px; }
  .sheet-body { padding: 24px 24px 0; }
  .sheet-actions { padding-bottom: 24px; }
  .modal-head { padding: 20px 24px 14px; }
  .modal-body { padding: 16px 24px; }
  .modal-foot { padding: 14px 24px 20px; }
  .library-item { grid-template-columns: 180px minmax(0, 1fr); align-items: start; }
}

@media (min-width: 960px) {
  .view-review { max-width: 1080px; }
  .piece {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas: "media head" "media body";
    grid-template-rows: auto 1fr;
    column-gap: 36px;
  }
  .piece-media { position: sticky; top: 16px; align-self: start; }
  .stage.reel-frame { width: min(100%, calc(min(64dvh, 580px) * 9 / 16)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::backdrop { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
