/* ASSOCIAGE viewer。外部の書体や画像は読み込まない */
html, body { margin: 0; height: 100%; background: var(--bg, #0e0a12); overflow: hidden; overscroll-behavior: none; }
/* 完成の静止画は、WebGL2 が使えないときだけ出す */
#poster { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }
/* 読み込み中の輪。回さない: 読んだ量のぶんだけ閉じていく */
#loader { position: fixed; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; color: var(--fg, #f2ede4);
  pointer-events: none; transition: opacity .3s ease; }
#loader.hide { opacity: 0; }
#loader svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke: currentColor; stroke-linecap: round; }
#loader svg { stroke-width: 2; }
#loader .track, #sharp .track { opacity: .2; }
#loader .bar, #sharp .bar { stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .12s linear; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab;
  opacity: 0; transition: opacity .35s ease; outline: none; }
#stage.ready { opacity: 1; }
#stage.dragging { cursor: grabbing; }
#caption { position: fixed; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 52px); transform: translateX(-50%);
  max-width: 86vw; padding: 7px 16px 8px; border-radius: 12px; text-align: center; pointer-events: none;
  color: #f2ede4; background: rgba(12, 9, 16, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .25s ease;
  font: 15px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; }
#caption.show { opacity: 1; }
#caption .name { display: block; font-weight: 600; letter-spacing: .04em; }
#caption .chain { display: block; margin-top: 2px; font-size: 12.5px; opacity: .74; }
/* 寄って、高解像度の版を読んでいる間だけ出る知らせ。輪は、読んだ量のぶんだけ閉じていく。
   ページの状態の知らせなので、上の段の真ん中（戻る・言語・共有と同じ高さ）に出す。下の物体の名前と操作バーから離しておけば、
   出ても消えても、下のものは動かない（2026-11-19、作者が選んだ。操作バーの上に出すと、消えたときに名前が一段落ちた）。
   操作バーの中の決まり（#ui svg: 20px・塗りつぶし）が当たらないように、操作バーの外に置く */
#sharp { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 5px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; height: 26px; box-sizing: border-box; padding: 0 11px 0 8px; border-radius: 999px; color: #f2ede4;
  background: rgba(12, 9, 16, .42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font: 11px/14px system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; letter-spacing: .02em; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; }
/* 上の段に入りきらない幅（戻ると、言語・共有のあいだ）では、そのすぐ下の段の真ん中に出す */
@media (max-width: 520px) { #sharp { top: calc(max(12px, env(safe-area-inset-top)) + 46px); } }
#sharp.show { opacity: .85; }
/* 共有を開いている間は、共有の列が上に重なるので、知らせは隠す */
body:has(#share-menu:not([hidden])) #sharp { opacity: 0; }
#sharp svg { flex: none; display: block; width: 12px; height: 12px; transform: rotate(-90deg); fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
@media (prefers-reduced-motion: reduce) { #loader, #loader .bar, #sharp, #sharp .bar, #stage, #caption { transition: none; } }
#back { position: fixed; left: max(14px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); width: 36px; height: 36px;
  display: grid; place-items: center; border-radius: 50%; color: #f2ede4; text-decoration: none; font: 18px/1 system-ui, sans-serif;
  background: rgba(12, 9, 16, .45); opacity: .55; transition: opacity .2s ease; }
#back:hover, #back:focus-visible { opacity: 1; }

/* 右上: 言葉の切り替えと、共有。高さの中心は、左上の「一覧へ」とそろえる */
#top { position: fixed; right: max(14px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; }
/* 言葉の切り替え（右上に小さく） */
#lang { display: flex; gap: 1px; padding: 3px;
  border-radius: 999px; background: rgba(12, 9, 16, .45); opacity: .6; transition: opacity .2s ease; }
#lang:hover, #lang:focus-within { opacity: 1; }
#lang button { border: 0; margin: 0; padding: 5px 8px; border-radius: 999px; background: transparent; color: #f2ede4; opacity: .55; cursor: pointer;
  font: 600 10.5px/1 system-ui, -apple-system, "Helvetica Neue", sans-serif; letter-spacing: .08em; }
#lang button[aria-pressed="true"] { opacity: 1; background: rgba(242, 237, 228, .18); }
#lang button:focus-visible { outline: 1px solid rgba(242, 237, 228, .7); outline-offset: 1px; }

/* 共有。押すと、その下に SNS ごとの絵だけの列が開く（言葉は読み上げ用の説明に入れる）。公開の作品だけ */
#share-btn { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #f2ede4; background: rgba(12, 9, 16, .45); opacity: .55; transition: opacity .2s ease; }
#share-btn:hover, #share-btn:focus-visible, #share-btn[aria-expanded="true"] { opacity: 1; }
#share-btn:focus-visible { outline: 1px solid rgba(242, 237, 228, .7); outline-offset: 1px; }
#share svg { width: 18px; height: 18px; fill: currentColor; grid-area: 1 / 1; }
#share svg.line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#share-btn svg { width: 20px; height: 20px; }
#share-menu { position: absolute; top: calc(100% + 8px); right: 0; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: rgba(12, 9, 16, .62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: share-in .16s ease; }
#share-menu[hidden], #share-menu [hidden] { display: none; }
#share-menu > * { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: #f2ede4; background: transparent; text-decoration: none; -webkit-tap-highlight-color: transparent; }
#share-menu > *:hover, #share-menu > *:focus-visible { background: rgba(242, 237, 228, .14); outline: none; }
#share-menu .i-done, #share-menu .done .i-link { display: none; }
#share-menu .done .i-done { display: block; }
@keyframes share-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #share-btn { transition: none; } #share-menu { animation: none; } }

/* 並びと時間の操作部。文字は出さず、線とつまみだけ */
#ui { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; width: min(560px, calc(100vw - 28px)); padding: 4px 6px; border-radius: 999px;
  background: rgba(12, 9, 16, .42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .4s ease; }
#ui.ready { opacity: .62; pointer-events: auto; }
#ui.ready:hover, #ui.ready:focus-within { opacity: 1; }
#ui button { flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #f2ede4;
  cursor: pointer; display: grid; place-items: center; }
#ui button:hover, #ui button:focus-visible { background: rgba(242, 237, 228, .14); outline: none; }
#ui svg { width: 20px; height: 20px; fill: currentColor; grid-area: 1 / 1; }
#ui .i-pause, #ui .i-picture { display: none; }
#play[aria-pressed="true"] .i-play, #arrange[aria-pressed="true"] .i-bundle { display: none; }
#play[aria-pressed="true"] .i-pause, #arrange[aria-pressed="true"] .i-picture { display: block; }
#ui .i-picture { fill: none; stroke: currentColor; stroke-width: 1.8; }
#scrub { flex: 1; min-width: 0; height: 36px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#scrub::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: rgba(242, 237, 228, .5); }
#scrub::-moz-range-track { height: 2px; border-radius: 2px; background: rgba(242, 237, 228, .5); }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: #f2ede4; border: 0; }
#scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #f2ede4; border: 0; }
#scrub:focus-visible { outline: 1px solid rgba(242, 237, 228, .6); outline-offset: 2px; border-radius: 8px; }
/* 連想の並びのときは、時間は動かせない */
#ui.alt #play, #ui.alt #scrub { opacity: .28; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #ui, #lang { transition: none; } }

/* 非公開の作品の、パスワードの入力欄（中央に小さく）。文字の色は、ページの地に合わせる（--fg） */
#unlock { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(300px, calc(100vw - 48px));
  display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--fg, #f2ede4);
  font: 14px/1.5 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; }
#unlock[hidden] { display: none; }
#unlock .note { grid-column: 1 / -1; margin: 0 0 6px; text-align: center; font-size: 13px; opacity: .72; }
#unlock input { min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid currentColor; background: transparent;
  color: inherit; font: inherit; font-size: 16px; letter-spacing: .04em; outline: none; opacity: .85; }
#unlock input::placeholder { color: inherit; opacity: .45; }
#unlock input:focus { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 22%, transparent); }
#unlock button { height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--fg, #f2ede4); color: var(--bg, #0e0a12);
  cursor: pointer; font: inherit; font-weight: 600; }
#unlock button:disabled { opacity: .5; cursor: progress; }
#unlock button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
#unlock .msg { grid-column: 1 / -1; min-height: 1.5em; margin: 2px 0 0; text-align: center; font-size: 13px; opacity: .85; }
#unlock.off input, #unlock.off button { display: none; }
