:root {
  --bg: #1b1714;
  --bg-top: #211410;
  --bg-bottom: #15100d;
  --ink: #080706;
  --ink-strong: #0f0b09;
  --nav-bg: #120d0a;
  --panel-low: #1f1712;
  --panel: rgba(42, 24, 18, 0.92);
  --panel-strong: rgba(76, 28, 20, 0.96);
  --line: rgba(228, 189, 108, 0.45);
  --line-strong: rgba(224, 181, 104, 0.45);

  --gold: #d6aa4f;
  --gold-soft: #f2dfab;
  --red: #8b1a1a;
  --red-bright: #b33a23;
  --red-dark: #7f1414;
  --green: #304738;
  --green-soft: #7aa47a;

  --text: #f6ecd1;
  --muted: #cbb68a;
  --text-inverse: #fff6e5;

  --q-white: #a8adb3;
  --q-green: #58b368;
  --q-blue: #4d9de0;
  --q-purple: #a06cd5;
  --q-orange: #e8862e;

  --hp: #c94f43;
  --mp: #4d7fa8;
  --exp: var(--gold);
  --success: #58b368;
  --warn: #e8a33d;
  --danger: #c94f43;

  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 28px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-pill: 999px;
  --radius: var(--r-md);

  --shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  --font-display: "Kaiti SC", "STKaiti", "KaiTi", "SimSun", serif;
}

/* Base Reset */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, color-mix(in srgb, var(--gold) 6%, transparent), transparent),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
a { color: var(--gold-soft); text-decoration: none; }
button, input { font-family: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

/* Layout Shell */
.page-shell {
  min-height: 100vh;
  padding: var(--sp-4) var(--sp-3) calc(80px + env(safe-area-inset-bottom));
}
.page-splash {
  display: flex; align-items: center; justify-content: center;
}
.screen {
  width: min(100%, 480px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* Typography */
.page-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; color: var(--gold-soft); }
.page-subtitle { font-size: var(--fs-md); color: var(--muted); margin-top: var(--sp-1); }
.eyebrow {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--gold); letter-spacing: 2px; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 12px; height: 1px; background: var(--gold); }
.section-title { font-size: var(--fs-lg); color: var(--gold-soft); font-weight: 600; }
.mini-copy { font-size: var(--fs-xs); color: var(--muted); }

/* Core Panel System (Replaces auth-card, splash-card, main-screen, section-card, etc) */
.page-panel, .section-card, .auth-card, .splash-card, .story-card, .main-screen {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow);
}
.panel-header {
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}

/* Layout Utilities */
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--muted); }
.field input, .chat-form textarea {
  width: 100%;
  padding: 0 var(--sp-3);
  min-height: 44px;
  background: color-mix(in srgb, var(--ink) 60%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-md);
  transition: all 0.2s;
}
.chat-form textarea { padding: var(--sp-3); min-height: 80px; resize: vertical; }
.field input:focus, .chat-form textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 20%, transparent);
}

/* Buttons */
.btn {
  display: inline-flex; justify-content: center; align-items: center;
  min-height: 44px; padding: 0 var(--sp-4);
  border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: transform 0.1s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(180deg, var(--red-bright), var(--red-dark));
  color: var(--text-inverse); border-color: var(--red);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 8px rgba(216,64,47,0.3);
}
.btn-secondary {
  background: var(--panel-low); color: var(--gold-soft); border-color: var(--line);
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary:hover { background: color-mix(in srgb, var(--gold) 10%, var(--panel-low)); }
.btn:disabled { cursor: not-allowed; opacity: 0.48; filter: none; transform: none; }

/* Common Chips & Tags */
.status-chip, .link-chip, .battle-tag, .mini-chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 var(--sp-2);
  border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--panel-low); color: var(--gold-soft); font-size: var(--fs-xs);
}
.link-chip { cursor: pointer; font-family: inherit; text-decoration: none; }

/* Tab Bar (Bottom Nav) */
.tabbar {
  position: fixed; right: 0; bottom: 0; left: 0; z-index: 100;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-1);
  width: min(100%, 480px); margin: 0 auto;
  padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--nav-bg) 95%, transparent);
  border-top: 1px solid var(--line); backdrop-filter: blur(10px);
}
.tabbar-item {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  height: 44px; border-radius: var(--r-sm);
  color: var(--muted); font-size: var(--fs-sm); text-decoration: none; border: none; background: transparent;
}
.tabbar-item.is-active {
  color: var(--gold-soft); font-weight: 600;
  background: color-mix(in srgb, var(--gold) 15%, transparent);
}

/* Tab Content Areas */
.tab-content { display: none; }
.tab-content.is-active { display: block; animation: fade-in 0.2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Shared Cards (Equip, Items, Classes) */
.class-picker, .equipment-preview-slots, .bag-grid, .quest-list, .monster-list, .skill-grid {
  display: grid; gap: var(--sp-3);
}
.equipment-preview-slots, .skill-grid { grid-template-columns: repeat(3, 1fr); }
.bag-grid { grid-template-columns: repeat(2, 1fr); }

.relic-item-card { min-height: 248px; }
.relic-item-card .btn { margin-top: auto; width: 100%; }
.relic-reward-copy { color: var(--gold-soft); font-size: var(--fs-sm); }
.relic-full-set {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line);
}
.relic-full-set .btn { flex: 0 0 auto; }

@media (max-width: 380px) {
  #relic-grid { grid-template-columns: 1fr; }
}

.class-option, .bag-item-card, .equip-slot-card, .quest-card, .monster-card, .detail-card, .info-point-card, .activity-entry-card {
  padding: var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-low);
  display: flex; flex-direction: column; gap: var(--sp-1);
}
.class-option.is-selected {
  border-color: var(--gold); background: color-mix(in srgb, var(--gold) 15%, var(--panel-low));
}
.detail-card, .info-point-card { align-items: center; text-align: center; }
.detail-card span, .info-point-card span, .monster-card p { font-size: var(--fs-xs); color: var(--muted); }
.detail-card strong, .info-point-card strong, .monster-card h4 { font-size: var(--fs-md); color: var(--gold-soft); }

/* Progress & Bars */
.hp-track, .attr-track, .tech-track {
  height: 8px; border-radius: var(--r-pill); background: var(--ink); overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
.hp-fill, .attr-fill, .tech-fill {
  display: block; height: 100%; border-radius: inherit;
}
.hp-fill { background: linear-gradient(90deg, var(--red-dark), var(--hp)); }
.attr-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--mp) 50%, var(--ink)), var(--mp)); }
#player-mp-bar, #enemy-mp-bar { background: linear-gradient(90deg, color-mix(in srgb, var(--mp) 50%, var(--ink)), var(--mp)); }
#quest-main-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 50%, var(--ink)), var(--gold)); }

/* Item Quality Colors */
.q-white, .item-white { border-left-color: var(--q-white); color: var(--q-white); }
.q-green, .item-green { border-left-color: var(--q-green); color: var(--q-green); }
.q-blue, .item-blue { border-left-color: var(--q-blue); color: var(--q-blue); }
.q-purple, .item-purple { border-left-color: var(--q-purple); color: var(--q-purple); }
.q-orange, .item-orange { border-left-color: var(--q-orange); color: var(--q-orange); }

/* Top Status Shell */
.top-status, .resource-strip {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3); background: var(--panel-low);
  border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: var(--sp-3);
}
.status-name { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; color: var(--gold-soft); }
.status-meta, .resource-strip span { font-size: var(--fs-xs); color: var(--muted); }
.status-power strong, .resource-strip strong { display: block; font-size: var(--fs-md); color: var(--text); margin-top: 2px; }

/* Marquee Shell */
.marquee-shell {
  overflow: hidden; padding: var(--sp-2) var(--sp-3);
  background: var(--panel-low); border: 1px solid var(--line); border-radius: var(--r-md);
  white-space: nowrap; margin-bottom: var(--sp-3);
}
.marquee-track {
  display: inline-block; animation: marquee-scroll 15s linear infinite;
}
.marquee-item { font-size: var(--fs-sm); color: var(--gold-soft); margin-right: var(--sp-5); }
@keyframes marquee-scroll { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* Battle Specifics */

/* Overlays / Shell UI */
.toast-layer {
  position: fixed; bottom: 100px; left: 0; right: 0; z-index: 2000;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); pointer-events: none;
}
.toast-item {
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill); font-size: var(--fs-sm);
  background: var(--panel-strong); border: 1px solid var(--gold); box-shadow: var(--shadow);
  color: var(--gold-soft); transition: opacity 0.3s, transform 0.3s;
}
.toast-danger { border-color: var(--danger); color: var(--danger); }
.toast-warn { border-color: var(--warn); color: var(--warn); }
.toast-item.is-leaving { opacity: 0; transform: translateY(-10px); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 13, 20, 0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.modal-card {
  width: 100%; max-width: 320px; padding: var(--sp-5);
  background: var(--panel-strong); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow); text-align: center;
}
.modal-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); }
.modal-actions .btn { flex: 1; }

.loading-bar {
  height: 4px; margin-top: var(--sp-4); border-radius: var(--r-pill); background: var(--line); overflow: hidden;
}
.loading-bar span {
  display: block; width: 40%; height: 100%; background: var(--gold); border-radius: inherit;
  animation: loading-slide 1.5s infinite ease-in-out;
}
@keyframes loading-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* Profile Detail */
.hero-banner { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.hero-avatar {
  width: 64px; height: 64px; border-radius: var(--r-md); background: var(--panel-strong);
  border: 1px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl); color: var(--gold-soft); font-family: var(--font-display);
}

/* Lists and Texts */
.plain-list { padding-left: var(--sp-4); margin: var(--sp-2) 0; color: var(--muted); font-size: var(--fs-sm); }
.page-note { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.auth-links { margin-top: var(--sp-4); text-align: center; font-size: var(--fs-sm); }
.form-message { min-height: 20px; font-size: var(--fs-sm); color: var(--warn); text-align: center; margin-top: var(--sp-2); }

/* Login keeps identity and credential entry separate so the first viewport stays compact. */
.auth-page {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: var(--sp-5) var(--sp-4);
  background-color: var(--nav-bg);
}
.auth-layout {
  width: min(100%, 880px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  align-items: center;
  gap: 56px;
}
.auth-intro {
  min-width: 0;
  padding: var(--sp-5) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.auth-title {
  margin-top: var(--sp-3);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.15;
  font-weight: 700;
  color: var(--gold-soft);
  letter-spacing: 0;
}
.auth-lead {
  margin-top: var(--sp-4);
  font-size: var(--fs-lg);
  color: var(--text);
}
.auth-era {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.auth-command {
  padding: var(--sp-5);
  background: rgba(35, 22, 17, 0.96);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
}
.auth-command-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.auth-command-header h2 {
  margin-top: var(--sp-2);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  line-height: 1.2;
  color: var(--gold-soft);
  letter-spacing: 0;
}
.auth-seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--red-bright);
  border-radius: var(--r-sm);
  color: var(--gold-soft);
  background: var(--red-dark);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
}
.auth-form { gap: var(--sp-3); }
.auth-form .field { gap: var(--sp-2); }
.auth-form .field input {
  min-height: 50px;
  border-radius: var(--r-sm);
  background: var(--ink-strong);
}
.auth-submit {
  min-height: 50px;
  margin-top: var(--sp-2);
  border-radius: var(--r-sm);
}
.auth-command .auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding-top: var(--sp-4);
  margin-top: var(--sp-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.auth-command .auth-links a {
  color: var(--gold-soft);
  font-weight: 600;
}
.auth-command .form-message { margin: var(--sp-2) 0 0; }

@media (max-width: 680px) {
  .auth-page {
    place-items: start center;
    padding: var(--sp-5) var(--sp-3);
  }
  .auth-layout {
    width: min(100%, 420px);
    grid-template-columns: 1fr;
    gap: var(--sp-5);
  }
  .auth-intro { padding: var(--sp-3) 0 var(--sp-4); }
  .auth-title { font-size: var(--fs-xl); }
  .auth-lead { margin-top: var(--sp-3); font-size: var(--fs-md); }
  .auth-era { margin-top: var(--sp-2); }
  .auth-command { padding: var(--sp-4); }
}

@media (max-width: 360px) {
  .auth-page { padding-inline: var(--sp-2); }
  .auth-layout { gap: var(--sp-4); }
  .auth-title { font-size: var(--fs-lg); }
  .auth-command { padding: var(--sp-3); }
}

/* Activity / Features */
.activity-entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.activity-entry-card { text-align: center; text-decoration: none; padding: var(--sp-2); border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-low); }
.activity-entry-card strong { display: block; font-size: var(--fs-md); color: var(--gold-soft); }
.activity-entry-card span { font-size: var(--fs-xs); color: var(--muted); }
.badge-dot { position: relative; }
  .badge-dot::after { content: '新'; position: absolute; top: -8px; right: -12px; font-size: var(--fs-xs); background: var(--red-bright); color: var(--text-inverse); padding: 0 var(--sp-1); border-radius: var(--r-pill); }

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }

/* Grid Fallbacks for Existing Classes */
.currency-grid, .detail-grid, .profile-core, .equipment-grid, .guild-summary-grid, .chat-channel-tabs, .quest-tabs {
  display: grid; gap: var(--sp-2);
}
.currency-grid, .detail-grid, .equipment-grid, .guild-summary-grid, .chat-channel-tabs, .quest-tabs { grid-template-columns: repeat(3, 1fr); }
.profile-core, .social-entry-grid { grid-template-columns: repeat(2, 1fr); display: grid; gap: var(--sp-2); }

.currency-card { text-align: center; padding: var(--sp-2); background: var(--panel-low); border: 1px solid var(--line); border-radius: var(--r-sm); }
.currency-card span { font-size: var(--fs-xs); color: var(--muted); }
.currency-card strong { display: block; font-size: var(--fs-md); color: var(--gold-soft); }

.social-entry-card { padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-low); text-decoration: none; display: flex; flex-direction: column; gap: var(--sp-1); }
.social-entry-card strong { color: var(--gold-soft); font-size: var(--fs-md); }
.social-entry-card p { color: var(--muted); font-size: var(--fs-xs); margin: 0; }

.quest-tab, .chat-channel-tab {
  height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel-low);
  color: var(--muted); font-size: var(--fs-sm); cursor: pointer;
}
.quest-tab.is-active, .chat-channel-tab.is-active {
  background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold-soft); border-color: var(--gold);
}

.quest-progress-head { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-sm); margin-bottom: var(--sp-1); }
.quest-progress-head strong { color: var(--gold-soft); }
.quest-progress-head span { color: var(--muted); }

.info-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }

/* Battle & Monsters Specific */
.monster-meta { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-1); }
.dungeon-heading { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.dungeon-list, .dungeon-wave-list { display: grid; gap: var(--sp-2); }
.dungeon-entry, .dungeon-wave-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.dungeon-entry strong, .dungeon-wave-row strong { color: var(--gold-soft); }
.dungeon-entry p, .dungeon-wave-row span { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--sp-1); }
.dungeon-entry .btn { flex: 0 0 auto; min-width: 72px; }

.map-travel-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--sp-3);
}
.map-select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-strong);
  color: var(--text);
  font-size: var(--fs-md);
}
.map-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 20%, transparent);
}
.map-travel-control .btn { min-width: 104px; }
.map-travel-detail {
  display: grid;
  gap: var(--sp-1);
  min-height: 72px;
  padding-top: var(--sp-3);
  margin-top: var(--sp-3);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-sm);
}
.map-travel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.map-travel-meta strong { color: var(--gold-soft); font-size: var(--fs-md); }

@media (max-width: 480px) {
  .map-travel-control { grid-template-columns: 1fr; }
  .map-travel-control .btn { width: 100%; }
}
.status-badges { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }
.monster-card h4 { color: var(--gold-soft); font-size: var(--fs-md); margin-bottom: var(--sp-1); }
.monster-card p { color: var(--muted); font-size: var(--fs-xs); }

.page-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); margin-top: var(--sp-4); }

.attr-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.attr-row label { width: 40px; color: var(--muted); font-size: var(--fs-xs); }
.attr-row .attr-track { flex: 1; }
.attr-row span { width: 40px; text-align: right; color: var(--gold-soft); font-size: var(--fs-xs); }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}
.skill-grid .btn, #action-item {
  width: 100%;
}

/* Monster Card specific tweaks */
.monster-card .header-row {
  margin-bottom: 0;
}
.monster-card .btn {
  margin-top: var(--sp-2);
}

/* Fix for buttons inside monster cards */
.monster-card .btn {
  width: 100%;
  margin-top: var(--sp-2);
}

.header-row h3 {
  font-size: var(--fs-lg);
  color: var(--gold-soft);
  font-weight: 600;
  margin: 0;
}

/* Battle Layout Polish */
/* Bag & Equipment Layout Fixes */
.equipment-grid { grid-template-columns: repeat(2, 1fr); } /* Changed from 3 to 2 for better button fit */
.equip-slot-card .btn, .bag-item-card .btn {
  width: 100%;
  margin-top: auto; /* Push button to bottom */
}
.equip-slot-card {
  height: 100%; /* Make them equal height */
}
.bag-item-card {
  height: 100%;
}
.equip-slot-card p, .bag-item-card p {
  color: var(--muted);
  font-size: var(--fs-xs);
  margin-bottom: var(--sp-1);
}
.bag-item-card h4, .equip-slot-card strong {
  color: var(--gold-soft);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-1);
}
.bag-item-card .header-row, .equip-slot-card .header-row {
  margin-bottom: 0;
}
.bag-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-bottom: var(--sp-2);
}
.equip-slot-name {
  font-size: var(--fs-xs);
  color: var(--gold);
  margin-bottom: var(--sp-1);
}
.equip-slot-card.is-empty {
  border-style: dashed;
  opacity: 0.7;
}

@media (min-width: 400px) {
  .equipment-grid { grid-template-columns: repeat(3, 1fr); } /* 3 cols on wider screens */
}

/* Modal actions fix for multiple buttons */
.modal-actions {
  flex-direction: column;
}

.inline-actions {
  display: flex;
  gap: var(--sp-2);
}
.inline-actions .btn {
  min-height: 32px;
  font-size: var(--fs-xs);
  padding: 0 var(--sp-2);
}

.bag-grid { grid-template-columns: repeat(2, 1fr); }

/* Prevent horizontal scroll from long words like "launch_blue_set_chest" */
.bag-item-card h4, .equip-slot-card strong, .bag-item-card p, .equip-slot-card p {
  word-break: break-all;
  overflow-wrap: break-word;
}

.bag-item-card h4, .equip-slot-card strong {
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-row {
  flex-wrap: wrap;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Compatibility layer: pages were already migrated to these classes; keep them styled while the token system is compacted. */
.page-stack,
.page-grid,
.section-list,
.announcement-list,
.ranking-list,
.chat-layout,
.chat-messages,
.recharge-tier-list,
.guild-tech-grid,
.achievement-groups,
.skill-tree-grid,
.skill-tree-column,
.equipment-preview,
.quest-progress-card,
.profile-actions {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
}

.page-grid,
.announcement-list,
.ranking-list,
.chat-messages,
.recharge-tier-list,
.guild-tech-grid,
.achievement-groups,
.skill-tree-grid {
  margin-top: var(--sp-3);
}

.empty-state,
.page-info,
.loading-state,
.gm-empty,
.gm-loading {
  padding: var(--sp-5) var(--sp-4);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--panel-low) 86%, transparent);
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.empty-state .btn {
  margin-top: var(--sp-3);
}

.panel-subtitle,
.page-note,
.modal-copy,
.text-muted {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.text-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.full-span {
  grid-column: 1 / -1;
}

.compact {
  gap: var(--sp-2);
}

.profile-snippet,
.profile-core,
.hero-panel,
.attr-chart,
.power-pill,
.equipment-preview,
.quest-progress-card,
.achievement-group-card,
.announcement-card,
.ranking-row,
.chat-message-card,
.recharge-tier-card,
.guild-tech-card,
.member-card,
.skill-node-card,
.mentor-candidate,
.exchange-row,
.unlock-row,
.speed-rank-row {
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--panel-low) 90%, transparent);
  min-width: 0;
}

.profile-core,
.attr-chart,
.skill-tree-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-actions,
.skill-node-actions,
.modal-actions,
.gm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.profile-actions .btn,
.skill-node-actions .btn,
.gm-modal-actions .gm-btn {
  flex: 1 1 120px;
}

.class-option {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
}

.class-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.class-option-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.equipment-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--gold-soft);
  font-size: var(--fs-xs);
}

.bag-item-card,
.equip-slot-card {
  border-left-width: 3px;
}

.bag-item-action,
.equip-action,
.skill-action {
  width: 100%;
  min-height: 36px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-sm);
}

.hp-fill.is-danger {
  background: linear-gradient(90deg, var(--red-dark), var(--danger));
  animation: danger-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes danger-pulse {
  from { filter: brightness(0.9); }
  to { filter: brightness(1.25); }
}


.tab-panel {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
}

.ranking-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
}

.ranking-row.is-self,
.recharge-tier-card.is-featured {
  border-color: var(--gold);
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 12%, var(--panel-low)), var(--panel-low));
}

.ranking-row__left {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-2);
}

.ranking-row__right {
  display: grid;
  gap: var(--sp-1);
  text-align: right;
}

.ranking-rank,
.speed-rank-medal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--gold) 8%, transparent);
  color: var(--gold-soft);
  font-weight: 700;
}

.chat-message-card {
  display: grid;
  gap: var(--sp-2);
}

.chat-message-card.is-self {
  border-color: color-mix(in srgb, var(--green-soft) 50%, transparent);
}

.chat-message-card.system {
  border-color: var(--gold);
}

.chat-message-meta,
.announcement-meta,
.member-meta,
.recharge-tier-head,
.guild-tech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.recharge-price,
.season-countdown,
.speed-rank-level {
  color: var(--gold);
  font-size: var(--fs-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.recharge-bonus {
  color: var(--warn);
  font-size: var(--fs-xs);
}

.reward-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px var(--sp-1) 0 0;
  padding: 0 var(--sp-2);
  border: 1px solid color-mix(in srgb, var(--q-blue) 60%, transparent);
  border-radius: var(--r-sm);
  color: var(--q-blue);
  background: color-mix(in srgb, var(--q-blue) 12%, transparent);
  font-size: var(--fs-xs);
}

.reward-chip.q-white { border-color: var(--q-white); color: var(--q-white); }
.reward-chip.q-green { border-color: var(--q-green); color: var(--q-green); }
.reward-chip.q-purple { border-color: var(--q-purple); color: var(--q-purple); }
.reward-chip.q-orange { border-color: var(--q-orange); color: var(--q-orange); }

.gift-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-2);
}

.gift-cell {
  display: flex;
  min-width: 0;
  min-height: 116px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-low);
}

.gift-cell strong {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--gold-soft);
  line-height: 1.25;
}

.gift-cell-day,
.gift-cell-tag,
.gift-cell-claim-btn {
  font-size: var(--fs-xs);
}

.gift-cell-claim-btn {
  min-height: 28px;
  border: 1px solid var(--gold);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--gold);
}

.gift-cell-tag {
  color: var(--success);
}

.milestone-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: var(--sp-4) 0;
}

.milestone-track::before {
  content: "";
  position: absolute;
  top: 9px;
  left: var(--sp-2);
  right: var(--sp-2);
  height: 3px;
  background: color-mix(in srgb, var(--line) 55%, transparent);
}

.milestone-node {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: var(--sp-1);
  color: var(--muted);
  font-size: var(--fs-xs);
  text-align: center;
}

.milestone-dot {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--panel-low);
}

.milestone-node.is-reached .milestone-dot {
  border-color: var(--gold);
  background: var(--gold);
}

.mentor-candidate,
.exchange-row,
.unlock-row,
.speed-rank-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.mentor-candidate-info,
.exchange-info,
.unlock-info,
.speed-rank-info {
  flex: 1 1 auto;
  min-width: 0;
}

.mentor-candidate-info strong,
.exchange-info strong,
.unlock-info strong,
.speed-rank-info strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-candidate-info span,
.exchange-info span,
.unlock-info span,
.speed-rank-info span {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.unlock-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-low);
}

.unlock-icon.is-open,
.unlock-countdown.is-done {
  color: var(--success);
}

.unlock-icon.is-locked {
  color: var(--warn);
}

.unlock-countdown {
  color: var(--gold-soft);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.speed-rank-medal.is-top1 { background: var(--gold); color: var(--ink); }
.speed-rank-medal.is-top2 { background: color-mix(in srgb, var(--q-white) 70%, var(--ink)); color: var(--ink); }
.speed-rank-medal.is-top3 { background: var(--red); color: var(--text-inverse); }

.skill-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.skill-node-card {
  display: grid;
  gap: var(--sp-2);
}

.top-marquee {
  margin-bottom: var(--sp-3);
}

/* GM pages share game.css in debug/static mode; these classes must remain self-contained. */
.gm-app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.gm-nav {
  padding: var(--sp-4);
  background: var(--nav-bg);
  border-right: 1px solid var(--line);
}

.gm-nav-brand {
  margin-bottom: var(--sp-4);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.gm-nav-section {
  display: grid;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.gm-main {
  min-width: 0;
  padding: var(--sp-4);
}

.gm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.gm-user-info {
  color: var(--muted);
  font-size: var(--fs-sm);
}

.gm-logout {
  color: var(--gold-soft);
}

.gm-card {
  margin-bottom: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.gm-card-title {
  margin-bottom: var(--sp-3);
  color: var(--gold-soft);
  font-size: var(--fs-lg);
}

.gm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.gm-form-row {
  display: grid;
  gap: var(--sp-1);
  min-width: 0;
}

.gm-form-row input,
.gm-form-row select,
.gm-form-row textarea,
.gm-form-inline input,
.gm-form-inline select {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--ink-strong);
  color: var(--text);
  font-size: var(--fs-sm);
}

.gm-form-row textarea {
  min-height: 96px;
  padding-top: var(--sp-2);
}

.gm-form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--sp-2);
}

.gm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-low);
  color: var(--gold-soft);
  font-weight: 600;
  cursor: pointer;
}

.gm-btn-sm {
  min-height: 32px;
  padding: 0 var(--sp-2);
  font-size: var(--fs-xs);
}

.gm-btn-primary {
  border-color: var(--red);
  background: linear-gradient(180deg, var(--red-bright), var(--red-dark));
  color: var(--text-inverse);
}

.gm-btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.gm-alert {
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel-low);
}

.gm-alert-error {
  border-color: var(--danger);
  color: var(--danger);
}

.gm-alert-success {
  border-color: var(--success);
  color: var(--success);
}

.gm-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs-sm);
}

.gm-table th,
.gm-table td {
  padding: var(--sp-2);
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  text-align: left;
}

.gm-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.gm-tag-green { border-color: var(--success); color: var(--success); }
.gm-tag-red { border-color: var(--danger); color: var(--danger); }
.gm-tag-gold { border-color: var(--gold); color: var(--gold); }
.gm-tag-muted { color: var(--muted); }

.gm-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.gm-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: color-mix(in srgb, var(--ink) 76%, transparent);
}

.gm-modal {
  width: min(100%, 520px);
  max-height: 90vh;
  overflow: auto;
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.reward-builder-list,
.reward-builder-row {
  display: grid;
  gap: var(--sp-2);
}

.reward-builder-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
}

@media (max-width: 420px) {
  .grid-3,
  .currency-grid,
  .detail-grid,
  .guild-summary-grid,
  .chat-channel-tabs,
  .quest-tabs,
  .info-points,
  .activity-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-core,
  .attr-chart,
  .social-entry-grid,
  .skill-tree-grid,
  .page-actions {
    grid-template-columns: 1fr;
  }

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

  .gm-app {
    display: block;
  }

  .gm-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .gm-form-grid,
  .reward-builder-row {
    grid-template-columns: 1fr;
  }
}

/* 主界面重排：状态栏与主体同宽、去掉外层重复边框、入口宫格、人物/资源紧凑行 */
[data-shell-top], .top-marquee { width: min(100%, 480px); margin-left: auto; margin-right: auto; }
.top-marquee[hidden] { display: none; }
.top-status { padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
.resource-strip { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
.resource-strip strong { font-size: var(--fs-sm); white-space: nowrap; }
.main-screen { background: none; border: 0; box-shadow: none; padding: 0; }
.tab-content { scroll-margin-top: var(--sp-2); }
#map-atlas h4 { margin: var(--sp-3) 0 var(--sp-1); }
.compact-list .header-row { padding: var(--sp-1) 0; border-bottom: 1px dashed var(--line); }
.compact-list .btn { min-height: 0; padding: 4px 12px; font-size: var(--fs-sm); }
.compact-list .header-row > span { display: flex; gap: var(--sp-1); align-items: center; }
.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin: var(--sp-1) 0 var(--sp-3); }
.entry-grid a {
  text-align: center; padding: var(--sp-2) 0; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-low); color: var(--gold-soft); text-decoration: none; font-size: var(--fs-sm);
}
[hidden] { display: none !important; }
.monster-card { padding: var(--sp-2) var(--sp-3); }
.monster-card h4 { margin: 0; }
.monster-card .btn { width: auto; min-height: 0; margin: 0; padding: 6px 18px; }
.monster-card p { margin-top: 2px; }

/* 手机上操作区不再强制一列：小按钮并排，主按钮拉伸填满 */
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.page-actions > .btn { flex: 1 1 auto; }
.panel-header + .page-actions { margin-top: 0; }
/* 排行：一行一名 */
.ranking-row { padding: 6px var(--sp-3); }
.ranking-row__right { gap: 0; }
.ranking-row__right .mini-copy { display: none; }
.ranking-rank { width: 28px; height: 28px; }
.ranking-row__left { grid-template-columns: 28px minmax(0, 1fr); }
.ranking-row__left > div:last-child { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.ranking-row__left strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 紧凑卡片：操作按钮放在标题行右侧 */
.compact-card { padding: var(--sp-2) var(--sp-3); }
.compact-card .header-row { gap: var(--sp-2); }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-1); }
.card-actions .btn { min-height: 0; padding: 4px 12px; font-size: var(--fs-sm); width: auto; }
/* 页内输入框/下拉与弹窗输入统一深色样式（此前该类无样式，显示为浏览器默认白底） */
.shell-prompt-input {
  min-height: 40px; padding: 0 var(--sp-3); flex: 1 1 140px; min-width: 0;
  background: color-mix(in srgb, var(--ink) 60%, transparent); border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text); font-size: var(--fs-md);
}
.shell-prompt-input:focus { outline: none; border-color: var(--gold); }
/* 进度条填充（此前 tech-fill 无背景色，帮派科技、世界Boss血条等看起来是一条黑条） */
.tech-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 45%, var(--ink)), var(--gold)); }

/* 战斗页：一屏布局。敌上我下，日志固定高度内部滚动，操作区固定在屏幕底部，拇指够得到“普攻”。 */
.page-shell.is-battle { padding-bottom: 0; }
.battle-screen { display: flex; flex-direction: column; gap: var(--sp-2); height: calc(100dvh - var(--sp-4)); padding-bottom: calc(var(--battle-dock, 150px) + env(safe-area-inset-bottom)); }
.battle-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.battle-alert:empty { display: none; }
.battle-unit { display: grid; gap: 6px; padding: var(--sp-2) var(--sp-3); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: var(--r-md); background: var(--panel-low); }
.battle-unit.is-enemy { border-color: color-mix(in srgb, var(--red) 45%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--red) 10%, var(--panel-low)), var(--panel-low)); }
.battle-unit-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.battle-unit-head strong { color: var(--gold-soft); font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.battle-bar { position: relative; height: 18px; border-radius: var(--r-pill); background: var(--ink); overflow: hidden; }
.battle-bar.is-mp { height: 12px; }
.battle-bar > span { position: absolute; inset: 0 auto 0 0; width: 0; height: 100%; border-radius: inherit; transition: width .3s; }
.battle-bar em { position: relative; display: block; font-style: normal; font-size: 12px; line-height: 18px; text-align: center; color: #fff; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000; }
.battle-bar.is-mp em { font-size: 10px; line-height: 12px; }
.battle-unit .status-badges { margin-top: 0; }
.battle-unit .status-badges:empty { display: none; }
.battle-log { flex: 1 1 0; min-height: 84px; overflow-y: auto; margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-2) calc(var(--sp-3) + 1.2em); background: var(--ink); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-xs); line-height: 1.5; }
.battle-log li:first-child { color: var(--text); }
.battle-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; width: min(100%, 480px); margin: 0 auto; padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--nav-bg) 96%, transparent); border-top: 1px solid var(--gold); backdrop-filter: blur(8px); }
.battle-field, .battle-result { display: grid; gap: var(--sp-2); }
.battle-field[hidden], .battle-result[hidden] { display: none; }
.battle-field .skill-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 96px; overflow-y: auto; }
.battle-field .skill-grid:empty { display: none; }
.battle-field .skill-grid .btn { min-height: 40px; padding: 4px 6px; font-size: var(--fs-xs); line-height: 1.25; white-space: normal; min-width: 0; }
.battle-action-row { display: flex; gap: var(--sp-2); }
.battle-action-row .btn { flex: 1; min-height: 48px; }
.battle-action-row .btn[hidden] { display: none; }
#action-flee { flex: 0 0 30%; }
#action-attack { font-size: var(--fs-lg); }
.battle-turn { text-align: center; }
.battle-result-title { color: var(--gold-soft); font-family: var(--font-display); font-size: var(--fs-lg); }

/* 页面分页签（utils.js initTabs） */
.page-tabs { position: sticky; top: 0; z-index: 20; display: flex; gap: 4px; padding: 6px; margin: 0 calc(-1 * var(--sp-1)); background: color-mix(in srgb, var(--nav-bg) 94%, transparent); border: 1px solid var(--line); border-radius: var(--r-md); backdrop-filter: blur(8px); overflow-x: auto; scrollbar-width: none; }
.page-tabs[hidden] { display: none; }
.page-tab { flex: 1 0 auto; min-height: 36px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-size: var(--fs-sm); white-space: nowrap; }
.page-tab[aria-selected="true"] { background: color-mix(in srgb, var(--gold) 22%, var(--panel-strong)); color: var(--gold-soft); font-weight: 700; }
.page-tab[hidden], .tab-off { display: none !important; }

/* 页面标题行：标题与“返回/刷新”同一行，副标题与说明在手机上省略，把首屏留给内容。 */
.panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: 0; padding-bottom: var(--sp-2); }
.panel-header .eyebrow, .panel-header .page-subtitle { display: none; }
.panel-header .page-title { font-size: var(--fs-lg); }
.panel-header .page-actions { margin: 0; flex-wrap: nowrap; }

/* 商城：充值档位两列，概要卡三列，减少一屏内的纵向占用。 */
#shop-tier-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.shop-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

#shop-tier-list .recharge-tier-head { flex-direction: column; align-items: flex-start; gap: 4px; }
#shop-tier-list .recharge-price { font-size: var(--fs-md); }

/* 技能：一技能一行，操作按钮靠右。 */
.skill-row { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); }
.skill-row-info { flex: 1; min-width: 0; }
.skill-row-info h4 { margin: 0; font-size: var(--fs-sm); }
.skill-row-info h4 small { color: var(--muted); font-weight: 400; }
.skill-row-info p { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.skill-row .skill-node-actions { flex: none; margin: 0; }
.skill-row .skill-node-actions:empty { display: none; }
.skill-row .skill-node-actions .btn { flex: none; min-width: 64px; min-height: 36px; padding: 0 var(--sp-3); }
.skill-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 邮件：时间与领取按钮同一行。 */
.mail-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.mail-foot .btn { flex: none; min-height: 36px; padding: 0 var(--sp-3); }

#mail-claim-all { min-height: 32px; padding: 0 var(--sp-3); }

/* 已装备区：卡片压矮，强化/卸下并排。 */
#equipped-grid .equip-slot-card { min-height: 0; padding: var(--sp-2) var(--sp-3); gap: 4px; }
#equipped-grid .card-actions { display: flex; gap: 6px; margin-top: 4px; }
#equipped-grid .card-actions .btn { flex: 1; min-height: 34px; padding: 0 4px; font-size: var(--fs-sm); }

