#dialog[data-kind="festival-sights-guide"] {
  width: min(720px, calc(100% - max(12px, var(--safe-left)) - max(12px, var(--safe-right))));
  max-height: calc(100dvh - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)));
  border-color: #3e4750;
  color: #293e44;
  background: #faf4e5;
  box-shadow: 0 5px 0 #35434a, 0 14px 58px #26203652;
}
#dialog[data-kind="festival-sights-guide"] .dialog-close {
  min-width: 44px;
  min-height: 44px;
  color: #294f51;
  border-color: #82918a;
  background: #efe9d6;
}
.sight-folio header { padding: 0 44px 13px 0; }
.sight-folio header h2 { margin: 0 0 2px; color: #28474c; }
.dialog-content .sight-folio header p { margin: 0; color: #545d59; }
.sight-folio-heading { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; }
.sight-folio-heading h3 { margin: 0; color: #4b5c5b; font-size: 13px; font-weight: 850; }
.sight-folio-heading::after { content: ""; order: 1; flex: 1; height: 1px; background: #b4b2a1; }
.sight-folio-heading span { order: 2; color: #73553a; font-size: 12px; font-weight: 800; }
.sight-leaves { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; }
.sight-leaf { min-width: 0; padding: 5px 5px 9px; border: 1px solid #bbbcaa; background: #fffaf0; border-radius: 6px; }
.sight-leaf-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 3px 7px; margin: 8px 4px 3px; }
.sight-leaf h3 { margin: 0; color: #2c4548; font-size: 15px; font-weight: 900; }
.sight-record { display: inline-flex; align-items: center; gap: 2px; color: #686961; font-size: 10px; font-weight: 750; }
.sight-leaf[data-recorded] .sight-record { color: #256657; }
.sight-record .glyph { width: 12px; height: 12px; stroke-width: 2.5; }
.dialog-content .sight-leaf p { margin: 0 4px; color: #53605a; font-size: 12px; line-height: 1.5; }
.dialog-content .sight-folio-controls {
  display: flex; align-items: center; gap: 9px; margin: 13px 0 0; padding: 8px 10px;
  border-left: 3px solid #789786; background: #e9ecdb; color: #334f4e; font-size: 13px;
}
.sight-folio-controls .glyph { width: 18px; height: 18px; }

/* Each print shows the finished shape so the player can recognise its two pieces on the island. */
.sight-print {
  --sky: #d2b1ab; --lower: #e9cfb6; --distant: #ad8990; --shore: #896f85;
  position: relative; isolation: isolate; width: 100%; aspect-ratio: 1.78;
  overflow: hidden; border-radius: 3px; background: linear-gradient(180deg, var(--sky), var(--lower) 92%);
}
.sight-print[data-print="boat"] { --sky: #8eb8b0; --lower: #d1dbbd; --distant: #83a9a1; --shore: #5a8790; }
.sight-print[data-print="moon"] { --sky: #727f9e; --lower: #b5a9a6; --distant: #777f94; --shore: #5c6c80; }
.sight-print > i { position: absolute; display: block; }
.sight-print-sun { top: 14%; right: 13%; width: 14%; aspect-ratio: 1; border-radius: 50%; background: #ffedbb; }
[data-print="moon"] .sight-print-sun { right: 18%; top: 16%; background: #ffe4a5; }
.sight-print-hills {
  inset: 28% 0 5%; background: var(--distant);
  clip-path: polygon(0 62%,14% 36%,20% 46%,34% 10%,42% 23%,48% 13%,64% 54%,78% 22%,91% 50%,100% 35%,100% 100%,0 100%);
}
.sight-print-shore {
  inset: 62% 0 0; background: var(--shore);
  clip-path: polygon(0 36%,14% 18%,23% 29%,31% 21%,44% 62%,57% 57%,72% 30%,81% 36%,92% 1%,100% 20%,100% 100%,0 100%);
}
.sight-print-subject {
  position: absolute; display: grid; left: 50%; top: 50%; height: 76%; max-width: 91%;
  aspect-ratio: var(--cols) / var(--rows); transform: translate(-50%,-50%);
  grid-template-columns: repeat(var(--cols),minmax(0,1fr)); grid-template-rows: repeat(var(--rows),minmax(0,1fr));
  filter: drop-shadow(0 1px 0 #534c5170);
}
.sight-map-side { min-width: 0; }
.sight-map-side canvas { margin-inline: auto; max-height: 245px; object-fit: contain; background: #383052; }
.sight-map-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; padding: 6px 8px;
  border-left: 3px solid #78a899; border-radius: 1px 6px 6px 1px; background: #edf1e6; color: #314f49;
}
.sight-map-note strong { font-size: 12px; font-weight: 900; }
.sight-map-note span { font-size: 11px; font-weight: 750; }
.sight-map-note button { margin: 0 0 0 auto; color: #31584f; border-color: #91a69b; background: #fffaf0; }
.sight-map-note button span { font-size: inherit; }

#festival-sight-hud {
  --sight-ink: #f9d699;
  position: absolute; inset: 0; pointer-events: none; user-select: none;
}
.sight-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(86vw,76dvh,640px); height: min(46dvh,72vw,380px);
  --edge: clamp(14px,2.8dvh,24px);
}
.sight-frame i {
  position: absolute; width: var(--edge); height: var(--edge); border: 0 solid #ffefcf;
  filter: drop-shadow(0 1px 1px #352940);
}
.sight-frame i:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; }
.sight-frame i:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; }
.sight-frame i:nth-child(3) { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.sight-frame i:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 2px 2px; }
#festival-sight-hud[data-aligned] .sight-frame i { border-color: #abffe0; }
.sight-plate {
  position: absolute; top: calc(50% + min(23dvh,36vw,190px) + 9px); left: 50%; transform: translateX(-50%);
  z-index:2; display: grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:5px;
  width:max-content; max-width:min(92vw,500px); min-height:52px; padding:4px 5px 4px 9px;
  color: #fff6de; background: #22373eec; border: 1px solid #e3cfa391; border-radius: 9px; box-shadow: 0 2px 0 #26313991;
}
.sight-plate-text { min-width:0; display:grid; gap:2px; margin-right:2px; }
.sight-plate-title,.sight-seam-list { display:flex; align-items:center; flex-wrap:wrap; gap:2px 7px; }
.sight-name, .sight-cue { display: block; }
.sight-name { color: #fff3d5; font-size: 14px; line-height: 1.35; font-weight: 900; }
.sight-cue { color: #e4e7d7; font-size: 11px; line-height: 1.25; font-weight: 650; }
.sight-cue:empty { display:none; }
.sight-key,.sight-mark-key { color:#d9dfd1; font-size:10px; font-weight:760; white-space:nowrap; }
.sight-mark-key { display:none; color:#f0e8cc; }
#festival-sight-hud[data-guides] .sight-mark-key { display:inline; }
.sight-seam-list > span { display:inline-flex; align-items:center; gap:3px; color:#efeada; font-size:11px; font-weight:720; line-height:1.25; }
.sight-seam-list i { color:var(--sight-ink); font:850 10px/1.2 system-ui,sans-serif; }
.sight-seam-list b { color:#ddd0b7; font-size:10px; }
.sight-seam-list [data-fit="yes"] b { color:#a6f6cd; }
.sight-plate button {
  pointer-events:auto; min-width:44px; min-height:44px; padding:3px 7px;
  border:1px solid #8da899; border-radius:6px; color:#f5f2dc; background:#344e50;
  font-size:12px; font-weight:820; white-space:nowrap; touch-action:manipulation;
}
.sight-plate button[aria-pressed="true"] { color:#203f37; background:#c0e4c7; border-color:#e0f4d0; }
.sight-plate .sight-exit { background:#2a4147; border-color:#788b85; }
.sight-plate button:focus-visible { outline:2px solid #ffe5a1; outline-offset:1px; }
#festival-sight-hud[data-aligned] .sight-cue { color: #b8f9db; }
#festival-sight-hud[data-aligned] .sight-key { color:#b5f4c6; }
.sight-guidelines,.sight-pair,.sight-pair svg { position:absolute; inset:0; width:100%; height:100%; overflow:hidden; pointer-events:none; }
.sight-guidelines[hidden],.sight-pair[hidden] { display:none; }
.sight-pair svg path { fill:none; stroke:#fff4d6; stroke-width:1.2px; stroke-dasharray:3.5 4; stroke-linecap:round; vector-effect:non-scaling-stroke; filter:drop-shadow(0 1px 1px #29393a); }
.sight-near-mark,.sight-far-mark { position:absolute; translate:-50% -50%; width:12px; height:12px; color:var(--sight-ink); filter:drop-shadow(0 0 1px #1d2c30) drop-shadow(0 1px 1px #233c43); }
.sight-far-mark { width:19px; height:19px; color:#fff9dc; }
.sight-near-mark b,.sight-far-mark b { position:absolute; inset:0; display:block; border:1.5px solid currentColor; background:transparent; }
.sight-near-mark b { rotate:45deg; }
.sight-far-mark b { border-style:dashed; border-radius:2px; }
.sight-pair[data-matched] .sight-near-mark { color:#a8f7cf; }
.sight-near-mark small { position:absolute; right:100%; bottom:90%; padding:1px 2px; min-width:10px; border-radius:3px; background:#203638db; color:#f8f4dd; text-align:center; font:800 9px/1 system-ui,sans-serif; }
.sight-near-mark[data-outside] b { inset:-1px; border:0; rotate:var(--pointer-angle); background:currentColor; clip-path:polygon(0 5%,100% 50%,0 95%,24% 50%); }
.sight-far-mark[data-outside] b { inset:3px; border:0; border-top:2.5px solid; border-right:2.5px solid; border-radius:0; rotate:calc(45deg + var(--pointer-angle)); }
#app[data-sight-view] :is(.festival-overlay,#festival-prompt,#live-camera,.keyboard-guide,#dash,#jump,#dash-state) { display: none !important; }
#app[data-sight-exhibit] .festival-card { display: none; }
#app[data-sight-view] #race-callout { top: max(64px,calc(var(--top) + 48px)); bottom: auto; }

@media (max-width: 520px) and (orientation: portrait) {
  .sight-leaves { grid-template-columns: 1fr; gap: 6px; }
  .sight-leaf { display: grid; grid-template-columns: minmax(72px,31%) minmax(0,1fr); column-gap: 9px; align-content: center; padding: 4px 7px 4px 4px; }
  .sight-print { grid-row: span 2; align-self: stretch; aspect-ratio: 1.5; }
  .sight-leaf-caption { align-self: end; margin: 0; }
  .dialog-content .sight-leaf p { margin: 2px 0 0; }
  .sight-map-side canvas { height: 185px; max-height: none; object-fit: contain; }
  .sight-frame { width: 86vw; height: min(35dvh,82vw); }
  .sight-plate { top: calc(50% + min(17.5dvh,41vw) + 9px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  #dialog[data-kind="festival-sights-guide"] .dialog-content { padding: 10px 16px 12px; }
  .sight-folio header { padding-bottom: 5px; }
  .sight-folio header h2 { font-size: 26px; }
  .sight-folio-heading { margin-bottom: 4px; }
  .sight-print { aspect-ratio: auto; height: clamp(49px,20dvh,82px); }
  .sight-leaf { padding-bottom: 5px; }
  .sight-leaf-caption { margin-top: 3px; }
  .dialog-content .sight-folio-controls { margin-top: 6px; padding-block: 4px; }
  #dialog[data-kind="festival-sights-guide"] .dialog-actions { margin-top: 7px; }
  .sight-frame { height: 44dvh; }
  .sight-plate { top: calc(72% + 4px); min-height: 38px; padding-block: 3px; }
  .sight-plate { max-width:min(490px,calc(100% - 220px)); }
  #app[data-sight-view] #race-callout { top: max(5px,var(--safe-top)); max-width: 40vw; }
}
