/* ============================================================
   透明の器 — Music Interactive Web
   ガラスの内側。朝もや。誰もいない街。
   ============================================================ */

:root {
  --ink: #2c343a;
  --mist: #c9d2d8;
  --paper: rgba(238, 243, 246, 0.92);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #9aa6ad;
  font-family: var(--serif);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* ---------- 歌詞（縦書き・結露ににじむ） ---------- */

#lyrics {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.lyric {
  position: absolute;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: clamp(17px, 2.6vmin, 26px);
  letter-spacing: 0.34em;
  line-height: 2.1;
  color: rgba(40, 50, 58, 0.0);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0);
  filter: blur(10px);
  opacity: 0;
  transition:
    opacity 1.3s ease,
    filter 1.6s ease,
    transform 9s linear,
    color 1.3s ease;
  transform: translateY(0);
  white-space: nowrap;
}

.lyric.on {
  opacity: 1;
  color: rgba(40, 50, 58, 0.82);
  filter: blur(0.4px);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.55);
  transform: translateY(14px);
}

.lyric.off {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(34px);
}

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

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

#title {
  position: absolute;
  top: 26px;
  left: 30px;
  font-size: 15px;
  letter-spacing: 0.55em;
  color: rgba(44, 52, 58, 0.55);
  opacity: 0;
  transition: opacity 3s ease;
}

#title.on { opacity: 1; }

#counter {
  position: absolute;
  bottom: 24px;
  left: 30px;
  font-size: 13px;
  letter-spacing: 0.28em;
  color: rgba(44, 52, 58, 0.6);
  transition: opacity 1.6s ease;
}

#counter #count {
  font-size: 19px;
  margin: 0 0.15em;
}

#hint {
  position: absolute;
  bottom: 24px;
  right: 30px;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(44, 52, 58, 0.42);
  transition: opacity 2s ease;
}

.hidden { opacity: 0 !important; }

/* ---------- トランスポート（再生・シーク・音量） ---------- */

#transport {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(238, 243, 246, 0.16);
  border: 1px solid rgba(70, 85, 95, 0.16);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  color: rgba(40, 50, 58, 0.7);
  touch-action: none;
  /* 触れていないときは静かに沈む */
  opacity: 0.12;
  transition: opacity 1.2s ease;
}

#transport:hover,
#transport.awake { opacity: 0.92; }

/* 開始前は見えないだけでなく、タッチも素通りさせない */
#transport.hidden {
  visibility: hidden;
  pointer-events: none;
}

#transport button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.4s ease;
}

#transport button:hover { background: rgba(255, 255, 255, 0.28); }

#transport svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

#icon-pause { fill: currentColor; stroke: none; }
#icon-play  { fill: currentColor; stroke: none; }

#seek {
  display: flex;
  align-items: center;
  gap: 11px;
}

#seek-track {
  position: relative;
  width: clamp(120px, 26vw, 280px);
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#seek-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: rgba(60, 75, 85, 0.22);
  border-radius: 2px;
}

#seek-fill {
  position: absolute;
  left: 0;
  height: 2px;
  width: 0%;
  background: rgba(48, 60, 70, 0.65);
  border-radius: 2px;
}

#seek-fill::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 249, 251, 0.95);
  box-shadow: 0 1px 4px rgba(40, 55, 65, 0.4);
  transform: translateY(-50%);
}

#time {
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(40, 50, 58, 0.55);
  min-width: 34px;
  font-variant-numeric: tabular-nums;
}

#vol {
  display: flex;
  align-items: center;
  gap: 8px;
}

#vol-track {
  position: relative;
  width: 62px;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#vol-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: rgba(60, 75, 85, 0.22);
  border-radius: 2px;
}

#vol-fill {
  position: absolute;
  left: 0;
  height: 2px;
  width: 80%;
  background: rgba(48, 60, 70, 0.6);
  border-radius: 2px;
}

#vol-fill::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(245, 249, 251, 0.95);
  box-shadow: 0 1px 3px rgba(40, 55, 65, 0.4);
  transform: translateY(-50%);
}

@media (max-width: 560px) {
  #transport { gap: 10px; padding: 9px 14px; bottom: 16px; }
  #vol { display: none; }
  #time { display: none; }
}

/* ---------- オーバーレイ共通 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(220, 229, 234, 0.96), rgba(167, 178, 185, 0.97));
  transition: opacity 2.4s ease, visibility 2.4s;
  cursor: pointer;
}

.overlay.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- スタート画面 ---------- */

.start-inner h1 {
  font-size: clamp(30px, 6vmin, 46px);
  font-weight: 500;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: rgba(42, 52, 60, 0.88);
}

.start-inner .sub {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.42em;
  color: rgba(42, 52, 60, 0.45);
}

.start-inner .invite {
  margin-top: 56px;
  font-size: 13px;
  letter-spacing: 0.4em;
  color: rgba(42, 52, 60, 0.6);
  animation: breathe 4.2s ease-in-out infinite;
}

.drop-wrap {
  height: 110px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin-bottom: 30px;
}

.drop {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 58% 58%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.95) 0 18%, rgba(190,205,214,0.55) 45%, rgba(120,138,148,0.5) 100%);
  box-shadow:
    0 2px 10px rgba(60, 75, 85, 0.35),
    inset 0 -3px 6px rgba(255,255,255,0.5);
  animation: hangfall 5.6s cubic-bezier(.55,.02,.7,.4) infinite;
}

@keyframes hangfall {
  0%   { transform: translateY(0) scale(1, 1); opacity: 0; }
  12%  { opacity: 1; }
  55%  { transform: translateY(4px) scale(0.96, 1.1); }
  72%  { transform: translateY(8px) scale(0.92, 1.18); }
  88%  { transform: translateY(86px) scale(0.85, 1.25); opacity: 1; }
  96%  { transform: translateY(96px) scale(1.3, 0.6); opacity: 0; }
  100% { transform: translateY(96px); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.85; }
}

/* ---------- 終景 ---------- */

#fin {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(231, 238, 242, 0.88), rgba(178, 189, 196, 0.92));
  cursor: default;
}

#fin.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

#fin-count {
  font-size: clamp(22px, 4.4vmin, 34px);
  letter-spacing: 0.32em;
  color: rgba(42, 52, 60, 0.85);
}

.fin-line {
  margin-top: 26px;
  font-size: 13px;
  letter-spacing: 0.38em;
  color: rgba(42, 52, 60, 0.5);
}

#replay {
  margin-top: 64px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  padding: 13px 34px;
  color: rgba(42, 52, 60, 0.75);
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(70, 85, 95, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.6s ease, color 0.6s ease;
}

#replay:hover {
  background: rgba(255, 255, 255, 0.7);
  color: rgba(42, 52, 60, 1);
}
