/* ソーラーシステム・トラベラー — サイバーUI */
:root {
  --cyan: #00f6ff;
  --cyan-dim: rgba(0, 246, 255, 0.55);
  --cyan-faint: rgba(0, 246, 255, 0.16);
  --bg-panel: rgba(3, 14, 26, 0.86);
  --amber: #ffc857;
  --font-mono: "Cascadia Mono", Consolas, "Courier New", "BIZ UDGothic", "MS Gothic", monospace;
  --font-jp: "Yu Gothic UI", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000208;
  font-family: var(--font-jp);
  color: #cfefff;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }
#space { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ==== 天体ラベル ==== */
#labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  cursor: pointer;
  font-family: var(--font-jp);
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 246, 255, 0.9), 0 0 2px #000, 0 1px 3px #000;
  padding: 3px 8px 4px;
  white-space: nowrap;
  will-change: transform;
  transition: opacity 0.25s;
}
.label::before {
  content: "";
  position: absolute; left: 50%; bottom: -5px;
  width: 1px; height: 7px;
  background: var(--cyan-dim);
}
.label.minor { font-size: 11px; color: #9adfff; }
.label.comet { color: #b7f4ff; font-size: 11px; }
.label.hidden { opacity: 0; pointer-events: none; }

/* ==== 共通HUDボタン ==== */
.hud-btn {
  pointer-events: auto;
  background: var(--bg-panel);
  border: 1px solid var(--cyan-dim);
  color: var(--cyan);
  font-family: var(--font-jp);
  font-size: 15px;
  letter-spacing: 0.1em;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(0, 246, 255, 0.25), inset 0 0 12px rgba(0, 246, 255, 0.07);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background 0.15s, box-shadow 0.15s;
}
.hud-btn:active {
  background: rgba(0, 90, 120, 0.85);
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.6);
}

#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 14px;
  pointer-events: none;
}
#title {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.25em;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 246, 255, 0.8);
  border-left: 3px solid var(--cyan);
  padding: 4px 10px;
  background: linear-gradient(90deg, var(--cyan-faint), transparent 80%);
}
#title small { display: block; font-size: 10px; letter-spacing: 0.5em; color: #7fd4e8; }
#hud-buttons { display: flex; gap: 10px; }

/* ==== 情報パネル (サイバーポップアップ) ==== */
#info-panel {
  position: absolute;
  top: 66px; right: 14px;
  z-index: 30;
  width: min(360px, calc(100vw - 28px));
  max-height: calc(100% - 150px);
  background: var(--bg-panel);
  border: 1px solid var(--cyan-dim);
  box-shadow: 0 0 22px rgba(0, 246, 255, 0.35), inset 0 0 30px rgba(0, 246, 255, 0.05);
  backdrop-filter: blur(6px);
  padding: 14px 16px 16px;
  overflow-y: auto;
  transform: translateX(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
#info-panel.open { transform: translateX(0); opacity: 1; pointer-events: auto; }

/* スキャンライン */
#info-panel::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 246, 255, 0.045) 0 1px, transparent 1px 3px);
  animation: scan 9s linear infinite;
}
@keyframes scan { from { background-position-y: 0; } to { background-position-y: 120px; } }

/* コーナーブラケット */
.brackets::before, .brackets::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--cyan);
  border-style: solid;
}
.brackets::before { top: 4px; left: 4px; border-width: 2px 0 0 2px; }
.brackets::after { bottom: 4px; right: 4px; border-width: 0 2px 2px 0; }

#ip-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
#ip-name {
  font-size: 26px; font-weight: bold;
  color: #ffffff;
  text-shadow: 0 0 12px var(--cyan), 0 0 4px var(--cyan);
  letter-spacing: 0.1em;
}
#ip-name-en {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.3em;
  color: #7fd4e8;
}
#ip-type {
  display: inline-block;
  font-size: 11px;
  color: #061018;
  background: var(--cyan);
  padding: 2px 10px;
  margin-bottom: 10px;
  letter-spacing: 0.2em;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
#ip-map {
  width: 100%; height: 64px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--cyan-faint);
  margin-bottom: 10px;
  filter: saturate(1.1);
}
#ip-map.none { display: none; }

#ip-rows { font-size: 13px; line-height: 1.5; }
.ip-row {
  display: flex;
  gap: 8px;
  padding: 5px 2px;
  border-bottom: 1px dashed rgba(0, 246, 255, 0.22);
  opacity: 0;
  transform: translateX(-8px);
  animation: rowin 0.3s forwards;
}
@keyframes rowin { to { opacity: 1; transform: none; } }
.ip-row .k {
  flex: 0 0 108px;
  color: #7fd4e8;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding-top: 2px;
}
.ip-row .v { flex: 1; color: #e8fbff; }

#ip-fact {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #d9f6e8;
  background: rgba(0, 255, 170, 0.06);
  border-left: 3px solid #34e0a1;
  opacity: 0;
  animation: rowin 0.4s 0.5s forwards;
}
#ip-fact::before {
  content: "▶ まめちしき";
  display: block;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: #34e0a1;
  margin-bottom: 4px;
}
#ip-close {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none;
  color: var(--cyan);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  text-shadow: 0 0 8px var(--cyan);
}
#ip-goto {
  margin-top: 12px;
  width: 100%;
  font-size: 14px;
}

/* ==== 内部構造モーダル ==== */
#interior {
  position: absolute; inset: 0;
  background: rgba(0, 5, 10, 0.78);
  display: none;
  align-items: center; justify-content: center;
  z-index: 45;
}
#interior.open { display: flex; }
#int-card {
  position: relative;
  width: min(780px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--cyan-dim);
  box-shadow: 0 0 26px rgba(0, 246, 255, 0.4), inset 0 0 30px rgba(0, 246, 255, 0.05);
  padding: 20px 22px 18px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
#int-card::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 246, 255, 0.04) 0 1px, transparent 1px 3px);
}
#int-title {
  font-size: 22px;
  letter-spacing: 0.15em;
  color: #ffffff;
  text-shadow: 0 0 12px var(--cyan), 0 0 4px var(--cyan);
  margin-bottom: 12px;
  padding-right: 40px;
}
#int-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none;
  color: var(--cyan);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  text-shadow: 0 0 8px var(--cyan);
  z-index: 1;
}
#int-body { display: flex; gap: 18px; align-items: flex-start; }
#int-img {
  flex: 0 0 44%;
  width: 44%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--cyan-faint);
  box-shadow: 0 0 14px rgba(0, 246, 255, 0.2);
}
#int-right { flex: 1; min-width: 0; }
#int-note {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #7fd4e8;
  margin-bottom: 8px;
}
.int-layer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 4px;
  border-bottom: 1px dashed rgba(0, 246, 255, 0.22);
  opacity: 0;
  transform: translateX(-8px);
  animation: rowin 0.3s forwards;
}
.int-layer .sw {
  flex: 0 0 20px;
  width: 20px; height: 20px;
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 246, 255, 0.25);
}
.int-layer .num {
  flex: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  padding-top: 3px;
}
.int-layer .tx { flex: 1; min-width: 0; }
.int-layer .tx b {
  display: block;
  font-size: 14px;
  color: #e8fbff;
  margin-bottom: 2px;
}
.int-layer .tx span {
  font-size: 12px;
  line-height: 1.55;
  color: #a8d8e8;
}
#int-fact {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #d9f6e8;
  background: rgba(0, 255, 170, 0.06);
  border-left: 3px solid #34e0a1;
}
#int-fact::before {
  content: "▶ まめちしき";
  display: block;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: #34e0a1;
  margin-bottom: 4px;
}
#int-close2 { margin-top: 14px; width: 100%; font-size: 14px; }
#ip-inside { margin-top: 12px; width: 100%; font-size: 14px; }
#ip-goto { margin-top: 8px; }
@media (max-width: 680px) {
  #int-body { flex-direction: column; align-items: center; }
  #int-img { flex: none; width: min(62vw, 300px); }
  #int-right { width: 100%; }
}

/* ==== 起動画面 ==== */
#boot {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, #04182a 0%, #000208 75%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  z-index: 50;
  transition: opacity 0.7s;
}
#boot.fade { opacity: 0; pointer-events: none; }
#boot-title {
  font-family: var(--font-mono);
  font-size: clamp(20px, 5vw, 34px);
  letter-spacing: 0.3em;
  color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan);
}
#boot-sub { font-size: 13px; letter-spacing: 0.4em; color: #7fd4e8; }
#boot-bar {
  width: min(420px, 70vw); height: 10px;
  border: 1px solid var(--cyan-dim);
  padding: 2px;
}
#boot-bar > div {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #007a8a, var(--cyan));
  box-shadow: 0 0 10px var(--cyan);
  transition: width 0.3s;
}
#boot-log {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #58b7cc;
  height: 3em;
  text-align: center;
  white-space: pre-line;
}
#boot-start {
  display: none;
  font-size: 18px;
  padding: 14px 34px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 246, 255, 0.3); }
  50% { box-shadow: 0 0 26px rgba(0, 246, 255, 0.8); }
}

/* ==== ヘルプ ==== */
#help {
  position: absolute; inset: 0;
  background: rgba(0, 5, 10, 0.72);
  display: none;
  align-items: center; justify-content: center;
  z-index: 40;
}
#help.open { display: flex; }
#help-card {
  position: relative;
  width: min(430px, calc(100vw - 40px));
  background: var(--bg-panel);
  border: 1px solid var(--cyan-dim);
  box-shadow: 0 0 24px rgba(0, 246, 255, 0.4);
  padding: 24px 26px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
#help-card h2 {
  font-size: 17px; letter-spacing: 0.3em;
  color: var(--cyan);
  margin-bottom: 16px;
  text-shadow: 0 0 10px var(--cyan);
}
.help-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 0;
  font-size: 14.5px;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(0, 246, 255, 0.2);
}
.help-row .ico { font-size: 26px; flex: 0 0 40px; text-align: center; }

/* ==== 操作トースト ==== */
#toast {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  background: var(--bg-panel);
  border: 1px solid var(--cyan-faint);
  padding: 7px 18px;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ==== うちゅうマップ (パンくず) ==== */
#scale-map {
  position: absolute;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--cyan-faint);
  box-shadow: 0 0 12px rgba(0, 246, 255, 0.18);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  z-index: 20;
  max-width: calc(100vw - 24px);
  flex-wrap: nowrap;
}
#scale-map .chip {
  background: none; border: none;
  color: #6fbdd4;
  font-family: var(--font-jp);
  font-size: 12px; letter-spacing: 0.06em;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, text-shadow 0.2s;
}
#scale-map .chip.cur {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 246, 255, 0.9);
  font-weight: bold;
}
#scale-map .sep { color: #3a6b7a; font-size: 11px; }
#scale-map .bh-tag {
  display: none;
  color: #ffb0e6;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding-left: 4px;
  border-left: 1px solid rgba(0, 246, 255, 0.2);
  text-shadow: 0 0 8px rgba(255, 120, 220, 0.8);
}
#scale-map.bh .bh-tag { display: inline; }

/* ==== ズーム端の ワープ確認ボタン ==== */
#scale-jump {
  position: absolute;
  left: 50%; bottom: 64px;
  transform: translateX(-50%) translateY(14px);
  background: rgba(3, 22, 34, 0.92);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-jp);
  font-size: 17px; letter-spacing: 0.1em;
  padding: 13px 26px;
  cursor: pointer;
  z-index: 25;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(0, 246, 255, 0.5), inset 0 0 16px rgba(0, 246, 255, 0.1);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  transition: opacity 0.3s, transform 0.3s;
}
#scale-jump.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  animation: jumpPulse 1.5s ease-in-out infinite;
}
@keyframes jumpPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(0, 246, 255, 0.4), inset 0 0 16px rgba(0, 246, 255, 0.1); }
  50% { box-shadow: 0 0 30px rgba(0, 246, 255, 0.9), inset 0 0 20px rgba(0, 246, 255, 0.2); }
}

/* ==== ワープの閃光オーバーレイ ==== */
#warp-flash {
  position: absolute; inset: 0;
  z-index: 44;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at center, #d8fbff 0%, #29b6d6 35%, rgba(0, 20, 40, 0) 72%);
}
#warp-flash.go { animation: warpFlash 0.9s ease-out; }
@keyframes warpFlash {
  0% { opacity: 0; transform: scale(0.2); }
  35% { opacity: 0.95; }
  100% { opacity: 0; transform: scale(2.4); }
}

@media (max-width: 620px) {
  #info-panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 42vh; }
  #hud-top { padding: 8px 8px; }
  #title { font-size: 11px; letter-spacing: 0.1em; padding: 3px 7px; }
  #title small { display: none; }
  #hud-buttons { gap: 5px; }
  .hud-btn { font-size: 13px; padding: 8px 11px; }
  /* せまい画面では「たいようけいへ」「ぜんたい」はアイコンだけに */
  #btn-solar, #btn-home { font-size: 0; padding: 8px 10px; }
  #btn-solar::before { content: "🌍"; font-size: 16px; }
  #btn-home::before { content: "🏠"; font-size: 16px; }
  /* パンくずは題名・ボタンの下の段に */
  #scale-map { top: 46px; gap: 2px; padding: 4px 7px; }
  #scale-map .chip { font-size: 10px; padding: 2px 3px; letter-spacing: 0; }
  #scale-map .sep { font-size: 9px; }
  #scale-map .bh-tag { font-size: 9px; padding-left: 3px; }
  #scale-jump { font-size: 15px; padding: 11px 18px; bottom: 20px; }
}
