/*
  ファイル: museum/css/museum3d.css
  役割: 3D ミュージアム（museum/3d.html）の画面の見た目（入館の画面・入館パス・扉・ミニマップ・操作ボタン）
  依存ファイル: なし（フォントは 3d.html が Google Fonts から読む）
  このファイルを呼び出すもの: museum/3d.html
  このファイルが呼び出すもの: なし
*/
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Lato", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
canvas { display: block; }
#overlay {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10;
  color: #d4af37;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-shadow: 0 0 5px #000;
  pointer-events: none;
}
#overlay small { color: #bbb; }
#back {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
  color: #d4af37;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  padding: 8px 14px;
  border: 1px solid rgba(212,175,55,0.5);
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
}
#back:hover { background: rgba(212,175,55,0.2); }
#info {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  color: #aaa;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 8px 16px;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  border: 1px solid #444;
  transition: background 0.4s, color 0.4s, border-color 0.4s;
}
#info:hover,
#info.near {
  background: rgba(212, 175, 55, 0.2);
  color: #f9f4ef;
  border-color: #d4af37;
}
#info b {
  display: block;
  color: #d4af37;
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

/* 入館の画面（クリック・タップで消える。Esc で視点の固定を外すと戻る） */
#start {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  color: #f9f4ef;
  transition: opacity 0.6s;
}
#start .content { position: relative; z-index: 1; transition: opacity 0.35s ease; }
/* 入口の扉（パスを確かめると左右に開く。背景もこの扉が受け持つ） */
#start .gate {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 0;
  pointer-events: none;
}
#start .gate i {
  position: relative;
  flex: 1;
  transition: transform 1.1s cubic-bezier(.6,0,.2,1);
}
#start .gate i:first-child {
  background: radial-gradient(circle at 100% 50%, #2a1e0e, #070503 62%);   /* 閉じている間は館内が透けないよう不透明 */
  box-shadow: inset -2px 0 0 #b8923e;
}
#start .gate i:last-child {
  background: radial-gradient(circle at 0% 50%, #2a1e0e, #070503 62%);   /* 閉じている間は館内が透けないよう不透明 */
  box-shadow: inset 2px 0 0 #b8923e;
}
/* 扉の飾りの枠と取っ手 */
#start .gate i::before {
  content: "";
  position: absolute;
  inset: 9% 12%;
  border: 1px solid rgba(201,162,74,0.22);
  box-shadow: inset 0 0 0 10px rgba(0,0,0,0.15), inset 0 0 0 11px rgba(201,162,74,0.12);
}
#start .gate i::after {
  content: "";
  position: absolute;
  top: 46%;
  width: 6px;
  height: 8%;
  border-radius: 3px;
  background: linear-gradient(180deg, #f3d58a, #8a6420);
  opacity: 0.7;
}
#start .gate i:first-child::after { right: 22px; }
#start .gate i:last-child::after  { left: 22px; }
#start.opening .content { opacity: 0; }
#start.opening .gate i:first-child { transform: translateX(-101%); }
#start.opening .gate i:last-child  { transform: translateX(101%); }
/* 一度入館したあと（Esc の一時停止）は、扉とパスを出さずに暗い幕だけ */
#start.checked { background: rgba(0,0,0,0.78); }
#start.checked .gate, #start.checked .pass-card { display: none; }

/* 入館パス */
#start .pass-card {
  position: relative;
  width: min(340px, 86vw);
  margin: 26px auto 0;
  padding: 16px 20px 14px;
  box-sizing: border-box;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(212,175,55,0.7);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 40%),
    linear-gradient(160deg, #2a1d0e, #0d0905 70%);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), inset 0 0 0 4px rgba(0,0,0,0.25), inset 0 0 0 5px rgba(212,175,55,0.2);
  overflow: hidden;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: #c9a25a;
}
#start .pass-card .pc-title { font-family: "Playfair Display", serif; font-size: 1.05rem; color: #f3d58a; letter-spacing: 0.12em; margin: 4px 0 10px; }
#start .pass-card .pc-row { display: flex; justify-content: space-between; color: #a8946a; margin-top: 2px; }
#start .pass-card .pc-row b { color: #e9dcc0; font-weight: normal; }
#start .pass-card .holo {
  position: absolute;
  right: 18px;
  top: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f3d58a, #9fd8ff, #e7b6ff, #f3d58a);
  opacity: 0.55;
}
#start .pass-card .barcode {
  height: 30px;
  margin-top: 12px;
  background: repeating-linear-gradient(90deg, #e9dcc0 0 2px, transparent 2px 4px, #e9dcc0 4px 5px, transparent 5px 9px, #e9dcc0 9px 12px, transparent 12px 14px);
  opacity: 0.75;
  transition: filter 0.3s, opacity 0.3s;
}
/* 読み取りの光 */
#start .pass-card::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  top: -10%;
  height: 4px;
  background: linear-gradient(90deg, transparent, #fff3c4, transparent);
  box-shadow: 0 0 18px 6px rgba(243,213,138,0.55);
  opacity: 0;
}
#start.checking .pass-card::after { animation: scan 1s ease-in-out forwards; }
@keyframes scan {
  0%   { top: -10%; opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { top: 108%; opacity: 0; }
}
/* 確認できた印 */
#start .pass-card .ok {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10,8,4,0.55);
  opacity: 0;
  transition: opacity 0.3s;
}
#start .pass-card .ok span {
  padding: 8px 18px;
  border: 2px solid #8fdc9a;
  border-radius: 6px;
  color: #c8f5cf;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  background: rgba(20,40,24,0.7);
  box-shadow: 0 0 22px rgba(143,220,154,0.45);
  transform: scale(1.6);
  transition: transform 0.35s cubic-bezier(.3,1.6,.5,1);
}
#start.verified .pass-card .ok { opacity: 1; }
#start.verified .pass-card .ok span { transform: scale(1); }
#start.verified .pass-card .barcode { filter: drop-shadow(0 0 6px rgba(143,220,154,0.9)); opacity: 1; }
#start.ready { cursor: pointer; }
#start.hide { opacity: 0; pointer-events: none; }
#start h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(1.8rem, 6vw, 3.4rem);
  letter-spacing: 0.12em;
  margin: 0;
  background: linear-gradient(90deg, #d4af37, #f9f4ef, #d4af37);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
#start p { color: #aaa; line-height: 1.9; margin: 18px 0 0; font-size: 0.95rem; }
#start .progress {
  width: min(360px, 80vw);
  height: 3px;
  margin: 28px auto 8px;
  background: rgba(212,175,55,0.18);
  border-radius: 2px;
  overflow: hidden;
}
#start .progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8a6420, #f3d58a);
  transition: width 0.5s ease;
}
#start .status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: #9c8a63;
}
#start .enter {
  margin-top: 22px;
  padding: 14px 40px;
  border: 1px solid #d4af37;
  background: transparent;
  color: #d4af37;
  font: inherit;
  letter-spacing: 0.25em;
  cursor: pointer;
  animation: pulse 2.4s ease-in-out infinite;
}
#start .enter:disabled {
  opacity: 0.3;
  cursor: default;
  animation: none;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(212,175,55,0); }
  50% { box-shadow: 0 0 28px rgba(212,175,55,0.45); }
}

/* ミニマップ（右上・TOP の下） */
#minimap {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 140px;
  height: 140px;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  border: 1px solid #444;
  border-radius: 4px;
  pointer-events: none;
}
@media (max-width: 480px) {
  #minimap { width: 100px; height: 100px; }
}

/* 画面中央の照準 */
#cross {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(212,175,55,0.7);
  z-index: 5;
  pointer-events: none;
}

/* スマートフォン用の移動ボタン（タッチの端末だけ出す） */
#pad {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 15;
  display: none;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(2, 52px);
  gap: 8px;
}
.touch #pad { display: grid; }
.touch #info { bottom: 150px; }
#pad div {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(212,175,55,0.6);
  background: rgba(0,0,0,0.55);
  color: #d4af37;
  border-radius: 8px;
  font-size: 20px;
}
#pad div.on { background: rgba(212,175,55,0.35); }
#pad .up { grid-column: 2; grid-row: 1; }
#pad .left { grid-column: 1; grid-row: 2; }
#pad .down { grid-column: 2; grid-row: 2; }
#pad .right { grid-column: 3; grid-row: 2; }

@media (prefers-reduced-motion: reduce) {
  #start h1, #start .enter { animation: none; }
  #start .progress i { transition: none; }
  #start .gate i, #start .content, #start .pass-card .ok, #start .pass-card .ok span { transition: none; }
  #start.checking .pass-card::after { animation: none; }
}
