:root {
  --teal: #0f9b8e;
  --teal-dark: #0b6f66;
  --ink: #12302d;
  --white: #ffffff;
  --glass: rgba(10, 30, 28, 0.55);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--white);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
button { font: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }

#video, #gl { position: fixed; inset: 0; width: 100%; height: 100%; }
#video { object-fit: cover; }
#gl { display: block; }
body.front #gl { transform: scaleX(-1); }
#video { visibility: hidden; }

#fade { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#fade.on { opacity: 1; }

/* スタート */
#start {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, #1b5e57 0%, #0b2624 60%, #071716 100%);
}
.start-inner { max-width: 360px; text-align: center; }
.eyebrow { letter-spacing: .2em; font-size: 12px; color: #8fe0d6; margin: 0 0 12px; }
h1 { font-size: 28px; line-height: 1.45; margin: 0 0 16px; }
.lead { font-size: 14px; line-height: 1.9; color: #d7ecea; margin: 0 0 28px; }
.note { font-size: 11px; color: #a9c9c5; margin: 12px 0 0; }
.primary {
  background: var(--teal); color: var(--white); padding: 14px 40px; border-radius: 999px;
  font-size: 16px; font-weight: 700; box-shadow: 0 6px 20px rgba(15, 155, 142, .45);
}
.primary:active { background: var(--teal-dark); }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: center; align-items: center;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 0; pointer-events: none;
}
#hint {
  background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: 8px 16px; border-radius: 999px; font-size: 13px;
}
.icon {
  position: absolute; right: 16px; top: calc(env(safe-area-inset-top) + 8px);
  width: 44px; height: 44px; border-radius: 50%; background: var(--glass); color: var(--white);
  display: grid; place-items: center; pointer-events: auto;
}
.icon svg { width: 24px; height: 24px; }

#controls {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 0 16px calc(env(safe-area-inset-bottom) + 18px);
}
#rooms { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.room {
  background: var(--glass); color: var(--white); padding: 7px 14px; border-radius: 999px; font-size: 12px;
  border: 1px solid rgba(255,255,255,.25);
}
.room.active { background: var(--teal); border-color: var(--teal); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill {
  background: var(--glass); color: var(--white); padding: 9px 14px; border-radius: 999px; font-size: 12px;
  min-width: 92px;
}
.pill.dark { background: rgba(255,255,255,.15); }
.pill[disabled] { visibility: hidden; }
.shutter {
  width: 72px; height: 72px; border-radius: 50%; background: var(--white);
  box-shadow: 0 0 0 4px rgba(255,255,255,.35), 0 0 0 8px rgba(15,155,142,.6);
}
.shutter:active { transform: scale(.94); }

#loading {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  background: rgba(0,0,0,.35); font-size: 13px;
}
#loading span {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); border-top-color: var(--teal);
  animation: spin 1s linear infinite;
}
#loading p { margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

#preview {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px 16px; gap: 8px;
}
#preview img { max-width: 100%; max-height: 70vh; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#preview .row { margin-top: 12px; justify-content: center; }
.pill.spacer { visibility: hidden; }
