/* ============================================================
 * 《硕博矿工》— 矿井控制台风格
 * ============================================================ */

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

:root {
  --void: #07090f;
  --rock: #11151d;
  --panel: #141b25;
  --panel-2: #1c2835;
  --steel: #3c5368;
  --chalk: #efe9da;
  --muted: #a9b3bf;
  --faint: #748290;
  --amber: #e0a43c;
  --amber-2: #f0c15b;
  --teal: #52c8b8;
  --rust: #c46a3a;
  --good: #51c184;
  --bad: #ef5b57;
  --warn: #f3c15d;
  --ink: #0b0d12;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background:
    linear-gradient(132deg, rgba(224, 164, 60, 0.11) 0 18%, transparent 18% 48%, rgba(82, 200, 184, 0.08) 48% 62%, transparent 62% 100%),
    linear-gradient(180deg, #101722 0%, #090b12 48%, #05070c 100%);
  color: var(--chalk);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  min-height: 100vh;
  padding: 18px;
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  opacity: 0.38;
  background-image:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(0deg, rgba(224, 164, 60, 0.05) 0 2px, transparent 2px 86px);
}

body::after {
  opacity: 0.65;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.5), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.48)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 24%);
}

.screen {
  display: none;
  min-height: 0;
}

.screen:not(.hidden) {
  display: flex;
}

.hidden,
[hidden] {
  display: none !important;
}

.wrap {
  width: min(1180px, calc(100vw - 20px));
  max-width: 100%;
  height: calc(100dvh - 36px);
  min-height: 0;
  color: var(--chalk);
  background:
    linear-gradient(180deg, rgba(32, 44, 58, 0.98), rgba(9, 11, 16, 0.99)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 10px);
  border: 1px solid rgba(239, 233, 218, 0.14);
  border-radius: 26px 20px 34px 12px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
}

.wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.46;
  background-image:
    linear-gradient(90deg, rgba(82, 200, 184, 0.07), transparent 22%, transparent 78%, rgba(224, 164, 60, 0.07)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 9px);
}

.wrap::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 12px;
  height: 7px;
  border-radius: 999px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(224, 164, 60, 0.76), rgba(82, 200, 184, 0.55), transparent);
  opacity: 0.85;
}

button,
.char-desc,
.skin-cond,
.rail-text,
.tagline,
#resultText,
#resultDetail {
  overflow-wrap: anywhere;
}

button:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.hud-icon-img,
.label-img,
.toast-img,
.wx-avatar-img,
.char-img,
.skin-img,
.up-img,
.mobile-icon-img {
  display: inline-block;
  object-fit: contain;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 2px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 3px 8px rgba(0, 0, 0, 0.16);
}

.hud-icon-img {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}

.label-img {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  vertical-align: -3px;
  border-radius: 6px;
  padding: 1px;
}

.toast-img {
  border-radius: 7px;
  padding: 2px;
}

/* ---------------- 通用 ---------------- */
.btn {
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 232, 175, 0.28);
  border-radius: 16px 16px 22px 8px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 900;
  color: #171109;
  background: linear-gradient(180deg, #ffd36a, #df9431 58%, #ac5d26);
  box-shadow: 0 4px 0 #5a351d, 0 13px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}

.btn:hover {
  filter: brightness(1.08) saturate(1.04);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #5a351d, 0 8px 16px rgba(0, 0, 0, 0.24);
}

.btn:disabled {
  filter: grayscale(0.75);
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  color: var(--chalk);
  border-color: rgba(169, 179, 191, 0.22);
  background: linear-gradient(180deg, #34475b, #1a2531);
  box-shadow: 0 4px 0 #0a0e14, 0 13px 24px rgba(0, 0, 0, 0.24);
}

.btn-buy {
  padding: 7px 13px;
  min-height: 34px;
  font-size: 13px;
}

/* ---------------- 菜单 ---------------- */
#screen-menu {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  padding: clamp(16px, 3.5vh, 34px) clamp(20px, 3.5vw, 44px) clamp(14px, 2.8vh, 30px);
  overflow: hidden;
  position: relative;
  z-index: 1;
}

#screen-menu::before {
  content: "";
  position: absolute;
  inset: 22px 22px auto;
  height: 170px;
  z-index: -1;
  opacity: 0.44;
  background:
    linear-gradient(90deg, transparent, rgba(82, 200, 184, 0.16), transparent),
    repeating-linear-gradient(90deg, rgba(224, 164, 60, 0.18) 0 8px, transparent 8px 18px);
  border-radius: 32px 20px 48px 14px;
  transform: skewY(-1.6deg);
}

.menu-head {
  min-width: 0;
  text-align: center;
}

#screen-menu h1 {
  font-size: clamp(30px, 5.5vh, 56px);
  line-height: 1;
  color: #fff2c2;
  text-shadow: 0 3px 0 #5d351a, 0 16px 34px rgba(0, 0, 0, 0.42);
  margin-bottom: 6px;
}

.tagline {
  max-width: 720px;
  color: #d7decb;
  font-size: clamp(12px, 1.8vh, 15px);
  line-height: 1.4;
  margin: 0 auto 8px;
  text-align: center;
}

.menu-stats {
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 5px 12px;
  margin: 0 auto;
  color: #bff4ea;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  background: rgba(7, 9, 15, 0.62);
  border: 1px solid rgba(82, 200, 184, 0.22);
  border-radius: 999px;
}

.section-title {
  width: 100%;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--amber-2);
  font-size: 13px;
  font-weight: 900;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(224, 164, 60, 0.65), transparent);
  margin-left: 4px;
}

.char-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-height: 0;
  align-content: start;
}

.menu-choice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  margin-top: 12px;
}

.menu-choice-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.char-card,
.skin-card,
.up-card,
.rail-panel {
  position: relative;
  overflow: hidden;
  color: var(--chalk);
  background:
    linear-gradient(150deg, rgba(35, 48, 62, 0.98), rgba(12, 16, 23, 0.97)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 12px);
  border: 1px solid rgba(239, 233, 218, 0.13);
  border-radius: 18px 18px 26px 9px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 14px 26px rgba(0, 0, 0, 0.26);
}

.char-card::before,
.skin-card::before,
.up-card::before,
.rail-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--teal), var(--amber));
  opacity: 0.55;
}

.char-card {
  min-height: 126px;
  padding: 13px 12px 13px 10px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 10px;
  align-items: center;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s;
}

.char-figure {
  position: relative;
  grid-row: 1 / span 2;
  width: 76px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-img {
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.34));
}

.char-mark {
  position: absolute;
  right: -1px;
  bottom: 1px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #171109;
  font-size: 13px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff0bd, #dca44b);
  border-radius: 50%;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.24);
}

.char-card:hover,
.skin-card:hover,
.up-card:hover {
  transform: translateY(-2px);
  border-color: rgba(82, 200, 184, 0.42);
}

.char-card.selected,
.skin-card.selected {
  border-color: rgba(224, 164, 60, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px rgba(224, 164, 60, 0.16),
    0 18px 34px rgba(0, 0, 0, 0.3);
}

.char-name {
  margin: 0 0 3px;
  color: #fff0bd;
  font-size: 16px;
  font-weight: 900;
}

.char-desc {
  align-self: start;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.skin-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-height: 0;
  flex: 1;
}

.skin-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-height: 0;
  flex: 1;
}

.skin-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-height: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.skin-group:first-child {
  padding-top: 0;
  border-top: none;
}

.skin-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
}

.skin-group-title {
  color: #fff0bd;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.skin-card {
  min-height: 0;
  padding: 10px 9px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s, border-color 0.14s, box-shadow 0.14s, opacity 0.14s;
}

.skin-figure {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skin-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.28));
}

.skin-card.locked {
  opacity: 0.48;
  filter: grayscale(0.25);
}

.skin-name {
  margin: 4px 0 3px;
  color: #fff0bd;
  font-size: 12px;
  font-weight: 900;
}

.skin-cond {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.menu-actions {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.menu-actions .btn {
  font-size: 16px;
  padding: 10px 24px;
}

/* ---------------- 游戏 ---------------- */
#screen-game {
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.hud {
  color: var(--chalk);
  background:
  linear-gradient(180deg, rgba(24, 34, 45, 0.98), rgba(8, 11, 16, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 10px);
  border: 1px solid rgba(239, 233, 218, 0.13);
  border-radius: 20px 20px 28px 10px;
  padding: 10px 12px 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.24);
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.hud-title {
  color: #fff0bd;
  font-size: 15px;
  font-weight: 900;
}

.hud-target {
  color: #c8d7d4;
  font-size: 13px;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  color: #dce6e7;
  font-size: 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 999px;
}

.hud-stat b {
  color: var(--amber-2);
  font-size: 14px;
}

.mentor-face {
  font-size: 15px;
}

.combo-badge {
  color: #0d0b07;
  background: linear-gradient(180deg, #ffd56b, #d78c2c);
  border-color: rgba(255, 213, 106, 0.7);
}

.combo-badge b {
  color: #0d0b07;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.hud-btn {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(169, 179, 191, 0.2);
  border-radius: 12px 12px 16px 7px;
  background: linear-gradient(180deg, #2c3b4d, #121923);
  color: var(--chalk);
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.hud-btn.icon {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.hud-btn.icon.active {
  border-color: rgba(224, 164, 60, 0.72);
  box-shadow:
    0 4px 0 #5a351d,
    0 0 0 2px rgba(224, 164, 60, 0.14),
    0 13px 24px rgba(0, 0, 0, 0.28);
}

.hud-btn:hover {
  filter: brightness(1.12);
}

.hud-btn.primary {
  color: #171109;
  background: linear-gradient(180deg, #ffd36a, #df9431);
  border-color: rgba(255, 232, 175, 0.62);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.progress-track {
  flex: 1;
  height: 20px;
  position: relative;
  overflow: hidden;
  background: #070a10;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.58);
}

.progress-fill {
  height: 100%;
  width: 0%;
  position: relative;
  background: linear-gradient(90deg, var(--teal), var(--amber-2));
  border-radius: 999px;
  transition: width 0.25s;
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.24) 0 8px, transparent 8px 16px);
  opacity: 0.25;
}

#cap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 7px;
  color: #101218;
  background: #fff0bd;
  border-radius: 999px;
  border: 1px solid rgba(16, 18, 24, 0.12);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  transition: left 0.25s;
}

.progress-label {
  min-width: 46px;
  color: var(--amber-2);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.relationship-row {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  padding: 3px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.relationship-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 6px;
  padding: 1px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.relationship-row b {
  flex: 0 0 auto;
  color: #fff0bd;
  font-size: 12px;
  font-weight: 900;
}

.relationship-row span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relationship-row.partnered {
  border-color: rgba(244, 143, 177, 0.32);
  background: rgba(244, 143, 177, 0.08);
}

.relationship-row.partnered .relationship-icon {
  border-color: rgba(244, 143, 177, 0.42);
}

.relationship-row.breaking {
  border-color: rgba(239, 91, 87, 0.48);
  background: rgba(239, 91, 87, 0.1);
}

.relationship-row.breaking b {
  color: #ffd0ce;
}

.bars {
  display: none;
}

.bar {
  font-size: 12px;
}

.bar label {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
}

.barTrack {
  height: 13px;
  overflow: hidden;
  background: #070a10;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 999px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55);
}

.barTrack > div {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s;
}

#barHair {
  background: linear-gradient(90deg, #7f5a3a, #d9aa64);
}

#barMood {
  background: linear-gradient(90deg, #2e8f68, #9be29d);
}

#barMor {
  background: linear-gradient(90deg, #6577d9, #b4c4ff);
}

.game-layout {
  display: block;
  flex: 1;
  min-height: 0;
  position: relative;
}

.game-stage {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(10, 13, 18, 0.86), rgba(7, 9, 15, 0.98)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 11px);
  border: 1px solid rgba(239, 233, 218, 0.12);
  border-radius: 22px 18px 30px 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 34px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.stage-head {
  display: none;
}

.stage-kicker {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
}

.stage-note {
  color: #dce4db;
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

canvas#cv {
  display: block;
  max-width: 100%;
  max-height: none;
  flex: 0 0 auto;
  margin: 0 auto;
  cursor: crosshair;
  background: #080a10;
  border: 1px solid rgba(239, 233, 218, 0.15);
  border-radius: 18px 18px 25px 10px;
  box-shadow:
    inset 0 0 0 3px rgba(82, 200, 184, 0.08),
    0 18px 34px rgba(0, 0, 0, 0.32);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.game-hint {
  display: none;
}

.run-rail {
  display: none;
}

.mobile-dock,
.mobile-sheet {
  display: none;
}

.mobile-sheet {
  position: absolute;
  top: 88px;
  right: 12px;
  bottom: 12px;
  width: min(340px, calc(100vw - 24px));
  z-index: 34;
  color: var(--chalk);
  background: rgba(8, 11, 16, 0.98);
  border: 1px solid rgba(239, 233, 218, 0.14);
  border-radius: 16px 16px 22px 8px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mobile-sheet.hidden {
  display: none;
}

.mobile-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  background: linear-gradient(180deg, rgba(24, 34, 45, 0.98), rgba(12, 16, 22, 0.98));
  border-bottom: 1px solid rgba(239, 233, 218, 0.09);
}

.mobile-sheet-title {
  color: #fff0bd;
  font-size: 13px;
  font-weight: 900;
}

.sheet-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  padding: 8px 10px;
  background: rgba(10, 14, 20, 0.98);
  border-bottom: 1px solid rgba(239, 233, 218, 0.09);
}

.sheet-tab-btn {
  min-width: 0;
  min-height: 30px;
  padding: 5px 4px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  cursor: pointer;
}

.sheet-tab-btn:hover {
  color: var(--chalk);
  border-color: rgba(82, 200, 184, 0.38);
}

.sheet-tab-btn.active {
  color: #171109;
  background: linear-gradient(180deg, #fff0bd, #dca44b);
  border-color: rgba(255, 240, 189, 0.76);
}

.mobile-sheet-close {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239, 233, 218, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--chalk);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.mobile-sheet-body {
  padding: 10px 12px 12px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.mobile-block + .mobile-block {
  margin-top: 10px;
}

.mobile-block {
  padding: 10px 10px 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px 14px 18px 8px;
}

.mobile-block-title {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 6px;
}

.mobile-block-main {
  color: #fff0bd;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 4px;
}

.mobile-block-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.mobile-guide-list {
  display: grid;
  gap: 6px;
}

.mobile-guide-item {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 8px;
  background: rgba(82, 200, 184, 0.045);
  border-left: 2px solid rgba(82, 200, 184, 0.58);
  border-radius: 8px 10px 10px 4px;
}

.mobile-guide-item b {
  color: #fff0bd;
  font-size: 11px;
  line-height: 1.45;
}

.mobile-guide-item span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.mobile-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mobile-guide-chip {
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px 9px 12px 5px;
}

.mobile-guide-chip b,
.mobile-guide-chip span {
  display: block;
}

.mobile-guide-chip b {
  color: #fff0bd;
  font-size: 11px;
  margin-bottom: 2px;
}

.mobile-guide-chip span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.mobile-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mobile-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px 12px 16px 6px;
}

.mobile-metric img {
  width: 20px;
  height: 20px;
}

.mobile-metric b {
  color: #fff0bd;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.mobile-metric span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.mobile-bars {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mobile-bar label {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.mobile-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rail-panel {
  min-height: 110px;
  padding: 15px 15px 14px 17px;
}

.rail-label {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 8px;
}

.rail-title {
  color: #fff0bd;
  font-size: 17px;
  line-height: 1.4;
  font-weight: 900;
  margin-bottom: 8px;
}

.rail-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.effect-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 34px;
}

.effect-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  color: #dde8ec;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.effect-pill.bad {
  color: #ffd6d5;
  background: rgba(239, 91, 87, 0.15);
  border-color: rgba(239, 91, 87, 0.34);
}

.effect-pill.warn {
  color: #ffe6a6;
  background: rgba(243, 193, 93, 0.14);
  border-color: rgba(243, 193, 93, 0.32);
}

.effect-pill.good {
  color: #c9ffe0;
  background: rgba(81, 193, 132, 0.14);
  border-color: rgba(81, 193, 132, 0.34);
}

.effect-pill.calm {
  color: #bff4ea;
  background: rgba(82, 200, 184, 0.12);
  border-color: rgba(82, 200, 184, 0.24);
}

/* Toast */
#toast {
  position: absolute;
  top: 76px;
  left: 50%;
  z-index: 50;
  max-width: 88%;
  padding: 10px 16px;
  pointer-events: none;
  color: var(--chalk);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  background: rgba(10, 13, 18, 0.94);
  border: 1px solid rgba(239, 233, 218, 0.14);
  border-radius: 16px 16px 22px 8px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
}

#toast .toast-visual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  vertical-align: middle;
}

.toast-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.bad {
  background: rgba(78, 22, 24, 0.96);
  border-color: rgba(239, 91, 87, 0.42);
}

#toast.good {
  background: rgba(18, 66, 48, 0.96);
  border-color: rgba(81, 193, 132, 0.42);
}

#toast.gold {
  color: #201507;
  background: rgba(245, 190, 88, 0.98);
  border-color: rgba(255, 232, 175, 0.62);
}

/* ---------------- 微信聊天弹窗 ---------------- */
#wx {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 60;
  width: 270px;
  overflow: hidden;
  pointer-events: none;
  color: #111;
  background: #eef1f3;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px 18px 25px 10px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.52);
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.25s, transform 0.25s;
}

#wx.show {
  opacity: 1;
  transform: translateY(0);
}

.wx-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  color: #fff;
  background: linear-gradient(180deg, #222833, #121720);
  font-size: 15px;
  font-weight: 900;
}

.wx-avatar {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wx-avatar-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.wx-body {
  padding: 12px 12px 4px;
}

.wx-bubble {
  color: #111;
  background: #95ec69;
  border-radius: 11px 11px 11px 3px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.wx-note {
  color: #747474;
  font-size: 11px;
  margin: 6px 2px 0;
  text-align: left;
}

.wx-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 12px 12px;
  background: #eef1f3;
}

.wx-actions .btn {
  min-height: 36px;
  padding: 7px 16px;
  font-size: 14px;
}

.wx-time {
  color: #898989;
  font-size: 11px;
  padding: 6px 12px 10px;
  text-align: right;
}

#wx.modal {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  display: flex;
  width: min(420px, calc(100vw - 24px));
  height: auto;
  max-height: calc(100dvh - 24px);
  margin: auto;
  flex-direction: column;
  justify-content: center;
  pointer-events: auto;
  background: rgba(5, 7, 12, 0.76);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}

#wx.modal .wx-body {
  padding-top: 16px;
}

#wx.modal .wx-bubble {
  font-size: 16px;
}

#wx.modal .wx-time {
  display: none;
}

/* ---------------- 商店 ---------------- */
#screen-shop {
  flex-direction: column;
  gap: 16px;
  padding: 34px 34px 36px;
  position: relative;
  z-index: 1;
}

#screen-shop h2 {
  color: #fff0bd;
  font-size: 30px;
  line-height: 1.15;
}

.shop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.shop-score {
  color: #bff4ea;
  font-size: 18px;
  font-weight: 900;
  padding: 8px 13px;
  background: rgba(7, 9, 15, 0.56);
  border: 1px solid rgba(82, 200, 184, 0.22);
  border-radius: 999px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.up-card {
  min-height: 158px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.up-card.maxed {
  opacity: 0.68;
}

.up-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.up-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  margin-top: 1px;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.26));
}

.up-name {
  color: #fff0bd;
  font-size: 15px;
  font-weight: 900;
}

.up-desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.up-pips {
  display: flex;
  gap: 5px;
}

.pip {
  width: 26px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pip.on {
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.up-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.up-lv {
  color: #c7d4d2;
  font-size: 12px;
  font-weight: 900;
}

.shop-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------------- 结算 ---------------- */
#screen-result {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 560px;
  padding: 56px 36px;
  position: relative;
  z-index: 1;
  text-align: center;
}

#screen-result::before {
  content: "";
  position: absolute;
  inset: 34px;
  z-index: -1;
  background:
    linear-gradient(160deg, rgba(82, 200, 184, 0.13), transparent 36%),
    linear-gradient(20deg, rgba(224, 164, 60, 0.13), transparent 42%);
  border: 1px solid rgba(239, 233, 218, 0.11);
  border-radius: 30px 22px 42px 12px;
}

#resultTitle {
  color: #fff0bd;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
}

#screen-result.good #resultTitle {
  color: #c9ffe0;
}

#screen-result.bad #resultTitle {
  color: #ffd0ce;
}

#resultText {
  max-width: 660px;
  color: #e3e8e3;
  font-size: 17px;
  line-height: 1.85;
}

#resultDetail {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.result-actions {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .wrap {
    width: min(980px, calc(100vw - 16px));
  }

  .game-layout {
    display: block;
  }

  canvas#cv {
    max-height: none;
  }
}

@media (max-width: 720px) {
  body {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: #05070c;
    height: 100dvh;
    min-height: 100dvh;
  }

  .wrap {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  #screen-menu,
  #screen-shop,
  #screen-result {
    height: 100%;
    min-height: 0;
    padding: 24px 14px 18px;
  }

  #screen-menu {
    padding: 10px 10px 9px;
    overflow: hidden;
  }

  #screen-shop,
  #screen-result {
    overflow-y: auto;
  }

  #screen-menu h1 {
    font-size: 30px;
  }

  .tagline {
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 5px;
  }

  .menu-choice-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 7px;
    margin-top: 7px;
  }

  .menu-choice-panel:first-child .char-row {
    flex: 0 0 auto;
  }

  .char-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .char-card {
    min-height: 94px;
    padding: 7px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .char-figure {
    width: auto;
    grid-row: auto;
    height: 46px;
  }

  .char-img {
    width: 42px;
    height: 42px;
  }

  .char-name {
    margin: 3px 0 2px;
    font-size: 14px;
  }

  .char-desc {
    align-self: auto;
    font-size: 10px;
    line-height: 1.25;
  }

  .section-title {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .skin-stack {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .skin-group {
    gap: 4px;
    padding-top: 5px;
  }

  .skin-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .skin-card {
    padding: 6px 4px;
  }

  .skin-figure {
    height: 28px;
  }

  .skin-img {
    width: 26px;
    height: 26px;
  }

  .skin-name {
    margin: 3px 0 2px;
    font-size: 10px;
  }

  .skin-cond {
    font-size: 9px;
    line-height: 1.18;
  }

  .skin-row,
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skin-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #screen-game {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    overflow: hidden;
  }

  .hud {
    border-radius: 0 0 16px 16px;
    padding: 8px 10px 9px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.26);
  }

  .hud-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, max-content);
    gap: 6px 5px;
    align-items: center;
    margin-bottom: 6px;
  }

  .hud-title {
    font-size: 13px;
  }

  .hud-target,
  .hud-stat {
    font-size: 11px;
  }

  .hud-stat {
    padding: 3px 7px;
  }

  .hud-stat b {
    font-size: 13px;
  }

  .mentor-face {
    font-size: 13px;
  }

  .combo-badge {
    display: none;
  }

  .hud-btn.icon {
    display: none;
  }

  .hud-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
    margin-top: 2px;
  }

  .hud-btn {
    min-height: 32px;
    font-size: 11px;
    padding: 5px 8px;
  }

  .progress-row {
    margin-bottom: 6px;
  }

  .relationship-row {
    min-height: 24px;
    margin: 0 2px 6px;
    padding: 2px 8px;
  }

  .relationship-row span {
    font-size: 10px;
  }

  .bars {
    display: none;
  }

  .game-layout {
    flex: 1;
    min-height: 0;
  }

  .game-stage {
    height: 100%;
    padding: 4px;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }

  .stage-head {
    display: none;
  }

  canvas#cv {
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 14px;
  }

  .run-rail {
    display: none;
  }

  .game-hint {
    display: none;
  }

  .menu-actions .btn,
  .btn {
    min-height: 42px;
  }

  .menu-actions {
    gap: 7px;
    flex-wrap: nowrap;
  }

  .menu-actions .btn {
    width: auto;
    flex: 1;
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .mobile-dock {
    display: flex;
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    margin: 0 8px 8px;
    z-index: 35;
    gap: 8px;
    flex: 0 0 auto;
  }

  .mobile-icon-btn {
    flex: 1;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(29, 39, 52, 0.96), rgba(10, 14, 20, 0.96));
    border: 1px solid rgba(239, 233, 218, 0.14);
    border-radius: 14px 14px 18px 7px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-icon-btn.active {
    border-color: rgba(224, 164, 60, 0.7);
    box-shadow:
      0 10px 22px rgba(0, 0, 0, 0.34),
      0 0 0 2px rgba(224, 164, 60, 0.16);
  }

  .mobile-icon-img {
    width: auto;
    height: 20px;
    max-width: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 7px;
    padding: 1px 3px;
    flex: 0 0 auto;
  }

  .mobile-sheet {
    display: block;
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 66px;
    z-index: 34;
    color: var(--chalk);
    background: rgba(8, 11, 16, 0.98);
    border: 1px solid rgba(239, 233, 218, 0.14);
    border-radius: 16px 16px 22px 8px;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
    max-height: min(52dvh, calc(100dvh - 122px));
    overflow: hidden;
  }

  .mobile-sheet.hidden {
    display: none;
  }

  .mobile-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 8px;
    background: linear-gradient(180deg, rgba(24, 34, 45, 0.98), rgba(12, 16, 22, 0.98));
    border-bottom: 1px solid rgba(239, 233, 218, 0.09);
  }

  .mobile-sheet-title {
    color: #fff0bd;
    font-size: 13px;
    font-weight: 900;
  }

  .sheet-tabs {
    display: none;
  }

  body.mobile-game .sheet-tabs {
    display: none !important;
  }

  .mobile-sheet-close {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(239, 233, 218, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--chalk);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
  }

  .mobile-sheet-body {
    padding: 10px 12px 12px;
    overflow: auto;
    flex: 1;
    min-height: 0;
    max-height: calc(52dvh - 52px);
  }

  .mobile-block + .mobile-block {
    margin-top: 10px;
  }

  .mobile-block {
    padding: 10px 10px 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px 14px 18px 8px;
  }

  .mobile-block-title {
    color: var(--teal);
    font-size: 11px;
    font-weight: 900;
    margin-bottom: 6px;
  }

  .mobile-block-main {
    color: #fff0bd;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.35;
    margin-bottom: 4px;
  }

  .mobile-block-sub {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
  }

  .mobile-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px 12px 16px 6px;
  }

  .mobile-metric img {
    width: 20px;
    height: 20px;
  }

  .mobile-metric b {
    color: #fff0bd;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
  }

  .mobile-metric span {
    color: var(--muted);
    font-size: 10px;
    line-height: 1;
  }

  .mobile-bars {
    display: grid;
    gap: 8px;
    margin-top: 10px;
  }

  .mobile-bar label {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-height: 680px) {
  #screen-menu {
    padding-top: 9px;
    padding-bottom: 8px;
  }

  #screen-menu h1 {
    font-size: clamp(27px, 5vh, 40px);
    margin-bottom: 4px;
  }

  #screen-menu .tagline {
    font-size: 11px;
    line-height: 1.25;
    margin-bottom: 4px;
  }

  #screen-menu .menu-choice-grid {
    margin-top: 5px;
    gap: 6px;
  }

  #screen-menu .char-card {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  #screen-menu .char-figure {
    height: 40px;
  }

  #screen-menu .char-img {
    width: 36px;
    height: 36px;
  }

  #screen-menu .skin-figure {
    height: 24px;
  }

  #screen-menu .skin-img {
    width: 22px;
    height: 22px;
  }

  #screen-menu .skin-card {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  #screen-menu .menu-actions {
    margin-top: 6px;
  }

  #screen-menu .menu-actions .btn {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 12px;
  }
}

@media (max-width: 440px) {
  .skin-row,
  .shop-grid {
    grid-template-columns: 1fr;
  }

  .shop-actions,
  .result-actions {
    flex-direction: column;
  }

  .shop-actions .btn,
  .result-actions .btn {
    width: 100%;
  }
}
