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

html, body {
  height: 100%;
  overflow: hidden;
  background: #04060b;
  color: rgba(205, 215, 235, 0.85);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", -apple-system, sans-serif;
  font-weight: 300;
  cursor: default;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- 開始オーバーレイ ---- */
#intro {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, #070b14 0%, #04060b 70%);
  transition: opacity 2.5s ease;
  z-index: 10;
}
#intro.fading { opacity: 0; pointer-events: none; }

.intro-inner { text-align: center; max-width: 30em; padding: 2em; }

h1 {
  font-size: 2.2rem;
  font-weight: 200;
  letter-spacing: 0.45em;
  margin-bottom: 0.6em;
  color: rgba(190, 205, 235, 0.9);
  text-indent: 0.45em; /* letter-spacingの右余白ぶん補正 */
}

.tagline {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  margin-bottom: 1.8em;
  color: rgba(170, 185, 215, 0.7);
}

.desc {
  font-size: 0.8rem;
  line-height: 2;
  color: rgba(150, 165, 195, 0.55);
  margin-bottom: 2.5em;
}

#start {
  background: none;
  border: 1px solid rgba(150, 175, 220, 0.35);
  border-radius: 2em;
  color: rgba(200, 212, 238, 0.9);
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  padding: 0.9em 3em;
  cursor: pointer;
  transition: all 0.6s ease;
}
#start:hover {
  border-color: rgba(170, 195, 240, 0.7);
  box-shadow: 0 0 30px rgba(120, 155, 230, 0.15);
}

.hint {
  margin-top: 2em;
  font-size: 0.7rem;
  color: rgba(140, 155, 185, 0.4);
}

/* ---- おやすみ ---- */
#goodnight {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 20;
  font-size: 1rem;
  letter-spacing: 0.4em;
  color: rgba(160, 175, 205, 0.5);
  transition: opacity 8s ease;
  opacity: 0;
}
#goodnight.visible { opacity: 1; }

/* ---- 操作バー ---- */
#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2em;
  padding: 1.2em;
  font-size: 0.75rem;
  color: rgba(170, 185, 215, 0.6);
  background: linear-gradient(to top, rgba(4, 6, 11, 0.9), transparent);
  transition: opacity 1s ease;
  z-index: 5;
}
#controls.hidden, #goodnight.hidden { opacity: 0; pointer-events: none; }

#controls label { display: flex; align-items: center; gap: 0.6em; }

#controls input[type="range"] {
  width: 90px;
  accent-color: #5a7ab8;
}

#controls select, #controls button {
  background: rgba(20, 28, 45, 0.8);
  border: 1px solid rgba(150, 175, 220, 0.2);
  border-radius: 1em;
  color: rgba(190, 202, 228, 0.8);
  font-size: 0.75rem;
  padding: 0.35em 1em;
  cursor: pointer;
}

.status { font-size: 0.7rem; color: rgba(140, 155, 185, 0.45); }

/* ---- データ表示（画面下・極小） ---- */
#readout {
  position: fixed;
  bottom: 4.2em;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  color: rgba(160, 175, 210, 0.35);
  pointer-events: none;
  z-index: 4;
  transition: opacity 3s ease;
}

/* ---- レイヤーミキサー ---- */
#mixer {
  position: fixed;
  right: 1.2em;
  bottom: 5.5em;
  max-height: calc(100vh - 7.5em);
  overflow-y: auto;
  width: 272px;
  background: rgba(8, 12, 22, 0.92);
  border: 1px solid rgba(150, 175, 220, 0.15);
  border-radius: 0.8em;
  padding: 1em 1.1em 0.6em;
  font-size: 0.72rem;
  z-index: 6;
  transition: opacity 0.6s ease;
}
#mixer.hidden { opacity: 0; pointer-events: none; }

.mixer-head {
  display: flex;
  align-items: center;
  gap: 0.6em;
  letter-spacing: 0.2em;
  color: rgba(190, 202, 228, 0.75);
  margin-bottom: 0.9em;
}
.tuning {
  margin-left: auto;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: rgba(140, 155, 185, 0.5);
}
#mixer-close {
  background: none;
  border: none;
  color: rgba(160, 175, 205, 0.5);
  font-size: 0.8rem;
  cursor: pointer;
}

.mixer-scale {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.9em;
  font-size: 0.72rem;
  color: rgba(170, 185, 215, 0.6);
}
.mixer-scale select {
  background: rgba(20, 28, 45, 0.8);
  border: 1px solid rgba(150, 175, 220, 0.2);
  border-radius: 1em;
  color: rgba(190, 202, 228, 0.8);
  font-size: 0.7rem;
  padding: 0.3em 0.8em;
  cursor: pointer;
}

.channel { margin-bottom: 0.7em; }
.ch-name {
  color: rgba(185, 198, 225, 0.8);
  margin-bottom: 0.15em;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}
.ch-name:hover .ch-label { color: rgba(215, 225, 245, 0.95); }
.ch-doc {
  margin-left: auto;
  font-size: 0.7rem;
  color: rgba(140, 155, 190, 0.4);
}
.ch-name:hover .ch-doc { color: rgba(170, 190, 230, 0.8); }
.ch-src {
  font-size: 0.62rem;
  color: rgba(140, 155, 190, 0.45);
}
.ch-info {
  color: rgba(140, 155, 190, 0.55);
  font-size: 0.66rem;
  margin-bottom: 0.35em;
  min-height: 1em;
}
.ch-row { display: flex; align-items: center; gap: 0.6em; }
.fader { flex: 1; accent-color: #5a7ab8; }
.mute, .solo {
  background: none;
  border: 1px solid rgba(150, 175, 220, 0.25);
  border-radius: 0.4em;
  color: rgba(160, 175, 205, 0.55);
  font-size: 0.65rem;
  width: 1.9em;
  height: 1.7em;
  cursor: pointer;
}
.mute.on {
  color: rgba(235, 185, 120, 0.9);
  border-color: rgba(235, 185, 120, 0.5);
}
.solo.on {
  color: rgba(150, 225, 180, 0.9);
  border-color: rgba(150, 225, 180, 0.5);
}

/* ---- 言語切り替え（常設・右上） ---- */
#lang {
  position: fixed;
  top: 1em;
  right: 1.2em;
  z-index: 15;
  background: rgba(12, 18, 32, 0.6);
  border: 1px solid rgba(150, 175, 220, 0.2);
  border-radius: 1em;
  color: rgba(170, 185, 215, 0.6);
  font-size: 0.7rem;
  padding: 0.35em 1em;
  cursor: pointer;
}
#lang:hover { color: rgba(210, 220, 240, 0.9); }

/* ---- 音の解説モーダル ---- */
#doc {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 9, 0.65);
  transition: opacity 0.4s ease;
}
#doc.hidden { opacity: 0; pointer-events: none; }

.doc-card {
  width: min(430px, 88vw);
  max-height: 72vh;
  overflow-y: auto;
  background: rgba(10, 15, 26, 0.97);
  border: 1px solid rgba(150, 175, 220, 0.18);
  border-radius: 0.9em;
  padding: 1.3em 1.5em;
}

.doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1em;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: rgba(200, 212, 238, 0.9);
}
#doc-close {
  background: none;
  border: none;
  color: rgba(160, 175, 205, 0.5);
  font-size: 0.85rem;
  cursor: pointer;
}

.doc-sec { margin-bottom: 1.1em; }
.doc-label {
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  color: rgba(130, 150, 190, 0.6);
  margin-bottom: 0.4em;
}
.doc-sec p {
  font-size: 0.78rem;
  line-height: 1.9;
  color: rgba(180, 192, 218, 0.8);
}

/* ---- ISSツールチップ ---- */
#iss-tip {
  position: fixed;
  z-index: 8;
  background: rgba(10, 15, 26, 0.95);
  border: 1px solid rgba(150, 200, 240, 0.25);
  border-radius: 0.6em;
  padding: 0.6em 0.9em;
  font-size: 0.68rem;
  line-height: 1.7;
  color: rgba(190, 225, 245, 0.85);
  white-space: pre-line;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#iss-tip.hidden { opacity: 0; }

/* ---- 減光モード ---- */
body.dimmed #sky { opacity: 0.25; }
body.dimmed #readout { opacity: 0; }
#sky { transition: opacity 3s ease; }

/* ---- モバイル（タップ操作・狭幅） ---- */
@media (max-width: 640px) {
  #controls {
    flex-wrap: wrap;
    gap: 0.7em 1.4em;
    padding: 0.9em 0.9em 1.2em;
    font-size: 0.72rem;
    background: linear-gradient(to top, rgba(4, 6, 11, 0.95) 70%, transparent);
  }
  #controls input[type="range"] { width: 76px; }
  .status { flex-basis: 100%; text-align: center; }

  #readout {
    bottom: 9.8em;
    padding: 0 1em;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    line-height: 1.8;
  }

  #mixer {
    left: 0.7em;
    right: 0.7em;
    width: auto;
    bottom: 7em;
    max-height: calc(100vh - 10em);
    padding: 0.9em 1em 0.5em;
  }

  #lang { top: 0.7em; right: 0.8em; }
}
