:root {
  color-scheme: light;
  --paper: #f6f3e9;
  --ink: #203c3a;
  --muted: #536660;
  --line: #caccc0;
  --coral: #a34131;
  --edge: clamp(1.15rem, 4.05vw, 5rem);
  --ui-font: "DM Sans", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-family: var(--ui-font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 17.5rem; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, canvas:focus-visible {
  outline: 3px solid #14796e;
  outline-offset: 4px;
}
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { display: block; flex: none; width: 1.22rem; height: 1.22rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.folio { width: min(100%, 108rem); margin: 0 auto; padding: 0 var(--edge) clamp(1.75rem, 5vw, 4.5rem); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: clamp(1.3rem, 3.65vw, 3.25rem) 0 clamp(1.15rem, 2.5vw, 2.1rem); border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: clamp(.7rem, 1.4vw, 1.4rem); }
h1, h2, p, figure, dl, dd { margin: 0; }
h1 { font-family: "DM Serif Text", "Baskervville", Georgia, "Times New Roman", serif; font-size: clamp(2.15rem, 4.55vw, 4.65rem); font-weight: 400; letter-spacing: -.065em; line-height: .94; white-space: nowrap; }
.identity p { margin: .56rem 0 0 .1rem; color: var(--muted); font-size: clamp(.8rem, 1.05vw, .99rem); line-height: 1.4; letter-spacing: .025em; }
.harbor-mark { position: relative; flex: none; display: block; width: clamp(2.8rem, 4.7vw, 4.55rem); aspect-ratio: 1; border-radius: 50%; background: var(--ink); }
.harbor-mark i { position: absolute; display: block; }
.sun { width: 17%; height: 17%; top: 20%; right: 23%; border-radius: 50%; background: #f39572; }
.sail { left: 24%; top: 19%; width: 28%; height: 40%; background: #fbf5df; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.hull { left: 19%; top: 62%; width: 63%; height: 12%; background: #fbf5df; clip-path: polygon(0 0, 100% 0, 78% 100%, 18% 100%); }
.wake { left: 29%; top: 79%; width: 42%; height: 2.4%; border-radius: 100%; background: #f39572; }
.primary { display: inline-flex; min-height: 2.95rem; align-items: center; justify-content: center; gap: .56rem; padding: .7rem 1.15rem; border: 1px solid var(--ink); border-radius: 100rem; color: #fffdf3; background: var(--ink); font-size: .94rem; font-weight: 650; line-height: 1.4; text-align: center; }
.primary:hover { background: #315451; }
.mode-button { flex: none; }
.mode-button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.mode-button[aria-pressed="true"]:hover { background: #e8e9dd; }

.gallery { display: grid; grid-template-columns: minmax(0, 1fr) clamp(11.25rem, 15.2vw, 15.5rem); gap: clamp(1.4rem, 2.7vw, 3rem); align-items: start; padding-top: clamp(1.15rem, 2.25vw, 2rem); }
.plate { min-width: 0; }
.stage { position: relative; isolation: isolate; overflow: hidden; width: 100%; aspect-ratio: 16 / 10; border-radius: .85rem; background: var(--stage-color, #dce6df); box-shadow: inset 0 0 0 1px #233e3610; }
#render-image, #world { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
#render-image { object-fit: contain; }
#world { touch-action: none; cursor: grab; }
#world:active { cursor: grabbing; }
#world:focus-visible { outline-offset: -5px; }
.stage:fullscreen, .stage.is-expanded { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; background: var(--stage-color, #dce6df); }
.stage.is-expanded { position: fixed; inset: 0; z-index: 10; width: 100dvw; height: 100dvh; }
body.has-expanded { overflow: hidden; }
.stage-button, .stage-tools { color: var(--ink); background: #fffdf3f2; border: 1px solid #193d3524; box-shadow: 0 2px 8px #17332a13; }
.stage-button, .stage-tools button, .close-button { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; padding: 0; }
.expand-button { position: absolute; top: .8rem; right: .8rem; border-radius: 50%; }
.stage-button:hover, .stage-tools button:hover, .close-button:hover { background: #e4ecdf; }
.stage-tools { position: absolute; right: .8rem; bottom: .8rem; display: flex; align-items: center; gap: .1rem; padding: .12rem; border-radius: 5rem; }
.stage-tools button { background: transparent; border: none; border-radius: 50%; }
.stage-tools .icon { width: 1.1rem; height: 1.1rem; }
.loading-note { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; align-items: center; gap: .6rem; padding: .58rem .92rem; border-radius: 10rem; background: #203c3aee; color: white; font-size: .875rem; white-space: nowrap; }
.spinner { width: .9rem; height: .9rem; border: 2px solid #ffffff66; border-top-color: white; border-radius: 50%; animation: turn .85s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.plate-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .92rem .1rem 0; }
.plate-caption strong { font-size: clamp(1.02rem, 1.28vw, 1.25rem); font-weight: 670; letter-spacing: -.055em; }
.caption-medium { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.feedback { margin-top: .75rem; font-size: .94rem; line-height: 1.6; color: var(--coral); overflow-wrap: anywhere; }
.feedback:empty { display: none; }

.views { min-width: 0; }
.views h2 { display: flex; align-items: center; gap: .8rem; margin: .04rem 0 1rem; color: var(--muted); font-size: .9rem; font-weight: 650; line-height: 1.35; letter-spacing: -.035em; }
.views h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.view-list { display: grid; gap: clamp(.65rem, 1.5vw, 1.35rem); }
.view-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .52rem .45rem; position: relative; border-radius: .45rem; color: var(--ink); text-decoration: none; }
.thumb { grid-column: 1 / -1; overflow: hidden; display: block; aspect-ratio: 2.4; border-radius: .48rem; background: #dce5df; box-shadow: 0 0 0 1px #1c342915; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 160ms ease-out; }
.view-card:hover .thumb img { transform: scale(1.035); }
.view-card[aria-current="true"] .thumb { outline: 2px solid var(--coral); outline-offset: 2px; }
.view-label { padding-left: .04rem; font-size: .98rem; font-weight: 570; letter-spacing: -.045em; line-height: 1.45; }
.view-card[aria-current="true"] .view-label { color: var(--coral); font-weight: 700; }
.selected-mark { display: grid; place-items: center; width: 1.1rem; height: 1.1rem; border: 1px solid var(--line); border-radius: 50%; color: transparent; }
.selected-mark .icon { width: .9rem; height: .9rem; stroke-width: 2; }
.view-card[aria-current="true"] .selected-mark { border-color: var(--coral); background: var(--coral); color: #fffdf3; }

.sheet { width: min(27rem, calc(100% - 2rem)); max-height: calc(100% - 2.5rem); overflow: auto; padding: 1.35rem; background: var(--paper); color: var(--ink); border: 1px solid #69776b70; border-radius: .85rem; box-shadow: 0 1rem 4rem #0c282941; }
.sheet::backdrop { background: #17322f77; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.sheet h2 { font-size: 1.24rem; letter-spacing: -.05em; }
.close-button { flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: transparent; border: 1px solid var(--line); }
.instructions { display: grid; }
.instructions div { display: grid; grid-template-columns: 5.1rem 1fr; align-items: baseline; gap: .5rem; border-top: 1px solid var(--line); padding: .65rem 0; }
.instructions dt { font-size: .9rem; font-weight: 700; }
.instructions dd, .sheet p { color: var(--muted); font-size: .96rem; line-height: 1.6; word-break: keep-all; }
#file-form { display: grid; gap: .5rem; margin-top: 1.1rem; }
#file-form label { font-weight: 650; font-size: .96rem; }
#file-form label code { margin-left: .25rem; color: var(--muted); font-weight: 400; }
#file-form input { max-width: 100%; padding: .42rem; margin-bottom: .45rem; background: #fffdf8; border: 1px solid var(--line); border-radius: .4rem; font-size: .88rem; }
#file-form .primary { justify-self: end; }

@media (max-width: 60rem) {
  .gallery { grid-template-columns: minmax(0, 1fr) 9rem; gap: 1.25rem; }
  .view-list { gap: 1rem; }
  .views h2 { margin-bottom: .8rem; }
}
@media (max-width: 46rem) {
  .gallery { grid-template-columns: 1fr; gap: 1.65rem; }
  .view-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.65rem, 2.5vw, 1rem); }
  .thumb { aspect-ratio: 1.9; }
  .view-label { font-size: .92rem; }
  .views h2 { margin-bottom: .9rem; }
  .stage.is-live:not(:fullscreen):not(.is-expanded) { aspect-ratio: 4 / 3; }
}
@media (max-width: 32rem) {
  :root { --edge: clamp(.85rem, 4.25vw, 1.3rem); }
  .folio { padding-bottom: 1.5rem; }
  .masthead { gap: .6rem; padding-top: 1.4rem; padding-bottom: 1.2rem; }
  .identity { gap: .57rem; }
  .harbor-mark { width: 2.26rem; }
  h1 { font-size: clamp(1.58rem, 6.4vw, 2.05rem); }
  .identity p { margin-top: .35rem; font-size: .74rem; letter-spacing: 0; }
  .primary { min-height: 2.75rem; gap: .38rem; padding: .55rem .78rem; font-size: .86rem; }
  .mode-button .icon { width: 1rem; height: 1rem; }
  .gallery { gap: 1.55rem; }
  .stage { border-radius: .65rem; }
  .stage.is-live:not(:fullscreen):not(.is-expanded) { aspect-ratio: 1.05; }
  .stage-button, .stage-tools button { width: 2.75rem; height: 2.75rem; }
  .expand-button { top: .55rem; right: .55rem; }
  .stage-tools { right: .55rem; bottom: .55rem; }
  .plate-caption { padding-top: .7rem; }
  .view-list { display: flex; flex-direction: column; gap: 0; }
  .view-card { grid-template-columns: 5.8rem minmax(0, 1fr) auto; gap: .8rem; padding: .55rem .05rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .views h2 { margin-bottom: .2rem; }
  .thumb { grid-column: auto; width: 100%; aspect-ratio: 1.75; border-radius: .32rem; }
  .selected-mark { margin-right: .25rem; }
  .view-label { font-size: 1rem; }
}
@media (max-width: 21.5rem) {
  .harbor-mark { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
.production-note { margin-top: 1rem; color: #56615c; font-size: 0.8125rem; }
