:root {
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  color: #f2eadb;
  background: #15282a;
  color-scheme: dark;
  --panel: #1b3032;
  --mat: #101e20;
  --muted: #c5c9bd;
  --line: #687a74;
  --brass: #e0c494;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif CJK JP", serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button { min-height: 44px; font: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; }
h1 { font-size: clamp(1.45rem, 4.8vw, 2.3rem); letter-spacing: .06em; }
h2 { font-size: 1.15rem; }
.primary, .quiet {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 13px;
  color: inherit;
  background: transparent;
  font-size: .9rem;
}
.primary { color: #1c2927; background: var(--brass); border-color: var(--brass); font-weight: 700; }
button:enabled:is(:hover, :focus-visible) { filter: brightness(1.12); }
.source-link { color: var(--brass); text-underline-offset: .2em; }
.gallery {
  width: min(100%, 1250px);
  margin-inline: auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  display: grid;
  gap: 12px;
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand, .artist { color: var(--muted); font-size: .82rem; }
.artist { margin-top: 4px; }
.music { flex: none; }
footer { color: var(--muted); font-size: .75rem; text-align: center; line-height: 1.55; }

.setup { display: grid; gap: 9px; }
.setup > h2 { font-size: .93rem; color: var(--muted); letter-spacing: .09em; }
#open-floorplan { display:flex; align-items:center; justify-content:space-between; padding:.6rem .85rem; background:#223636; color:#eadcc0; border:1px solid #687a74; border-radius:2px; }
#open-floorplan span:first-child { font-family:serif; font-size:1.07rem; }
#open-floorplan span:last-child, #room-note { font-size:.84rem; }
#floorplan { background:#e8e2d3; color:#2f413e; width:min(92vw,32rem); border:2px solid #84795f; padding:clamp(14px,4vw,28px); }
#floorplan header { display:flex; align-items:baseline; justify-content:space-between; border-bottom: 2px solid #69736a; }
#floorplan h2 { font-family:serif; color:#233b34; }
#floorplan header span { font:italic 1.4rem Georgia,serif; }
#floorplan p { font-size:.85rem; }
.floor-grid { display:grid; grid-template-columns:1fr 22px 1fr; row-gap:6px; padding:10px; background:repeating-linear-gradient(0deg,transparent 0 15px,#56635314 15px 16px),repeating-linear-gradient(90deg,transparent 0 15px,#56635314 15px 16px),#dad6c7; border:1px solid #9e9f8d; }
.floor-grid button { text-wrap:balance; font-size:clamp(.83rem,3.6vw,1rem); position:relative; line-height:1.2; min-height:48px; font-family:serif; background:#f7f2e5; color:#30463d; border:2px solid #54645b; border-radius:0; padding:5px; }
.floor-grid button:nth-child(odd) {grid-column:1}
.floor-grid button:nth-child(even) {grid-column:3}
.floor-grid button::after {content:""; position:absolute; width:5px; height:12px; background:#e0dbcd; right:-3px; top:35%; border-block:1px solid #5b695e;}
.floor-grid button:nth-child(even)::after {right:auto;left:-3px}
.floor-grid button[aria-current] {background:#324c43;color:#fff4d7}
.floor-grid button[aria-current]::before {content:"現在地";display:block;color:#edcf94;font:11px system-ui}
.floor-grid { position:relative; isolation:isolate; grid-template-columns:minmax(0,1fr) 28px minmax(0,1fr); }
.floor-grid::before { content:""; position:absolute; z-index:-1; top:9%; bottom:8%; left:calc(50% - 12px); width:24px; border-inline:1px solid #a79e87; background:repeating-linear-gradient(45deg,#c9bfaa 0 2px,transparent 2px 8px); }
.floor-grid button[data-room="intro"], .floor-grid button[data-room="entrance"] { grid-column:1/-1; justify-self:center; width:72%; }
.floor-grid button[data-room="intro"] { grid-row:1; border-radius:48% 48% 2px 2px / 35% 35% 2px 2px; }
.floor-grid button[data-room="entrance"] { grid-row:6; border-bottom:5px double #788276; }
.floor-grid button[data-room="intro"]::after, .floor-grid button[data-room="entrance"]::after { left:calc(50% - 8px); top:auto; bottom:-3px; width:16px; height:4px; border:0; }
.floor-grid button[data-room="entrance"]::after { top:-3px; bottom:auto; }
#floorplan form {text-align:right}
#floorplan .quiet {background:transparent;color:#30463d;border-color:#78857a}
#curtain { position:absolute; inset:0; overflow:hidden; pointer-events:none; z-index:2; }
#curtain i { position:absolute; top:0; bottom:0; width:51%; left:0; box-shadow:inset -2px 0 3px #181414; border-inline-end:2px solid #a58c66;
 background:linear-gradient(165deg,#e4c1a015,transparent 40%,#150e1599),repeating-linear-gradient(92deg,#362532 0%,#593e4a 4%,#70535b 7%,#503541 11%,#2e222c 16%,#392731 19%); }
#curtain i+i {left:auto;right:0;border-inline:1px solid #856f5c;background-position:100% 0}
footer #offline-status {display:block}
#room-note { margin: 0; }
.gallery[data-room="flowers"] { --wall-color: #393b32; --wall-light: #626653; }
.gallery[data-room="water"] { --wall-color: #243d48; --wall-light: #516a71; }
.gallery[data-room="people"] { --wall-color: #363735; --wall-light: #64564a; }
.gallery-wall {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #61726a82;
  background:
    repeating-linear-gradient(0deg, #ffffff03 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 15%, var(--wall-light, #516054), transparent 70%),
    var(--wall-color, #283e3e);
  box-shadow: inset 0 -16px 55px #101a1a8c;
}
.works {
  position: relative;
  z-index: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  align-items: stretch;
  gap: 13px;
  padding: 15px 13% 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
}
.works::-webkit-scrollbar { display: none; }
.work {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  color: #f0e6d4;
  background: transparent;
  scroll-snap-align: center;
  outline-offset: -2px;
}
.frame {
  --image-limit: 224px;
  align-self: center;
  display: block;
  position: relative;
  width: min(100%, 335px, calc(var(--frame-ratio, 1.25) * var(--image-limit) + 20px));
  padding: clamp(7px, 1.65vw, 14px);
  background: linear-gradient(135deg, #a78350 0%, #63442b 27%, #3a281d 52%, #99744a 76%, #452f22 100%);
  border: 1px solid #aa8759;
  box-shadow: 4px 9px 14px #0d1414a0, inset 0 0 0 2px #513724, inset 0 0 0 3px #c8a67695, inset 0 0 0 5px #4f392a;
}
.frame::after {
  content: "";
  position: absolute;
  inset: clamp(6px, 1.4vw, 12px);
  box-shadow: inset 1px 2px 4px #110e0bc4;
  pointer-events: none;
}
.frame img { display: block; width: 100%; height: auto; background: #1b1b17; }
.plaque {
  display: block;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid #a18b6780;
  background: #223537;
  box-shadow: 2px 3px 4px #14222280;
  text-align: center;
}
.plaque strong { display: block; font: 600 .94rem/1.4 var(--serif); }
.plaque small { display: block; color: #d3c7b5; font-size: .75rem; line-height: 1.4; }
.work[aria-pressed="true"] .plaque { color: #222a25; background: #dfc9a4; border-color: #f3ddad; }
.work[aria-pressed="true"] .plaque small { color: #494438; }
.gallery-floor {
  position: relative;
  height: 43px;
  border-top: 4px double #637064;
  background:
    repeating-conic-gradient(from 234deg at 50% -112px, #241c191c 0deg 1deg, transparent 1deg 9deg),
    linear-gradient(90deg, #131b1a48, transparent 40%, #d0a97b19 57%, #181b1a48),
    linear-gradient(#534236, #6c5544);
  box-shadow: inset 0 5px 12px #151a1890;
  pointer-events: none;
}
.visitor {
  --start: -36px;
  --pause: clamp(56px, 21vw, 240px);
  --end: min(100vw, 1250px);
  --scale: .75;
  --ink: #192728;
  position: absolute;
  bottom: 3px;
  left: 0;
  width: 42px;
  height: 87px;
  transform-origin: 50% 100%;
  animation: visitor-cross 23s -7s infinite linear;
}
.visitor--far {
  --start: min(100vw, 1250px);
  --pause: clamp(248px, 71vw, 880px);
  --end: -41px;
  --scale: .59;
  --ink: #263534;
  bottom: 10px;
  animation-duration: 31s;
  animation-delay: -10s;
}
.visitor--near {
  --pause: clamp(151px, 49vw, 610px);
  --scale: .67;
  --ink: #202b2c;
  animation: visitor-observe 12s -3s infinite ease-in-out;
}
.visitor::before {
  position: absolute;
  content: "";
  width: 47px;
  height: 8px;
  left: 2px;
  bottom: 0;
  transform: rotate(-8deg);
  border-radius: 50%;
  background: #14212292;
  filter: blur(3px);
}
.visitor i { position: absolute; display: block; background: var(--ink); }
.visitor i:nth-child(1) { width: 15px; height: 18px; top: 3px; left: 15px; border-radius: 56% 48% 46% 51%; transform: rotate(7deg); }
.visitor i:nth-child(2) { width: 29px; height: 43px; top: 20px; left: 7px; border-radius: 45% 42% 21% 26%; transform: skewX(-5deg); }
.visitor i:nth-child(3) { width: 23px; height: 42px; top: 42px; left: 10px; clip-path: polygon(0 0, 100% 0, 89% 100%, 57% 100%, 50% 57%, 41% 100%, 10% 100%); }
.visitor--far i:nth-child(2) { width: 24px; left: 10px; transform: skewX(5deg); }
.visitor--near i:nth-child(1) { width: 17px; height: 17px; left: 12px; }
.visitor--near i:nth-child(2) { border-radius: 42% 48% 33% 18%; }
@keyframes visitor-cross {
  0% { transform: translateX(var(--start)) scale(var(--scale)); opacity: 0; }
  10% { opacity: .60; }
  30% { transform: translateX(var(--pause)) scale(var(--scale)) rotate(-2deg); opacity: .82; }
  45% { transform: translateX(var(--pause)) scale(var(--scale)) rotate(5deg); }
  58% { transform: translateX(var(--pause)) scale(var(--scale)) rotate(1deg); }
  79% { opacity: .63; }
  95%, 100% { transform: translateX(var(--end)) scale(var(--scale)); opacity: 0; }
}
@keyframes visitor-observe {
  0%, 100% { transform: translateX(var(--pause)) scale(var(--scale)) rotate(-2deg); opacity: .68; }
  47%, 58% { transform: translateX(calc(var(--pause) + 5px)) scale(var(--scale)) rotate(5deg); opacity: .79; }
}
.gallery-nav { display: flex; justify-content: center; align-items: center; gap: 15px; }
.gallery-nav .quiet { width: 44px; padding: 0; font-size: 1.4rem; border-color: transparent; }
.gallery-nav output { min-width: 4ch; text-align: center; color: var(--muted); font-size: .86rem; }
.course-desk { width: min(100%, 640px); justify-self: center; }
.course-desk fieldset { border: 0; padding: 0; margin: 0 0 9px; display: grid; gap: 5px; }
.course-desk legend { font-size: .91rem; color: var(--muted); margin-bottom: 6px; padding: 0; }
.course {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 53px;
  border-top: 1px solid #687a7480;
  padding: 5px 8px;
  cursor: pointer;
}
.course:has(input:checked) { border-color: #beaa83; background: #253938; }
.course input { margin: 0; accent-color: var(--brass); }
.course strong, .course span span { display: block; font-size: .875rem; line-height: 1.45; }
.course span span { color: var(--muted); }
#begin { width: 100%; }
#setup-error { padding-top: 8px; color: #f5baac; font-size: .875rem; }

.exhibit { display: grid; gap: 9px; }
.toolbar, .zoom-controls, .actions, .caption-source, .verdict-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar { justify-content: space-between; }
#observation-time { font-size: .85rem; color: var(--brass); font-variant-numeric: tabular-nums; }
.zoom-controls { gap: 0; border: 1px solid var(--line); border-radius: 3px; }
.zoom-controls button { width: 44px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 1.25rem; }
.zoom-controls #view-reset { border-left: 1px solid var(--line); font-size: .83rem; }
#zoom-value { width: 33px; text-align: center; font-size: .84rem; font-variant-numeric: tabular-nums; }
.paintings { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(6px, 1.5vw, 16px); }
.paintings[data-compare="true"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.picture {
  position: relative;
  width: 100%;
  aspect-ratio: var(--picture-ratio, 1.25);
  max-height: clamp(155px, calc(100svh - 315px), 640px);
  border: 1px solid #687a7488;
  background: var(--mat);
}
.paintings[data-compare="true"] .picture { max-height: 560px; }
canvas { display: block; width: 100%; height: 100%; }
.picture canvas { position: absolute; inset: 0; touch-action: none; user-select: none; }
figcaption { padding: 4px 0; font-size: .875rem; color: var(--muted); }
.observation {
  background: #1b3032;
  border-left: 2px solid #bba173;
  padding: 9px 12px 2px;
}
.caption { min-height: 3.1em; font-size: .9rem; line-height: 1.55; }
.caption span[data-enter="true"] { display: block; animation: caption-enter .5s ease-out; }
@keyframes caption-enter { from { opacity: .65; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.caption-source { justify-content: space-between; flex-wrap: wrap; column-gap: 6px; row-gap: 0; }
.caption-source a { padding-block: 8px; font-size: .75rem; }
.caption-source .quiet { border-color: transparent; padding-inline: 0; }
.status { line-height: 1.5; color: var(--muted); font-size: .875rem; }
.actions .primary, .verdict-actions .primary { flex: 1; }
.exit { justify-self: start; }
.verdict { display: grid; gap: 8px; }
.verdict > .quiet { justify-self: start; }
.verdict p { max-width: 37em; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.sound-options { display: flex; flex-wrap: wrap; margin-top: 14px; gap: 8px; }
.sound-options > button { flex: 1; }
.sound-options > button[aria-pressed="true"] { border-color: var(--brass); color: var(--brass); }
.release-info { margin: 2px auto 0; max-width: 550px; }
.release-info summary { display: inline list-item; padding-block: 5px; color: var(--brass); cursor: pointer; }
.release-info dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; text-align: left; margin: 0; padding: 4px 8px; }
.release-info dd { margin: 0; }

.reading { width: min(100%, 720px); justify-self: center; display: grid; gap: 9px; }
.reading p { line-height: 1.6; }
.result-score { color: var(--brass); font-size: 1.2rem; font-weight: 700; }
.vote-result { color: var(--muted); font-size: .9rem; }
.answer-overview { padding: 8px; background: var(--mat); border: 1px solid #687a7480; }
.answer-overview canvas { height: auto; }
.answer-overview figcaption { padding: 6px 1px 0; }
#answer-list { list-style: none; padding: 0; margin: 4px 0 8px; }
#answer-list li { padding: 12px 0; border-top: 1px solid #687a7480; }
.answer-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; margin-bottom: 6px; }
.answer-title strong { font-size: .95rem; }
.answer-badge { font-size: .83rem; padding: 2px 5px; border: 1px solid; }
.answer-badge[data-found="true"] { color: #b2e0cd; }
.answer-badge[data-found="false"] { color: #f2c4a3; border-style: dashed; }
.answer-crops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 460px; margin-block: 8px; }
.answer-crops canvas { height: auto; background: var(--mat); }
.answer-crops figcaption { font-size: .75rem; }
#answer-list p, #visit-note { font-size: .9rem; }
.credit { font-size: .75rem; color: var(--muted); }
#replay { margin-top: 8px; }
dialog {
  width: min(475px, calc(100% - 26px));
  max-height: 85svh;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #203638;
  color: inherit;
  box-shadow: 0 12px 44px #061112a8;
}
dialog::backdrop { background: #0c1718bd; }
dialog p { margin-block: 12px; line-height: 1.6; }
dialog form { margin-top: 12px; }
dialog .primary { width: 100%; }
@media (min-width: 680px) {
  .gallery { padding-inline: 25px; }
  .works {
    grid-auto-flow: row;
    grid-template-columns: repeat(var(--room-count, 3), minmax(0, 1fr));
    grid-auto-columns: auto;
    min-height: clamp(265px, 36vw, 431px);
    gap: clamp(10px, 3vw, 42px);
    padding: 20px clamp(21px, 5vw, 58px) 14px;
    overflow: visible;
  }
  .frame { --image-limit: 265px; }
  .gallery-floor { height: 54px; }
  .gallery-nav { display: none; }
  .course-desk fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .exhibit { width: min(100%, 1170px); justify-self: center; }
}
@media (max-width: 350px) {
  .gallery { padding-inline: 10px; }
  .works { padding-top: 8px; }
  .actions { gap: 5px; }
  .actions .quiet { padding-inline: 7px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .gallery { gap: 7px; padding-block: 7px; }
  .exhibit { column-gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(205px, .43fr); align-items: start; }
  .paintings { grid-column: 1; grid-row: 1 / span 4; }
  .toolbar, .observation, .status, .actions, .verdict { grid-column: 2; }
  .toolbar, .actions { flex-wrap: wrap; }
  .actions .primary { flex-basis: 100%; }
  .picture, .paintings[data-compare="true"] .picture { height: 59svh; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .visitor { animation: none; transform: translateX(var(--pause)) scale(var(--scale)); opacity: .7; }
  .caption span[data-enter="true"] { animation: none; }
}

.sound-options { display: grid; gap: 18px; }
.sound-channel { display: grid; gap: 7px; }
.sound-channel button { justify-self: start; }
.sound-channel label { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.sound-channel output { font-variant-numeric: tabular-nums; color: var(--muted); }
.sound-channel input[type="range"] { width: 100%; min-height: 44px; margin: 0; accent-color: #e0c494; }
.sound-note { font-size: .8rem; color: var(--muted); }

.stats-note { color: var(--muted); font-size: .875rem; }
.stats-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.stats-toggle input { width: 20px; height: 20px; accent-color: #e0c494; }

.stats-overview { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
