/* ═══════════════════════════════════════════
   Installation Mode — Styles
   ═══════════════════════════════════════════ */

/* ── Launch Button Wrapper — contains button + mode menu ── */
#installation-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
}

#installation-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, border-color 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
  /* Hidden by default — shown when audio plays */
  opacity: 0;
  pointer-events: none;
}

#installation-btn.visible {
  opacity: 1;
  pointer-events: auto;
  animation: instBtnNoticeGlow 2.5s ease 1s 1 normal;
}

@keyframes instBtnNoticeGlow {
  0%   { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border-color: var(--panel-border); box-shadow: none; transform: scale(1); }
  15%  { background: rgba(108, 180, 238, 0.4); color: #fff; border-color: var(--accent); box-shadow: 0 0 25px rgba(108, 180, 238, 0.7); transform: scale(1.15); }
  60%  { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border-color: var(--panel-border); box-shadow: none; transform: scale(1); }
  100% { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border-color: var(--panel-border); box-shadow: none; transform: scale(1); }
}

#installation-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  #installation-btn:hover {
    background: rgba(108, 180, 238, 0.15);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(108, 180, 238, 0.12);
  }
}

#installation-btn:active {
  transform: scale(0.92);
}

/* ── Hover Label ── */
#inst-hover-label {
  position: absolute;
  right: 55px; /* Offset to the left of the button */
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  background: rgba(15, 20, 35, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: 'Hiragino Kaku Gothic ProN', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

@media (hover: hover) {
  #installation-btn.visible:hover ~ #inst-hover-label {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
  }
}

/* ── Fullscreen Overlay ── */
#installation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#installation-overlay canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
}

#installation-overlay .inst-trail-canvas {
  z-index: 1;
}

#installation-overlay .inst-main-canvas {
  z-index: 2;
}

/* ── Close Button ── */
#installation-close-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.4s ease;
}

#installation-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ── Fullscreen Toggle Button ── */
#installation-fs-btn {
  position: fixed;
  top: 20px;
  right: 68px;
  z-index: 10000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.4s ease;
}

#installation-fs-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.25);
}

#installation-fs-btn.is-fullscreen {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.2);
}

#installation-fs-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sonivore Title & Caption ── */
#inst-title-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 10000;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Hiragino Kaku Gothic ProN', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  padding: 8px 12px;
  transition: all 0.4s ease;
}

#inst-title-btn:hover {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

#inst-caption-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#inst-caption-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.inst-caption-content {
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.inst-caption-content::-webkit-scrollbar {
  width: 4px;
}
.inst-caption-content::-webkit-scrollbar-track {
  background: transparent;
}
.inst-caption-content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

#inst-caption-overlay.show .inst-caption-content {
  transform: translateY(0);
}

.inst-caption-header {
  margin-bottom: 24px;
  font-family: 'Hiragino Kaku Gothic ProN', -apple-system, sans-serif;
}

.inst-caption-title {
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  font-weight: 400;
  margin-bottom: 8px;
  color: #fff;
}

.inst-caption-meta {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.6;
}

.inst-caption-body {
  font-size: 0.85rem;
  line-height: 2.2;
  letter-spacing: 0.08em;
  font-weight: 300;
}

.inst-caption-body p {
  margin-bottom: 1.2em;
}

/* ── UI Idle Fade Out ── */
#installation-close-btn, 
#installation-fs-btn, 
#inst-title-btn {
  /* When returning from idle, fade in smoothly over 1s */
  transition: opacity 1.0s ease-in, color 0.4s ease, text-shadow 0.4s ease, border-color 0.4s ease !important;
  opacity: 1;
}

#installation-overlay.is-idle #installation-close-btn,
#installation-overlay.is-idle #installation-fs-btn,
#installation-overlay.is-idle #inst-title-btn {
  /* When going idle, fade out slowly over 2.5s */
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 2.5s ease-out !important;
}

/* ── Start Intro Text ── */
#inst-intro-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Hiragino Kaku Gothic ProN', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.25em;
  pointer-events: none;
  opacity: 0;
  animation: instIntroFade 5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  z-index: 10000;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

@keyframes instIntroFade {
  0%   { opacity: 0; margin-top: 10px; }
  25%  { opacity: 1; margin-top: 0; }
  75%  { opacity: 1; margin-top: 0; }
  100% { opacity: 0; margin-top: -10px; }
}

@keyframes instFadeIn {
  to { opacity: 1; }
}

/* ── Audio Analysis Overlay ── */
#inst-analysis-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#inst-analysis-overlay.show {
  opacity: 1;
}

.inst-analysis-content {
  text-align: center;
  width: 240px;
}

.inst-analysis-text {
  font-family: 'Hiragino Kaku Gothic ProN', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 16px;
}

.inst-analysis-bar-wrap {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  overflow: hidden;
}

.inst-analysis-bar {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.35);
  transition: width 0.05s linear;
  position: relative;
}

/* ── Three.js Modes Shared UI ── */
.tjs-ui {
    position: absolute; inset: 0; pointer-events: auto;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 40px; z-index: 100; transition: opacity 1.5s cubic-bezier(0.19, 1, 0.22, 1);
    color: white; font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.tjs-ui.hidden-ui .tjs-header, .tjs-ui.hidden-ui .tjs-center, .tjs-ui.hidden-ui .tjs-nav {
    opacity: 0; pointer-events: none;
}
.tjs-header { display: flex; justify-content: space-between; align-items: flex-start; pointer-events: auto; transition: opacity 0.5s; }
.tjs-brand { display: flex; align-items: center; gap: 20px; }
.tjs-line { width: 1.5px; height: 60px; background: linear-gradient(to bottom, #fff, transparent); }
.tjs-title h1 { margin: 0; font-size: clamp(20px, 3vw, 28px); font-weight: 200; letter-spacing: 0.8em; text-transform: uppercase; color: #fff;}
.tjs-title p { margin: 5px 0 0; font-size: 8px; letter-spacing: 0.6em; opacity: 0.5; text-transform: uppercase; font-weight: 800; color: #fff;}
.tjs-controls { display: flex; gap: 15px; }
.tjs-close-btn, .tjs-fs-btn {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.3); font-size: 18px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: all 0.4s ease;
}
.tjs-fs-btn.is-fullscreen { color: rgba(255, 255, 255, 0.6); border-color: rgba(255, 255, 255, 0.2); }
.tjs-fs-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.tjs-close-btn:hover, .tjs-fs-btn:hover { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.7); }

.tjs-center { text-align: center; transition: opacity 0.5s; pointer-events: none; }
.tjs-m-title { font-size: clamp(28px, 6vw, 52px); font-weight: 100; letter-spacing: 1.8em; text-transform: uppercase; margin-bottom: 25px; margin-left: 1.8em; text-shadow: 0 0 30px rgba(255, 255, 255, 0.2); color: #fff; }
.tjs-m-desc { font-size: 10px; letter-spacing: 0.4em; opacity: 0.4; max-width: 750px; margin: 0 auto; line-height: 2.2; text-transform: uppercase; font-style: italic; color: #fff; }

.tjs-nav { display: flex; justify-content: center; gap: clamp(15px, 3vw, 35px); pointer-events: auto; margin-bottom: 20px; transition: opacity 0.5s; }
.tjs-btn {
    width: 55px; height: 55px; border-radius: 50%; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    color: rgba(255, 255, 255, 0.3);
}
.tjs-btn:hover, .tjs-btn.active {
    background: rgba(255, 255, 255, 0.15); border-color: white; color: white;
    transform: scale(1.15); box-shadow: 0 0 50px rgba(255, 255, 255, 0.2);
}

/* ── PC Only Restriction ── */
@media (max-width: 1023px), (hover: none) {
  #installation-wrap {
    display: none !important;
  }
}

