/* 《牌宗》桌面版 UI — 水墨金漆 · 牌桌 */

:root {
  --bg: #07090d;
  --bg2: #12161f;
  --panel: rgba(16, 20, 28, 0.82);
  --panel-solid: #141a24;
  --panel-border: rgba(212, 175, 55, 0.28);
  --gold: #d4af37;
  --gold-light: #f3e0a0;
  --gold-dim: #8a7340;
  --ink: #0c1018;
  --felt: #0f3d32;
  --felt-deep: #0a2a22;
  --felt-edge: #1a5c4a;
  --red: #c23b2e;
  --red-bright: #e85d4c;
  --text: #efe8d8;
  --muted: #8b8794;
  --accent: #6e8cff;
  --green: #3dcf9a;
  --danger: #f07178;
  --card-w: 74px;
  --card-h: 104px;
  --radius: 16px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Noto Serif SC", "Songti SC", serif;
  --calligraphy: "Ma Shan Zheng", "Noto Serif SC", serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --header-h: 56px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ===== 背景层 ===== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, #141a28 0%, var(--bg) 55%);
}
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.bg-glow-a {
  width: 520px; height: 520px;
  left: -80px; top: -120px;
  background: rgba(212, 175, 55, 0.18);
}
.bg-glow-b {
  width: 480px; height: 480px;
  right: -60px; bottom: -80px;
  background: rgba(61, 120, 100, 0.2);
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}
.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 顶栏 ===== */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
  background: linear-gradient(180deg, rgba(20, 24, 32, 0.9), rgba(10, 12, 16, 0.5));
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-seal {
  width: 36px;
  height: 36px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-family: var(--calligraphy);
  font-size: 22px;
  color: var(--gold);
  transform: rotate(-6deg);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
  background: url('../assets/ui/seal.jpg') center / cover no-repeat;
  color: transparent;
  font-size: 0;
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 6px;
  color: var(--gold-light);
}
.brand-tag {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 1px;
}
.header-nav { display: flex; gap: 8px; }
.nav-link {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.nav-link:hover {
  color: var(--gold-light);
  border-color: rgba(212, 175, 55, 0.3);
}

/* ===== Screen ===== */
.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
.screen.active { display: flex; }

.content-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px 32px 40px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.content-shell.wide { width: min(1280px, 100%); }
.content-shell.narrow { width: min(560px, 100%); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.section-title {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 4px;
}
.section-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}
.map-qipai { margin-top: 4px !important; }

.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.panel { padding: 18px 20px; }
.panel-label {
  font-size: 12px;
  color: var(--gold-light);
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.gold-text { color: var(--gold-light); font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 26px;
  font-size: 14px;
  transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s, border-color 0.15s, background 0.15s;
  letter-spacing: 1px;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(145deg, #e8c96a 0%, #c9a227 45%, #8b6914 100%);
  color: #1a1200;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.28), inset 0 1px 0 rgba(255,255,255,0.35);
  min-width: 140px;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.42), inset 0 1px 0 rgba(255,255,255,0.4);
}

.btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid rgba(212, 175, 55, 0.35);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 10px 18px;
  font-size: 13px;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(255,255,255,0.22);
}

.btn-danger {
  background: rgba(240, 113, 120, 0.12);
  color: var(--danger);
  border: 1px solid rgba(240, 113, 120, 0.35);
}
.btn-small {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 8px;
  min-width: 0;
}
.btn-lg {
  padding: 16px 40px;
  font-size: 16px;
  min-width: 220px;
  border-radius: 14px;
}
.btn-block { width: 100%; }
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.btn-row.end {
  justify-content: flex-end;
  margin-top: 20px;
  flex-shrink: 0;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 16px 0 4px;
  background: linear-gradient(transparent, var(--bg) 30%);
}

/* ===== 标题页 ===== */
#screen-title {
  overflow: auto;
  position: relative;
}
.title-bg-art {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 9, 13, 0.88) 0%, rgba(7, 9, 13, 0.55) 45%, rgba(7, 9, 13, 0.82) 100%),
    linear-gradient(180deg, rgba(7, 9, 13, 0.2) 0%, rgba(7, 9, 13, 0.92) 100%),
    url('../assets/ui/title_bg.jpg') center / cover no-repeat;
  z-index: 0;
  pointer-events: none;
}
.title-layout {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  align-items: center;
  padding: 40px 48px 48px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.title-hero {
  text-align: left;
}
.title-ornament {
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--gold-dim);
  margin-bottom: 18px;
  text-transform: none;
}
.title-seal {
  width: 96px;
  height: 96px;
  border: 3px solid var(--gold);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--calligraphy);
  font-size: 56px;
  color: var(--gold);
  transform: rotate(-8deg);
  box-shadow:
    0 0 0 1px rgba(212,175,55,0.2),
    0 0 40px rgba(212, 175, 55, 0.22);
  margin-bottom: 18px;
  background: linear-gradient(145deg, rgba(212,175,55,0.08), transparent);
  animation: seal-in 0.8s ease both;
}
.title-seal-img {
  background:
    linear-gradient(145deg, rgba(0,0,0,0.15), rgba(0,0,0,0.35)),
    url('../assets/ui/seal.jpg') center / cover no-repeat;
  font-size: 0;
  color: transparent;
  overflow: hidden;
}
@keyframes seal-in {
  from { opacity: 0; transform: rotate(-8deg) scale(0.85); }
  to { opacity: 1; transform: rotate(-8deg) scale(1); }
}
.title-main {
  font-family: var(--calligraphy);
  font-size: clamp(64px, 8vw, 96px);
  font-weight: 400;
  letter-spacing: 18px;
  line-height: 1;
  background: linear-gradient(180deg, #fff6d4 0%, var(--gold-light) 40%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 16px;
  text-indent: 18px;
}
.title-sub {
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 2px;
  line-height: 1.75;
  max-width: 420px;
}
.title-stats {
  display: flex;
  gap: 14px;
  margin: 28px 0 24px;
}
.stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-radius: 12px;
  padding: 14px 20px;
  min-width: 110px;
}
.stat-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.stat-card strong {
  font-family: var(--display);
  font-size: 26px;
  color: var(--gold-light);
  font-weight: 700;
}
.title-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.title-quote {
  margin-top: 28px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--gold-dim);
  letter-spacing: 4px;
}
.title-side h3 {
  font-family: var(--display);
  color: var(--gold-light);
  font-size: 16px;
  letter-spacing: 3px;
  margin-bottom: 16px;
}
.sect-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sect-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}
.sect-list b {
  color: var(--gold-light);
  font-weight: 600;
  min-width: 56px;
}
.sect-list span { color: var(--muted); text-align: right; }
.side-tip {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(212,175,55,0.15);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* ===== 角色 ===== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  flex: 1;
  align-content: start;
}
.char-card {
  background: linear-gradient(165deg, rgba(30, 36, 48, 0.95), rgba(14, 18, 26, 0.95));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.char-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--char-color, var(--gold));
  opacity: 0.85;
  z-index: 2;
}
.char-card:hover {
  border-color: rgba(212, 175, 55, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}
.char-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.4), 0 12px 36px rgba(212, 175, 55, 0.15);
}
.char-card.locked { opacity: 0.42; cursor: not-allowed; }
.char-card.locked:hover { transform: none; box-shadow: none; }
.char-portrait {
  width: 100%;
  aspect-ratio: 3 / 3.2;
  background: var(--char-color, #333) center top / cover no-repeat;
  position: relative;
}
.char-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(10, 12, 18, 0.92) 100%);
  pointer-events: none;
}
.char-avatar {
  display: none;
}
.char-body {
  padding: 10px 16px 16px;
  margin-top: -28px;
  position: relative;
  z-index: 1;
}
.char-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
}
.char-sect {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 10px;
}
.char-skill {
  font-size: 12px;
  color: var(--gold-light);
  line-height: 1.55;
  opacity: 0.9;
}
.char-skill b { color: var(--text); }

/* ===== 奇牌 ===== */
.qipai-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  flex: 1;
  align-content: start;
  overflow: auto;
}
.qipai-card {
  background: linear-gradient(165deg, rgba(30, 36, 48, 0.95), rgba(14, 18, 26, 0.95));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
  min-height: 130px;
}
.qipai-card:hover, .qipai-card.selected {
  border-color: var(--gold);
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.12);
  transform: translateY(-2px);
}
.qipai-card .rarity {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 8px;
  letter-spacing: 1px;
}
.qipai-card .name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
  letter-spacing: 2px;
}
.qipai-card .desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* ===== 战斗桌面布局 ===== */
.screen-battle {
  padding: 0;
}
.battle-desktop {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr 240px;
  gap: 14px;
  padding: 14px 18px 16px;
}

.battle-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
}
.battle-side .side-block {
  flex-shrink: 0;
}
.battle-side .side-block.grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.side-kicker {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.side-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 2px;
}
.side-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.score-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.score-row .label {
  width: 20px;
  color: var(--muted);
  flex-shrink: 0;
  font-weight: 600;
}
.bar-track {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-fill.player {
  background: linear-gradient(90deg, #5b6ee8, #d4af37);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}
.bar-fill.enemy {
  background: linear-gradient(90deg, #8b1e1e, #e85d4c);
}
.score-num {
  width: 78px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--text);
  opacity: 0.85;
}

.battle-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--muted);
}
.chip.gold { border-color: rgba(212,175,55,0.4); color: var(--gold-light); }
.chip.danger { border-color: rgba(240,113,120,0.4); color: var(--danger); }
.chip.green { border-color: rgba(61,207,154,0.4); color: var(--green); }

.battle-log-panel {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  padding-right: 4px;
}
.battle-log-panel div {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  word-break: break-all;
}

.build-list {
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}
.build-list .build-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.build-list .build-item b {
  color: var(--gold-light);
  white-space: nowrap;
}
.hotkeys {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hotkeys div {
  display: flex;
  align-items: center;
  gap: 10px;
}
kbd {
  display: inline-block;
  min-width: 42px;
  text-align: center;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.35);
  font-family: inherit;
  font-size: 11px;
  color: var(--gold-light);
}
.tip-box {
  font-size: 11px;
  line-height: 1.65;
  color: var(--muted);
  padding: 12px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.05);
  border: 1px dashed rgba(212, 175, 55, 0.2);
}

/* 中央牌桌 */
.battle-table {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}
.table-felt {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  padding: 18px 22px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(10, 40, 30, 0.35), rgba(5, 12, 10, 0.55) 70%),
    url('../assets/ui/table_felt.jpg') center / cover no-repeat;
  border: 3px solid #2a1f10;
  box-shadow:
    inset 0 0 0 2px rgba(212, 175, 55, 0.25),
    inset 0 0 60px rgba(0, 0, 0, 0.35),
    0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.felt-ring {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 18px;
  pointer-events: none;
}
.enemy-area {
  position: relative;
  z-index: 1;
  text-align: center;
  flex-shrink: 0;
  padding-bottom: 8px;
}
.enemy-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 0;
  text-align: left;
}
.enemy-name {
  font-family: var(--display);
  color: rgba(255, 230, 180, 0.85);
  letter-spacing: 3px;
  font-size: 14px;
}
.enemy-cards {
  display: flex;
  justify-content: center;
  min-height: 56px;
  padding: 4px 0;
}
.card-back {
  width: 40px;
  height: 56px;
  background:
    linear-gradient(145deg, rgba(0,0,0,0.15), transparent),
    url('../assets/ui/card_back.jpg') center / cover no-repeat;
  border: 1.5px solid var(--gold);
  border-radius: 6px;
  margin-left: -18px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.35);
  position: relative;
}
.card-back:first-child { margin-left: 0; }

.enemy-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}
.enemy-portrait {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 2px solid rgba(212, 175, 55, 0.45);
  background: url('../assets/ui/enemy.jpg') center top / cover no-repeat;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  flex-shrink: 0;
}
.battle-char-portrait {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(212,175,55,0.4);
  background-size: cover;
  background-position: center top;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.table-area {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  gap: 10px;
}
.last-play {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  max-width: 90%;
  min-height: 80px;
  align-items: center;
}
.last-play-info {
  font-size: 14px;
  color: rgba(255,255,255,0.65);
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.last-play-info .score-pop {
  color: var(--gold-light);
  font-family: var(--display);
  font-weight: 700;
  font-size: 36px;
  display: block;
  letter-spacing: 2px;
  animation: pop 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  text-shadow: 0 0 24px rgba(212, 175, 55, 0.5);
}
@keyframes pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.util-bars {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 8px;
}
.jiguan-bar, .jinnang-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.jiguan-chip, .jinnang-chip {
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(61, 207, 154, 0.45);
  color: var(--green);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
  font-family: inherit;
}
.jiguan-chip:hover {
  background: rgba(61, 207, 154, 0.15);
  transform: translateY(-1px);
}
.jinnang-chip {
  border-color: rgba(110, 140, 255, 0.45);
  color: #b8c7ff;
}
.jinnang-chip:hover {
  background: rgba(110, 140, 255, 0.12);
}
.jiguan-chip .cost {
  opacity: 0.7;
  font-size: 11px;
}

/* 手牌区 */
.hand-area {
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(20, 24, 32, 0.95), rgba(12, 14, 20, 0.98));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 12px 16px 14px;
  box-shadow: var(--shadow);
}
.hand-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  gap: 12px;
}
.hand-hint {
  color: var(--gold-light);
  font-size: 13px;
  min-height: 18px;
  flex: 1;
  text-align: center;
  font-weight: 500;
}
.hand-tools { display: flex; gap: 8px; }

.hand-cards {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible;
  padding: 22px 12px 12px;
  min-height: calc(var(--card-h) + 40px);
  scrollbar-width: thin;
}

/* 卡牌 */
.card {
  width: var(--card-w);
  height: var(--card-h);
  background:
    linear-gradient(165deg, #fffef9 0%, #f7edd8 55%, #ebe0c8 100%);
  border-radius: 8px;
  border: 2px solid #c9ba96;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: -28px;
  position: relative;
  transition: transform 0.14s ease, border-color 0.14s, box-shadow 0.14s, z-index 0s;
  color: #1a1a1a;
}
.card:first-child { margin-left: 0; }
.card:hover {
  transform: translateY(-10px);
  z-index: 8;
  border-color: var(--gold);
}
.card.red { color: var(--red); }
.card.black { color: #1c1c1c; }
.card.joker-red {
  color: var(--red);
  background: linear-gradient(160deg, #fff8f6, #ffd9d4);
}
.card.joker-black {
  color: #2a2a2a;
  background: linear-gradient(160deg, #f8f8f8, #ddd);
}

.card .rank {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-family: var(--display);
}
.card .suit {
  font-size: 26px;
  line-height: 1;
}
.card .rank-sm {
  font-size: 12px;
  font-weight: 700;
  align-self: flex-start;
  margin-left: 2px;
  line-height: 1.2;
}

.card.selected {
  transform: translateY(-22px) scale(1.04);
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(212, 175, 55, 0.5),
    0 12px 28px rgba(212, 175, 55, 0.35);
  z-index: 10;
}
.card.frozen {
  opacity: 0.4;
  filter: grayscale(0.85);
  pointer-events: none;
}
.card.hint {
  box-shadow: 0 0 0 2px var(--green), 0 8px 20px rgba(61,207,154,0.35);
}

.card.table-card {
  margin-left: -20px;
  width: 64px;
  height: 90px;
  cursor: default;
}
.card.table-card:first-child { margin-left: 0; }
.card.table-card:hover { transform: none; }

/* 操作栏 */
.action-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 4px;
}
.action-bar .btn {
  min-width: 140px;
  padding: 12px 28px;
  font-size: 15px;
}

/* ===== 帮助 ===== */
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}
.help-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
  overflow-y: auto;
}
.help-content h3 {
  font-family: var(--display);
  color: var(--gold-light);
  margin: 14px 0 8px;
  font-size: 15px;
  letter-spacing: 2px;
}
.help-content h3:first-child { margin-top: 0; }
.help-content strong { color: var(--text); }

/* ===== 结算 ===== */
.result-shell {
  justify-content: center;
  text-align: center;
}
.result-score {
  font-family: var(--display);
  font-size: 72px;
  font-weight: 900;
  color: var(--gold);
  margin: 8px 0 20px;
  letter-spacing: 4px;
  text-shadow: 0 0 40px rgba(212, 175, 55, 0.3);
}
.result-label {
  font-size: 14px;
  color: var(--muted);
}
.breakdown-list {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  max-height: 180px;
  overflow-y: auto;
  margin: 8px 0;
  text-align: left;
}
.result-build {
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  margin-top: 8px;
}

/* ===== 藏经阁 ===== */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-content: start;
}
.shop-section {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.shop-section h3 {
  font-family: var(--display);
  font-size: 15px;
  color: var(--gold-light);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.shop-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px 14px;
  gap: 10px;
  transition: border-color 0.15s;
}
.shop-item:hover { border-color: rgba(212, 175, 55, 0.25); }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .name { font-weight: 600; font-size: 13px; }
.shop-item .desc { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.shop-item .price {
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
  font-weight: 600;
}
.empty-hint {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
}

/* 地图 */
.map-path {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  flex: 1;
  align-content: start;
  overflow: auto;
}
.map-realm {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 18px;
  border-top: 3px solid rgba(212, 175, 55, 0.25);
  transition: 0.15s;
}
.map-realm.current {
  border-color: rgba(212, 175, 55, 0.45);
  border-top-color: var(--gold);
  box-shadow: 0 8px 32px rgba(212, 175, 55, 0.1);
}
.map-realm.done {
  border-top-color: var(--green);
  opacity: 0.75;
}
.map-realm h3 {
  font-family: var(--display);
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--gold-light);
  letter-spacing: 2px;
}
.map-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-stage {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
}
.map-stage.current {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(212,175,55,0.2);
  background: rgba(212, 175, 55, 0.08);
}
.map-stage.done {
  border-color: rgba(61, 207, 154, 0.4);
  color: var(--green);
}
.map-stage small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; }
.modal {
  padding: 24px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h3 {
  font-family: var(--display);
  color: var(--gold-light);
  margin-bottom: 12px;
  font-size: 18px;
  letter-spacing: 2px;
}
.modal p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 14px;
}
.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 280px;
  overflow-y: auto;
}
.modal-opt {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-family: inherit;
  transition: 0.12s;
}
.modal-opt:hover {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.08);
}

/* Toast */
.toast {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(16, 20, 28, 0.96);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(480px, 90%);
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 24px rgba(212,175,55,0.15);
  letter-spacing: 1px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.28);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.45);
}

/* ===== 响应式：平板 / 窄桌面 ===== */
/* 详细移动端见 css/mobile.css（后加载覆盖） */
@media (max-width: 1100px) {
  .battle-desktop {
    grid-template-columns: 220px 1fr;
  }
  .title-layout {
    grid-template-columns: 1fr;
    padding: 28px 32px;
  }
  .title-side { max-width: 480px; }
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-grid { grid-template-columns: 1fr 1fr; }
  .map-path { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
}

/* ===== 模式 / 图鉴 / 成就 / 阅历 ===== */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.mode-card {
  background: linear-gradient(165deg, rgba(30, 36, 48, 0.95), rgba(14, 18, 26, 0.95));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
  font-family: inherit;
  color: var(--text);
}
.mode-card:hover { border-color: rgba(212,175,55,0.4); }
.mode-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212,175,55,0.35), 0 8px 28px rgba(212,175,55,0.12);
}
.mode-card.locked { opacity: 0.45; cursor: not-allowed; }
.mode-card h4 {
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold-light);
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.mode-card p { font-size: 12px; color: var(--muted); line-height: 1.55; }
.mode-card .tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  color: var(--gold-dim);
}

.achieve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  overflow: auto;
  flex: 1;
  align-content: start;
}
.achieve-card {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}
.achieve-card.locked {
  opacity: 0.4;
  filter: grayscale(0.6);
}
.achieve-card .name {
  font-family: var(--display);
  font-size: 15px;
  margin: 4px 0 6px;
  letter-spacing: 1px;
}
.achieve-card.done {
  border-color: rgba(61, 207, 154, 0.4);
}
.achieve-card .reward { color: var(--gold); margin-top: 6px; }

@media (max-width: 780px) {
  .mode-grid { grid-template-columns: 1fr; }
}

/* 分享码 */
.share-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  word-break: break-all;
  color: var(--gold-light);
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.5;
  text-align: left;
  user-select: text;
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--muted);
}
.history-row strong { color: var(--text); font-size: 13px; }
.history-row button {
  align-self: flex-start;
  margin-top: 4px;
}

/* 破境演出 */
.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(circle at center, rgba(40, 30, 10, 0.55), rgba(0,0,0,0.82));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.fx-overlay.show {
  display: flex;
  opacity: 1;
  animation: fx-in 1.6s ease forwards;
}
@keyframes fx-in {
  0% { opacity: 0; }
  15% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}
.fx-title {
  font-family: var(--calligraphy);
  font-size: clamp(48px, 10vw, 96px);
  color: var(--gold-light);
  letter-spacing: 16px;
  text-shadow: 0 0 40px rgba(212,175,55,0.6), 0 4px 20px rgba(0,0,0,0.5);
  transform: scale(0.6);
  animation: fx-title 1.2s cubic-bezier(0.22,1,0.36,1) forwards;
}
.fx-sub {
  margin-top: 12px;
  font-size: 16px;
  color: rgba(255,255,255,0.75);
  letter-spacing: 6px;
  opacity: 0;
  animation: fx-sub 1s 0.2s ease forwards;
}
.fx-burst {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.45), transparent 70%);
  animation: fx-burst 1s ease-out forwards;
}
@keyframes fx-title {
  0% { transform: scale(0.5); opacity: 0; }
  40% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes fx-sub {
  to { opacity: 1; }
}
@keyframes fx-burst {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(4); opacity: 0; }
}

.score-pop.big {
  font-size: 48px !important;
  color: #fff4c2 !important;
  text-shadow: 0 0 30px rgba(212,175,55,0.8);
}
