:root {
  --paper: #f6f4ef;
  --surface: #fffefb;
  --ink: #252822;
  --muted: #63685f;
  --line: #dcdcd1;
  --accent: #b64810;
  --orange: #ed6f29;
  --deep: #252c28;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
#review-welcome { inline-size: min(25rem,calc(100% - 32px)); box-sizing: border-box; max-block-size: calc(100dvh - 32px); border: 1px solid #d7d7cb; border-radius: 16px; padding: clamp(22px,4vw,32px); background: var(--surface); color: var(--ink); box-shadow: 0 18px 70px #18231c35; }
#review-welcome:modal { overscroll-behavior: contain; }
#review-welcome::backdrop { background: rgb(26 32 29 / 64%); overflow: hidden; overscroll-behavior: contain; }
.welcome-mark { display: block; margin-bottom: 16px; }
#welcome-title { margin: 0; font-size: 1.55rem; letter-spacing: -.035em; }
#welcome-hint { margin: 6px 0 20px; color: var(--muted); font-size: .875rem; }
#welcome-form label { display: block; margin-bottom: 5px; font-size: .875rem; font-weight: 600; }
#welcome-name { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid #abb4a9; border-radius: 7px; background: white; color: var(--ink); font-size: 1rem; }
#welcome-name:focus-visible { outline: 2px solid #ac4d20; outline-offset: 2px; }
#welcome-error { min-height: 1.35em; margin: 6px 0; color: #9a3816; font-size: .82rem; }
#welcome-form button { width: 100%; min-height: 44px; border-radius: 7px; background: var(--deep); color: white; font-weight: 650; }
.studio { max-width: 1560px; padding: 0 clamp(12px,2.2vw,36px) 40px; }
.masthead { min-height: 56px; height: auto; justify-content: flex-start; flex-wrap: wrap; gap: 0 14px; padding-block: 7px; }
.masthead h1 { margin: 0; padding-inline-start: 14px; border-inline-start: 1px solid #c9cdc4; color: #424b42; font-size: clamp(.875rem,.78rem + .35vw,1.125rem); font-weight: 620; }
.brand { color: var(--ink); font-size: 20px; letter-spacing: -.05em; }
.brand img { height: 27px; width: 27px; }
.masthead nav { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: clamp(14px,2.7vw,38px); }
.masthead nav a { font-size: 13px; font-weight: 570; padding: 9px 0; color: #484c44; }
.masthead nav a:hover { color: var(--accent); text-underline-offset: 6px; }
#player { --rail-width: clamp(270px,23vw,344px); display: grid; grid-template-columns: minmax(0,1fr) var(--rail-width); align-items: stretch; overflow: hidden; border: 1px solid #cccec4; border-radius: 12px; background: var(--surface); }
.view-column { min-width: 0; align-self: start; container: stage / inline-size; }
#screen { width: 100%; background: #e9e8e3; }
#review-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 25; }
.controls { padding: 9px clamp(10px,1.15vw,18px); gap: clamp(5px,.62vw,11px); color-scheme: dark; background: #232b28; border-bottom: 1px solid #43504a; }
.controls button { min-height: 36px; color: #f5f5ee; background: #333e38; border: 1px solid #515c56; font-size: 12px; font-weight: 610; transition: background-color 120ms; }
.controls button:hover { background: #48554d; }
.controls #play { flex: 0 0 33px; padding: 4px; background: #ffb079; border-color: #ffb079; color: #252923; }
.controls #play:hover { background: #ffc49a; }
.controls #clock { color: #e5ece6; font: 11px/1.2 ui-monospace, 'SFMono-Regular', Consolas, monospace; font-variant-numeric: tabular-nums; }
.controls #seek { accent-color: #ffad76; min-height: 32px; }
.view-column .caption { align-items: baseline; min-height: 40px; padding: 8px clamp(10px,1.15vw,18px); margin: 0; background: #2b342f; }
.caption strong { color: #f2f3ec; font-size: 13px; }
.caption strong::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 8px 1px 0; background: var(--orange); }
.caption #note { color: #dee2d9; font-size: 12px; line-height: 1.6; }
#review-panel { position: relative; align-self: stretch; min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.review-inner { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 18px clamp(14px,1.3vw,22px); }
.review-header, .review-list-head, .name-edit, .composer-actions { display: flex; align-items: center; gap: 8px; }
.review-header, .review-list-head { justify-content: space-between; }
.review-header h2 { margin: 0; font-size: 21px; letter-spacing: -.045em; line-height: 1.3; }
#review-status { flex: none; color: var(--muted); font-size: 11px; font-weight: 620; }
#review-name-form { margin-top: 16px; }
#review-name-form label, #review-anchor-label { display: block; margin-bottom: 5px; font-size: 12px; color: #555d50; font-weight: 620; }
#review-name, #review-text { min-width: 0; width: 100%; border: 1px solid #c9cec1; border-radius: 5px; background: #fffefb; color: var(--ink); font: inherit; font-size: 13px; }
#review-name { padding: 7px 9px; }
#review-text { display: block; resize: vertical; min-height: 65px; padding: 9px; line-height: 1.5; }
.name-edit button, .composer-actions button { flex: none; min-height: 34px; border-radius: 5px; padding: 4px 12px; color: white; background: var(--deep); font-size: 12px; font-weight: 630; }
.name-edit button:hover, .composer-actions button[type='submit']:hover { background: #485242; }
#review-members { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 16px; }
#review-members:empty { margin-top: 0; }
.review-list-head { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.review-list-head h3 { margin: 0; font-size: 14px; }
.review-filter { grid-column: 1/-1; display: inline-flex; align-items: center; justify-self: start; gap: 6px; min-height: 32px; font-size: 12px; color: #50594d; cursor: pointer; }
.review-filter input { width: 15px; height: 15px; margin: 0; accent-color: #515d47; cursor: pointer; }
#review-resolved-count { font-variant-numeric: tabular-nums; color: var(--muted); }
#review-count { display: inline-block; margin-left: 3px; min-width: 19px; padding: 1px 4px; border-radius: 4px; color: #5a6257; background: #eceee5; font: 11px/1.4 ui-monospace,monospace; text-align: center; vertical-align: 1px; }
#review-pin-mode { display: inline-flex; gap: 3px; align-items: center; min-height: 32px; padding: 4px 8px; border-radius: 5px; border: 1px solid #e6c5aa; color: #864014; background: #fbf2e7; font-size: 12px; font-weight: 650; }
#review-pin-mode:hover, #review-pin-mode[aria-pressed='true'] { background: #f5dfc6; border-color: #b65f2d; }
#review-pin-mode span { font-size: 16px; line-height: 1; }
#review-composer {
  position: absolute; z-index: 32; width: min(260px, calc(100% - 12px));
  max-height: calc(100% - 12px); overflow: auto; overscroll-behavior: contain;
  padding: 10px; border: 1px solid #d9c6b3; border-radius: 9px;
  background: #fffdf8; box-shadow: 0 5px 24px #39241338;
}
#review-composer textarea { resize: none; min-height: 45px; font-size: 16px; }
#review-draft-feedback { margin: 5px 0 0; color: #88401c; font-size: 12px; }
#review-draft-feedback:empty { display: none; }
.composer-actions { justify-content: flex-end; margin-top: 7px; }
.composer-actions #review-cancel { color: #5d6057; background: transparent; }
#review-feedback { color: var(--accent); font-size: 12px; margin: 7px 0; }
#review-feedback:empty { display: none; }
#review-comments { list-style: none; padding: 0; margin: 8px 0 0; }
#review-empty { margin-top: 16px; padding: clamp(11px,1.8vw,28px) 6px; text-align: center; color: var(--muted); border: 1px dashed #d6d8cb; border-radius: 7px; background: #fbfaf5; }
#review-empty strong { display: block; font-size: 13px; color: #41483d; }
#review-empty p { margin: 5px 0 0; font-size: 12px; line-height: 1.65; }
.empty-pin { display: inline-block; position: relative; width: 23px; height: 17px; margin: 0 0 7px; border: 1.5px solid #bd8254; border-radius: 5px 5px 5px 1px; }
.empty-pin::after { content: ''; position: absolute; left: 4px; right: 5px; top: 6px; height: 2px; border-radius: 2px; background: #d29e77; }
.chapter-section { margin-top: clamp(26px,2.5vw,42px); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 12px; }
.section-heading h2 { margin: 0; font-size: clamp(20px,1.6vw,25px); letter-spacing: -.045em; }
.section-heading span { font-size: 12px; color: var(--muted); }
.chapters { grid-template-columns: repeat(6,minmax(0,1fr)); gap: clamp(7px,.9vw,16px); }
.chapters button { display: grid; align-content: start; gap: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0; }
.chapters button[aria-current] { border-color: #b65d28; background: #fff8ed; }
.chapters button:hover { border-color: #ad9276; }
.chapters img { display: block; width: 100%; max-width: none; aspect-ratio: 2.15; border-radius: 0; object-fit: cover; }
.chapters button > span { display: block; padding: 8px 11px 10px; }
.chapters small { color: #5d6259; font-size: 10px; font-variant-numeric: tabular-nums; }
.chapters b { font-size: 14px; }
.chapters button[aria-current] small { color: #90400f; }
#shots { display: block; padding: 0; margin-top: 22px; border: 1px solid var(--line); border-width: 1px 0; }
#shots summary { display: flex; align-items: center; gap: 12px; padding: 15px 0; color: #343b31; font-weight: 650; font-size: 15px; list-style: none; }
#shots summary::-webkit-details-marker { display: none; }
#shots summary::after { content: '+'; margin-left: auto; color: #7d644d; font: 24px/1 ui-monospace,monospace; }
#shots details[open] summary::after { content: '−'; }
#shots summary span { color: var(--muted); font-size: 12px; font-weight: 400; }
#shots details[open] summary span { display: none; }
#shots dl { display: grid; grid-template-columns: minmax(110px,165px) minmax(0,730px); gap: 12px 20px; padding: 6px 0 14px; }
#shots dt, #shots dd { margin: 0; }
#shots dd { color: var(--muted); line-height: 1.75; }
#player :is(button,input,textarea,select,summary):focus-visible, .studio :is(a,summary):focus-visible { outline: 2px solid #965024; outline-offset: 2px; }
#screen #answers button:focus-visible, #screen #gate:focus-visible { outline: 3px solid #f69031; outline-offset: 0; }
#loading { background: #eae8df; }
#loading section, #routes section { border: 1px solid #cec7b8; background: #fffdf5f7; border-radius: 9px; box-shadow: 0 6px 24px #30281c24; }
#loading section { padding: 14px 22px; }
#loading h2 { color: #4c5146; font-size: clamp(14px,1.3vw,21px); }
#screen #gate { background: #a94210; color: #fff; border: 1px solid #ffdcc2; border-radius: 9px; min-height: 38px; padding: .52em 1.05em; font-size: clamp(.875rem,2.1cqi,1.125rem); box-shadow: 0 2px 8px #32201740; }
#screen #gate:hover { background: #88390f; }
#routes button, #investigation .signal-actions button, #investigation .signal-pass button { background: var(--deep); color: #fff; }
#routes button:hover, #investigation .signal-actions button:hover, #investigation .signal-pass button:hover { background: #904817; }
#routes kbd, .signal-pass kbd { color: #ffbf82; }
.signal-title,.signal-note,.signal-actions,.drag-caption { color: var(--ink); background: #fffdf6f5; border-color: #d3cdbc; border-radius: 7px; }
.signal-title { border-left-color: var(--orange); }
#knowledge { border-radius: 8px; border-color: #d3cdbc; border-top-color: var(--orange); }
#investigation .rail-slot { border-color: #865527; }
#investigation .rail-slot.armed { background: #ffe1a9; border-color: #763e16; }
#investigation .rail-handle { color: white; background: #9f4514; }
#map-tools { border: 1px solid #d3cdbc; box-shadow: 0 3px 10px #30281c14; background: #fffdf5f5; }
#map-tools select { border: 1px solid #bbbeb1; border-radius: 4px; background: #fffef9; color: var(--ink); }
.service-sheet { --sheet-orange: var(--accent); background: #fcfaf3; border-top-color: var(--orange); }
.service-sheet .ds-act, .wc-souvenir .wc-sv-primary { background: var(--deep); }
.wc-souvenir { background: linear-gradient(122deg,#fffdf5,#f3ede0 80%,#eddac2); }
#player:is(:fullscreen,.expanded) { width: 100%; height: 100%; max-width: none; max-height: none; display: grid; grid-template-columns: minmax(0,1fr) var(--rail-width); grid-template-rows: minmax(0,1fr); align-items: stretch; padding: 0; border: 0; border-radius: 0; background: #222621; }
#player:is(:fullscreen,.expanded) .view-column { min-height: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#player:is(:fullscreen,.expanded) .view-column :is(#screen,.controls,.caption) { width: min(100%,calc((100dvh - 96px)*16/9)); flex: none; }
#player:is(:fullscreen,.expanded) .review-inner { padding-top: max(18px,env(safe-area-inset-top)); }
@media (max-width: 900px) {
  #player { --rail-width: 235px; }
  .chapters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .chapters button { display: flex; align-items: center; }
  .chapters img { width: 34%; aspect-ratio: 1.32; }
  .chapters button > span { padding: 6px 7px; }
  .controls { gap: 5px; }
}
@media (max-width: 740px) {
  .studio { padding-inline: 12px; }
  .masthead { min-height: 49px; gap: 0 8px; }
  .brand { font-size: 18px; }
  .brand img { height: 24px; width: 24px; }
  .masthead nav { gap: 13px; }
  .masthead nav a { font-size: 12px; }
  #player { grid-template-columns: minmax(0,1fr); }
  #review-panel { border-left: 0; border-top: 1px solid var(--line); }
  .review-inner { position: static; display: grid; grid-template-columns: 1fr minmax(0,1fr); gap: 0 12px; padding: 12px 14px; }
  .review-header { grid-column: 1; justify-content: flex-start; gap: 9px; }
  .review-header h2 { font-size: 18px; }
  #review-name-form { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin: 0; }
  #review-name-form label { margin-bottom: 2px; font-size: 11px; }
  #review-members { grid-column: 1; grid-row: 2; margin: 4px 0; }
  .review-list-head, #review-feedback, #review-comments, #review-empty { grid-column: 1/-1; }
  .review-list-head { margin-top: 10px; padding-top: 10px; }
  #review-empty { margin-top: 8px; }
  #review-comments { max-height: 40dvh; overflow-y: auto; }
  .chapter-section { margin-top: 24px; }
  #shots dl { grid-template-columns: 1fr; gap: 4px; }
  #shots dd { margin-bottom: 10px; }
}
@media (max-width: 480px) {
  .masthead nav { gap: 10px; }
  .controls { padding: 5px; gap: 3px; }
  .controls button { min-height: 32px; padding: 4px; }
  .controls #clock { font-size: 10px; }
  .controls #play { flex-basis: 27px; }
  .view-column .caption { min-height: 32px; padding: 5px 8px; }
  .caption #note { font-size: 10px; }
  .chapters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .review-inner { padding: 11px; }
  .name-edit { gap: 4px; }
  .name-edit button { padding: 3px 8px; }
}
@media (max-width: 740px) and (orientation: portrait) {
  #player:is(:fullscreen,.expanded) { grid-template-columns: 100%; grid-template-rows: min-content minmax(0,1fr); align-content: start; }
  #player:is(:fullscreen,.expanded) .view-column { height: auto; }
  #player:is(:fullscreen,.expanded) .view-column :is(#screen,.controls,.caption) { width: 100%; }
  #player:is(:fullscreen,.expanded) #review-panel { min-height: 0; overflow: auto; }
}
@media (orientation: landscape) and (max-height: 550px) {
  #player:is(:fullscreen,.expanded) { --rail-width: clamp(185px,26vw,250px); }
  #player:is(:fullscreen,.expanded) .view-column :is(#screen,.controls,.caption) { width: min(100%,calc((100dvh - 83px)*16/9)); }
  #player:is(:fullscreen,.expanded) #review-panel { border-top: 0; border-left: 1px solid var(--line); }
  #player:is(:fullscreen,.expanded) .review-inner { display: block; position: absolute; padding: 10px; }
  #player:is(:fullscreen,.expanded) #review-name-form { margin-top: 8px; }
  #player:is(:fullscreen,.expanded) #review-comments { max-height: none; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .controls button { transition: none; }
}
@media (min-width: 901px) and (max-height: 830px) {
  .studio { max-width: min(1560px,calc(172dvh + 205px)); }
  .masthead { min-height: 48px; }
}

#journey-subtitle {
  pointer-events: none;
  margin: 0;
  padding: .3em .8em;
  background: rgb(20 24 22 / 88%);
  color: white;
  text-align: center;
  line-height: 1.45;
  font-size: clamp(13px, 1.35vw, 20px);
  font-weight: 560;
  overflow-wrap: anywhere;
}
#screen > #journey-subtitle {
  position: absolute;
  z-index: 18;
  bottom: 2.5%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 92%;
  border-radius: 5px;
}
#subtitle-dock { width: 100%; }
#subtitle-dock:has(#journey-subtitle:not([hidden])) { background: #252823; }
#player:where(:fullscreen,.expanded) #subtitle-dock:has(#journey-subtitle:not([hidden])) { max-width: min(100%,calc((100dvh - 96px)*16/9)); }
.controls :is(#subtitle-toggle,#map)[aria-pressed="true"] { color: #ffd5b4; border-color: #ae754e; background: #493a2e; }
#review-status[data-online="true"] { display: inline-flex; align-items: center; gap: 5px; color: #32614e; }
#review-status[data-online="true"]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #36805e; }
@media (min-width: 741px) and (min-height: 600px) {
  .review-inner { display: flex; flex-direction: column; }
  .review-inner > :not(#review-comments) { flex: none; }
  #review-comments { min-block-size: 4.5rem; overflow-y: auto; overscroll-behavior: contain; }
  .review-list-head { margin-top: 2px; }
}
@container stage (max-width: 34rem) {
  .controls { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 6px 8px; }
  .controls #seek { grid-column: span 2; width: 100%; margin: 0; }
  .controls #play { justify-self: start; width: 36px; }
  .controls button { min-height: 36px; }
}
@media (max-width: 500px) {
  .masthead nav { gap: 10px; }
  .masthead nav a { padding-block: 6px; }
  .masthead h1 { padding-inline-start: 8px; }
}
@media (max-width: 390px) {
  .masthead nav a[href="#player"] { display: none; }
}

#routes:not([hidden]) { inset: auto 8px 7px auto; width: max-content; max-width: 96%; padding: 0; background: transparent; pointer-events: none; z-index: 11; }
#routes section { padding: 5px 7px; pointer-events: auto; }
#routes section h2 { display: none; }
#routes section button { min-height: 34px; }
