@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/fonts/InstrumentSerif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --gutter: clamp(20px, 5vw, 64px);
  --wrap: clamp(1180px, 78vw, 1560px);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; margin: 0; background: var(--bg); color: var(--ink); }
button, a, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { opacity: .58; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 4px; }
::selection { background: var(--bg-3); }
h1, h2, p { margin: 0; }
.shell { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.icon { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 5; top: 8px; left: 12px; transform: translateY(-160%); border-radius: 7px; background: var(--ink); color: var(--card); padding: 10px 16px; }
.skip:focus { transform: none; }

.mast, .mast__left, .brand, .back { display: flex; align-items: center; }
.mast { justify-content: space-between; gap: 16px; min-height: 67px; position: relative; }
.mast::after { content: ""; position: absolute; inset: auto var(--gutter) 0; height: 1px; background: var(--hair-2); }
.mast__left { gap: 16px; }
.brand { gap: 12px; min-height: 44px; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.brand img { display: block; width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 1px var(--hair-2); }
.division { height: 16px; border-left: 1px solid var(--hair-2); }
.page-name, .back { color: var(--muted); font-size: 14px; }
.back { gap: 8px; min-height: 44px; }
.back:hover { color: var(--gold-deep); }
.back .icon { width: 16px; }
main { flex: 1 0 auto; }
.stage {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.85fr);
  gap: clamp(24px, 3.7vw, 65px);
  align-items: center;
  padding-block: clamp(38px, 5.6vw, 98px);
}
.lead { min-width: 0; }
.scene-kind { display: flex; align-items: center; gap: 11px; margin-bottom: 19px; color: var(--muted); font-size: 12.5px; line-height: 1.4; font-weight: 600; text-transform: uppercase; letter-spacing: .085em; }
.scene-kind::before { content: ""; width: 22px; height: 1px; background: var(--gold); }
.title { font: 400 clamp(74px, 7.1vw, 124px)/.89 var(--serif); letter-spacing: -.035em; }
.title em { display: block; color: var(--gold-2); font-weight: 400; }
#scene-deck { max-width: 33ch; margin-top: 21px; color: var(--ink-2); font: 400 clamp(16px, 1.25vw, 20px)/1.49 var(--sans); }
.action, .live-small, .plain-button, .preview-toggle, .round, .share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 99px;
  font: 550 14px/1.2 var(--sans);
}
.action { padding: 0 20px; background: var(--ink); color: var(--card); }
.action:hover:not(:disabled) { background: var(--ink-2); }
#enter { gap: 14px; margin-top: 25px; min-height: 48px; }
.print {
  align-self: center;
  min-width: 0;
  padding: clamp(5px, .6vw, 9px) clamp(5px, .6vw, 9px) 0;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--plate);
}
.screen { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 16/10; border-radius: 12px; background: var(--bg-2); }
.screen picture, .screen img, .screen video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.screen video { opacity: 0; transition: opacity .35s ease; }
.screen video.has-frame { opacity: 1; }
.print-tools, .preview-controls { display: flex; align-items: center; }
.print-tools { min-height: 54px; justify-content: space-between; padding: 2px 4px; }
.preview-controls { gap: 3px; }
.preview-toggle, .share-button, .round, .plain-button { background: transparent; padding: 0 11px; color: var(--ink-2); }
.preview-toggle:hover, .share-button:hover, .round:hover, .plain-button:hover { background: var(--bg); color: var(--ink); }
.preview-toggle .icon, .share-button .icon { width: 15px; height: 15px; }
.share-button { color: var(--muted); }
.round { width: 44px; padding: 0; }
#next-preview { display: none; }

.scene-strip { display: grid; grid-template-columns: 1fr 2fr; align-items: center; gap: 20px; border-block: 1px solid var(--hair-2); padding-block: 19px; }
.strip-title { font: 400 clamp(24px, 2.4vw, 34px)/1.05 var(--serif); letter-spacing: -.018em; }
.switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 6px 12px 6px 6px; border-radius: 11px; border: 1px solid transparent; }
.choice img { width: clamp(55px, 5vw, 79px); height: 47px; object-fit: cover; border-radius: 6px; }
.choice strong, .choice small { display: block; }
.choice strong { color: var(--ink); font: 400 clamp(21px, 1.8vw, 28px)/1.06 var(--serif); letter-spacing: -.01em; }
.choice small { margin-top: 3px; color: var(--muted); font-size: 13px; line-height: 1.3; }
.choice:hover { border-color: var(--hair-2); }
.choice[aria-current="page"] { background: var(--card); border-color: var(--hair-2); }
.choice[aria-current="page"]::after { content: ""; margin-left: auto; flex: none; width: 7px; height: 11px; border: solid var(--gold-2); border-width: 0 1.6px 1.6px 0; transform: rotate(42deg); }
.notes { border-bottom: 1px solid var(--hair-2); }
.notes summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 61px; list-style: none; cursor: pointer; font-size: 16px; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary .icon { color: var(--muted); }
.notes[open] summary .icon { transform: rotate(45deg); }
.notes-copy { max-width: 72ch; padding: 0 0 24px; color: var(--muted); font: 400 16px/1.55 var(--sans); }
.notes-copy p + p { margin-top: 8px; }
.notes-copy a, .failure a { color: var(--gold-deep); text-decoration: underline; text-underline-offset: .16em; }
.foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; padding-block: 18px 22px; color: var(--muted); font-size: 13px; }
.foot nav { display: flex; align-items: center; gap: 19px; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
.foot a:hover { color: var(--gold-deep); }

.studio {
  width: min(1500px, calc(100vw - 48px));
  height: min(1000px, calc(100dvh - 48px));
  max-width: 100vw;
  max-height: 100dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--hair-2);
  border-radius: 18px;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 18px 64px rgba(var(--shade), .2);
}
.studio::backdrop { background: rgba(40, 31, 21, .48); backdrop-filter: blur(5px); }
.studio-layout { display: grid; height: 100%; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--bg); }
.studio-layout:fullscreen, .studio:fullscreen { width: 100%; height: 100%; }
.studio:fullscreen { border: 0; border-radius: 0; }
.studio-bar, .studio-controls, .studio-actions { display: flex; align-items: center; }
.studio-bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; padding: 7px 14px; border-bottom: 1px solid var(--hair-2); }
.studio-bar #leave { justify-self: start; }
.studio-bar #swap { justify-self: end; }
.studio-title { font: 400 29px/1 var(--serif); letter-spacing: -.02em; }
.studio-controls { justify-content: space-between; gap: 18px; padding: 12px 20px; border-top: 1px solid var(--hair-2); }
.studio-controls p { max-width: 39ch; color: var(--ink-2); font: 400 15px/1.42 var(--sans); }
.studio-actions { justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.live-small { padding: 0 14px; background: var(--card); border-color: var(--hair-2); color: var(--ink); }
.live-small:hover:not(:disabled), .live-small[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-deep); }
.live-small[aria-pressed="true"] { background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--gold); }
.live-stage { position: relative; isolation: isolate; overflow: hidden; background: var(--bg-2) center/cover no-repeat; }
.live-stage iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.live-stage iframe[data-loading] { opacity: 0; }
.loading, .failure {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 13px;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 18px 24px;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--plate);
  text-align: center;
}
.loading { grid-auto-flow: column; align-items: center; }
.loading::before { content: ""; width: 18px; height: 18px; border: 2px solid var(--bg-3); border-top-color: var(--gold-2); border-radius: 50%; animation: turn .9s linear infinite; }
@keyframes turn { to { transform: rotate(1turn); } }
body.modal-open { overflow: hidden; }

@media (max-width: 850px) {
  .stage { grid-template-columns: minmax(0, .85fr) minmax(0, 1.65fr); gap: 22px; }
  .title { font-size: clamp(62px, 8vw, 74px); }
  .screen { aspect-ratio: 4/3; }
  .scene-strip { grid-template-columns: minmax(128px, .68fr) minmax(0, 2fr); }
  .choice { gap: 8px; }
}
@media (max-width: 700px) {
  .mast { min-height: 61px; }
  .stage { grid-template-columns: minmax(0,1fr); gap: 22px; padding-block: 28px; }
  .lead { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 15px; }
  .lead-copy { flex: 1 1 230px; }
  .scene-kind { margin-bottom: 9px; }
  .title { font-size: clamp(50px, 9.4vw, 70px); line-height: .98; }
  .title em { display: inline; }
  #scene-deck { margin-top: 11px; max-width: 40ch; }
  #enter { margin-top: 0; min-height: 44px; }
  .screen { aspect-ratio: 16/9; }
  #next-preview { display: inline-flex; }
  .scene-strip { grid-template-columns: minmax(0,1fr); gap: 12px; padding-block: 17px; }
  .switches { gap: 8px; }
  .studio { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .studio-bar { padding: max(6px,env(safe-area-inset-top)) 8px 6px; gap: 4px; }
  .studio-title { font-size: 24px; }
  .studio-bar .plain-button { gap: 5px; padding: 0 7px; }
  .studio-controls { flex-wrap: wrap; gap: 8px; padding: 11px 12px max(12px,env(safe-area-inset-bottom)); }
  .studio-controls p { max-width: none; }
  .studio-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 500px) {
  .mast__left { gap: 9px; }
  .brand { gap: 7px; }
  .back { gap: 5px; }
  .lead { display: block; }
  #enter { margin-top: 16px; }
  .screen { aspect-ratio: .86; }
  [data-scene="space"] .screen { aspect-ratio: .75; }
  [data-scene="space"] .screen :is(img,video) { object-position: 50% 53%; }
  .print-tools { min-height: 48px; padding-inline: 0; }
  .choice { padding: 5px; gap: 7px; }
  .choice img { width: clamp(35px, 9vw, 45px); height: 36px; }
  .choice strong { font-size: 20px; }
  .choice small { font-size: 12px; }
  .choice[aria-current="page"]::after { width: 5px; height: 9px; margin-right: 3px; }
  .studio-actions { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) 44px 44px; gap: 5px; }
  .studio-actions:has(#fullscreen[hidden]) { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr) 44px; }
  .studio-actions:has(#follow[hidden]) { grid-template-columns: 1fr 44px 44px; }
  .studio-actions:has(#follow[hidden]):has(#fullscreen[hidden]) { grid-template-columns: 1fr 44px; }
  .studio-actions > button { padding: 3px 7px; min-width: 0; min-height: 44px; }
  .studio-actions :is(#fullscreen,#live-play) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 375px) {
  .mast__left { gap: 7px; }
  .page-name, .back { font-size: 13px; }
  .choice img { width: 30px; }
  .studio-bar .close-label, .studio-bar #swap span { display: none; }
  .studio-bar .plain-button { min-width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
