/* =========================================================
   夜空ミク 2026 — 疑似着信 → ビデオメッセージ（体）
   本番デザイン: Figma 01〜04 / Frame29
   ========================================================= */
:root {
  --mint:   #56ffe6;
  --white:  #ffffff;
  --ring:   #a01a6b;   /* avatar magenta ring accent */
  --grad:      linear-gradient(90deg, #3affde 0%, #610082 50%, #ff0040 100%);
  --grad-soft: linear-gradient(90deg,
      rgba(58,255,222,.20) 0%, rgba(217,104,255,.20) 50%, rgba(255,57,93,.20) 100%);
  --app-max: 440px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* ensure the hidden attribute always wins over display rules */
html, body { height: 100%; }
body {
  background: #05060f;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  color: var(--white);
  overflow: hidden;
  overscroll-behavior: none;
}

/* full-viewport stage: background fills the whole screen (tablets included);
   each screen centers its own phone-width content */
#app {
  position: relative;
  width: 100%;
  height: 100vh;        /* fallback */
  height: 100dvh;       /* visible area (excludes browser URL/menu bars) */
  margin: 0;
  overflow: hidden;
  background: #07091c;
}

/* ---------- screens ---------- */
.screen {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; align-items: center;
  animation: fade-in .35s ease both;
}
.screen[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   Background scene — purple diamond argyle + corner glow
   (colors sampled from Figma 02/03/04)
   ========================================================= */
.bg-scene {
  background-color: #07091c;
  /* diamond tile (top layer) + corner glow + vertical purple edges — all behind content */
  background-image:
    url("assets/tile-soft.png"),
    radial-gradient(75% 48% at 0% 0%,   rgba(120,48,116,.85), transparent 72%),
    radial-gradient(75% 48% at 100% 0%, rgba(120,48,116,.85), transparent 72%),
    radial-gradient(75% 48% at 0% 100%, rgba(120,48,116,.85), transparent 72%),
    radial-gradient(75% 48% at 100% 100%, rgba(120,48,116,.85), transparent 72%),
    linear-gradient(180deg, #2a1330 0%, #07091c 15%, #07091c 85%, #2a1330 100%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 168px 168px, cover, cover, cover, cover, cover;
}
.popup, .connect-ring, .call-inner, .slide-wrap, .credits, .dialog { position: relative; z-index: 1; }

/* splash (01): extra pink inner vignette */
.splash-glow::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  box-shadow: inset 0 0 160px 5px rgba(255, 89, 194, .35);
  pointer-events: none;
}

/* =========================================================
   Pills (gradient buttons)
   ========================================================= */
.pill {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  color: var(--white); font-family: inherit; font-size: 16px; font-weight: 500;
  letter-spacing: 1px; border-radius: 64px;
  display: inline-flex; align-items: center; justify-content: center; gap: 20px;
  transition: transform .12s ease, filter .2s ease;
}
.pill:active { transform: scale(.97); }
.pill-solid {
  width: 268px; height: 64px; background: var(--grad);
  box-shadow: 0 8px 30px rgba(255,0,64,.25), 0 0 24px rgba(58,255,222,.25);
}
.pill-wide { width: min(300px, calc(100% - 48px)); height: 64px; }
.pill-icon { width: 42px; height: auto; }

/* =========================================================
   Screen 01 — はじめる
   ========================================================= */
#screen-splash { justify-content: center; padding: 0 24px; }
.popup {
  width: 100%; max-width: 316px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 12px 24px; position: relative; z-index: 1;
}
.popup-title {
  color: var(--mint); font-size: 24px; line-height: 1.35; letter-spacing: 2px; font-weight: 500;
  text-shadow: 0 0 18px rgba(86,255,230,.45);
}
.popup-sub { color: var(--white); font-size: 15px; line-height: 1.7; letter-spacing: 1.2px; }

/* TOP page schedule */
.schedule { position: relative; z-index: 1; width: 100%; max-width: 340px; margin-top: 20px; }
.schedule-head { color: var(--mint); font-size: 13px; letter-spacing: 1px; text-align: center; margin-bottom: 10px; }
.schedule-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.schedule-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(16,18,40,.78);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 13px;
}
.st-time { color: #b9bbe0; min-width: 98px; font-variant-numeric: tabular-nums; }
.st-label { color: #fff; font-weight: 500; }
.st-note { color: var(--mint); font-size: 10.5px; margin-left: auto; text-align: right; }
.schedule-list li.current {
  background: linear-gradient(90deg, rgba(58,255,222,.18), rgba(255,57,93,.12));
  border-color: rgba(86,255,230,.6);
  box-shadow: 0 0 16px rgba(86,255,230,.2);
}
.schedule-list li.current .st-label { color: var(--mint); }
/* 雨天順延の注記 */
.schedule-postpone {
  list-style: none; text-align: center;
  color: #ffd76a; font-size: 12px; letter-spacing: .5px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(255,180,0,.12); border: 1px solid rgba(255,180,0,.4);
}

/* =========================================================
   Screen 02 — 接続中 (connecting)
   ========================================================= */
#screen-connect { justify-content: center; gap: 40px; }
.connect-ring {
  position: relative; width: 160px; height: 160px;
  display: grid; place-items: center;
}
.connect-ring .ring {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; border-radius: 50%;
  border: 1.5px solid var(--mint); opacity: 0;
  animation: ring-pulse 2s ease-out infinite;
}
.connect-ring .ring:nth-child(2) { animation-delay: 1s; }
@keyframes ring-pulse {
  0%   { transform: scale(1);   opacity: .7; }
  100% { transform: scale(1.7); opacity: 0; }
}
.connect-ring .phone {
  width: 160px; height: 160px; filter: drop-shadow(0 0 20px rgba(86,255,230,.5));
  transform-origin: center; animation: phone-shake 2s linear infinite;
}
.connect-ring .phone img { width: 100%; height: 100%; }
/* Figma Frame30: rise up then vibrate ±10° */
@keyframes phone-shake {
  0%   { opacity: 0; transform: translateY(50px) rotate(0); }
  25%  { opacity: 1; transform: translateY(0) rotate(0); }
  30%  { transform: rotate(10deg); }
  35%  { transform: rotate(-10deg); }
  40%  { transform: rotate(10deg); }
  45%  { transform: rotate(-10deg); }
  50%  { transform: rotate(10deg); }
  55%  { transform: rotate(-10deg); }
  60%  { transform: rotate(10deg); }
  65%  { transform: rotate(-10deg); }
  70%  { transform: rotate(10deg); }
  75%  { transform: rotate(-10deg); }
  100% { transform: rotate(-10deg); }
}
.connect-label {
  position: relative; z-index: 1;
  color: var(--white); font-size: 15px; letter-spacing: 2px; opacity: .9;
}

/* =========================================================
   Screens 03 / replay — call frame layout
   ========================================================= */
.call-frame {
  justify-content: flex-start;
  padding: clamp(20px, 8vh, 120px) 24px max(18px, env(safe-area-inset-bottom));
}
.call-inner {
  flex: 1; width: 100%; z-index: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(16px, 3.5vh, 36px);
}
.call-names { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.name-jp {
  color: var(--mint); font-size: 24px; letter-spacing: 2px; font-weight: 500;
  text-shadow: 0 0 18px rgba(86,255,230,.5);
}
.name-en { color: var(--white); font-size: 15px; letter-spacing: 1.5px; opacity: .95; }

/* avatar (high-res source framed exactly per Figma) + expanding magenta circle */
.avatar-wrap { position: relative; width: 176px; height: 176px; }
.avatar {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 2;
  width: 176px; height: 176px;
}
.avatar img {
  width: 176px; height: 176px; display: block;
  border-radius: 50%; object-fit: cover;
}
/* Rectangle 4 — #ff2793 @50%, expands & fades, centered exactly on the avatar */
.pulse-circle {
  position: absolute; top: 50%; left: 50%; z-index: 1;
  width: 214px; height: 214px; margin: -107px 0 0 -107px;  /* center on avatar */
  border-radius: 50%;
  background: rgba(255, 39, 147, .5);
  animation: pulse4 2s linear infinite;
}
.pulse-circle:nth-child(2) { animation-delay: 1s; }
@keyframes pulse4 {
  0%   { transform: scale(.8); opacity: 1; }
  30%  { opacity: 1; }
  75%  { transform: scale(1.2); opacity: 0; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* video-call tag + 3 blinking dots */
.videotag {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--white); font-size: 15px; letter-spacing: 1.5px;
}
.videotag .row { display: flex; align-items: center; gap: 8px; }
.videotag-icon { width: 24px; height: auto; }
.dots { display: inline-flex; gap: 8px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); }
.dots i:nth-child(1) { animation: dot1 2s linear infinite; }
.dots i:nth-child(2) { animation: dot2 2s linear infinite; }
.dots i:nth-child(3) { animation: dot3 2s linear infinite; }
@keyframes dot1 { 0%{opacity:1} 30%{opacity:0} 60%{opacity:1} 100%{opacity:1} }
@keyframes dot2 { 0%{opacity:1} 20%{opacity:1} 50%{opacity:0} 80%{opacity:1} 100%{opacity:1} }
@keyframes dot3 { 0%{opacity:1} 40%{opacity:1} 70%{opacity:0} 100%{opacity:1} }

/* ---------- slide to answer ---------- */
.slide-wrap { width: 100%; display: flex; justify-content: center; z-index: 1; }
.slide-track {
  position: relative;
  width: min(354px, calc(100% - 24px)); height: 106px;
  border-radius: 64px;
  background: var(--grad-soft);
  border: 1px solid rgba(255,255,255,.85);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; overflow: hidden;
  touch-action: none; user-select: none;
}
.slide-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: linear-gradient(90deg, rgba(58,255,222,.35), rgba(97,0,130,.2));
  pointer-events: none;
}
.slide-knob {
  position: absolute; left: 8px; top: 50%;
  width: 90px; height: 90px; margin-top: -45px;
  display: grid; place-items: center; will-change: transform;
  animation: nudge 1.7s ease-in-out infinite;
}
/* svg has ~22.7% shadow padding; overscale so the teal disc ≈ knob box (tighter gap) */
.slide-knob img { width: 131px; height: 131px; margin: -20px; pointer-events: none; }
.slide-knob.dragging { animation: none; }
@keyframes nudge { 0%,55%,100% { transform: translateX(0);} 28% { transform: translateX(20px);} }
.slide-label {
  position: absolute; left: 0; right: 0; text-align: center; padding-left: 90px;
  color: var(--white); font-size: 16px; letter-spacing: 1px; pointer-events: none;
  animation: label-breathe 2s ease-in-out infinite;
}
@keyframes label-breathe { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ---------- credits (piapro / Crypton license) ---------- */
.credits {
  z-index: 1; text-align: center; padding-top: clamp(12px, 2.5vh, 22px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.credits p {
  color: #a8a9d0; font-size: 12px; line-height: 1.55; letter-spacing: .3px;
}
.credit-logos { display: flex; align-items: center; gap: 8px; }
.logo-miku   { height: 14px; width: auto; }
.logo-piapro { height: 10px; width: auto; }
.credit-oto  { color: #a8a9d0; font-size: 11px; letter-spacing: .3px; margin-left: 2px; }

/* =========================================================
   Screen — 動画 (vertical YouTube, interaction blocked)
   ========================================================= */
.screen-video { background: #000; justify-content: center; }
/* fill the whole stage; the video letterboxes (contain, centered) — 黒帯OK */
.video-stage {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: #000;
}
#yt-video {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;           /* どんな画角でも全部表示・中央・黒帯 */
  background: #000;
  border: 0; display: block;
}
.video-block { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 5; background: transparent; }
/* themed "connecting" cover shown over the player until YouTube's initial UI clears */
.video-cover {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 6;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
}
.video-cover.hidden { opacity: 0; pointer-events: none; }
.cover-inner {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.cover-logo { height: 42px; width: auto; }
.cover-text { color: var(--white); font-size: 15px; letter-spacing: 2px; opacity: .9; }
.cover-countdown { color: var(--mint); font-size: 15px; letter-spacing: 1px; font-variant-numeric: tabular-nums; min-height: 20px; }
/* 音声解錠フォールバック（自動再生で音が出せなかった端末向け・通常は非表示） */
.audio-unlock {
  position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 8; border: 0; cursor: pointer;
  padding: 14px 24px; border-radius: 999px;
  background: linear-gradient(90deg, var(--mint, #39c5bb), var(--magenta, #e12885));
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  animation: audioUnlockPulse 1.4s ease-in-out infinite;
}
@keyframes audioUnlockPulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }
.spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(86, 255, 230, .22);
  border-top-color: var(--mint);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* finale sync wait screen */
#screen-wait { justify-content: center; }
.wait-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.wait-logo { height: 46px; width: auto; }
.wait-text { color: var(--white); font-size: 17px; line-height: 1.6; letter-spacing: 1px; }
.wait-countdown { color: var(--mint); font-size: 15px; letter-spacing: 1px; font-variant-numeric: tabular-nums; min-height: 20px; }

/* disabled start button (prep window) */
.pill:disabled { cursor: default; filter: grayscale(.5) brightness(.7); opacity: .85; }
.pill:disabled:active { transform: none; }
#dev-end {
  position: absolute; right: 10px; bottom: 10px; z-index: 9;
  font: 12px/1 monospace; padding: 8px 10px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,.85); color: #000; cursor: pointer;
}

/* =========================================================
   Screen — もう一度見る (Frame29 dialog style)
   ========================================================= */
#screen-venue, #screen-menu { justify-content: center; background: rgba(6,6,14,.92); }
.dialog {
  position: relative; z-index: 1;
  width: min(340px, calc(100% - 48px));
  background: #0a0b18;
  border: 1px solid rgba(86,255,230,.55);
  border-radius: 20px;
  padding: 36px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dialog-title { color: var(--mint); font-size: 19px; line-height: 1.4; letter-spacing: 1.5px; text-align: center; margin-bottom: 4px; }
.dialog .pill { width: 100%; }
.dialog-note { color: #8f90b8; font-size: 11px; line-height: 1.6; text-align: center; margin-top: 4px; }

/* secondary (outlined) pill */
.pill-outline {
  width: 268px; height: 60px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(86,255,230,.5);
  color: var(--white);
}
.pill-outline:active { transform: scale(.97); }

/* missed-videos list */
.missed-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.missed-item { height: 52px; font-size: 15px; }

/* 見逃し一覧ポップアップ（モーダル） */
.modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(4,5,12,.78);
  animation: fade-in .25s ease both;
}
.modal-card {
  width: min(360px, calc(100% - 32px)); max-height: 82vh; overflow-y: auto;
  background: #0a0b18; border: 1px solid rgba(86,255,230,.55); border-radius: 20px;
  padding: 28px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.modal-title { color: var(--mint); font-size: 18px; letter-spacing: 1.5px; text-align: center; margin-bottom: 2px; }
.modal-card .missed-item { width: 100%; }

/* 終了メッセージ（当日22:00以降・文字のみ） */
#screen-closing { justify-content: center; }
.closing-msg {
  margin: 0 28px; text-align: center;
  color: var(--mint); font-size: 22px; font-weight: 700;
  line-height: 1.7; letter-spacing: 1px;
  text-shadow: 0 0 18px rgba(58,255,222,.35);
}

/* TOPへ戻る（他ボタンと同体裁・水色の透過） */
.pill-mint {
  width: 268px; height: 60px;
  background: rgba(86,255,230,.14);
  border: 1px solid rgba(86,255,230,.55);
  color: var(--mint);
}
.pill-mint:active { transform: scale(.97); }

/* pre-event message */
.pre-msg { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.pre-heading { color: var(--mint); font-size: 22px; letter-spacing: 1.5px; text-shadow: 0 0 18px rgba(86,255,230,.5); }
.pre-sub { color: var(--white); font-size: 15px; letter-spacing: 1px; opacity: .95; }

/* =========================================================
   reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .pulse-circle, .dots i, .slide-knob, .slide-label,
  .connect-ring .ring, .connect-ring .phone { animation: none; }
  .pulse-circle { opacity: .3; }
  .connect-ring .phone { opacity: 1; transform: none; }
}

/* =========================================================
   フレックス gap 非対応環境（iOS 14.4以前 Safari等）向けフォールバック
   flexの gap と inset ショートハンドは同世代(Safari14.1/iOS14.5)で対応したため、
   inset未対応＝flex gap未対応 とみなし、gap をマージンで代替する。
   ========================================================= */
@supports not (inset: 0) {
  #screen-connect > * + * { margin-top: 40px; }
  .popup > * + *       { margin-top: 18px; }
  .schedule-list > li + li { margin-top: 6px; }
  .schedule-list li .st-label { margin-left: 10px; }
  .call-inner > * + *  { margin-top: clamp(16px, 3.5vh, 36px); }
  .call-names > * + *  { margin-top: 6px; }
  .videotag > * + *    { margin-top: 14px; }
  .videotag .row > * + * { margin-left: 8px; }
  .dots > * + *        { margin-left: 8px; }
  .credits > * + *     { margin-top: 6px; }
  .credit-logos > * + * { margin-left: 8px; }
  .cover-inner > * + * { margin-top: 22px; }
  .wait-inner > * + *  { margin-top: 24px; }
  .dialog > * + *      { margin-top: 16px; }
  .missed-list > * + * { margin-top: 10px; }
  .modal-card > * + *  { margin-top: 14px; }
  .pre-msg > * + *     { margin-top: 10px; }
  .pill > * + *        { margin-left: 20px; }
}

/* =========================================================
   PC閲覧時のスマホ誘導オーバーレイ（パッド/スマホでは非表示）
   ========================================================= */
.pc-gate {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  background: #07091c;
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(97,0,130,.55), transparent 60%),
    radial-gradient(90% 60% at 50% 110%, rgba(255,0,64,.28), transparent 60%);
}
.pc-gate-card {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 40px 32px;
  background: rgba(10,11,24,.72);
  border: 1px solid rgba(86,255,230,.35);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.pc-gate-title {
  font-size: 26px; font-weight: 700; line-height: 1.5;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--mint);
}
.pc-gate-qr {
  margin: 26px 0 20px;
  padding: 14px; background: #fff; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.pc-gate-qr img { display: block; width: 240px; height: 240px; }
.pc-gate-sub { font-size: 15px; line-height: 1.7; color: rgba(255,255,255,.82); }
