:root {
  --bg: #fff5f9;
  --bg-soft: #ffe8f2;
  --ink: #45353f;
  --muted: #756570;
  /* 字号阶梯（基准 16px，便于全局放大） */
  --text-2xs: 0.75rem;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --line-tight: 1.35;
  --line-normal: 1.5;
  --line-relaxed: 1.6;
  --pink: #ff9ec7;
  --pink-deep: #ff7eb3;
  --pink-light: #ffd4e8;
  --lavender: #e8d4ff;
  --tape: #ff9ec7;
  --up: #ff6b8a;
  --down: #6ecf9a;
  --card: #ffffff;
  --border: #f5c6dc;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 20px rgba(255, 126, 179, 0.18);
  --shadow-soft: 0 2px 10px rgba(255, 182, 212, 0.35);
  --font-serif: 'M PLUS Rounded 1c', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-sans: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(255, 214, 232, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 15%, rgba(232, 212, 255, 0.4), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(255, 200, 220, 0.25), transparent 45%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 8l2.5 7.5H40l-6 4.5 2.5 7.5L30 23l-6.5 4.5 2.5-7.5-6-4.5h7.5z' fill='%23ffc8dd' fill-opacity='0.35'/%3E%3C/svg%3E");
  min-height: 100vh;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(180deg, #fff 0%, #fff8fc 100%);
  color: var(--ink);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--pink-light);
  box-shadow: var(--shadow-soft);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.logo-text {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 700;
}

.nav-center {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 2px solid var(--pink-light);
  border-radius: 999px;
  background: var(--bg-soft);
}
.nav-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.nav-btn.active {
  background: linear-gradient(135deg, #fff 0%, var(--pink-light) 100%);
  color: var(--pink-deep);
  border-color: var(--pink);
  box-shadow: var(--shadow-soft);
}
.nav-btn-guide {
  margin-left: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  border: 2px solid var(--tape);
  background: linear-gradient(135deg, var(--tape) 0%, #e8d4b8 100%);
  color: #5a3d20;
  box-shadow: 0 2px 0 rgba(90, 61, 32, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}
.nav-btn-guide:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(90, 61, 32, 0.2);
}
.nav-btn-guide:active {
  transform: translateY(0);
}

.user-actions { display: flex; gap: 12px; align-items: center; }
.bread-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(145deg, #ffe8f2, var(--pink-light));
  border: 2px solid var(--pink);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--pink-light);
  background: var(--bg-soft);
  object-fit: contain;
  object-position: center bottom;
  flex-shrink: 0;
}
.welcome { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.header-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
}
.btn-portrait-toggle {
  min-width: 44px;
  font-size: var(--text-sm);
  padding: 6px 10px;
}
.btn-portrait-toggle.is-off {
  color: var(--muted);
  background: var(--bg);
  border-style: dashed;
}

.character-dock--portrait-hidden .character-dock-portrait-wrap {
  display: none;
}
.character-dock--portrait-hidden .character-dock-inner:hover .character-dock-portrait-wrap {
  transform: none;
}

.skip-link {
  position: absolute; left: -9999px; top: auto; z-index: 3000;
  padding: 10px 16px; background: var(--card); color: var(--ink);
  font-weight: 700; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--border);
}
.skip-link:focus { left: 16px; top: 16px; }

:focus-visible {
  outline: 2px solid var(--tape);
  outline-offset: 2px;
}

.mobile-tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}
.mobile-tab-bar[hidden] { display: none !important; }
.mobile-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: var(--text-xs); font-weight: 700; cursor: pointer;
}
.mobile-tab.active { color: var(--ink); background: var(--bg); border: 1px dashed var(--border); }
.mobile-tab-icon { font-size: 1.25rem; }

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}
#screen-game[hidden],
#screen-rank[hidden] {
  display: none !important;
}

body.in-game #screen-game:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.view-rank #screen-game {
  display: none !important;
}

body.view-rank #screen-rank {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: min(720px, calc(100vh - 156px));
}

body.view-rank .character-dock {
  display: none !important;
}

.rank-page {
  background: linear-gradient(180deg, #fff 0%, #fff8fc 100%);
  border: 2px solid var(--pink-light);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
}

body.view-rank .rank-page {
  max-width: none;
  flex: 1 1 auto;
}
.rank-page-title {
  font-family: var(--font-serif);
  font-size: 24px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.rank-disclaimer {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: var(--line-relaxed);
  margin-bottom: 12px;
  text-align: center;
}
.rank-scope-nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--pink-light);
}
.rank-scope-nav button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.rank-scope-nav button.active {
  background: #fff;
  color: var(--pink-deep);
  border-color: var(--pink);
  box-shadow: var(--shadow-soft);
}
.rank-scope-hint {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
}

.entry-overlay { z-index: 1050; }
.entry-overlay[hidden] { display: none !important; }
.entry-overlay.show { display: flex; }
.entry-modal { max-width: 560px; width: 92%; margin: auto; }
.welcome-card {
  position: relative;
  background: linear-gradient(165deg, #fff 0%, #fff8fc 45%, #ffeef5 100%);
  padding: 40px 32px;
  border-radius: calc(var(--radius) + 4px);
  border: 2px solid var(--pink-light);
  text-align: center;
  box-shadow: var(--shadow), 0 0 0 6px rgba(255, 200, 220, 0.25);
  overflow: visible;
}

.kawaii-card::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 14px;
  background: var(--pink);
  border-radius: 0 0 8px 8px;
  opacity: 0.85;
}

.card-deco {
  position: absolute;
  font-size: 18px;
  color: var(--pink);
  opacity: 0.55;
  pointer-events: none;
}
.card-deco-tl { top: 14px; left: 16px; }
.card-deco-tr { top: 12px; right: 18px; font-size: 16px; }
.card-deco-bl { bottom: 18px; left: 20px; font-size: 15px; }
body.entry-open { overflow: hidden; }
.welcome-card h1 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: 28px;
  margin-bottom: 12px;
}
.welcome-card p { color: var(--muted); margin-bottom: 20px; }
.entry-lead { font-size: 15px; line-height: 1.6; margin-bottom: 16px; }
.entry-disclaimer-primary {
  text-align: left;
  margin: 0 auto 14px;
  padding: 12px 16px;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  border: 2px dashed var(--pink-light);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}
.chart-mood-disclaimer {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--line-relaxed);
  margin: 6px 0 0;
  padding: 0 4px;
  text-align: center;
}
.entry-disclaimer {
  text-align: left;
  margin: 0 auto 24px;
  padding: 12px 16px;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-sm);
  border: 2px dashed var(--pink-light);
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.entry-disclaimer li { margin: 6px 0; }
.entry-legal {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
}
.entry-legal input { margin-top: 4px; flex-shrink: 0; }
.entry-legal a { color: var(--ink); font-weight: 700; }

.about-meta { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

.rank-loss { font-weight: 800; color: var(--up); font-variant-numeric: tabular-nums; }

.btn-entry-start { width: 100%; max-width: 280px; padding: 14px 24px; font-size: 16px; }
.btn-entry-start:disabled { opacity: 0.45; cursor: not-allowed; }
.sim-disclaimer {
  font-size: 12px;
  color: var(--muted);
  margin: -4px 0 12px;
}
/* about.html */
.about-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.about-header {
  text-align: center;
  padding: 32px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.about-back {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.about-back:hover { color: var(--ink); text-decoration: underline; }
.about-header h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin-bottom: 6px;
}
.about-subtitle { color: var(--muted); font-size: 15px; }
.about-main {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  width: 100%;
}
.about-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.about-card-muted { background: var(--bg); }
.about-card-highlight {
  border-color: var(--pink);
  background: linear-gradient(180deg, #fff 0%, var(--pink-pale, #fff5f8) 100%);
}
.about-card h2 {
  font-family: var(--font-serif);
  font-size: 18px;
  margin-bottom: 12px;
}
.about-card p,
.about-card li {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
}
.about-card ul {
  padding-left: 1.25em;
}
.about-card li { margin: 8px 0; }
.about-card code {
  font-size: 0.92em;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}
.footer-link,
.entry-about-link a {
  color: var(--tape);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-link:hover,
.entry-about-link a:hover { color: var(--ink); }
.entry-about-link {
  margin: 0 0 16px;
  font-size: 13px;
}
.entry-about-link a { color: var(--muted); }

.name-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  margin-bottom: 20px; max-width: 520px; margin-left: auto; margin-right: auto;
}
.name-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
  font-weight: 700; color: var(--ink); cursor: pointer;
}
.name-card-avatar {
  width: 56px; height: 56px; border-radius: 12px;
  object-fit: contain; object-position: center bottom;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}
.name-card:hover { box-shadow: var(--shadow); }
.name-card.selected { border-style: dashed; background: var(--card); }

.bread-btn.claimed { filter: grayscale(0.4); opacity: 0.8; }

.btn-primary, .btn-secondary {
  padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  color: #fff;
  border: 2px solid #ff8fb8;
  box-shadow: 0 4px 14px rgba(255, 126, 179, 0.45);
  text-shadow: 0 1px 0 rgba(180, 60, 100, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 126, 179, 0.5);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-secondary {
  background: #fff;
  color: var(--pink-deep);
  border: 2px dashed var(--pink-light);
}
.btn-sm { padding: 8px 14px; font-size: 13px; margin-right: 6px; }
.btn-text {
  background: none; border: none; color: var(--muted);
  font-weight: 700; cursor: pointer; padding: 8px;
}
.btn-text:hover { color: var(--ink); }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 16px;
  flex: 1 1 auto;
  min-height: min(680px, calc(100vh - 156px));
  align-items: stretch;
}
.main-chart-area {
  background: linear-gradient(180deg, #fff 0%, #fffbfd 100%);
  border-radius: var(--radius);
  border: 2px solid var(--pink-light);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: hidden;
}
.main-chart-area > *:not(.chart-container) {
  flex: 0 0 auto;
}
.main-chart-area > .chart-container {
  flex: 1 1 auto;
  min-height: 0;
}
.chart-header {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, var(--bg-soft) 100%);
  overflow: hidden;
}
.chart-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.chart-header-main--empty {
  align-items: flex-start;
}
.chart-header-brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}
.stock-name {
  font-family: var(--font-serif);
  font-weight: 800;
  color: var(--ink);
  font-size: var(--text-md);
  line-height: var(--line-tight);
}
.stock-code {
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--pink-light);
}
.chart-header-quote {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.current-price {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.current-price.is-up { color: var(--up); }
.current-price.is-down { color: var(--down); }
.chart-header-change {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.2;
}
.chart-header-change.is-up {
  color: var(--up);
  background: rgba(255, 107, 138, 0.1);
}
.chart-header-change.is-down {
  color: var(--down);
  background: rgba(110, 207, 154, 0.14);
}
.chart-header-change .change-sep {
  font-weight: 600;
  opacity: 0.55;
}
.chart-header-change .change-abs {
  font-size: var(--text-xs);
  font-weight: 700;
}
.chart-header-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--pink-light);
}
.chart-stat-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--pink-light);
  min-width: 0;
}
.chart-stat-k {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.2;
}
.chart-stat-v {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-empty-hint {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  text-align: right;
  flex: 1 1 auto;
}
@media (max-width: 520px) {
  .chart-header-quote {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .chart-header-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.current-price.flash-up, #trade-price.flash-up { animation: priceFlashUp 0.55s ease; }
.current-price.flash-down, #trade-price.flash-down { animation: priceFlashDown 0.55s ease; }
@keyframes priceFlashUp {
  0%, 100% { background: transparent; }
  40% { background: rgba(255, 107, 138, 0.22); border-radius: 6px; }
}
@keyframes priceFlashDown {
  0%, 100% { background: transparent; }
  40% { background: rgba(110, 207, 154, 0.28); border-radius: 6px; }
}

.path-badge {
  text-align: center; font-size: 13px; font-weight: 600;
  color: var(--tape); background: var(--bg);
  padding: 6px 12px; border-radius: 8px; margin-bottom: 8px;
  border: 1px dashed var(--border);
}
.timer-display {
  text-align: center; font-size: 28px; font-weight: 800;
  color: var(--ink); margin-bottom: 8px;
  font-family: var(--font-serif);
}
.challenge-status {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px;
  font-size: var(--text-sm); color: var(--muted); line-height: var(--line-relaxed);
}
.challenge-status strong { color: var(--ink); }
.challenge-status .status-profit { font-size: var(--text-lg); font-weight: 800; margin-top: 6px; }
.challenge-status .status-profit.up { color: var(--up); }
.challenge-status .status-profit.down { color: var(--down); }
.challenge-controls { text-align: center; margin-bottom: 12px; }

.chart-container {
  flex: 1 1 auto;
  min-height: 320px;
  border-radius: var(--radius-sm);
  border: 2px solid #ffd6e7;
  background: #fff8fc;
  transition: border-color 280ms ease, box-shadow 280ms ease;
}
.chart-container.mood-line-boom {
  border-color: #ffc4a8;
  box-shadow: inset 0 0 0 1px rgba(255, 79, 154, 0.12);
}
.chart-container.mood-line-up {
  border-color: #ffd6e7;
  box-shadow: inset 0 0 0 1px rgba(255, 126, 179, 0.1);
}
.chart-container.mood-line-flat {
  border-color: #e8e9ef;
  background: #fafbfd;
}
.chart-container.mood-line-down {
  border-color: #c8ddff;
  box-shadow: inset 0 0 0 1px rgba(95, 168, 255, 0.1);
}
.chart-container.mood-line-crash {
  border-color: #c4b8ff;
  box-shadow: inset 0 0 0 1px rgba(123, 97, 255, 0.12);
}
.main-chart-area.mood-chart-flash {
  animation: mood-chart-flash 420ms ease-out;
}
@keyframes mood-chart-flash {
  0%, 100% { filter: none; }
  45% { filter: brightness(1.04); }
}
.chart-canvas { width: 100%; height: 100%; min-height: 300px; display: block; }
.chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  padding: 10px 4px 4px; font-size: var(--text-sm); color: var(--muted);
}
.chart-legend .legend-note {
  font-size: var(--text-xs); color: var(--muted); font-weight: 600; margin-left: auto;
}
.legend-mood-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: var(--text-sm);
  line-height: 1.2;
}
.legend-mood-icon {
  font-size: 0.85em;
  line-height: 1;
}
.legend-mood-pct {
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}
.legend-mood-pill.mood-line-boom {
  color: #b85c00;
  background: linear-gradient(135deg, #fff0bd 0%, #ffe5f1 100%);
}
.legend-mood-pill.mood-line-up {
  color: #d9367f;
  background: #ffe5f1;
}
.legend-mood-pill.mood-line-flat {
  color: #6f7385;
  background: #f2f3f7;
}
.legend-mood-pill.mood-line-down {
  color: #2469b3;
  background: #e5f1ff;
}
.legend-mood-pill.mood-line-crash {
  color: #5d43d6;
  background: #ece8ff;
}

.dashboard .sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.sidebar-section {
  background: linear-gradient(180deg, #fff 0%, #fff9fc 100%);
  border-radius: var(--radius);
  border: 2px solid var(--pink-light);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 156px);
  overflow: hidden;
}
.tab-nav {
  display: flex;
  gap: 6px;
  padding: 8px;
  flex: 0 0 auto;
  border-bottom: 2px solid var(--pink-light);
  background: var(--bg-soft);
}
.tab-nav button {
  flex: 1;
  padding: 9px 8px;
  border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  font-size: var(--text-sm);
  font-weight: 700; color: var(--muted); cursor: pointer;
}
.tab-nav button.active {
  background: #fff;
  color: var(--pink-deep);
  border-color: var(--pink);
  box-shadow: var(--shadow-soft);
}
.tab-content {
  display: flex;
  flex-direction: column;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
/* 侧栏 Tab：必须互斥显示（避免 [hidden] 被 display:flex 盖掉导致两面板叠在一起） */
.tab-content > [role="tabpanel"] {
  display: none !important;
  flex: 0 0 auto;
  min-height: 0;
}
.tab-content > #panel-trade.is-active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.tab-content > #panel-asset.is-active {
  display: block !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#panel-asset.asset-panel {
  padding: 14px;
}

.trade-panel {
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  padding: 8px 10px 6px;
  gap: 4px;
}
.trade-panel-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.asset-panel .panel-header {
  margin-bottom: 10px;
}
.asset-panel .panel-header h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--ink);
}
.asset-panel-sub {
  margin: 4px 0 0;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--muted);
}
.info-item--hero .value {
  font-size: var(--text-2xl);
}
.info-item--hero .label {
  font-size: var(--text-sm);
}
.legal-banner {
  margin: 8px 0 0;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink);
  background: #fff8fc;
  border: 1px dashed var(--pink-light);
  border-radius: 8px;
  text-align: center;
}
.trade-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--pink-light);
  background: linear-gradient(90deg, #fff9fc 0%, #fff 100%);
}
.trade-mode-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trade-mode-title {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--ink);
}
.trade-mode-desc {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--line-tight);
  font-weight: 600;
}
.trade-mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}
.trade-mode-switch-text {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--tape);
}
.trade-mode-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.trade-mode-switch-ui {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #e8dce3;
  border: 1px solid var(--border);
  transition: background 0.2s ease;
}
.trade-mode-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}
.trade-mode-switch input:checked + .trade-mode-switch-ui {
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-color: #ff8fb8;
}
.trade-mode-switch input:checked + .trade-mode-switch-ui::after {
  transform: translateX(18px);
}
.trade-mode-switch input:focus-visible + .trade-mode-switch-ui {
  outline: 2px solid var(--pink-deep);
  outline-offset: 2px;
}
.trade-panel:not(.trade-mode-normal) .trade-advanced {
  display: none !important;
}
.trade-panel:not(.trade-mode-normal) .trade-field-row--2 {
  grid-template-columns: 1fr;
}

/* —— 简单模式：仅操作区，气氛值看左侧图表，一屏无滚轮 —— */
.trade-panel:not(.trade-mode-normal) {
  padding: 8px 10px 6px;
  gap: 4px;
}
.trade-panel:not(.trade-mode-normal) .trade-mode-desc,
.trade-panel:not(.trade-mode-normal) .trade-rules-details,
.trade-panel:not(.trade-mode-normal) .trade-field-price {
  display: none !important;
}
.trade-panel:not(.trade-mode-normal) .trade-mode-bar {
  margin-bottom: 0;
  padding: 5px 8px;
}
.trade-panel:not(.trade-mode-normal) .trade-type {
  margin-bottom: 0;
}
.trade-panel:not(.trade-mode-normal) .trade-panel-body {
  flex: 0 0 auto;
  overflow: visible;
}
.trade-panel:not(.trade-mode-normal) .trade-fields {
  display: block;
}
.trade-panel:not(.trade-mode-normal) .trade-field-row--2 {
  display: none;
}
.trade-panel:not(.trade-mode-normal) .position-hint::before {
  content: '气氛值见左侧图表 · ';
  color: var(--muted);
  font-weight: 600;
}
body.challenge-idle .trade-panel:not(.trade-mode-normal) .position-hint::before {
  content: none;
}
.trade-panel:not(.trade-mode-normal) .trade-summary-grid {
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}
.trade-panel:not(.trade-mode-normal) .trade-summary-item--emph {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px dashed var(--pink-light);
}
.trade-panel:not(.trade-mode-normal) #trade-balance-after-row {
  display: none;
}

/* 正常模式：中间表单区滚动 */
.trade-panel.trade-mode-normal .trade-panel-body {
  flex: 1 1 auto;
  min-height: 0;
}
.trade-panel.trade-mode-normal .trade-fields {
  gap: 8px;
}
.trade-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.trade-type button {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-weight: 700;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--ink);
}
.trade-type button.active { background: var(--card); box-shadow: var(--shadow); }
.trade-type button.active[data-side="buy"] { border-color: var(--up); color: var(--up); }
.trade-type button.active[data-side="sell"] { border-color: var(--down); color: var(--down); }
.trade-type button.active[data-side="short"] { border-color: #c45c8a; color: #a63d6e; }
.trade-type button.active[data-side="cover"] { border-color: var(--tape); color: #6b5b8a; }
.trade-alerts { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.trade-alerts:empty { display: none; }
.trade-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trade-panel.trade-mode-normal .trade-panel-body {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.trade-panel-foot {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--pink-light);
  background: linear-gradient(180deg, transparent 0%, #fff9fc 35%);
}
.trade-rules-details {
  font-size: var(--text-xs);
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--card);
}
.trade-rules-details summary {
  cursor: pointer;
  font-weight: 700;
  padding: 6px 0;
  color: var(--tape);
  list-style-position: inside;
}
.trade-rules-details[open] { padding-bottom: 8px; }
.trade-fields { display: flex; flex-direction: column; gap: 8px; }
.trade-field-row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-group-compact { margin-bottom: 0; }
.form-group-compact label {
  font-size: var(--text-xs);
  margin-bottom: 4px;
  font-weight: 700;
}
.trade-summary {
  border-radius: 10px;
  border: 1px solid var(--pink-light);
  background: linear-gradient(180deg, #fff 0%, #fff5f9 100%);
  padding: 8px 10px;
}
.trade-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.trade-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.trade-summary-label {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 700;
}
.trade-summary-item .trade-amount-value {
  font-size: var(--text-md);
  line-height: var(--line-tight);
  word-break: break-all;
}
.trade-summary-item--emph {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px dashed var(--pink-light);
}
.trade-summary-item--emph .trade-summary-label { font-size: var(--text-sm); color: var(--ink); font-weight: 800; }
.trade-summary-item--emph .trade-amount-value { font-size: var(--text-lg); }
#trade-balance-after-row[hidden] { display: none; }
.trade-select {
  width: 100%; padding: 10px; border-radius: 8px;
  border: 1px solid var(--border); font-size: var(--text-base);
  background: var(--card); color: var(--ink);
}
.submit-btn {
  width: 100%; padding: 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: var(--text-base); font-weight: 800;
  color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-color: #ff8fb8;
  box-shadow: 0 4px 12px rgba(255, 126, 179, 0.35);
}
.submit-btn.sell {
  background: linear-gradient(135deg, #e8fff0 0%, #c8f5d8 100%);
  border-color: var(--down);
  color: #2d6b4a;
  box-shadow: var(--shadow-soft);
}
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; color: var(--muted); font-size: var(--text-sm); margin-bottom: 6px; font-weight: 700; }
.price-input, .quantity-input {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.price-input input, .quantity-input input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: var(--text-base);
  background: var(--card);
}
.price-input .unit, .quantity-input .unit {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
}
.currency-symbol {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.trade-account-value,
.trade-amount-value,
.asset-panel .value,
.current-price {
  font-variant-numeric: tabular-nums;
}
.quantity-tips { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.quantity-tips span {
  font-size: var(--text-xs); color: var(--tape); cursor: pointer; font-weight: 700;
  padding: 6px 8px; border: 1px dashed var(--border); border-radius: 6px;
}
.trade-account-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.trade-account-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}
.trade-account-value {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--ink);
}
.trade-account-value.warn { color: #b8860b; }
.trade-account-value.loss { color: var(--up); }
.trade-rules-hint {
  font-size: var(--text-xs);
  line-height: var(--line-relaxed);
  color: var(--muted);
  margin: 6px 0 0;
  padding: 0;
  background: transparent;
  border: none;
}
.leverage-warn {
  font-size: var(--text-xs);
  font-weight: 700;
  color: #b45309;
  background: #fff8e8;
  border: 1px dashed #e6c88a;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 0;
}
.loss-cut-banner {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--up);
  background: #fff0f0;
  border: 1px solid #e8b4b4;
  border-radius: 8px;
  padding: 6px 8px;
  margin: 0;
}
.asset-rules-note {
  font-size: var(--text-xs);
  color: var(--muted);
  line-height: var(--line-relaxed);
  margin: -4px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.trade-summary-item .trade-amount-value.warn,
#trade-balance-after.warn { color: var(--up); }
.position-hint {
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 8px;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--ink);
  font-weight: 700;
  border: 1px dashed var(--border);
  text-align: center;
  line-height: var(--line-tight);
}
.trade-amount-value { color: var(--ink); font-size: var(--text-lg); font-weight: 800; }
.quantity-tips { gap: 6px; margin-top: 6px; }
.quantity-tips span {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  font-size: var(--text-xs);
}
.trade-panel-foot .submit-btn { padding: 13px; margin-top: 4px; }
.message { font-size: var(--text-sm); margin: 0; color: var(--down); line-height: var(--line-tight); font-weight: 600; }
.message-slot { min-height: 1.4em; }
.message.error { color: var(--up); }

.conn-banner {
  flex: 0 0 auto;
  align-self: stretch;
  display: block;
  margin: 0 0 10px;
  padding: 8px 16px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: var(--line-normal);
  color: var(--pink-deep);
  background: linear-gradient(90deg, #fff5f9 0%, #ffeef5 50%, #fff5f9 100%);
  border: 1px solid var(--pink);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  max-height: 80px;
  overflow: hidden;
  transition: opacity var(--motion-normal, 280ms) var(--motion-ease, ease),
    transform var(--motion-normal, 280ms) var(--motion-ease, ease),
    max-height var(--motion-normal, 280ms) var(--motion-ease, ease),
    margin var(--motion-normal, 280ms) var(--motion-ease, ease),
    padding var(--motion-normal, 280ms) var(--motion-ease, ease);
}
.conn-banner:not([hidden]) {
  animation: bannerIn var(--motion-normal, 280ms) var(--motion-ease, ease) both;
}
.conn-banner[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  border: none;
}
.value.flash-highlight { animation: assetFlash 0.8s ease; }
@keyframes assetFlash {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); color: var(--tape); }
}

/* —— 操作反馈与过渡动效 —— */
:root {
  --motion-fast: 180ms;
  --motion-normal: 280ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

#app-main {
  transition: opacity var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}
#app-main.main-fade-out {
  opacity: 0.55;
  transform: translateY(6px);
}
#app-main.main-fade-in {
  opacity: 1;
  transform: translateY(0);
}

#screen-game,
#screen-rank {
  transition: opacity var(--motion-normal) var(--motion-ease);
}
body.view-rank #screen-rank.view-surface-in {
  animation: viewSurfaceIn var(--motion-normal) var(--motion-ease) both;
}
body.view-game #screen-game.view-surface-in {
  animation: viewSurfaceIn var(--motion-normal) var(--motion-ease) both;
}
@keyframes viewSurfaceIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-content > [role="tabpanel"].tab-panel-enter {
  animation: tabPanelIn var(--motion-normal) var(--motion-ease) both;
}
@keyframes tabPanelIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

.nav-btn,
.mobile-tab,
.tab-nav button,
.trade-type button,
.submit-btn,
.rank-scope-nav button {
  transition: background var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    opacity var(--motion-fast) var(--motion-ease);
}
.trade-type button:active,
.submit-btn:active:not(:disabled),
.nav-btn:active:not(.active) {
  transform: scale(0.97);
}
.submit-btn.btn-flash-ok {
  animation: btnOkFlash 0.55s var(--motion-ease);
}
@keyframes btnOkFlash {
  0%, 100% { box-shadow: var(--shadow-soft); }
  40% { box-shadow: 0 0 0 3px rgba(196, 165, 116, 0.45); transform: scale(1.02); }
}
.ui-flash {
  animation: uiFlash 0.5s var(--motion-ease);
}
@keyframes uiFlash {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.08); }
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 192, 210, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--motion-normal) var(--motion-ease),
    backdrop-filter var(--motion-normal) var(--motion-ease);
}
.modal-overlay.show {
  display: flex;
  opacity: 1;
}
.modal-overlay[hidden] {
  display: none !important;
  opacity: 0;
}
.modal-overlay.modal-enter .bread-modal,
.modal-overlay.modal-enter .guide-modal,
.modal-overlay.modal-enter .entry-modal {
  animation: modalPopIn var(--motion-normal) var(--motion-ease) both;
}
.modal-overlay.modal-leave .bread-modal,
.modal-overlay.modal-leave .guide-modal {
  animation: modalPopOut 220ms var(--motion-ease) both;
}
@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalPopOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.97) translateY(8px); }
}

.entry-overlay.show {
  animation: overlayFadeIn var(--motion-normal) var(--motion-ease) both;
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.entry-overlay.show .entry-modal {
  animation: modalPopIn var(--motion-normal) var(--motion-ease) both;
}

.toast-root {
  position: fixed;
  top: max(16px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(420px, 92vw);
  width: 100%;
}
.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 14px;
  border-radius: 12px;
  font-size: var(--text-sm);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(90, 74, 86, 0.12);
  background: var(--card);
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: opacity var(--motion-normal) var(--motion-ease),
    transform var(--motion-normal) var(--motion-ease);
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
}
.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast.toast-leave {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}
.toast-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}
.toast-success .toast-icon {
  background: rgba(76, 175, 120, 0.18);
  color: #2d7a52;
}
.toast-error .toast-icon {
  background: rgba(220, 100, 120, 0.15);
  color: var(--up);
}
.toast-info .toast-icon {
  background: rgba(196, 165, 116, 0.22);
  color: #6b4f28;
}
.toast-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toast-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.toast-msg {
  font-weight: 700;
  line-height: 1.45;
  word-break: break-word;
}
.toast-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  background: currentColor;
  opacity: 0.35;
  animation: toastBarShrink linear forwards;
}
.toast-success .toast-bar { color: #2d7a52; }
.toast-error .toast-bar { color: var(--up); }
.toast-info .toast-bar { color: var(--tape); }
@keyframes toastBarShrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
.toast-success { border-color: rgba(76, 175, 120, 0.45); }
.toast-error { border-color: rgba(220, 100, 120, 0.4); }
.toast-info { border-color: var(--tape); }

.global-loading {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(255, 245, 249, 0.88);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 220ms var(--motion-ease);
}
.global-loading.loading-visible {
  opacity: 1;
}
.global-loading[hidden] { display: none !important; }
.global-loading.loading-visible .loading-box {
  animation: modalPopIn 240ms var(--motion-ease) both;
}
.loading-box {
  background: var(--card); padding: 28px 36px; border-radius: var(--radius);
  border: 1px solid var(--border); text-align: center; box-shadow: var(--shadow);
}
.loading-spinner {
  width: 36px; height: 36px; margin: 0 auto 12px;
  border: 3px solid var(--bg); border-top-color: var(--tape);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--ink); font-weight: 700; font-size: var(--text-sm); }

.asset-panel .panel-header h3 {
  font-size: var(--text-md);
  font-family: var(--font-serif);
}
.asset-panel .info-item { margin-bottom: 12px; }
.asset-panel .label { color: var(--muted); font-size: var(--text-sm); display: block; font-weight: 700; }
.asset-panel .value { font-size: var(--text-xl); font-weight: 800; color: var(--ink); }
.asset-panel .value.profit { color: var(--up); }
.asset-panel .value.loss { color: var(--down); }
.asset-panel #asset-total.warn { color: #b8860b; }
.asset-panel #asset-total.loss { color: var(--up); }
.value.short-pos { color: #6b5b95; }
.info-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.rank-list { margin-top: 8px; }
.rank-item {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 8px; padding: 10px 12px; border-radius: 8px;
  background: var(--bg); margin-bottom: 8px;
  border: 1px solid transparent;
}
.rank-item.is-me {
  border-color: var(--tape);
  background: var(--card);
  box-shadow: var(--shadow);
}
.rank-no { font-weight: 800; color: var(--tape); }
.rank-my-footer {
  margin-top: 12px; padding: 12px 14px; border-radius: 8px;
  background: var(--bg); border: 1px dashed var(--border);
  font-size: var(--text-sm); font-weight: 600; color: var(--muted); text-align: center;
}
.rank-item { font-size: var(--text-sm); }
.rank-assets { font-weight: 700; color: var(--ink); }
.empty-hint { color: var(--muted); text-align: center; padding: 20px; font-size: var(--text-sm); }

.app-footer {
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: var(--line-relaxed);
  background: var(--bg);
  border-top: 1px solid var(--pink-light);
}
.app-footer p {
  margin: 0;
  max-width: 56rem;
  margin-inline: auto;
}

.bread-modal {
  position: relative; background: var(--card);
  border-radius: var(--radius); padding: 36px 28px;
  max-width: 400px; width: 90%; text-align: center;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.guide-modal {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 520px;
  width: 92%;
  margin: auto;
  padding: 24px 22px 20px;
  max-height: min(85vh, 640px);
  overflow-y: auto;
  text-align: left;
}
.guide-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  margin: 0 0 14px;
  padding-right: 28px;
}
.guide-body {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.guide-lead {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff8fc 0%, var(--bg-soft) 100%);
  border: 1px solid var(--pink-light);
}
.guide-section {
  margin-bottom: 14px;
}
.guide-section-title {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--pink-deep);
  letter-spacing: 0.02em;
}
.guide-body p { margin: 0 0 10px; }
.guide-body ul {
  margin: 0 0 8px;
  padding-left: 1.25em;
}
.guide-body li { margin: 6px 0; }
.guide-mood-list {
  list-style: none;
  padding-left: 0 !important;
}
.guide-mood-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.guide-mood-tag {
  display: inline-block;
  min-width: 2.5em;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 8px;
}
.guide-mood-tag.mood-line-up { color: #d9367f; background: #ffe5f1; }
.guide-mood-tag.mood-line-boom { color: #b85c00; background: #fff0bd; }
.guide-mood-tag.mood-line-flat { color: #6f7385; background: #f2f3f7; }
.guide-mood-tag.mood-line-down { color: #2469b3; background: #e5f1ff; }
.guide-mood-tag.mood-line-crash { color: #5d43d6; background: #ece8ff; }
.guide-foot {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0 !important;
}
.guide-ok-btn {
  width: 100%;
  max-width: 200px;
  margin: 18px auto 0;
  display: block;
}
body.guide-open { overflow: hidden; }
#guide-overlay.show { display: flex; }
.modal-close {
  position: absolute; top: -12px; right: -12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--border); font-size: 20px; cursor: pointer;
}
.big-bread { font-size: 72px; }
.bread-title { font-size: 20px; margin: 12px 0; font-family: var(--font-serif); }
.bread-hint { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.bread-error { color: var(--up); font-size: 13px; margin-bottom: 12px; }
.sell-bread-btn {
  padding: 12px 32px; border-radius: 8px; font-weight: 700;
  border: 1px solid var(--border); background: var(--tape); cursor: pointer;
}
.success-title { color: var(--ink); margin: 12px 0; }
.success-btn {
  margin-top: 16px; padding: 10px 28px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--tape);
  font-weight: 700; cursor: pointer;
}

.character-dock {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 900;
  width: min(220px, 30vw);
  max-width: 240px;
  pointer-events: none;
}
.character-dock.has-character {
  pointer-events: auto;
}
.character-dock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  width: 100%;
}
.character-dock-inner:hover .character-dock-portrait-wrap {
  transform: translateY(-4px);
}
.character-dock-portrait-wrap {
  line-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transition: transform 0.22s ease;
  filter: drop-shadow(0 8px 20px rgba(255, 126, 179, 0.28));
  background: transparent;
}
.character-dock-portrait {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  max-height: min(340px, 46vh);
  object-fit: contain;
  object-position: bottom center;
  border: none;
  border-radius: 0;
  background: transparent !important;
  image-rendering: auto;
}
.character-dock-hint {
  margin: 8px 0 0;
  padding: 6px 10px;
  max-width: 200px;
  font-size: 12px;
  background: var(--card);
  border: 2px dashed var(--pink-light);
  border-radius: var(--radius-sm);
}

.name-card:disabled { opacity: 0.6; cursor: wait; }

@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .sidebar-section {
    max-height: none;
  }
  .name-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .app-header {
    position: sticky; top: 0; z-index: 800;
    padding: 10px 12px; flex-wrap: wrap; gap: 8px;
  }
  .logo-text { font-size: var(--text-xs); line-height: 1.25; max-width: 10em; }
  .nav-center { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .nav-btn { padding: 7px 12px; font-size: var(--text-xs); }
  .user-actions { gap: 8px; margin-left: auto; }
  .welcome { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .btn-portrait-toggle { min-width: 40px; padding: 6px 8px; font-size: var(--text-xs); }
  body.in-game { padding-bottom: 72px; }
  body.in-game .app-footer { padding-bottom: 80px; }
  .character-dock {
    left: 4px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: min(160px, 36vw);
  }
  .character-dock-portrait {
    max-width: 160px;
    max-height: min(240px, 34vh);
  }
  .mobile-tab-bar:not([hidden]) { display: grid; }
  .sidebar .tab-nav { display: none; }
  .tab-content { overflow: hidden; }
  .trade-panel.trade-mode-normal .trade-panel-body {
    max-height: min(48vh, 380px);
  }
  .chart-container { min-height: 220px; }
}

/* —— 全屏萌系装饰（不影响点击） —— */
.page-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.deco {
  position: absolute;
  user-select: none;
  line-height: 1;
}

.deco-star,
.deco-heart,
.deco-spark {
  font-size: clamp(14px, 2vw, 22px);
  color: var(--pink);
  opacity: 0.4;
  animation: decoFloat 7s ease-in-out infinite;
  text-shadow: 0 0 12px rgba(255, 182, 212, 0.6);
}

.deco-heart { color: #ff8fb8; font-size: clamp(16px, 2.2vw, 24px); }

.deco-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink-light);
  opacity: 0.65;
  animation: decoPulse 4s ease-in-out infinite;
}

.deco-bubble {
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 220, 0.55);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(255, 214, 232, 0.15));
  animation: decoFloat 9s ease-in-out infinite;
}

.deco-ribbon {
  top: -40px;
  right: 8%;
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 200, 220, 0.35) 40%, rgba(255, 158, 199, 0.2) 55%, transparent 55%);
  transform: rotate(18deg);
  opacity: 0.5;
}

.d1 { top: 8%; left: 6%; animation-delay: 0s; }
.d2 { top: 18%; right: 10%; animation-delay: -1.2s; font-size: 26px; }
.d3 { top: 42%; left: 4%; animation-delay: -2s; }
.d4 { bottom: 28%; right: 6%; animation-delay: -0.8s; }
.d5 { top: 62%; left: 12%; animation-delay: -3s; }
.d6 { bottom: 12%; right: 14%; animation-delay: -1.6s; }
.d7 { top: 28%; left: 22%; width: 6px; height: 6px; animation-delay: -0.5s; }
.d8 { top: 75%; right: 22%; width: 10px; height: 10px; animation-delay: -2.4s; }
.d9 { bottom: 38%; left: 8%; width: 5px; height: 5px; animation-delay: -1.8s; }
.d10 { top: 12%; right: 28%; width: 48px; height: 48px; animation-delay: -2.2s; }
.d11 { bottom: 18%; left: 18%; width: 36px; height: 36px; animation-delay: -3.5s; }

@keyframes decoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(6deg); }
}

@keyframes decoPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.35); opacity: 0.85; }
}

.welcome-card h1 {
  background: linear-gradient(120deg, var(--pink-deep) 0%, #c77dff 55%, var(--pink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo-text {
  background: linear-gradient(90deg, var(--ink) 0%, var(--pink-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.entry-legal input[type='checkbox'] {
  accent-color: var(--pink-deep);
  width: 18px;
  height: 18px;
}

.footer-link {
  color: var(--pink-deep);
  text-decoration: none;
  font-weight: 700;
}
.footer-link:hover {
  text-decoration: underline;
  color: var(--pink);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .page-deco { display: none; }
  #app-main.main-fade-out,
  #app-main.main-fade-in {
    opacity: 1;
    transform: none;
  }
  .toast-bar { display: none; }
  .main-chart-area.mood-chart-flash {
    animation: none;
  }
}
