/* 高齢者に合わせるのは操作の数・当たり判定・コントラスト。見た目は合わせない。
   写真そのものを主役に置き、UI は黙らせる。 */

:root {
  --bg: #111;
  --fg: #fff;
  --panel: rgba(0, 0, 0, 0.55);
  --accent: #fff;
  --tap: 56px;   /* Apple HIG 44pt / Material 48dp を上回る。屋外・手袋も想定 */
}

* { box-sizing: border-box; }

/* display を指定した要素では hidden 属性が効かなくなる（作者スタイルが UA に勝つ）。
   JS 側は hidden で出し入れするので、ここで一度だけ優先させる。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* --- 開始画面 --------------------------------------------------------- */

#start-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  text-align: center;
}

h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: 0.02em; margin: 0; max-width: 100%; overflow-wrap: anywhere; }

.note { font-size: 0.95rem; opacity: 0.7; margin: 0; line-height: 1.6; }

/* --- ボタン ----------------------------------------------------------- */

.big-button {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 1.25rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--fg);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.big-button.primary {
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.15rem;
  padding: 0 2rem;
}

.big-button[aria-pressed="true"] {
  background: var(--accent);
  color: #000;
  border-color: transparent;
}

/* 手順は屋外で初見の人が読む。番号を目立たせ、1 行 1 動作にする。 */

.howto {
  width: 100%;
  max-width: 30rem;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.howto h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  opacity: 0.85;
}

/* たたんである側。開閉できることが分かるよう印を出す */
.howto summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  opacity: 0.85;
}

.howto summary::-webkit-details-marker { display: none; }

.howto summary::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  rotate: -45deg;
  transition: rotate 150ms ease;
}

.howto[open] summary::before { rotate: 45deg; }

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* grid や flex にすると li の子要素が 1 つずつ列に入って崩れる。
   バッジだけを浮かせ、本文は普通の段落のまま流す。 */
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.7rem;
  margin-bottom: 0.9rem;
  font-size: 1rem;
  line-height: 1.7;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--fg);
  color: #000;
  font-size: 0.95rem;
  font-weight: 700;
}

.howto .note { margin-top: 0.75rem; }

.link {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--fg);
  opacity: 0.7;
}

/* 地点の切り替え。現地で URL を打たずに行き来できるようにする。 */
.spot-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }

.spot-nav a {
  display: grid;
  place-items: center;
  min-height: var(--tap);
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: var(--fg);
  text-decoration: none;
}

.spot-nav a[aria-current="page"] { background: var(--accent); color: #000; border-color: transparent; }

/* --- 体験画面 --------------------------------------------------------- */

#stage { position: fixed; inset: 0; overflow: hidden; }

#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 下 1/3 は HUD が占める。写真はその上の領域の中央に置き、ボタンと重ねない。 */
#layers { position: absolute; inset: 0 0 34% 0; pointer-events: none; }

/* 写真を画面いっぱいにせず中央に額縁状に置く。
   「ぴったり合わせること」をゴールから外すため。 */
.overlay-photo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(86vw, 56vh * 1.4);
  transform-origin: center;
  translate: -50% -50%;
  opacity: 0.5;
  transition: opacity 260ms ease;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

/* 「もどる」は操作ボタンと別の場所・別の形にして、体験の操作と混ざらないようにする。 */
.back-button {
  position: absolute;
  top: calc(0.75rem + env(safe-area-inset-top));
  left: 0.75rem;
  min-height: var(--tap);
  padding: 0 1rem 0 0.75rem;
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--panel);
  border: none;
  border-radius: 10px;
  backdrop-filter: blur(12px);
  cursor: pointer;
}

/* --- HUD -------------------------------------------------------------- */

#hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6) 40%);
}

#controls { display: flex; gap: 0.5rem; }

/* 明るさで見え方が変わるため、濃さは現地で変えられるようにする。
   屋外・手袋を想定してつまみを大きく取る。 */
#fade {
  flex-basis: 100%;
  max-width: 22rem;
  height: var(--tap);
  accent-color: var(--accent);
  background: transparent;
}

#hud .note { flex-basis: 100%; text-align: center; }

/* --- 警告 ------------------------------------------------------------- */

#stop-walking {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  font-size: 1.4rem;
  line-height: 1.8;
  text-align: center;
}

/* --- カメラなしの表示 ------------------------------------------------- */

#fallback-root:empty { display: none; }

.fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1.5rem;
}

.fallback-photo { max-width: 100%; max-height: 70vh; }
