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

:root {
  --bg: #0a0a1a;
  --surface: #12122a;
  --card: #1a1a3a;
  --border: #2a2a4a;
  --primary: #e94560;
  --primary-dark: #b8354d;
  --secondary: #0f3460;
  --text: #e8e8f0;
  --text-dim: #8888aa;
  --success: #4caf50;
  --fail: #f44336;
  --r1: #9e9e9e;
  --r2: #4caf50;
  --r3: #2196f3;
  --r4: #9c27b0;
  --r5: #ff9800;
  --nav-h: 60px;
  --header-h: 44px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Helvetica Neue', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  font-size: 14px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* PWA（全画面）でステータスバー・ホームバーに重ならないよう安全領域を空ける */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0f2a, #1a0a2a);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--primary), var(--r5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
/* 打ち上げ中はヘッダーを出さず、画面いっぱいに使う */
body.in-flight .app-header { display: none; }
body.in-flight main, body.screen-garage main { padding-bottom: 0; overflow: hidden; }

.bottom-nav {
  display: flex;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  transition: color .2s;
}
.nav-btn .nav-icon { font-size: 20px; }
.nav-btn.active { color: var(--primary); }
.nav-btn:active { transform: scale(0.95); }

/* ===== HOME ===== */
.home-screen { padding: 16px; }

.home-header {
  background: linear-gradient(135deg, var(--surface), var(--card));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.player-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.player-stats { display: flex; gap: 12px; font-size: 13px; color: var(--text-dim); }
.stat-item { white-space: nowrap; }

.score-display {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.score-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 2px; }
.score-value { font-size: 32px; font-weight: 700; color: var(--r5); }
.score-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.home-gacha-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.gacha-btn {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary), #ff6b6b);
  border: none;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform .15s;
}
.gacha-btn:active { transform: scale(0.97); }
.gacha-btn-icon { font-size: 36px; }
.gacha-btn-text { font-size: 18px; font-weight: 700; margin-top: 4px; }
.gacha-btn-sub { font-size: 12px; opacity: 0.8; }

.gacha-btn.pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233,69,96,0.5); }
  50% { box-shadow: 0 0 20px 8px rgba(233,69,96,0.3); }
}

.gacha-done {
  width: 100%;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  text-align: center;
  color: var(--text-dim);
}
.gacha-done-icon { font-size: 24px; color: var(--success); margin-bottom: 4px; }

.ticket-btn {
  padding: 10px 20px;
  background: var(--card);
  border: 1px solid var(--r4);
  border-radius: 10px;
  color: var(--r4);
  font-size: 13px;
  cursor: pointer;
}

.home-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.quick-btn:active { background: var(--border); }
.quick-icon { font-size: 20px; }

.unlock-info {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
}
.unlock-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--r5));
  border-radius: 3px;
  transition: width .5s;
}
.unlock-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; text-align: right; }

/* ===== GARAGE ===== */
.garage-screen { padding: 12px; }
.garage-header h2 { font-size: 18px; margin-bottom: 6px; }
.rocket-stats-bar {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--card);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.stage-count-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
}
.stage-count-label { font-size: 13px; font-weight: 600; margin-right: 4px; }
.stage-count-btn {
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.stage-count-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(233,69,96,0.1); }

.stage-group {
  margin-top: 4px;
  border-left: 2px solid var(--border);
  padding-left: 8px;
}
.stage-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--r5);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  padding: 4px 0;
}

.rocket-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.part-slot {
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: background .15s;
}
.part-slot:active { background: var(--border); }
.part-slot-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.part-slot-card {
  border-left: 3px solid;
  padding: 6px 10px;
  border-radius: 4px;
}
.part-rarity { font-size: 11px; }
.part-name { font-size: 14px; font-weight: 600; }
.part-brief { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.part-slot-change { font-size: 10px; color: var(--primary); text-align: right; margin-top: 4px; }

.rocket-visual {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.rocket-svg {
  width: 100px;
  height: 260px;
  filter: drop-shadow(0 0 8px rgba(233,69,96,0.3));
}

/* ===== PART SELECT MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}
.modal-content {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  max-height: 70vh;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .3s ease-out;
}
.modal-content.show { transform: translateY(0); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

.part-list { display: flex; flex-direction: column; gap: 8px; }
.part-list-item {
  padding: 10px;
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.part-list-item:active { background: var(--border); }
.part-list-item.selected { background: var(--secondary); }
.part-list-rarity { font-size: 11px; }
.part-list-name { font-size: 14px; font-weight: 600; margin: 2px 0; }
.part-list-stats { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

/* ===== LAUNCH ===== */
.launch-screen { padding: 12px; }
.launch-header h2 { font-size: 18px; margin-bottom: 12px; }

.config-section {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.config-label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.site-list { display: flex; flex-direction: column; gap: 6px; }
.site-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.site-btn.active { border-color: var(--primary); background: rgba(233,69,96,0.1); }
.site-btn.locked { opacity: 0.4; cursor: not-allowed; }
.site-name { font-weight: 600; }
.site-mult { color: var(--r5); font-weight: 600; }
.site-lock { font-size: 11px; color: var(--text-dim); }

/* ===== WORLD MAP ===== */
.world-map-container {
  width: 100%;
  height: 70vh;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: rgba(6, 6, 20, 0.6);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.world-map-svg {
  width: 250%;
  height: 100%;
  display: block;
  min-width: 900px;
}

.map-pin .pin-dot {
  fill: #4a6a9a;
  transition: fill 0.2s, r 0.2s;
}
.map-pin .pin-ring {
  fill: none;
  stroke: #4a6a9a;
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity 0.2s, stroke 0.2s;
}
.map-pin .pin-label {
  fill: #8888aa;
  font-family: -apple-system, 'Helvetica Neue', sans-serif;
  font-weight: 600;
  pointer-events: none;
  transition: fill 0.2s;
}
.map-pin .pin-lock {
  fill: #555;
  pointer-events: none;
}

.map-pin:hover .pin-dot {
  fill: #7a9acc;
}
.map-pin:hover .pin-ring {
  opacity: 0.5;
  stroke: #7a9acc;
}

.map-pin.active .pin-dot {
  fill: var(--primary);
  filter: drop-shadow(0 0 4px rgba(233, 69, 96, 0.6));
}
.map-pin.active .pin-ring {
  stroke: var(--primary);
  opacity: 0.6;
  stroke-width: 2;
  animation: pinPulse 2s infinite;
}
.map-pin.active .pin-label {
  fill: var(--primary);
  font-weight: 700;
}

.map-pin.locked .pin-dot {
  fill: #2a2a4a;
  stroke: #333;
  stroke-width: 1;
}
.map-pin.locked .pin-label {
  fill: #555;
}

@keyframes pinPulse {
  0%, 100% { opacity: 0.6; stroke-width: 2; }
  50% { opacity: 0.2; stroke-width: 3; }
}

.world-map-container::-webkit-scrollbar { height: 4px; }
.world-map-container::-webkit-scrollbar-track { background: transparent; }
.world-map-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.map-site-popup {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
}
.map-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.map-popup-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.map-popup-mult {
  font-size: 14px;
  font-weight: 700;
  color: var(--r5);
}
.map-popup-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.map-popup-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.map-popup-features {
  font-size: 11px;
  color: var(--r3);
}

.orbit-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.orbit-btn {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}
.orbit-btn.active { border-color: var(--r3); background: rgba(33,150,243,0.1); color: var(--r3); }

.launch-rocket-preview {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 0;
}
.rocket-preview-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rp-part { flex-shrink: 0; }
.rp-part .part-svg { width: 100%; height: 100%; display: block; }

.launch-summary {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--card);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.launch-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #ff4444, #ff8800);
  border: none;
  border-radius: 14px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform .1s;
}
.launch-btn:active { transform: scale(0.97); }
.launch-btn-text { font-size: 22px; font-weight: 700; }
.launch-btn-sub { font-size: 12px; opacity: 0.8; margin-top: 2px; }

/* ===== LAUNCH ANIMATION ===== */
.launch-anim-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #050515;
  overflow: hidden;
}
#launch-canvas {
  width: 100%;
  height: 100%;
}

.telemetry-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
}
.telem-row { display: flex; justify-content: space-between; gap: 12px; margin: 2px 0; }
.telem-label { color: var(--text-dim); }
.telem-target, .telem-target .telem-label { font-weight: 700; color: var(--text); }

.speed-control {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  padding: 4px 12px;
  border-radius: 16px;
  z-index: 5;
}
.speed-control input[type="range"] {
  width: 100px;
  height: 4px;
}
.speed-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--r3);
  min-width: 28px;
  text-align: center;
}

.launch-status {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--r5);
  font-weight: 600;
  white-space: nowrap;
}

.liftoff-btn {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 48px;
  background: linear-gradient(135deg, #ff4444, #ff8800);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 30px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  cursor: pointer;
  z-index: 10;
  animation: liftoffPulse 1.5s infinite;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 4px 20px rgba(255,68,68,0.4);
}
.liftoff-btn:active { transform: translateX(-50%) scale(0.95); }
@keyframes liftoffPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(255,68,68,0.4); }
  50% { box-shadow: 0 4px 30px rgba(255,136,0,0.7); }
}

/* ===== RESULTS ===== */
.results-screen { padding: 16px; }

.results-header {
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.results-header.success { background: linear-gradient(135deg, rgba(76,175,80,0.15), rgba(76,175,80,0.05)); }
.results-header.failure { background: linear-gradient(135deg, rgba(244,67,54,0.15), rgba(244,67,54,0.05)); }
.results-icon { font-size: 48px; }
.results-title { font-size: 22px; font-weight: 700; margin-top: 8px; }
.results-fail-reason { font-size: 13px; color: var(--fail); margin-top: 6px; }

.results-score {
  text-align: center;
  margin-bottom: 16px;
}
.score-big { font-size: 40px; font-weight: 700; color: var(--r5); }

.results-breakdown {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.breakdown-row:last-child { border-bottom: none; }

.results-flight { margin-bottom: 16px; }
.results-flight h3 { font-size: 15px; margin-bottom: 10px; }
.flight-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.fstat {
  display: flex;
  justify-content: space-between;
  background: var(--card);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.fstat span:first-child { color: var(--text-dim); }

.flight-chart-area {
  margin-top: 12px;
  background: var(--card);
  border-radius: 8px;
  padding: 8px;
}
#flight-chart { width: 100%; height: auto; }

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-primary, .btn-secondary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

/* ===== RECORDS ===== */
.records-screen { padding: 12px; }
.records-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.records-header h2 { font-size: 18px; }
.records-summary { font-size: 13px; color: var(--text-dim); }

.flight-list { display: flex; flex-direction: column; gap: 8px; }
.flight-card {
  background: var(--card);
  border-radius: 10px;
  padding: 10px 12px;
  border-left: 3px solid;
}
.flight-card.success { border-color: var(--success); }
.flight-card.failure { border-color: var(--fail); }
.flight-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.flight-num { font-weight: 700; font-size: 13px; }
.flight-status { font-size: 12px; }
.flight-card.success .flight-status { color: var(--success); }
.flight-card.failure .flight-status { color: var(--fail); }
.flight-score { font-weight: 700; color: var(--r5); }
.flight-card-body { display: flex; gap: 12px; font-size: 11px; color: var(--text-dim); }

.empty-msg { text-align: center; padding: 40px 20px; color: var(--text-dim); }

/* ===== COLLECTION ===== */
.collection-screen { padding: 12px; }
.collection-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.collection-header h2 { font-size: 18px; }
.collection-count { font-size: 13px; color: var(--text-dim); }

.collection-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.col-tab {
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.col-tab.active { border-color: var(--primary); color: var(--primary); background: rgba(233,69,96,0.1); }

.collection-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.col-card {
  background: var(--card);
  border: 1px solid;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.col-card.locked { opacity: 0.4; }
.col-svg { width: 56px; height: 48px; margin: 0 auto 4px; overflow: hidden; }
.col-svg svg { width: 100%; height: 100%; display: block; }
.col-svg.locked-svg { filter: grayscale(1) brightness(0.4); }
.col-rarity { font-size: 11px; }
.col-name { font-size: 14px; font-weight: 600; margin: 2px 0; }
.col-stats { font-size: 11px; color: var(--text-dim); text-align: left; }
.col-locked { font-size: 11px; color: var(--text-dim); font-style: italic; }

/* ===== GACHA ANIMATION ===== */
#gacha-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1a0a2a, #050515);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gacha-animation {
  text-align: center;
}
.gacha-rocket-anim {
  animation: gachaLaunch 1.5s ease-in forwards;
}
.gacha-rocket {
  font-size: 64px;
  filter: drop-shadow(0 0 20px rgba(255,150,0,0.6));
}
@keyframes gachaLaunch {
  0% { transform: translateY(200px) scale(1); opacity: 1; }
  70% { transform: translateY(-50px) scale(1.3); opacity: 1; }
  100% { transform: translateY(-300px) scale(0.5); opacity: 0; }
}

/* ===== GACHA RESULT ===== */
/* オーバーレイ全面をクリック可能にする（タップで閉じる領域 = 画面全体） */
.gacha-result-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#gacha-result {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.8);
}
.gacha-result-card {
  width: 85%;
  max-width: 350px;
  padding: 24px;
  border: 2px solid;
  border-radius: 16px;
  text-align: center;
  transform: scale(0.5);
  opacity: 0;
  transition: all .4s cubic-bezier(.34,1.56,.64,1);
}
.gacha-result-card.show { transform: scale(1); opacity: 1; }
.gacha-part-svg { width: 100px; height: 80px; margin: 0 auto 12px; }
.gacha-part-svg .part-svg { width: 100%; height: 100%; }
.gacha-rarity { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.gacha-part-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.gacha-category { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.gacha-stats { font-size: 11px; color: var(--text-dim); line-height: 1.5; margin-bottom: 12px; text-align: left; }
.gacha-new {
  display: inline-block;
  padding: 4px 16px;
  background: var(--primary);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  animation: newBounce 0.6s ease-out;
}
@keyframes newBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.gacha-dupe {
  font-size: 12px;
  color: var(--r5);
  margin-bottom: 12px;
}

/* ===== SCROLLBAR ===== */
main::-webkit-scrollbar { width: 3px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== HOME HERO ===== */
.home-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 160px;
}
.home-stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
}
.home-hero-content {
  position: relative;
  z-index: 1;
  padding: 20px 16px 16px;
}
.home-player-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.home-score-value {
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255,160,0,0.5);
}
.home-score-unit {
  font-size: 20px;
  font-weight: 600;
  color: var(--r5);
  margin-left: 4px;
}
.home-score-sub {
  font-size: 12px;
  color: rgba(200,200,230,0.7);
  margin-top: 4px;
}
.home-stats-row {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  font-size: 13px;
  color: rgba(200,200,255,0.8);
}
.home-stat { white-space: nowrap; }

/* ===== GACHA BUTTON ENHANCED ===== */
.gacha-btn-glow {
  position: relative;
  overflow: hidden;
}
.gacha-btn-shine {
  position: absolute;
  top: -50%;
  left: -60%;
  width: 50%;
  height: 200%;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.18) 50%, transparent 60%);
  animation: btnShine 3s infinite;
}
@keyframes btnShine {
  0% { left: -60%; }
  60%, 100% { left: 120%; }
}

/* ===== GACHA RESULT ENHANCED ===== */
.gacha-particles-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.gacha-result-overlay {
  position: relative;
}
.gacha-result-card {
  position: relative;
  z-index: 2;
}
.gacha-rarity-glow {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
.gacha-result-card.show .gacha-rarity-glow {
  opacity: 1;
}
.gacha-legendary {
  animation: legendaryPulse 1.5s infinite;
}
@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 20px var(--rarity-color, #ff9800), 0 0 40px var(--rarity-color, #ff9800); }
  50% { box-shadow: 0 0 40px var(--rarity-color, #ff9800), 0 0 80px var(--rarity-color, #ff9800); }
}

/* ===== GACHA FAIRING SEQUENCE ===== */
.gacha-caption {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  letter-spacing: 1px;
  color: #cfe3ff;
  background: rgba(0,0,0,0.45);
  padding: 6px 14px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 2;
}
.gacha-skip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  z-index: 2;
}

/* ===== FLIGHT CONTROLS ===== */
.telemetry-overlay { font-size: 10px; padding: 6px 8px; }
.telem-row { margin: 1px 0; }
.liftoff-btn { bottom: 150px; }
.flight-controls { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.fc-group { position: absolute; display: flex; gap: 6px; pointer-events: auto; }
.fc-left { left: 8px; bottom: 96px; }
.fc-right { right: 8px; bottom: 156px; }
.fc-bottom { left: 50%; bottom: 96px; transform: translateX(-50%); }
.fc-bar {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; padding: 3px 4px; touch-action: none;
}
.fc-label { font-size: 9px; color: var(--text-dim); }
.fc-value { font-family: 'Courier New', monospace; font-size: 10px; color: var(--r3); min-width: 34px; text-align: center; }
.fc-throttle .fc-value { color: var(--r5); }
.fc-track { position: relative; background: rgba(255,255,255,0.08); border-radius: 4px; touch-action: none; cursor: pointer; }
.fc-v .fc-track { width: 20px; height: 120px; }
.fc-h .fc-track { width: 120px; height: 20px; }
.fc-zero { position: absolute; background: rgba(255,255,255,0.35); }
.fc-v .fc-zero { left: 3px; right: 3px; height: 1px; top: 50%; }
.fc-h .fc-zero { top: 3px; bottom: 3px; width: 1px; left: 50%; }
.fc-throttle .fc-zero { display: none; }
.fc-fill { position: absolute; background: rgba(33,150,243,0.35); }
.fc-v .fc-fill { left: 0; right: 0; }
.fc-h .fc-fill { top: 0; bottom: 0; }
.fc-throttle .fc-fill { background: rgba(255,152,0,0.4); }
.fc-thumb {
  position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: #e8e8f0; border: 2px solid var(--r3); box-shadow: 0 0 6px rgba(0,0,0,0.6);
}
.fc-v .fc-thumb { left: 50%; margin-left: -7px; }
.fc-h .fc-thumb { top: 50%; margin-top: -7px; }
.fc-throttle .fc-thumb { border-color: var(--r5); }
.fc-bar.active { border-color: var(--r3); }
.fc-end { font-size: 8px; color: var(--text-dim); white-space: nowrap; }
.fc-hrow { display: flex; align-items: center; gap: 4px; }
.fc-stage { left: 8px; bottom: 290px; flex-direction: column; gap: 4px; }
.fc-btn {
  width: 50px; padding: 5px 0; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff;
  border: 1px solid rgba(255,255,255,0.25); cursor: pointer; touch-action: manipulation;
}
.fc-btn-separate { background: rgba(156,39,176,0.75); }
.fc-btn-ignite { background: rgba(255,87,34,0.8); }
.fc-btn-payload { background: rgba(0,150,136,0.8); }
.fc-btn-fairing { background: rgba(96,125,139,0.85); font-size: 10px; }
.fc-btn:active { transform: scale(0.94); }

/* 推進剤搭載量（Lv≤2） */
.prop-load-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.prop-load-row input[type="range"] { flex: 1; min-width: 0; }
.prop-load-name { font-size: 12px; font-weight: 600; width: 28px; flex-shrink: 0; }
.prop-load-val { font-size: 12px; font-family: monospace; color: var(--text-dim); width: 116px; flex-shrink: 0; text-align: right; }
.prop-load-hint { font-size: 11px; color: var(--text-dim); line-height: 1.5; }

/* 2D/3D 表示切替（Lv2以降） */
.view-toggle {
  position: absolute; left: 10px; top: 10px; z-index: 6;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(10, 14, 30, 0.75); color: #cfe6ff;
  border: 1px solid rgba(120, 190, 255, 0.4);
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
}
.view-toggle.active { background: rgba(0, 120, 200, 0.6); color: #fff; }

/* Lv3以降の目標表示 */
.target-spec { background: rgba(0,188,212,0.08); border: 1px solid rgba(0,188,212,0.3); border-radius: 8px; padding: 8px 10px; }
.target-spec-row { font-size: 12px; color: var(--text); margin-top: 3px; }
