/* theme.css - 全站共用霓虹像素主题（大厅 + 所有游戏页）
   背景图路径相对本 CSS 文件：shared/pixel-gagarin.png */
:root {
  --bg: #05070f;
  --panel: #0c1226;
  --line: #1a2547;
  --accent: #00e5ff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Courier New", ui-monospace, Consolas, monospace;
  color: #dfe7ff;
  background:
    linear-gradient(rgba(5, 7, 15, .82), rgba(5, 7, 15, .88)),
    url("pixel-gagarin.png") center / cover no-repeat fixed,
    radial-gradient(1100px 650px at 50% -12%, #17234d 0%, transparent 60%),
    radial-gradient(900px 600px at 88% 112%, #3b1a4a 0%, transparent 55%),
    var(--bg);
  image-rendering: pixelated; /* 背景保持像素硬边 */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.hidden { display: none !important; }

header {
  text-align: center;
  padding: 18px 16px 12px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
}
h1 {
  font-size: clamp(26px, 5vw, 44px);
  letter-spacing: 6px;
  text-shadow: 0 0 18px var(--accent), 0 0 44px rgba(0, 229, 255, .35);
  user-select: none;
}
h1 em {
  font-style: normal;
  color: var(--accent);
  font-size: .55em;
  vertical-align: super;
  letter-spacing: 2px;
}
#mute-icon {
  font-size: 22px;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, .6));
  user-select: none;
}

/* ---------- 通用布局与面板 ---------- */
.layout {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 0 16px 12px;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 152px;
}
.panel {
  background: linear-gradient(180deg, rgba(18, 26, 54, .92), rgba(9, 14, 32, .94));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.panel h2 {
  font-size: 11px;
  letter-spacing: 3px;
  color: #7f93c9;
  margin-bottom: 8px;
  text-align: center;
}
.legend {
  font-size: 11px;
  line-height: 1.9;
  color: #9fb0dd;
  text-align: center;
}
.legend b { color: #dfe7ff; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(0, 229, 255, .5);
  text-align: center;
}
.stat-value.small { font-size: 22px; }
.stat-row { margin-bottom: 10px; }
.stat-row:last-child { margin-bottom: 0; }

/* ---------- 覆盖层（菜单/暂停/结束） ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 18px;
  background: rgba(4, 7, 18, .74);
  backdrop-filter: blur(3px);
  border-radius: 12px;
}
.overlay h2 {
  font-size: clamp(20px, 4vw, 26px);
  letter-spacing: 3px;
  text-shadow: 0 0 16px var(--accent);
  white-space: pre-line;
}
.overlay p {
  font-size: 12px;
  line-height: 2;
  color: #a9b8e8;
  white-space: pre-line;
  max-width: 260px;
}
.btn {
  cursor: pointer;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(0, 229, 255, .08);
  padding: 10px 22px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 2px;
  box-shadow: 0 0 14px rgba(0, 229, 255, .25), inset 0 0 8px rgba(0, 229, 255, .12);
  transition: .15s;
}
.btn:hover {
  background: rgba(0, 229, 255, .18);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

/* ---------- 触屏按键 ---------- */
.touch {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  padding: 6px 12px 24px;
  max-width: 520px;
  order: 10;
  flex-basis: 100%;
}
.touch-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.touch button {
  min-width: 54px;
  min-height: 50px;
  font-size: 18px;
  font-family: inherit;
  color: #cfe8ff;
  background: linear-gradient(180deg, rgba(24, 36, 74, .95), rgba(11, 17, 40, .95));
  border: 1px solid #2b3a6e;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.touch button:active {
  background: rgba(0, 229, 255, .18);
  border-color: var(--accent);
}
.touch .wide { min-width: 76px; }

footer {
  font-size: 11px;
  color: #5b6c9d;
  padding: 0 16px 18px;
  text-align: center;
  letter-spacing: 1px;
}

/* ---------- 音乐抽屉（music.js 顶层模式动态注入；固定悬浮右缘，不挤占布局） ---------- */
#music-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1031;
  writing-mode: vertical-rl;
  letter-spacing: 4px;
  font-size: 13px;
  font-family: inherit;
  padding: 14px 8px;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(18, 26, 54, .95), rgba(9, 14, 32, .95));
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(0, 229, 255, .2);
  transition: right .25s ease;
}
#music-tab.shifted { right: 252px; }

#music-panel {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translate(105%, -50%);
  transition: transform .25s ease;
  z-index: 1030;
  width: 240px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(18, 26, 54, .96), rgba(9, 14, 32, .97));
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 12px 0 0 12px;
  box-shadow: -8px 8px 30px rgba(0, 0, 0, .5);
}
#music-panel.open { transform: translate(0, -50%); }
#music-panel h2 {
  font-size: 11px;
  letter-spacing: 3px;
  color: #7f93c9;
  text-align: center;
}
#mp-now {
  font-size: 12px;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 229, 255, .5);
  min-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
  overflow: hidden;
}
#mp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #7dffce);
}
.mp-time {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #7f93c9;
}
.mp-controls { display: flex; gap: 6px; }
.mp-controls button,
.mp-modes button {
  font-family: inherit;
  color: #cfe8ff;
  background: linear-gradient(180deg, rgba(24, 36, 74, .95), rgba(11, 17, 40, .95));
  border: 1px solid #2b3a6e;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.mp-controls button {
  flex: 1;
  min-height: 34px;
  font-size: 13px;
  padding: 0 2px;
}
.mp-controls button:active { background: rgba(0, 229, 255, .18); border-color: var(--accent); }
.mp-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mp-modes button {
  font-size: 11px;
  padding: 6px 0;
  letter-spacing: 1px;
}
.mp-modes button.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 229, 255, .15);
  box-shadow: 0 0 10px rgba(0, 229, 255, .25);
}
.mp-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
#mp-vol {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .07);
  outline: none;
  cursor: pointer;
}
#mp-vol::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 229, 255, .6);
}
#mp-vol::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 229, 255, .6);
}
#mp-vol-text {
  min-width: 24px;
  text-align: right;
  font-size: 10px;
  color: #7f93c9;
}
#mp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: #2b3a6e transparent;
}
.mp-item {
  padding: 7px 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(26, 37, 71, .6);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mp-item:hover { background: rgba(0, 229, 255, .07); }
.mp-item.active {
  background: rgba(0, 229, 255, .12);
  box-shadow: inset 3px 0 0 var(--accent);
}
.mp-item.active .mp-cn { color: var(--accent); }
.mp-cn { font-size: 12px; color: #dfe7ff; }
.mp-ru { font-size: 10px; color: #7f93c9; }

/* ---------- 通用移动端 ---------- */
@media (max-width: 720px) {
  .layout { gap: 12px; }
  .side {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
  .side .panel { flex: 0 1 168px; }
  .panel.legend { display: none; }
}
