:root {
  --mint: #B5E8D5;
  --sky: #A0E7E5;
  --peach: #FFD8B5;
  --lavender: #D5C5E8;
  --lemon: #FFE9A8;
  --coral: #FFB5A8;
  --bg: #F4FBF8;
  --card: #FFFFFF;
  --ink: #2C5F5D;
  --soft: #88B8B0;
  --warn: #FF8B7B;
  --shadow: 0 4px 16px rgba(44, 95, 93, 0.08);
  /* v4.5.0: animation duration vars (mobile override below) */
  --anim-fast: 100ms;
  --anim-normal: 200ms;
  --anim-slow: 320ms;
  /* v3.4.0 character colors (independent from theme) */
  --char-mint: #B5E8D5;
  --char-sky: #A0E7E5;
  --char-peach: #FFD8B5;
  --char-lavender: #D5C5E8;
  --char-lemon: #FFE9A8;
  --char-coral: #FFB5A8;
  --char-red: #FF8B7B;
  --char-purple: #C5A8E8;
}

:root[data-theme="night"] {
  --mint: #6FA8D9;
  --sky: #4A6B8A;
  --peach: #8A6B5A;
  --lavender: #6B5A8A;
  --lemon: #D9B76F;
  --coral: #8A5A6B;
  --bg: #1A1F2E;
  --card: #252B3D;
  --ink: #E8EEF7;
  --soft: #4A5673;
  --warn: #FF7B6B;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  /* v3.4.0 character colors (night mode — slightly darker) */
  --char-mint: #6FA8D9;
  --char-sky: #4A6B8A;
  --char-peach: #8A6B5A;
  --char-lavender: #6B5A8A;
  --char-lemon: #D9B76F;
  --char-coral: #8A5A6B;
  --char-red: #FF7B6B;
  --char-purple: #8A6BC5;
}

:root[data-theme="candy"] {
  --mint: #FFB5D8;
  --sky: #B5E0FF;
  --peach: #FFD0B5;
  --lavender: #E0B5FF;
  --lemon: #FFE89A;
  --coral: #FFB5C8;
  --bg: #FFF0F8;
  --card: #FFFFFF;
  --ink: #8B5A8C;
  --soft: #D8A8D0;
  --warn: #FF6B8B;
  --shadow: 0 4px 16px rgba(255, 180, 210, 0.4);
  /* v3.4.0 character colors (candy — brighter) */
  --char-mint: #FFB5D8;
  --char-sky: #B5E0FF;
  --char-peach: #FFD0B5;
  --char-lavender: #E0B5FF;
  --char-lemon: #FFE89A;
  --char-coral: #FFB5C8;
  --char-red: #FF6B8B;
  --char-purple: #E0B5FF;
}

/* v3.1.0 scoped theme transitions (avoid * selector on large game boards) */
body, .card, .modal-card, .btn, .tile, .player-card, .prop-card,
.topbar, .menu, .settings-form, .lobby-card {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* v3.7.0 board background */
.board-bg-picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.board-bg-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 2px solid var(--soft);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.board-bg-btn.active {
  border-color: var(--mint);
  background: var(--mint);
  font-weight: 700;
}
.board {
  position: relative;
  background-color: #FFFFFF;
  transition: background-color 0.2s ease;
}
.board[data-bg="mint"]  { background-color: #E8F5EE; --cell-bg: #FFFFFF; --tile-border: var(--mint); --tile-shadow: 0 4px 0 var(--soft); }
.board[data-bg="night"] { background-color: #1A1F2E; --cell-bg: #2A3045; --tile-border: #6FA8D9; --tile-shadow: 0 4px 0 rgba(0,0,0,0.4); }
.board[data-bg="candy"] { background-color: #FFF0F8; --cell-bg: #FFFAFE; --tile-border: var(--char-red); --tile-shadow: 0 4px 0 rgba(255,180,210,0.4); }
.board[data-bg="forest"] { background-color: #DDEEDD; --cell-bg: #F0F8F0; --tile-border: #6B8E5A; --tile-shadow: 0 4px 0 rgba(150,180,140,0.4); }
.board[data-bg="retro"] { background-color: #F5EFE0; --cell-bg: #F5EFE0; --tile-border: #8B6B4A; --tile-shadow: 0 4px 0 rgba(139,107,74,0.3); }

/* v3.6.0 chat drawer */
.chat-drawer {
  position: fixed;
  right: -300px;
  top: 0;
  bottom: 0;
  width: 280px;
  background: var(--card);
  border-left: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  z-index: 800;
}
.chat-drawer.open { right: 0; }
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
}
.chat-close { background: transparent; border: 0; font-size: 24px; cursor: pointer; }
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg { padding: 4px 6px; border-radius: 4px; word-break: break-word; }
.chat-player { background: rgba(0,0,0,0.04); }
.chat-ai { background: rgba(181, 232, 213, 0.2); }
.chat-ai .chat-prefix { color: var(--soft); margin-right: 4px; }
.chat-system { text-align: center; color: var(--soft); font-size: 12px; }
.chat-name { font-weight: 700; margin-right: 6px; }
.chat-input-row {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid var(--soft);
  align-items: center;
}
.chat-input { flex: 1; padding: 4px 8px; border: 1px solid var(--soft); border-radius: 4px; }
.chat-send { padding: 4px 12px; background: var(--mint); border: 2px solid var(--ink); border-radius: 4px; cursor: pointer; }
.chat-send:disabled, .chat-input:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-counter { font-size: 11px; color: var(--soft); }
.chat-disconnected { padding: 8px; color: var(--warn); text-align: center; }
#chat-toggle-btn { position: relative; }
#chat-unread { color: var(--warn); font-weight: 700; margin-left: 2px; }

/* v3.5.0 charts */
.charts-view { padding: 8px; }
.charts-view h4 { margin: 16px 0 6px; font-size: 14px; }
.chart-canvas { width: 100%; height: 200px; display: block; }

/* v3.4.0 character library */
.char-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--ink);
  font-size: 1.4em;
}
.char-avatar.char-avatar-rect { border-radius: 6px; }
.modal-body .char-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.char-card { padding: 6px 4px; border: 2px solid var(--soft); border-radius: 6px; text-align: center; min-width: 0; }
.char-card.custom { background: var(--card); }
.char-card.built-in { background: rgba(0,0,0,0.04); }
.char-name { font-weight: 700; margin: 4px 0; }
.char-actions { display: flex; gap: 4px; justify-content: center; }
.emoji-btn { background: transparent; border: 2px solid transparent; border-radius: 4px; padding: 2px; cursor: pointer; font-size: 18px; }
.emoji-btn.selected, .emoji-btn[style*="--ink"] { border-color: var(--ink) !important; }

/* v3.1.0 theme picker */
.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.theme-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 2px solid var(--soft);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.theme-btn.active {
  border-color: var(--mint);
  background: var(--mint);
  font-weight: 700;
  color: var(--ink);
}
.theme-btn:hover:not(.active) {
  border-color: var(--ink);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
}
#app { min-height: 100vh; padding: 16px; }

.btn {
  font-family: inherit; font-weight: 800; cursor: pointer;
  border: 2px solid var(--ink); background: var(--card); color: var(--ink);
  padding: 10px 20px; border-radius: 14px; font-size: 15px;
  transition: transform .08s, box-shadow .12s;
  box-shadow: 0 3px 0 var(--soft);
}
.btn:active { transform: scale(0.96); box-shadow: 0 1px 0 var(--soft); }
.btn.primary { background: var(--mint); }
.btn.big { font-size: 18px; padding: 14px 28px; }

.menu { text-align: center; padding: 40px 16px; }
.menu h1 { font-size: clamp(32px, 5vw, 56px); margin: 0 0 16px; font-weight: 900; }
.menu h1 .emoji { font-size: 0.7em; vertical-align: middle; }
.menu p { color: var(--soft); margin-bottom: 32px; }
.player-count button { margin: 0 8px; font-size: 18px; }

.pick h2 { text-align: center; font-size: 28px; }
.char-grid {
  display: grid; gap: 16px; max-width: 720px; margin: 24px auto;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.char-card {
  background: var(--card); border-radius: 16px; padding: 16px;
  text-align: center; box-shadow: var(--shadow); cursor: pointer;
  border: 3px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.char-card:hover { border-color: var(--mint); }
.char-card input {
  font-family: inherit; font-weight: 700; text-align: center;
  border: 2px solid var(--soft); border-radius: 8px; padding: 6px;
  width: 100%; font-size: 14px; color: var(--ink);
}
#start-btn { display: block; margin: 24px auto; }

/* v4.0.2 pick screen — 3x4 grid of all 12 zodiac, click to toggle select */
.char-grid.pick-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 760px;
}
.char-card.pick-card {
  position: relative;
  padding: 10px 6px;
  font: inherit;
  color: inherit;
  transition: transform .14s, border-color .14s, background .14s, box-shadow .14s;
}
.char-card.pick-card:not(.disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.char-card.pick-card.picked {
  border-color: var(--mint);
  background: rgba(125, 211, 174, 0.18);
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(125, 211, 174, 0.45);
}
.char-card.pick-card.picked .char-avatar {
  /* v4.0.3 selected-state avatar feedback: outer ring + brightness pop */
  box-shadow: 0 0 0 3px var(--mint), 0 0 14px rgba(125, 211, 174, 0.55);
  filter: brightness(1.06) saturate(1.1);
}
.char-card.pick-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.char-card.pick-card .pick-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--mint); color: #fff;
  width: 24px; height: 24px; line-height: 24px;
  border-radius: 50%; font-weight: 800; font-size: 13px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.pick-names {
  max-width: 720px; margin: 16px auto;
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.pick-name-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); padding: 6px 10px;
  border-radius: 10px; border: 2px solid var(--soft);
}
.pick-name-label { font-size: 13px; color: var(--soft); font-weight: 700; white-space: nowrap; }
.pick-name-row input {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font-family: inherit; font-weight: 700; font-size: 14px;
  color: var(--ink); padding: 2px 0;
}
.pick-name-row input:focus { outline: 2px solid var(--mint); border-radius: 4px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--card); border-radius: 14px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}

.gameplay {
  display: grid; grid-template-columns: 1fr 320px; gap: 16px;
}
@media (max-width: 1023px) {
  .gameplay { grid-template-columns: 1fr; }
  #players { order: 2; display: flex; overflow-x: auto; gap: 8px; padding-bottom: 8px; }
}

/* v4.5.0: hint to compositor for frequently-animated properties.
   `will-change` promotes .tile.current (scale on hover/active) and
   .piece (translateY on elevation) to GPU layers — fewer repaints
   during dice rolls and turn transitions. */
.tile.current { will-change: transform; }
.piece { will-change: transform; }
.btn { will-change: transform; }

/* v4.5.0: layout isolation on the board grid — children can no longer
   trigger reflow of the whole grid when their inner text changes. */
.board-grid { contain: layout style; }

/* v4.5.0: mobile (< 720px) — touch targets, simplified layout, lighter anims */
@media (max-width: 720px) {
  :root {
    /* v4.5.0: 20% shorter animation duration = less GPU/CPU on mobile */
    --anim-fast: 80ms;
    --anim-normal: 160ms;
    --anim-slow: 240ms;
  }

  /* v4.5.0: bigger touch targets (Apple HIG 44pt minimum) */
  .btn { min-height: 44px; padding: 12px 16px; font-size: 15px; }
  .theme-btn { min-width: 44px; min-height: 44px; padding: 10px 12px; }
  .player-count button { min-width: 64px; min-height: 44px; }

  /* v4.5.0: header collapses (date moves to second line) */
  .topbar { flex-direction: column; gap: 4px; padding: 8px; }
  .topbar-left, .topbar-right { width: 100%; justify-content: center; flex-wrap: wrap; }

  /* v4.5.0: pick grid reflows to 3 columns instead of 4 */
  .char-grid.pick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    max-width: 100%;
    padding: 0 8px;
  }

  /* v4.5.0: smaller topbar font, hide map name from left */
  .topbar-left { font-size: 12px; }

  /* v4.5.0: dice + roll button stacked full-width */
  #dice-display { font-size: 28px; }
  #roll-btn { min-height: 56px; font-size: 18px; }

  /* v4.5.0: lighter hover effects (no transform on mobile) */
  .char-card.pick-card:not(.disabled):hover {
    transform: none;
    box-shadow: var(--shadow);
  }
  .char-card.pick-card.picked {
    transform: none;  /* don't scale — avoids layout thrash on tap */
  }
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(var(--board-size, 11), 1fr);
  grid-template-rows: repeat(var(--board-size, 11), 1fr);
  gap: 4px;
  aspect-ratio: 1 / 1;
  background: var(--soft);
  padding: 4px; border-radius: 14px;
  box-shadow: var(--shadow);
}

/* v3.9.0: center panel cells */
.board-center-cell {
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #2c3e50;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  pointer-events: none;
  user-select: none;
}

.board-center-cell.player-cell {
  border: 2px solid rgba(0,0,0,0.15);
  box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
}

.board-center-cell.property-cell {
  border-radius: 2px;
  min-height: 4px;
  min-width: 4px;
}

/* v4.0.1: small floating legend that explains center-panel cells */
.board-center-label {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  padding: 1px 8px;
  border-radius: 8px;
  border: 1px solid var(--soft);
  font-size: 9px;
  font-weight: 700;
  color: var(--soft);
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.tile {
  background: var(--card); border-radius: 10px; padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(8px, 1.2vw, 11px); text-align: center; position: relative;
  border: 2px solid transparent; transition: border-color .2s, transform .12s;
}
.tile.current { border-color: var(--ink); transform: scale(1.05); }
.tile.highlight { border-color: var(--warn); }
.tile-color-bar { position: absolute; top: 0; left: 0; right: 0; height: 6px; border-radius: 10px 10px 0 0; }
.tile.color-mint .tile-color-bar { background: var(--mint); }
.tile.color-sky .tile-color-bar { background: var(--sky); }
.tile.color-peach .tile-color-bar { background: var(--peach); }
.tile.color-lavender .tile-color-bar { background: var(--lavender); }
.tile.color-lemon .tile-color-bar { background: var(--lemon); }
.tile.color-coral .tile-color-bar { background: var(--coral); }
.tile-name { font-weight: 800; }
.tile-price { color: var(--soft); font-size: 0.85em; }
.tile-pieces { position: absolute; bottom: 2px; right: 2px; display: flex; gap: 2px; align-items: flex-end; }
.piece { display: inline-block; border-radius: 50%; transition: transform .25s ease; }
.piece svg { display: block; }

#players { display: flex; flex-direction: column; gap: 10px; }
.player-card {
  background: var(--card); border-radius: 14px; padding: 12px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow);
  border: 3px solid transparent; flex-shrink: 0; min-width: 240px;
  position: relative;
}
.player-card.current { border-color: var(--ink); box-shadow: 0 6px 24px rgba(44,95,93,.18); }
.player-card.bankrupt { opacity: 0.4; }
.player-money { font-size: 22px; font-weight: 900; color: var(--mint); }
.player-meta { font-size: 11px; color: var(--soft); }

.bottombar {
  margin-top: 16px; padding: 16px; background: var(--card);
  border-radius: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; gap: 16px;
}
#dice-display { display: flex; gap: 8px; }
.dice {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: var(--card);
  border: 2px solid var(--ink); border-radius: 8px;
  font-weight: 900; font-size: 20px;
}
.dice.rolling { animation: shake .1s infinite alternate; }
@keyframes shake { from { transform: rotate(-10deg); } to { transform: rotate(10deg); } }

#log {
  position: fixed; right: 16px; bottom: 16px; width: 280px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  font-size: 12px; max-height: 240px; overflow: hidden;
}
.log-header { padding: 8px 12px; font-weight: 800; cursor: pointer; background: var(--mint); }
.log-body { padding: 8px 12px; max-height: 180px; overflow-y: auto; transition: max-height .2s; }
.log-body.collapsed { max-height: 0; padding: 0 12px; }
.log-item { padding: 4px 0; border-bottom: 1px solid var(--bg); }
.log-reward { color: #2a9d8f; }
.log-penalty { color: var(--warn); }
.log-move { color: #4a90e2; }
.log-special { color: #8e44ad; }
.log-system { color: var(--soft); }
.log-thought { color: #8e44ad; font-style: italic; }

#modal-root { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#modal-root:not(:empty) { pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(44,95,93,.5); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; background: var(--card); border-radius: 18px; padding: 24px;
  max-width: 360px; width: calc(100% - 32px); text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.modal-title { margin: 0 0 12px; font-size: 20px; }
.modal-body { margin-bottom: 16px; }
.modal-body .winner { font-size: 28px; font-weight: 900; color: var(--mint); }
.card-reveal .card-icon { font-size: 64px; }
.modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.modal-close {
  position: absolute; top: 8px; right: 12px; width: 32px; height: 32px;
  background: transparent; border: none; font-size: 24px; line-height: 1;
  color: var(--ink); cursor: pointer; opacity: 0.6;
  border-radius: 50%; transition: opacity 0.15s, background 0.15s;
  font-family: system-ui, sans-serif; padding: 0;
}
.modal-close:hover { opacity: 1; background: rgba(0,0,0,0.06); }
.modal-close:focus-visible { outline: 2px solid var(--mint-dark, #6cc4a1); outline-offset: 2px; opacity: 1; }

/* ===== Tier-1 新增样式 ===== */

/* 玩家卡：地产按钮 + AI 标识 */
.player-card.ai { border-left: 4px solid var(--soft); }
.player-card.open { border-color: var(--ink); }
.player-card .prop-toggle { font-size: 11px; padding: 4px 10px; margin-top: 6px; }
.player-card .player-name[data-rename] { cursor: text; }
.player-card .player-name[data-rename]:hover { background: var(--bg); border-radius: 4px; }

/* 侧边面板 */
#side-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#side-panel #players { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 1023px) {
  #side-panel #players { flex-direction: row; overflow-x: auto; }
}

/* 地产面板 */
.prop-panel { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.prop-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.prop-panel-header h4 { margin: 0; font-size: 16px; }
.prop-panel .empty { color: var(--soft); text-align: center; padding: 20px 0; }
.prop-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
.prop-card { background: var(--bg); border-radius: 10px; padding: 8px; border-left: 6px solid var(--mint); display: flex; flex-direction: column; gap: 4px; }
.prop-card.color-mint { border-left-color: var(--mint); }
.prop-card.color-sky { border-left-color: var(--sky); }
.prop-card.color-peach { border-left-color: var(--peach); }
.prop-card.color-lavender { border-left-color: var(--lavender); }
.prop-card.color-lemon { border-left-color: var(--lemon); }
.prop-card.color-coral { border-left-color: var(--coral); }
.prop-name { font-weight: 800; }
.prop-level { font-size: 14px; }
.prop-rent { font-size: 12px; color: var(--soft); }
.prop-card .btn { font-size: 12px; padding: 4px 10px; }
.prop-card .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.prop-max { color: var(--warn); font-weight: 800; font-size: 12px; }

/* 存档槽位 */
.save-slots { margin-top: 28px; max-width: 720px; margin-left: auto; margin-right: auto; }
.slot-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.slot-card { background: var(--card); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; min-height: 120px; }
.slot-card.empty { opacity: 0.6; align-items: center; justify-content: center; }
.slot-card.has-save { border-left: 6px solid var(--mint); }
.slot-card .muted { color: var(--soft); font-size: 11px; }
.slot-card .btn { font-size: 12px; padding: 4px 10px; }

/* 速度档位 */
.speed-picker { margin-top: 20px; }
.speed-picker .btn { margin: 0 4px; }
.speed-picker .btn.primary { background: var(--mint); }

/* 角色选择 AI 槽位 */
.char-card.ai-slot { opacity: 0.65; background: var(--bg); }
.char-card .muted { color: var(--soft); font-size: 12px; }
.pick-actions { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }

/* 顶栏存档按钮 */
#restart-btn { font-size: 13px; padding: 6px 14px; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
#mute-btn { font-size: 16px; padding: 6px 10px; min-width: 40px; }

/* ===== Tier-2 新增样式 ===== */
.settings-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.settings-form fieldset { border: 2px solid var(--soft); border-radius: 10px; padding: 8px 12px; }
.settings-form legend { font-weight: 800; padding: 0 4px; }
.settings-form .radio-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.settings-form input[type="radio"], .settings-form input[type="checkbox"] { accent-color: var(--mint); transform: scale(1.2); }

.prop-card.mortgaged { background: #f0f0f0; opacity: 0.75; position: relative; }
.prop-card.mortgaged::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(255,139,123,0.2) 6px, rgba(255,139,123,0.2) 12px);
  border-radius: 10px;
}
.prop-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.prop-actions .btn { flex: 1; font-size: 11px; padding: 4px 8px; }

.online-status {
  margin-top: 10px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-block;
}
.online-status.online { background: var(--mint); }
.online-status.offline { background: var(--warn); color: white; }
#install-btn { margin-top: 10px; }

/* Tier-2.5: 玩家间交易 */
.trade-form { display: flex; flex-direction: column; gap: 10px; text-align: left; max-height: 60vh; overflow-y: auto; }
.trade-form fieldset { border: 2px solid var(--soft); border-radius: 10px; padding: 8px 12px; }
.trade-form legend { font-weight: 800; padding: 0 4px; }
.trade-form label { display: flex; align-items: center; gap: 6px; padding: 3px 0; cursor: pointer; }
.trade-form input[type="number"] { width: 80px; padding: 4px; border: 2px solid var(--soft); border-radius: 6px; }
.trade-form select { padding: 4px; border: 2px solid var(--soft); border-radius: 6px; }
.trade-summary-row { padding: 4px 0; font-weight: 700; }
.player-card .trade-btn { font-size: 11px; padding: 4px 10px; margin-top: 6px; margin-left: 4px; background: var(--sky); }

/* lobby */
.lobby { max-width: 720px; margin: 0 auto; padding: 20px; }
.lobby h1 { text-align: center; }
.lobby-actions { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.room-card { background: white; border: 2px solid var(--mint-dark, #6cc4a1); border-radius: 12px; padding: 12px; text-align: center; }
.room-code { font-size: 24px; font-weight: bold; letter-spacing: 4px; color: var(--mint-dark, #6cc4a1); }
.room-info { font-size: 13px; color: #666; margin: 4px 0 8px; }
.btn.small { font-size: 12px; padding: 5px 12px; border-radius: 10px; }
.btn.ghost { background: transparent; }

/* online room (waiting lobby) */
.online-room { max-width: 720px; margin: 0 auto; padding: 20px; }
.online-room h1 { text-align: center; }
.online-room h1 .code { letter-spacing: 6px; color: var(--mint-dark, #6cc4a1); }
.seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.seat { background: white; border: 2px solid var(--mint-dark, #6cc4a1); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.seat.ai { border-style: dashed; opacity: 0.85; }
.seat.bankrupt { opacity: 0.5; }
.seat-num { font-size: 18px; font-weight: bold; color: var(--mint-dark, #6cc4a1); min-width: 28px; }
.seat-name { flex: 1; font-size: 15px; font-weight: 700; }
.seat-tag { font-size: 12px; color: #888; }
.online-room #start-btn { display: block; margin: 20px auto; font-size: 18px; padding: 12px 32px; }

/* a11y */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--mint-dark, #6cc4a1);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  z-index: 10000;
  text-decoration: none;
}
.skip-link:focus { top: 8px; }
.modal-card:focus { outline: none; }
.modal-card:focus-visible { outline: 3px solid var(--mint-dark, #6cc4a1); outline-offset: -3px; }

/* conn status pill */
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.conn-pill::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.conn-ok { background: rgba(108,196,161,0.18); color: #2c8a64; }
.conn-warn { background: rgba(255,200,80,0.22); color: #a06700; }
.conn-bad { background: rgba(232,90,90,0.20); color: #b03434; }

/* history modal */
.hist-summary { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.hist-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.hist-row { background: var(--card); border: 1px solid var(--soft); border-radius: 8px; padding: 8px 10px; }
.hist-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--soft); flex-wrap: wrap; }
.hist-meta strong { color: var(--ink); font-size: 14px; }
.hist-rank { margin: 6px 0 0 16px; padding: 0; font-size: 12px; }
.hist-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.hist-actions .muted { margin-left: auto; }

/* ===== Keyboard nav focus indicators ===== */
.player-card { outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .15s, box-shadow .15s; }
.player-card:focus { outline-color: var(--mint-dark, #6cc4a1); }
.player-card:focus-visible { outline-color: var(--mint-dark, #6cc4a1); box-shadow: 0 0 0 4px rgba(108,196,161,.35); }
.tile { outline: 2px solid transparent; outline-offset: -2px; }
.tile:focus-visible { outline-color: var(--warn); }
.btn:focus-visible { outline: 3px solid var(--mint-dark, #6cc4a1); outline-offset: 2px; }

/* AI difficulty badge */
.ai-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  color: white;
  vertical-align: middle;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

/* tutorial body */
.shortcuts-help kbd, .modal-body kbd {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--soft);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.modal-body ul { text-align: left; margin: 6px 0; padding-left: 20px; }
.modal-body li { margin: 3px 0; }

/* ===== Turn timer ===== */
.turn-timer-host { flex: 1 1 100%; margin: 4px 0; min-height: 8px; }
.turn-timer {
  position: relative;
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.turn-timer[hidden] { display: none; }
.turn-timer-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--mint);
  transition: width .25s linear, background-color .25s;
}
.turn-timer.warn .turn-timer-bar { background: #f5c45e; }
.turn-timer.danger .turn-timer-bar { background: #e85a5a; }
.turn-timer-text {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255,255,255,0.85);
  padding: 0 4px;
  border-radius: 4px;
}

/* ===== Achievements ===== */
.achievements-modal { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.achievement { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.achievement.unlocked { border-left: 6px solid var(--mint); }
.achievement.locked { opacity: 0.55; border-left: 6px solid var(--soft); }
.achievement-icon { font-size: 24px; min-width: 32px; text-align: center; }
.achievement-info { flex: 1; text-align: left; }
.achievement-title { font-weight: 800; }
.achievement-desc { font-size: 12px; color: var(--soft); }
.achievement-when { font-size: 11px; margin-top: 2px; }

/* ===== Achievement toast ===== */
.toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--mint);
  color: white;
  border-radius: 12px;
  padding: 12px 16px;
  min-width: 220px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(44,95,93,.25);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .3s, transform .3s;
  pointer-events: auto;
}
.toast.visible { opacity: 1; transform: translateX(0); }
.toast-title { font-weight: 900; font-size: 13px; opacity: .9; }
.toast-text { font-size: 14px; margin-top: 2px; }

/* ===== Mobile (<= 640px) ===== */
@media (max-width: 640px) {
  body { padding: 6px; }
  .topbar { padding: 8px 10px; flex-wrap: wrap; gap: 6px; }
  .topbar-left { font-size: 12px; flex: 1 1 100%; }
  .topbar-right { flex: 1 1 100%; justify-content: flex-end; gap: 6px; }
  .gameplay { grid-template-columns: 1fr; gap: 10px; }
  /* Board: tighter aspect ratio so it fits narrow screens without scrolling */
  .board-grid { gap: 2px; padding: 2px; aspect-ratio: 1 / 1; }
  .tile { padding: 3px; font-size: 9px; min-height: 44px; }
  .tile-name { font-weight: 800; line-height: 1.1; }
  .tile-price { display: none; }   /* too crowded; rent shown in property panel */
  /* Player cards: stop forcing 240px wide; horizontal scroll handled by parent */
  .player-card { min-width: 0; flex: 0 0 200px; padding: 8px; }
  .player-money { font-size: 18px; }
  .player-meta { font-size: 10px; }
  /* Bottombar: stack dice above roll button */
  .bottombar { flex-direction: column; gap: 10px; padding: 12px; }
  #roll-btn { font-size: 16px; padding: 12px 24px; min-height: 48px; width: 100%; max-width: 280px; }
  /* Log: smaller, can be collapsed by tapping header (already wired) */
  #log { width: calc(100% - 24px); right: 12px; bottom: 12px; max-height: 180px; }
  /* Buttons: larger touch targets in primary actions */
  .menu .btn[data-n], .menu #settings-btn, .menu #history-btn, .menu #online-btn,
  .slot-card .btn, .speed-picker .btn, .lobby-actions .btn { min-height: 44px; padding: 10px 16px; }
  /* Modal: more room on phone */
  .modal-card { padding: 18px; max-width: calc(100% - 16px); }
  .modal-title { font-size: 18px; }
  /* Online room seats: stack 1 column instead of 2 */
  .seats { grid-template-columns: 1fr; }
  /* Trade form labels: easier to tap */
  .trade-form label { padding: 6px 0; }
  .trade-form input[type="number"] { width: 100px; font-size: 15px; }
  /* Settings form: tighter */
  .settings-form input[type="radio"], .settings-form input[type="checkbox"] { transform: scale(1.4); }
  /* Hide dice animation frame text on tiny screens */
  .dice { width: 36px; height: 36px; font-size: 18px; }
  /* v3.9.0: shrink center-panel text + avatar borders on small screens */
  .board-center-cell { font-size: 8px; }
  .board-center-cell.player-cell { border-width: 1px; }
}

@media (max-width: 380px) {
  /* Very narrow phones (e.g. iPhone SE) */
  .player-card { flex-basis: 180px; }
  .menu h1 { font-size: 22px; }
  .modal-card { padding: 14px; }
  .field-set, .settings-form fieldset { padding: 6px 8px; }
}

/* Coarse pointer (touch): bump all interactive controls to 44px minimum */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; }
  .player-card { cursor: pointer; }
  .tile { min-height: 48px; }
}

/* ===== v2.7.0 team colors ===== */
:root {
  --team-0: #FF8B7B;
  --team-1: #7BB8FF;
  --team-2: #B5E8D5;
  --team-3: #FFE9A8;
  --team-none: #CCCCCC;
}

.team-stripe {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  pointer-events: none;
}

.team-stripe.team-0 { background: var(--team-0); }
.team-stripe.team-1 { background: var(--team-1); }
.team-stripe.team-2 { background: var(--team-2); }
.team-stripe.team-3 { background: var(--team-3); }
.team-stripe.team-none { background: var(--team-none); }

.team-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.team-dot.team-0 { background: var(--team-0); }
.team-dot.team-1 { background: var(--team-1); }
.team-dot.team-2 { background: var(--team-2); }
.team-dot.team-3 { background: var(--team-3); }
.team-dot.team-none { background: var(--team-none); }

.player-token.team-0 { box-shadow: 0 0 0 2px var(--team-0); }
.player-token.team-1 { box-shadow: 0 0 0 2px var(--team-1); }
.player-token.team-2 { box-shadow: 0 0 0 2px var(--team-2); }
.player-token.team-3 { box-shadow: 0 0 0 2px var(--team-3); }

/* Local lobby team-mode toggle (v2.7.0) */
.setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 10px;
  border: 2px solid var(--soft);
  cursor: pointer;
  max-width: 720px;
  margin: 12px auto 0;
  font-weight: 700;
}
.setting-row input[type="checkbox"] { accent-color: var(--mint); transform: scale(1.3); }

/* ===== v2.8.0 debug panel ===== */
.debug-rows { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.debug-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--soft); }
.debug-row:last-child { border-bottom: none; }
.debug-label { flex: 0 0 90px; color: var(--ink); font-weight: 700; }
.debug-value { flex: 1; font-family: ui-monospace, monospace; font-size: 15px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-good { background: var(--mint, #B5E8D5); box-shadow: 0 0 0 1px var(--ink); }
.dot-warn { background: var(--lemon, #FFE9A8); box-shadow: 0 0 0 1px var(--ink); }
.dot-bad  { background: var(--warn, #FF8B7B); box-shadow: 0 0 0 1px var(--ink); }
.dot-muted { background: var(--soft, #CCCCCC); box-shadow: 0 0 0 1px var(--ink); }

/* v2.9.0 spectator mode */
.spectator-card { opacity: 0.55; }
.spectator-badge { background: var(--soft, #CCCCCC); color: var(--ink); padding: 2px 6px; border-radius: 8px; font-size: 12px; margin-left: 6px; }
.observer-banner { background: var(--lemon, #FFE9A8); color: var(--ink); padding: 8px 16px; text-align: center; font-weight: 700; border-bottom: 2px solid var(--ink); }
.observer-list { max-height: 200px; overflow-y: auto; }

/* v4.0.0: character speech bubbles */
.char-avatar-wrap { position: relative; display: inline-block; }
.char-bubble {
  position: absolute;
  top: -8px;
  right: -60px;
  background: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #2C5F5D;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  border: 2px solid var(--mint, #B5E8D5);
  animation: bubble-fade 2s ease-in-out;
  pointer-events: none;
}
.bubble-tail {
  position: absolute;
  bottom: -7px;
  left: 12px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #fff;
}
.char-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 10px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--mint, #B5E8D5);
  z-index: -1;
}
@keyframes bubble-fade {
  0%   { opacity: 0; transform: translateY(8px) scale(0.9); }
  15%  { opacity: 1; transform: translateY(0) scale(1); }
  85%  { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) scale(0.95); }
}

/* v4.0.0: character state filters (replaces face overlay) */
.char-svg.state-win {
  filter: drop-shadow(0 0 4px #FFD700) drop-shadow(0 0 8px #FFA500) saturate(1.3);
  animation: char-win-glow 1.5s ease-in-out infinite;
}
.char-svg.state-lose {
  filter: grayscale(0.7) brightness(0.7);
  opacity: 0.7;
}
@keyframes char-win-glow {
  0%, 100% { filter: drop-shadow(0 0 4px #FFD700) drop-shadow(0 0 8px #FFA500) saturate(1.3); }
  50%      { filter: drop-shadow(0 0 6px #FFEC8B) drop-shadow(0 0 12px #FFD700) saturate(1.5); }
}

/* v4.5.0: error toast for uncaught errors / rejections */
.error-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #c0392b; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 9999; pointer-events: none;
  opacity: 0; transition: opacity 200ms ease;
  max-width: 80vw;
}
.error-toast.show { opacity: 1; }


/* v6.0.0: PWA install hint banner */
.install-hint {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #FFFEF7; border: 2px solid #B5E8D5;
  padding: 12px 16px; border-radius: 12px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  z-index: 8000; max-width: calc(100vw - 32px);
  opacity: 0; transition: opacity 280ms ease, transform 280ms ease;
  font-size: 14px; color: #2d4a3e;
}
.install-hint.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.install-hint-text { flex: 1; min-width: 0; }
.install-hint-cta { white-space: nowrap; }
.install-hint-close {
  background: none; border: 0; cursor: pointer; padding: 4px 8px;
  color: #2d4a3e; font-size: 16px; line-height: 1;
  border-radius: 4px;
}
.install-hint-close:hover { background: rgba(0,0,0,0.06); }
@media (max-width: 720px) {
  .install-hint { font-size: 13px; padding: 10px 12px; gap: 8px; bottom: 16px; }
}


/* v6.0.0: replay viewer modal */
.replay-card {
  width: min(96vw, 1100px);
  max-height: 92vh;
  display: flex; flex-direction: column;
}
.replay-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid #eee;
}
.replay-header h2 { margin: 0; font-size: 16px; }
.replay-board {
  flex: 1; min-height: 0; overflow: auto;
  padding: 8px;
}
.replay-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-top: 1px solid #eee;
  flex-wrap: wrap;
}
.replay-seek {
  flex: 1; min-width: 120px;
}
.replay-pos-text {
  font-variant-numeric: tabular-nums;
  color: #2d4a3e; font-size: 13px;
}
@media (max-width: 720px) {
  .replay-card { width: 100vw; max-height: 100vh; height: 100vh; }
}


/* v6.0.0: AI coach panel */
.coach-panel {
  background: linear-gradient(135deg, #FFFEF7 0%, #F4FBF8 100%);
  border: 2px solid #B5E8D5;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.coach-rec { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.coach-icon { font-size: 16px; }
.coach-label { color: #2d4a3e; }
.coach-reason { color: #5d7a6e; font-size: 12px; flex: 1; min-width: 0; }
.coach-adopt { background: #5BA0D6; color: #fff; }
.coach-adopt:hover { background: #4a8fc4; }
.coach-tips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: #2d4a3e; }
.coach-tip { background: rgba(91, 160, 214, 0.12); padding: 2px 8px; border-radius: 8px; }

/* ============================================================
   菜单重做 v4.4.0 — 薄荷马卡龙二次元
   - 1px 半透浅描边（废除粗实深色边框）
   - 圆角分级 6/12/20
   - 左上 45° 柔光 + 浅白顶部高光
   - 马卡龙色：mint/sky/peach/lavender/lemon/coral
   - reduced-motion 兜底
   ============================================================ */

/* 马卡龙扩展 token (light themes) */
:root {
  --macaron-mint: #B5E8D5;
  --macaron-sky: #A0E7E5;
  --macaron-peach: #FFD8B5;
  --macaron-lavender: #D5C5E8;
  --macaron-lemon: #FFE9A8;
  --macaron-coral: #FFB5A8;
  --macaron-cream: #FFF8EE;
  --macaron-gold: #F4D58D;
  --macaron-glass: rgba(255, 255, 255, 0.72);
  --macaron-glass-strong: rgba(255, 255, 255, 0.88);
  --macaron-ink: #2C5F5D;
  --macaron-soft: #88B8B0;
  --macaron-shadow: 0 8px 24px rgba(86, 197, 150, 0.18);
  --macaron-shadow-soft: 0 4px 14px rgba(86, 197, 150, 0.12);
  --macaron-glow: 0 0 0 4px rgba(181, 232, 213, 0.5);
  --macaron-border: 1px solid rgba(136, 184, 176, 0.25);
  --macaron-radius-sm: 6px;
  --macaron-radius: 12px;
  --macaron-radius-lg: 20px;
  --macaron-pad: 14px 18px;
  --macaron-gradient-hero: linear-gradient(135deg, #B5E8D5 0%, #A0E7E5 50%, #FFE9A8 100%);
  --macaron-gradient-mint: linear-gradient(135deg, #B5E8D5 0%, #A0E7E5 100%);
  --macaron-gradient-peach: linear-gradient(135deg, #FFD8B5 0%, #FFB5A8 100%);
  --macaron-gradient-lavender: linear-gradient(135deg, #D5C5E8 0%, #A0E7E5 100%);
  --macaron-gradient-candy: linear-gradient(135deg, #FFB5A8 0%, #D5C5E8 50%, #FFE9A8 100%);
}

[data-theme="night"] {
  --macaron-glass: rgba(37, 43, 61, 0.7);
  --macaron-glass-strong: rgba(37, 43, 61, 0.85);
  --macaron-ink: #E8EEF7;
  --macaron-soft: #6B7B9A;
  --macaron-border: 1px solid rgba(106, 122, 154, 0.4);
  --macaron-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --macaron-shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.25);
  --macaron-glow: 0 0 0 4px rgba(106, 178, 217, 0.35);
  --macaron-gradient-hero: linear-gradient(135deg, #2A3654 0%, #1F2A45 50%, #3A2A45 100%);
  --macaron-gradient-mint: linear-gradient(135deg, #2A3654 0%, #1F2A45 100%);
  --macaron-gradient-peach: linear-gradient(135deg, #4A3A45 0%, #5A3A45 100%);
  --macaron-gradient-lavender: linear-gradient(135deg, #3A3A5A 0%, #2A3A5A 100%);
  --macaron-gradient-candy: linear-gradient(135deg, #5A3A45 0%, #4A3A5A 50%, #4A4A3A 100%);
}

[data-theme="candy"] {
  --macaron-glass: rgba(255, 232, 232, 0.7);
  --macaron-glass-strong: rgba(255, 232, 232, 0.88);
  --macaron-ink: #6B3A4A;
  --macaron-soft: #B58A9A;
  --macaron-border: 1px solid rgba(255, 181, 168, 0.4);
  --macaron-shadow: 0 8px 24px rgba(255, 145, 145, 0.22);
  --macaron-shadow-soft: 0 4px 14px rgba(255, 145, 145, 0.15);
  --macaron-glow: 0 0 0 4px rgba(255, 181, 168, 0.5);
  --macaron-gradient-hero: linear-gradient(135deg, #FFD8E0 0%, #FFE9A8 50%, #D5C5E8 100%);
}

/* === 菜单容器 === */
.menu-refresh {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

/* 飘落星光背景 */
.menu-twinkle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.menu-twinkle .tw {
  position: absolute;
  opacity: 0.55;
  animation: twinkle-fall linear infinite;
}
.menu-twinkle .t1 { left: 8%;  top: -20px; animation-duration: 18s; animation-delay: 0s; }
.menu-twinkle .t2 { left: 24%; top: -30px; animation-duration: 22s; animation-delay: 4s; }
.menu-twinkle .t3 { left: 42%; top: -15px; animation-duration: 16s; animation-delay: 2s; }
.menu-twinkle .t4 { left: 60%; top: -40px; animation-duration: 24s; animation-delay: 7s; }
.menu-twinkle .t5 { left: 78%; top: -25px; animation-duration: 20s; animation-delay: 1s; }
.menu-twinkle .t6 { left: 90%; top: -35px; animation-duration: 19s; animation-delay: 5s; }
.menu-twinkle .t7 { left: 50%; top: -50px; animation-duration: 26s; animation-delay: 9s; }

@keyframes twinkle-fall {
  0%   { transform: translateY(0)      rotate(0deg);   opacity: 0; }
  8%   { opacity: 0.7; }
  50%  { transform: translateY(50vh)   rotate(180deg); opacity: 0.5; }
  92%  { opacity: 0.3; }
  100% { transform: translateY(110vh)  rotate(360deg); opacity: 0; }
}

/* === 顶部 Hero === */
.menu-hero {
  position: relative;
  text-align: center;
  padding: 26px 18px 22px;
  border-radius: var(--macaron-radius-lg);
  background: var(--macaron-glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: var(--macaron-border);
  box-shadow: var(--macaron-shadow);
  z-index: 1;
  overflow: hidden;
}
.menu-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--macaron-gradient-hero);
  opacity: 0.18;
  z-index: -1;
  border-radius: inherit;
}

.menu-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--macaron-ink);
  text-shadow: 0 0 12px rgba(181, 232, 213, 0.6), 0 2px 0 rgba(255, 255, 255, 0.5);
}
.title-dice {
  display: inline-flex;
  filter: drop-shadow(0 4px 8px rgba(86, 197, 150, 0.4));
  animation: dice-bob 3.5s ease-in-out infinite;
}
@keyframes dice-bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-6px) rotate(8deg); }
}
.title-text {
  background: var(--macaron-gradient-mint);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.4));
}

.menu-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--macaron-soft);
  font-weight: 500;
}

.hero-deco {
  position: absolute;
  opacity: 0.7;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.hero-deco-l { top: 12px; left: 14px; animation: deco-float 4s ease-in-out infinite; }
.hero-deco-r { top: 14px; right: 16px; animation: deco-float 4s ease-in-out infinite 1.5s; }
@keyframes deco-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-4px) rotate(4deg); }
}

.hero-sparkle {
  position: absolute;
  opacity: 0.6;
  animation: sparkle-pulse 2.5s ease-in-out infinite;
}
.hero-sparkle.s1 { top: 8px;  right: 60px; animation-delay: 0s; }
.hero-sparkle.s2 { top: 30px; left: 56px;  animation-delay: 0.8s; }
.hero-sparkle.s3 { top: 50px; right: 38px; animation-delay: 1.4s; }
@keyframes sparkle-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8) rotate(0deg); }
  50%      { opacity: 0.9; transform: scale(1.1) rotate(180deg); }
}

/* === 通用面板 === */
.menu-panel {
  position: relative;
  padding: var(--macaron-pad);
  border-radius: var(--macaron-radius-lg);
  background: var(--macaron-glass);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: var(--macaron-border);
  box-shadow: var(--macaron-shadow-soft);
  z-index: 1;
}

.panel-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--macaron-ink);
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.85;
}
.panel-label .sprite { color: var(--macaron-ink); }

/* === 果冻按钮基类 === */
.jelly-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--macaron-ink);
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  border-radius: var(--macaron-radius);
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 180ms ease,
              background 180ms ease;
  box-shadow: var(--macaron-shadow-soft),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  -webkit-tap-highlight-color: transparent;
}
.jelly-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, transparent 50%);
  border-radius: inherit;
  pointer-events: none;
}
.jelly-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--macaron-shadow),
              inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.jelly-btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 6px rgba(86, 197, 150, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.jelly-mint {
  background: var(--macaron-gradient-mint);
  color: var(--macaron-ink);
  border-color: rgba(86, 197, 150, 0.4);
}
.jelly-mint:hover {
  box-shadow: var(--macaron-shadow), var(--macaron-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.jelly-peach {
  background: var(--macaron-gradient-peach);
  color: #6B3A3A;
  border-color: rgba(255, 181, 168, 0.5);
}
.jelly-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* === 玩家数 === */
.player-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.player-btn {
  padding: 12px 4px;
  font-size: 14px;
}
.player-solo {
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.player-solo .sprite { color: var(--macaron-ink); }

/* === 存档卡 === */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.slot-card {
  position: relative;
  padding: 10px 12px 12px;
  border-radius: var(--macaron-radius);
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  box-shadow: var(--macaron-shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 110px;
  overflow: hidden;
}
.slot-empty {
  background: rgba(181, 232, 213, 0.18);
  border: 1px dashed rgba(136, 184, 176, 0.4);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.slot-empty .slot-icon { opacity: 0.5; }
.slot-empty .slot-head { font-size: 13px; color: var(--macaron-soft); }
.slot-empty .slot-meta { font-size: 12px; color: var(--macaron-soft); opacity: 0.7; }

.slot-has {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.85) 0%, rgba(181, 232, 213, 0.4) 100%);
}
.slot-has::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(244, 213, 141, 0) 0%, rgba(244, 213, 141, 0.6) 50%, rgba(244, 213, 141, 0) 100%);
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gold-flow 4s linear infinite;
  pointer-events: none;
}
@keyframes gold-flow {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.slot-icon { align-self: flex-start; }
.slot-head { font-size: 13px; color: var(--macaron-ink); }
.slot-meta { font-size: 12px; color: var(--macaron-ink); opacity: 0.8; }
.slot-time { font-size: 11px; color: var(--macaron-soft); margin-bottom: 4px; }
.slot-actions {
  display: flex;
  gap: 4px;
  margin-top: auto;
}
.slot-actions .jelly-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
}

/* === 速度药丸 === */
.speed-pills {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.pill-btn {
  flex: 1;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--macaron-ink);
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  border-radius: var(--macaron-radius-sm);
  cursor: pointer;
  transition: all 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
.pill-btn:hover { transform: scale(1.04); }
.pill-btn.active {
  background: var(--macaron-gradient-mint);
  color: var(--macaron-ink);
  box-shadow: var(--macaron-glow), var(--macaron-shadow-soft);
  border-color: rgba(86, 197, 150, 0.5);
  animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(181, 232, 213, 0.5), var(--macaron-shadow-soft); }
  50%      { box-shadow: 0 0 0 6px rgba(181, 232, 213, 0.0), var(--macaron-shadow-soft); }
}

/* === 地图卡 === */
.map-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.map-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  border-radius: var(--macaron-radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--macaron-ink);
  transition: all 180ms ease;
  -webkit-tap-highlight-color: transparent;
}
.map-card:hover { transform: scale(1.05); }
.map-card.active {
  background: var(--macaron-gradient-mint);
  border-color: rgba(86, 197, 150, 0.6);
  box-shadow: var(--macaron-glow), var(--macaron-shadow-soft);
  animation: breathe 2.5s ease-in-out infinite;
}
.map-card-name { font-size: 11px; }

/* === 工具组 === */
.tool-group { margin-bottom: 10px; }
.tool-group:last-child { margin-bottom: 0; }
.tool-group-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--macaron-soft);
  letter-spacing: 1px;
}
.tool-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tool-group:nth-child(3) .tool-row { grid-template-columns: repeat(2, 1fr); }
.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--macaron-ink);
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  border-radius: var(--macaron-radius);
  cursor: pointer;
  transition: all 180ms ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--macaron-shadow-soft),
              inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.tool-btn .sprite { flex-shrink: 0; color: var(--macaron-ink); }
.tool-btn:hover { transform: scale(1.04); box-shadow: var(--macaron-shadow); }
.tool-online {
  position: relative;
  background: var(--macaron-gradient-mint);
}
.tool-online::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--macaron-lemon);
  box-shadow: 0 0 6px var(--macaron-lemon);
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.4); }
}

/* === 主题药丸 === */
.theme-pills {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--macaron-ink);
  background: var(--macaron-glass-strong);
  border: var(--macaron-border);
  border-radius: 18px;
  cursor: pointer;
  transition: all 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-pill:hover { transform: scale(1.05); }
.theme-pill-mint.active {
  background: var(--macaron-gradient-mint);
  box-shadow: 0 0 0 3px rgba(181, 232, 213, 0.5);
  animation: pill-bounce 2.5s ease-in-out infinite;
}
.theme-pill-night.active {
  background: linear-gradient(135deg, #D5C5E8 0%, #6B5A8A 100%);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(213, 197, 232, 0.5);
  animation: pill-bounce 2.5s ease-in-out infinite 0.3s;
}
.theme-pill-candy.active {
  background: var(--macaron-gradient-candy);
  box-shadow: 0 0 0 3px rgba(255, 181, 168, 0.5);
  animation: pill-bounce 2.5s ease-in-out infinite 0.6s;
}
@keyframes pill-bounce {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

/* === 底部 === */
.menu-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 6px 0 0;
  z-index: 1;
  position: relative;
}
.online-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 18px;
  background: var(--macaron-glass);
  border: var(--macaron-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--macaron-ink);
}
.online-status.offline { opacity: 0.7; }
.online-dot { display: inline-flex; }
.online-dot .sprite { color: var(--macaron-ink); }

/* === reduced-motion 兜底 === */
@media (prefers-reduced-motion: reduce) {
  .menu-twinkle .tw,
  .title-dice,
  .hero-deco,
  .hero-sparkle,
  .pill-btn.active,
  .map-card.active,
  .theme-pill-mint.active,
  .theme-pill-night.active,
  .theme-pill-candy.active,
  .tool-online::after,
  .slot-has::after {
    animation: none !important;
  }
  .menu-twinkle { display: none; }
  .jelly-btn:hover, .tool-btn:hover, .map-card:hover, .pill-btn:hover, .theme-pill:hover {
    transform: none;
  }
}

/* === v4.5.0: 启动页 (splash) — 全屏可点击 ===
   视觉：大标题居中 + 星光飘落 + 四角装饰 + 主题色 chip + 提示文字。
   鼠标 / 触屏 / 空格 / Enter 都进菜单。写 localStorage 后再访不再出现。 */

.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 80% at 50% 35%, var(--macaron-mint, #B5E8D5) 0%, var(--macaron-cream, #FFF8F0) 70%);
  cursor: pointer;
  outline: none;
  z-index: 10;
  overflow: hidden;
}

[data-theme="night"] .splash {
  background:
    radial-gradient(120% 80% at 50% 35%, #5b4d8f 0%, #2a2440 70%);
}
[data-theme="candy"] .splash {
  background:
    radial-gradient(120% 80% at 50% 35%, #ffd6e8 0%, #fff0f5 70%);
}

.splash-twinkle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.splash-twinkle .tw {
  position: absolute;
  opacity: 0.85;
  animation: twinkle-fall 9s linear infinite;
}
.splash-twinkle .t1 { left: 8%;  top: -10%; animation-delay: 0s;   }
.splash-twinkle .t2 { left: 22%; top: -8%;  animation-delay: 1.6s; }
.splash-twinkle .t3 { left: 38%; top: -12%; animation-delay: 3.2s; }
.splash-twinkle .t4 { left: 52%; top: -9%;  animation-delay: 0.8s; }
.splash-twinkle .t5 { left: 67%; top: -14%; animation-delay: 2.4s; }
.splash-twinkle .t6 { left: 80%; top: -7%;  animation-delay: 4.0s; }
.splash-twinkle .t7 { left: 92%; top: -11%; animation-delay: 5.6s; }
.splash-twinkle .t8 { left: 14%; top: -6%;  animation-delay: 6.8s; }
.splash-twinkle .t9 { left: 74%; top: -13%; animation-delay: 7.4s; }

.splash-deco {
  position: absolute;
  opacity: 0.7;
  z-index: 1;
  animation: deco-float 7s ease-in-out infinite;
  pointer-events: none;
}
.splash-deco-tl { top: 8%;  left: 6%;  animation-delay: 0s; }
.splash-deco-tr { top: 6%;  right: 5%; animation-delay: 1.5s; }
.splash-deco-bl { bottom: 8%; left: 6%; animation-delay: 3s; }
.splash-deco-br { bottom: 10%; right: 5%; animation-delay: 2s; }

.splash-sparkle {
  position: absolute;
  z-index: 1;
  animation: sparkle-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
.splash-sparkle.s1 { top: 22%;  left: 18%;  animation-delay: 0.2s; }
.splash-sparkle.s2 { top: 18%;  right: 22%; animation-delay: 1.0s; }
.splash-sparkle.s3 { bottom: 24%; left: 26%; animation-delay: 1.6s; }
.splash-sparkle.s4 { bottom: 30%; right: 18%; animation-delay: 2.0s; }

.splash-core {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
  max-width: 560px;
  gap: 22px;
}

.splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.splash-dice {
  display: inline-block;
  filter: drop-shadow(0 6px 12px rgba(44, 95, 93, 0.18));
  animation: dice-bob 3.6s ease-in-out infinite;
}

.splash-title {
  margin: 0;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #2C5F5D 0%, #6B9DC8 35%, #FFB5A8 75%, #FFE9A8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(181, 232, 213, 0.5);
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.7));
  animation: title-glow 4s ease-in-out infinite;
}
[data-theme="night"] .splash-title {
  background: linear-gradient(135deg, #fff 0%, #c5b8ff 50%, #ffd6a8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="candy"] .splash-title {
  background: linear-gradient(135deg, #ff7ab8 0%, #ffb88c 60%, #fff48c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.splash-sub {
  margin: 0;
  font-size: clamp(13px, 1.4vw, 15px);
  color: var(--macaron-soft, #88B8B0);
  letter-spacing: 2px;
}
[data-theme="night"] .splash-sub { color: #c5b8ff; }
[data-theme="candy"] .splash-sub { color: #cc6f9a; }

.splash-cta {
  pointer-events: auto;
  margin-top: 8px;
  padding: 14px 38px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
}
.splash-cta.splash-jelly {
  background: linear-gradient(180deg, #fff 0%, var(--macaron-mint, #B5E8D5) 100%);
  border: 1px solid rgba(44, 95, 93, 0.18);
  border-radius: 999px;
  color: #2C5F5D;
  box-shadow:
    0 8px 24px rgba(181, 232, 213, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.splash-cta.splash-jelly:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 12px 32px rgba(181, 232, 213, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 6px rgba(181, 232, 213, 0.25);
}
.splash-cta.splash-jelly:active {
  transform: translateY(0) scale(0.98);
}

[data-theme="night"] .splash-cta.splash-jelly {
  background: linear-gradient(180deg, #c5b8ff 0%, #6b5fa8 100%);
  color: #fff;
}
[data-theme="candy"] .splash-cta.splash-jelly {
  background: linear-gradient(180deg, #ffd6e8 0%, #ffb5a8 100%);
  color: #8a3b62;
}

.splash-themes {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}
.splash-theme {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(44, 95, 93, 0.18);
  background: var(--macaron-cream, #FFF8F0);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 2px 8px rgba(44, 95, 93, 0.08);
}
.splash-theme:hover { transform: translateY(-2px) scale(1.06); }
.splash-theme.active {
  transform: scale(1.1);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.6),
    0 0 0 6px var(--macaron-mint, #B5E8D5),
    0 4px 16px rgba(44, 95, 93, 0.18);
  animation: splash-pill-bounce 0.6s ease-out;
}
.splash-theme[data-theme="night"].active {
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.6),
    0 0 0 6px #c5b8ff,
    0 4px 16px rgba(44, 95, 93, 0.18);
}
.splash-theme[data-theme="candy"].active {
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.6),
    0 0 0 6px #ffb5a8,
    0 4px 16px rgba(44, 95, 93, 0.18);
}

.splash-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--macaron-soft, #88B8B0);
  letter-spacing: 1px;
  opacity: 0.85;
}
.splash-hint-sep { opacity: 0.5; }

@keyframes twinkle-fall {
  0%   { transform: translateY(0)      rotate(0);   opacity: 0;   }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { transform: translateY(120vh)  rotate(360deg); opacity: 0; }
}
@keyframes deco-float {
  0%, 100% { transform: translateY(0)    rotate(-3deg); }
  50%      { transform: translateY(-14px) rotate(3deg); }
}
@keyframes sparkle-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.7; }
  50%      { transform: scale(1.3); opacity: 1;   }
}
@keyframes dice-bob {
  0%, 100% { transform: translateY(0)    rotate(-4deg); }
  50%      { transform: translateY(-10px) rotate(4deg); }
}
@keyframes title-glow {
  0%, 100% { filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.7)) drop-shadow(0 0 16px rgba(181, 232, 213, 0.5)); }
  50%      { filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.85)) drop-shadow(0 0 28px rgba(255, 181, 168, 0.6)); }
}
@keyframes splash-pill-bounce {
  0%   { transform: scale(0.8); }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-twinkle .tw,
  .splash-deco,
  .splash-sparkle,
  .splash-dice,
  .splash-title,
  .splash-theme.active {
    animation: none !important;
  }
  .splash-twinkle { display: none; }
}
