@font-face {
  font-family: Nunito;
  src: url("fonts/Nunito.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f5efe5;
  --side: #eee5d8;
  --ink: #322820;
  --muted: #62554b;
  --plum: #39262f;
  --copper: #973e22;
  --green: #425b42;
  --selected: #cedbd1;
  --line: #d8cbbc;
  --serif: Georgia, Cambria, serif;
  --ui: Nunito, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 var(--ui); }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .37; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid #3e736a;
  outline-offset: 3px;
}
a { color: #614435; }
h1, h2, h3 { margin: 0; font-family: var(--serif); line-height: 1.13; color: #432b21; }
p { margin: 0 0 .82rem; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.masthead {
  min-height: 76px; display: flex; gap: 2.8rem; align-items: center;
  justify-content: space-between; padding: .6rem clamp(1.2rem, 2.6vw, 3rem);
  color: #faf0df; background: var(--plum);
}
.brand { font: bold clamp(1.55rem, 3.1vw, 2.9rem)/1.1 var(--serif); color: inherit; text-decoration: none; }
.masthead nav { display: flex; gap: clamp(.85rem, 2.65vw, 2.7rem); align-self: stretch; align-items: center; }
.masthead nav a { display: flex; align-items: center; padding: .6rem 0; height: 100%; color: #faf0df; text-decoration: none; font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; }
.masthead nav a[aria-current] { border-color: #9fb9a8; }
.shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: minmax(243px, 22%) minmax(0,1fr); }
.sidebar { background: var(--side); border-right: 1px solid var(--line); position: sticky; top: 0; max-height: 100vh; overflow-y: auto; align-self: start; }
.scene-tools { padding: 1.35rem 1rem .4rem; }
.search { display: flex; width: 100%; gap: .45rem; align-items: center; padding: 0 .7rem; border: 1px solid #c8b8a5; border-radius: 8px; background: #f7efe4; }
.search svg { flex: 0 0 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; min-width: 0; border: 0; padding: .58rem .12rem; background: none; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid #3e736a; outline-offset: 2px; }
.compact { display: none; }
#scenes { padding: 0 .65rem 1.6rem; }
.scene-group { padding-top: .95rem; }
.scene-group h2 { font-size: 1rem; padding: .57rem .4rem .6rem; border-top: 1px solid var(--line); }
.scene-row { min-height: 48px; display: grid; grid-template-columns: 1.65rem 48px minmax(0, 1fr) 2.75rem; gap: .42rem; align-items: center; text-decoration: none; padding: .35rem .35rem; border-radius: 5px; color: var(--ink); }
.scene-row:hover { background: #f9f2e8; }
.scene-row[aria-current] { background: var(--selected); }
.scene-number, .scene-row time { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.scene-number { text-align: center; }
.scene-name { font-size: .87rem; font-weight: 750; line-height: 1.16; }
.scene-row img { width: 48px; aspect-ratio: 16/10; object-fit: cover; border-radius: 4px; display: block; background: #6b5442; }
.scene-view { width: 100%; max-width: 1350px; margin-inline: auto; padding: .95rem clamp(1.25rem, 2.9vw, 3.25rem) 3rem; min-width: 0; }
.scene-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .85rem; }
h1 { font-size: clamp(2.05rem, 4.05vw, 3.9rem); letter-spacing: -.04em; }
#duration { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; font: 1.15rem var(--serif); }
.screen { position: relative; aspect-ratio: var(--ratio, 1.7777); overflow: hidden; background: #211516; border-radius: 12px; }
.screen canvas { display: block; width: 100%; height: 100%; }
.screen:fullscreen { display: grid; place-items: center; border-radius: 0; }
.screen:fullscreen canvas { width: min(100vw, calc(100vh * var(--ratio))); height: auto; aspect-ratio: var(--ratio); }
#screen-status, #caption { position: absolute; margin: 0; color: #fff7ec; text-align: center; }
#screen-status { inset: 44% 8% auto; }
#caption { left: 8%; right: 8%; bottom: 4%; justify-self: center; width: fit-content; max-width: 84%; margin-inline: auto; font: 600 clamp(.87rem, 1.9vw, 1.62rem)/1.25 var(--serif); background: #211813db; border-radius: 5px; padding: .34em .65em; }
.player-controls { min-height: 58px; display: flex; flex-wrap: wrap; align-items: center; gap: .65rem 1.1rem; padding: .64rem 0; }
.transport, .settings, .timing { display: flex; align-items: center; gap: .35rem; }
.settings { gap: .8rem; font-size: .9rem; }
.settings label { display: flex; align-items: center; gap: .25rem; white-space: nowrap; }
.settings input { width: 1rem; height: 1rem; accent-color: var(--green); }
.timing { flex: 1; gap: .65rem; min-width: 180px; font-size: .86rem; }
#position { flex: 1; width: 0; cursor: pointer; accent-color: var(--copper); }
#clock { white-space: nowrap; font-variant-numeric: tabular-nums; }
button, select { border: 1px solid #ccbeaf; border-radius: 6px; background: #fcf6ec; padding: .4rem .65rem; }
button:not(:disabled):hover, select:hover { background: #e6dac9; }
button.square { display: grid; place-items: center; width: 36px; height: 37px; padding: 0; }
button.play { display: flex; align-items: center; gap: .45rem; min-width: 115px; justify-content: center; background: var(--green); color: white; border-color: var(--green); }
button.play:hover:not(:disabled) { background: #344c35; }
.markers { display: flex; flex-wrap: wrap; gap: .34rem .55rem; padding-bottom: .55rem; }
.marker, .stamp { padding: .22rem .43rem; font-size: .81rem; border-color: #cec0b0; font-variant-numeric: tabular-nums; }
.replacement { font-size: .82rem; color: var(--muted); align-self: center; }
.filmstrip { display: flex; gap: .55rem; overflow: auto; padding: .37rem .2rem .7rem; scrollbar-color: #c1aa94 transparent; }
button.frame-button { position: relative; flex: 0 0 clamp(108px, 10vw, 150px); height: fit-content; border: 2px solid transparent; padding: 0; background: #372820; }
.frame-button[aria-pressed="true"] { outline: 2px solid #3a6c60; outline-offset: 1px; }
.frame-button img, .photo-button img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; }
.frame-button time { position: absolute; bottom: 3px; right: 3px; color: #fff6ec; padding: 0 .34rem; font-size: .78rem; font-variant-numeric: tabular-nums; background: #241916e8; border-radius: 3px; }
.scene-detail { margin-top: 1rem; display: grid; grid-template-columns: 1fr 1fr; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.scene-detail > section { min-width: 0; }
.scene-detail > section:first-child { padding-right: 1.55rem; }
.scene-detail > section:last-child { padding-left: 1.55rem; border-left: 1px solid var(--line); }
.scene-detail h2 { font-size: 1.85rem; margin-bottom: .8rem; }
#shot-title { font: 800 .94rem/1.3 var(--ui); margin-bottom: .4rem; }
.text-link { text-underline-offset: .2em; font-weight: 800; font-size: .9rem; }
.controls-note, .edition, .empty, .muted { color: var(--muted); }
.controls-note { font-size: .88rem; margin-bottom: .55rem; }
.cues { padding: 0; margin-top: 1rem; list-style: none; }
.cues li { padding: .45rem 0 .2rem; border-top: 1px solid var(--line); }
.cues strong { display: inline-block; margin-left: .55rem; font-size: .88rem; }
.cues p { margin: .4rem 0 .55rem; }
.mechanic { padding: .85rem 0; border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.mechanic:first-child { padding-top: 0; border-top: 0; }
.mechanic h3, .mechanic h2 { font-size: 1.28rem; margin-bottom: .38rem; }
.mechanic .stamp { margin: .05rem 0 .55rem; }
.game-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 115px), 1fr)); gap: .55rem; }
button.photo-button { display: flex; flex-direction: column; width: 100%; gap: .3rem; padding: .24rem; text-align: left; background: #eee2d1; font-size: .78rem; line-height: 1.25; align-self: start; }
.photo-button span { padding: .12rem .25rem .23rem; }
.reader { max-width: 1160px; padding: 2rem clamp(1rem, 5vw, 4.1rem) 4rem; margin-inline: auto; }
.reader h1 { margin-bottom: 1rem; }
.reader .tabs { display: flex; gap: .45rem; flex-wrap: wrap; margin: .75rem 0 1.1rem; }
.tabs a { border: 1px solid var(--line); border-radius: 5px; text-decoration: none; font-size: .94rem; padding: .36rem .6rem; }
.tabs a[aria-current] { background: var(--selected); }
#document-body > h1 { font-size: 1.85rem; margin-top: 2rem; }
#document-body h2, #document-body h3 { margin: 1.2rem 0 .55rem; }
#document-body p, #document-body li { max-width: 84ch; }
#document-body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
#document-body th, #document-body td { padding: .48rem .6rem; border: 1px solid var(--line); vertical-align: top; }
#document-body img { max-width: 100%; }
#game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.8rem; }
#game-grid .mechanic { padding: .85rem 0; border-top: 1px solid var(--line); }
#game-grid .mechanic h2 { margin-top: .3rem; }
dialog { width: min(95vw, 1260px); max-height: 94dvh; border: 1px solid #b79d87; border-radius: 12px; padding: .65rem; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #1d1318cc; }
.viewer-head, .viewer-controls { display: flex; align-items: center; justify-content: space-between; gap: .45rem; }
dialog figure { margin: .45rem 0; }
dialog figure img { display: block; width: 100%; max-height: 73dvh; object-fit: contain; background: #241e20; }
dialog figcaption { margin-top: .3rem; }
@media (max-width: 1040px) {
  .settings { margin-left: auto; }
  .scene-row { grid-template-columns: 1.2rem 42px minmax(0, 1fr); }
  .scene-row time { display: none; }
  .scene-row img { width: 42px; }
}
@media (max-width: 760px) {
  .masthead { align-items: flex-start; flex-direction: column; gap: .35rem; padding-bottom: 0; }
  .masthead nav { gap: 1rem; flex-wrap: wrap; align-self: auto; font-size: .85rem; }
  .masthead nav a { padding: .45rem 0; }
  .shell { display: block; }
  .sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .scene-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; padding: .65rem 1rem; }
  .compact { display: flex; gap: .25rem; flex-direction: column; font-size: .74rem; }
  .compact select { width: 100%; min-width: 0; padding: .2rem; }
  #scenes { display: none; }
  .scene-view { padding: .8rem 1rem 2rem; }
  .scene-heading h1 { font-size: 2.1rem; }
  #duration { font-size: .9rem; }
  .scene-detail, #game-grid { grid-template-columns: 1fr; gap: 1.1rem; }
  .scene-detail > section:first-child, .scene-detail > section:last-child { padding: 0; border: 0; }
}
@media (max-width: 450px) {
  .player-controls { gap: .45rem; }
  .timing { min-width: 100%; order: 3; }
  .settings { gap: .38rem; font-size: .78rem; }
  button.square { width: 30px; height: 32px; }
  button.play { min-width: 88px; padding: .35rem; font-size: .83rem; }
  .scene-heading h1 { font-size: 1.75rem; }
}

.archive-frame { flex: 0 0 120px; }
.archive-frame img { width: 100%; display: block; border-radius: 5px; }
#unused-frame-list { margin-top: .65rem; font-size: .9rem; }
#storyboard-link { display: inline-block; margin: .7rem 0 0; }
