:root,
html[data-theme="violet"] {
  --bg: #120c1c;
  --bg-2: #1b1328;
  --bg-glow: #3b1d63;
  --card: #241833;
  --card-2: #2d1f40;
  --line: #3d2b55;
  --text: #f3edff;
  --muted: #b5a4cc;
  --accent: #9b7dff;
  --accent-2: #c4b5fd;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --input-bg: #140c22;
  --btn: #7c3aed;
  --btn-2: #6d28d9;
  --btn-secondary: #3b2a55;
  --tab: #2a1c3d;
  --tab-on: #6d28d9;
  --surface: #160c24;
  --toast-bg: #2e1b4a;
  --hover: #3b2a55;
  --logo-1: #7c3aed;
  --logo-2: #c084fc;
  --shadow: 0 12px 40px rgba(0, 0, 0, .35);
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
}
html[data-theme="ocean"] {
  --bg: #0a121c;
  --bg-2: #0f1a28;
  --bg-glow: #123a5c;
  --card: #132233;
  --card-2: #1a2f44;
  --line: #2a4560;
  --text: #e8f2ff;
  --muted: #93aec6;
  --accent: #5eb0ff;
  --accent-2: #9dceff;
  --input-bg: #0b1622;
  --btn: #1d7fd1;
  --btn-2: #1563a8;
  --btn-secondary: #24384c;
  --tab: #1a2d40;
  --tab-on: #1d7fd1;
  --surface: #0d1824;
  --toast-bg: #163048;
  --hover: #2a4560;
  --logo-1: #1d7fd1;
  --logo-2: #5eb0ff;
}
html[data-theme="forest"] {
  --bg: #0c1410;
  --bg-2: #121c16;
  --bg-glow: #1a4a32;
  --card: #16241c;
  --card-2: #1e3228;
  --line: #2d4a3a;
  --text: #eaf6ee;
  --muted: #95b5a4;
  --accent: #4ade80;
  --accent-2: #86efac;
  --input-bg: #0d1612;
  --btn: #178a4a;
  --btn-2: #146c3b;
  --btn-secondary: #24382c;
  --tab: #1a2e24;
  --tab-on: #178a4a;
  --surface: #0f1a14;
  --toast-bg: #1a3228;
  --hover: #2d4a3a;
  --logo-1: #178a4a;
  --logo-2: #4ade80;
}
html[data-theme="ember"] {
  --bg: #160e0a;
  --bg-2: #1e1410;
  --bg-glow: #5c2a12;
  --card: #271810;
  --card-2: #342018;
  --line: #5a3828;
  --text: #fff1e6;
  --muted: #c4a090;
  --accent: #fb923c;
  --accent-2: #fdba74;
  --input-bg: #140c08;
  --btn: #ea580c;
  --btn-2: #c2410c;
  --btn-secondary: #3d281c;
  --tab: #2e1c14;
  --tab-on: #ea580c;
  --surface: #1a100c;
  --toast-bg: #3a2214;
  --hover: #5a3828;
  --logo-1: #ea580c;
  --logo-2: #fb923c;
}
html[data-theme="light"] {
  --bg: #f3f0f8;
  --bg-2: #ebe6f4;
  --bg-glow: #ddd4f0;
  --card: #ffffff;
  --card-2: #f7f4fc;
  --line: #d4cce0;
  --text: #1f1630;
  --muted: #6b5f80;
  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --input-bg: #f8f5fc;
  --btn: #7c3aed;
  --btn-2: #6d28d9;
  --btn-secondary: #e8e0f4;
  --tab: #ebe4f6;
  --tab-on: #7c3aed;
  --surface: #f0ebf8;
  --toast-bg: #2e1b4a;
  --hover: #e0d6f0;
  --logo-1: #7c3aed;
  --logo-2: #c084fc;
  --shadow: 0 10px 28px rgba(60, 40, 100, .12);
  --good: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(1200px 600px at 10% -10%, var(--bg-glow) 0%, var(--bg) 45%); color: var(--text); }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; }
.wrap { max-width: 1100px; width: 100%; margin: 0 auto; padding: 20px 16px 80px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .04em; min-width: 0; flex: 1 1 auto; }
.brand .logo { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, var(--logo-1), var(--logo-2)); display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.brand > div:not(.logo),
#siteName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-pick { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; flex: 0 0 auto; }
.theme-pick-label { font-size: 12px; }
.theme-pick select {
  width: auto; min-width: 88px; padding: 6px 10px; font-size: 12px;
  background: var(--input-bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
}
.topbar > .row { flex: 0 1 auto; min-width: 0; justify-content: flex-end; }
.card { background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%), var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); min-width: 0; width: 100%; max-width: 100%; }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.home-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* 玩家頁：右側內容區垂直堆疊（同後台分頁） */
body.player-ui .player-page-stack,
body.player-ui .player-main > [id^="tab-"]:not(.grid) {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.player-ui .player-page-stack > .card,
body.player-ui .player-main > [id^="tab-"]:not(.grid) > .card {
  margin-top: 0;
  margin-bottom: 0;
}
.nav-points {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
  padding: 4px 2px 2px;
  line-height: 1.35;
}
.nav-user {
  font-size: 12px;
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.tf-preview-ok { color: var(--good); font-size: 13px; margin: 6px 0 0; }
.tf-preview-bad { color: var(--bad); font-size: 13px; margin: 6px 0 0; }
.grid-shop { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
h1, h2, h3 { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, textarea {
  width: 100%; max-width: 100%; min-width: 0; background: var(--input-bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; outline: none;
}
input[type="checkbox"], input[type="radio"] {
  width: auto; min-width: 18px; height: auto; padding: 0; margin: 0 6px 0 0; vertical-align: middle;
}
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 6px; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--btn), var(--btn-2)); font-weight: 600;
}
.btn.secondary { background: var(--btn-secondary); color: var(--text); }
.btn.good { background: #166534; }
.btn.bad { background: #7f1d1d; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tabs { display: flex; gap: 8px; overflow: auto; margin: 8px 0 16px; }
.tab, .hist-tab { padding: 8px 12px; border-radius: 999px; background: var(--tab); color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active, .hist-tab.active { background: var(--tab-on); color: #fff; }
.points { font-size: 28px; font-weight: 800; color: var(--accent-2); }
.item { text-align: center; }
.item img { width: 64px; height: 64px; object-fit: contain; image-rendering: auto; background: var(--surface); border-radius: 12px; }
.item .name { margin: 8px 0 4px; font-weight: 700; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--btn-secondary); color: var(--accent-2); }
.badge.good { background: #14532d; color: var(--good); }
.badge.bad { background: #7f1d1d; color: #fecaca; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: middle; }
.table img { width: 32px; height: 32px; }
/* 後台分頁：多張卡片垂直排列時統一間距 */
body.admin-ui [id^="page-"]:not(.grid) {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.admin-ui [id^="page-"]:not(.grid) > .card {
  margin-top: 0;
  margin-bottom: 0;
}
body.admin-ui .desktop-table { display: none !important; }
body.admin-ui .player-cards,
body.admin-ui .list-cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  min-width: 0;
  width: 100%;
}
body.admin-ui .mobile-only {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
@media (min-width: 900px) {
  body.admin-ui .player-cards,
  body.admin-ui .list-cards {
    grid-template-columns: 1fr 1fr;
  }
  body.admin-ui #shopCards.list-cards,
  body.admin-ui #rcCards.list-cards {
    grid-template-columns: 1fr;
  }
}
.vip-benefits { margin: 12px 0 0; font-size: 13px; }
.vip-tiers-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.vip-tier-col {
  flex: 1 1 0;
  min-width: 196px;
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.vip-tier-col.vip-tier-current { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.vip-tier-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  font-weight: 700;
  color: var(--accent-2);
}
.vip-tier-current .vip-tier-head b { color: var(--accent-2); }
.vip-tier-head .muted { font-size: 11px; font-weight: 400; }
.vip-benefit-group { display: grid; gap: 2px; }
.vip-online-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.vip-online-block > .vip-benefit-label { align-self: start; padding-top: 1px; }
.vip-online-extra {
  grid-column: 2;
  text-align: right;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 11px;
  line-height: 1.35;
}
.vip-benefit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.vip-benefit-sub {
  padding: 2px 8px 4px;
  background: transparent;
  border: none;
  border-radius: 0;
}
.vip-benefit-label { color: var(--text); font-weight: 600; font-size: 11px; line-height: 1.3; }
.vip-benefit-value {
  color: var(--text);
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  line-height: 1.35;
  font-size: 12px;
}
.price-block { margin-top: 6px; line-height: 1.4; }
.price-main { font-weight: 600; color: var(--accent-2); }
.price-sub { font-size: 12px; margin-top: 2px; }
.points-bar { margin-bottom: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.points-bar b { color: var(--accent-2); font-weight: 700; }
.points-breakdown {
  display: inline-block;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 12px;
  line-height: 1.45;
}
.reward-tier-row {
  margin-top: 6px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.reward-tier-row:last-child { border-bottom: none; }
.reward-claim-break .points-breakdown { font-size: 13px; }
.confirm-cost { margin: 10px 0 4px; font-size: 15px; line-height: 1.4; }
.confirm-cost-sub { margin: 0 0 4px; line-height: 1.4; }
.confirm-balance { margin: 0 0 10px; line-height: 1.4; }
.confirm-note { margin-top: 10px; line-height: 1.45; }
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--toast-bg); color: #fff; border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; z-index: 50; max-width: 90%; }
.auth { max-width: 420px; margin: 10vh auto; }
.sidebar { display: flex; gap: 16px; align-items: flex-start; width: 100%; max-width: 100%; }
.sidebar > div { min-width: 0; max-width: 100%; flex: 1; }
.nav { min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.nav button { text-align: left; }
/* 只縮窄電腦版左側選單，不改手機（≤800px） */
@media (min-width: 801px) {
  body.admin-ui .wrap { max-width: 1280px; }
  body.admin-ui .sidebar > .nav {
    flex: 0 0 148px;
    width: 148px;
    min-width: 148px;
    max-width: 148px;
    padding: 12px;
  }
  body.admin-ui .sidebar > div:not(.nav) {
    flex: 1 1 auto;
    min-width: 0;
  }
  body.player-ui .wrap { max-width: 1280px; }
  body.player-ui .sidebar > .nav {
    flex: 0 0 148px;
    width: 148px;
    min-width: 148px;
    max-width: 148px;
    padding: 12px;
  }
  body.player-ui .sidebar > .player-main {
    flex: 1 1 auto;
    min-width: 0;
  }
}
.search-list { max-height: 240px; overflow: auto; margin-top: 8px; }
.search-list .hit { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.search-list .hit:hover { background: var(--hover); }
.search-list .hit.hit-on {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
}
.search-list img { width: 36px; height: 36px; }
.cp-selected {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line, #3d2b55);
  background: rgba(0, 0, 0, 0.15);
}
.cp-selected.cp-selected-on {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.pal-picked { display: flex; gap: 10px; align-items: center; margin-top: 0; }
.pal-picked .badge { margin-bottom: 4px; }
.pal-picked img { width: 48px; height: 48px; object-fit: contain; }
.pack-builder { margin-top: 10px; display: grid; gap: 6px; }
.pack-line { display: grid; grid-template-columns: 28px 36px 1fr 80px auto; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.pack-line.dragging { opacity: .45; }
.rank-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.rank-me-summary {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(46, 125, 50, 0.45);
  background: rgba(46, 125, 50, 0.12);
  font-size: 14px;
  line-height: 1.55;
}
.rank-board { display: grid; gap: 12px; margin-top: 4px; }
.rank-entry {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.rank-entry.rank-me {
  border-color: rgba(76, 175, 80, 0.65);
  background: linear-gradient(180deg, rgba(76,175,80,0.16) 0%, rgba(76,175,80,0.06) 100%);
  box-shadow: 0 0 0 1px rgba(76,175,80,0.2), 0 4px 14px rgba(0,0,0,0.2);
}
.rank-entry.rank-top-1 { border-color: rgba(255, 193, 7, 0.55); }
.rank-entry.rank-top-2 { border-color: rgba(189, 189, 189, 0.55); }
.rank-entry.rank-top-3 { border-color: rgba(205, 127, 50, 0.55); }
.rank-entry-head {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-entry.rank-top-1 .rank-entry-head { color: #ffc107; }
.rank-entry.rank-top-2 .rank-entry-head { color: #e0e0e0; }
.rank-entry.rank-top-3 .rank-entry-head { color: #cd7f32; }
.rank-entry-line {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.rank-entry-line b { display: block; margin-bottom: 2px; color: var(--muted, #aaa); font-weight: 600; font-size: 12px; }
.rank-entry-id { font-size: 16px; font-weight: 700; color: var(--text, #f5f5f5); word-break: break-all; }
.rank-entry-points { margin-top: 2px; font-size: 16px; font-weight: 800; color: var(--accent-2); }
.rank-entry-points b { display: inline; margin: 0 6px 0 0; color: var(--muted, #aaa); font-size: 12px; font-weight: 600; }
.rank-empty { padding: 18px 0; text-align: center; }
.fail { color: #f87171; font-size: 12px; margin-top: 4px; }
.ok { color: #4ade80; font-size: 13px; font-weight: 600; margin-top: 4px; }
.row-fail td { background: rgba(248, 113, 113, .08); }
h4 { margin: 12px 0 6px; font-size: 14px; }
.pack-line img { width: 36px; height: 36px; object-fit: contain; }
.pack-list { min-height: 0; line-height: 1.35; max-height: 3.2em; overflow: hidden; }
.more { color: var(--accent-2); font-size: 12px; margin-top: 4px; }
.confirm-pack { max-height: 240px; overflow: auto; text-align: left; margin: 10px 0; display: grid; gap: 6px; }
.confirm-line { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: center; font-size: 13px; }
.confirm-line img { width: 28px; height: 28px; object-fit: contain; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--good); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 0; width: 100%; }
.field-row > * { min-width: 0; }
.time-pick {
  display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  max-width: 280px;
}
.time-pick select {
  width: auto; flex: 1 1 0; min-width: 72px; max-width: 110px;
}
.time-pick .muted { flex: 0 0 auto; white-space: nowrap; }
.date-filter { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-top: 8px; }
.date-filter > div { flex: 0 0 auto; min-width: 0; }
.date-filter label { margin: 0 0 4px; }
.date-filter input[type="date"] { width: 10.2em; max-width: 100%; padding: 8px 8px; }
.table.drag-table tr.dragging { opacity: .45; background: var(--tab); }
.drag-handle { cursor: grab; color: var(--muted); font-size: 18px; user-select: none; padding: 8px 10px; display: inline-block; }
.drag-handle:active { cursor: grabbing; }
.cat-row { margin-top: 8px; }
.cat-chip { border: 1px solid var(--line); background: var(--tab); color: var(--muted); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.cat-chip.active { background: var(--tab-on); color: #fff; border-color: var(--tab-on); }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 80; padding: 16px; }
.modal { max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; }
.modal-actions { justify-content: flex-end; margin-top: 14px; }
.pal-form label.inline { display: inline-flex; align-items: center; margin-right: 12px; }
.pal-form .suit-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 6px 0; }
.pal-form .suit-row input { width: 90px; }
.pal-form .cp-combo { margin: 6px 0 10px; }
.pal-form .cp-combo-q { width: 100%; }
.pal-form .cp-combo-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 180px;
  margin-top: 4px;
}
.pal-form .cp-combo-desc {
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
  min-height: 1.35em;
}
.merchant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.merchant-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line, #3b2a55); background: transparent; color: inherit; cursor: pointer; text-align: center; }
.merchant-pick img { width: 40px; height: 40px; object-fit: contain; }
.merchant-pick.merchant-pick-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.merchant-pick b { font-size: 13px; line-height: 1.3; }
.merchant-pick .muted { font-size: 11px; line-height: 1.25; }
.shop-toolbar { margin-bottom: 14px; }
.stat-list { margin: 0; padding-left: 18px; font-size: 13px; }
.pause-banner {
  background: linear-gradient(180deg, rgba(251,191,36,.18), transparent 70%), #2a1c0a;
  border: 1px solid #fbbf24;
  color: #fde68a;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 16px;
}
.pause-banner b { color: #fbbf24; display: block; margin-bottom: 4px; }
.ver-mismatch {
  background: #3b1212;
  border: 1px solid #f87171;
  color: #fecaca;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
}
.ver-mismatch b { color: #fff; }
.pause-card { border-color: #fbbf24; }
.nav button.nav-on { background: var(--tab-on); color: #fff; }
.player-cards { display: none; }
.player-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.player-card-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.player-card-name { min-width: 0; }
.player-card-name b { display: block; overflow-wrap: anywhere; }
.player-card-name .muted { overflow-wrap: anywhere; word-break: break-all; }
.player-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.player-card .player-pts { font-weight: 800; color: var(--accent-2); white-space: nowrap; }
.player-card-actions { margin-top: 8px; }
.player-card-actions .btn { flex: 1 1 auto; }
.adv-box { margin-top: 10px; }
.adv-box summary { cursor: pointer; color: var(--muted); font-size: 13px; }
#shopForm > summary,
#rcForm > summary,
details.card > summary.panel-sum {
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  list-style: none;
}
details.card > summary.panel-sum::-webkit-details-marker { display: none; }
details.card > summary.panel-sum h3 {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
details.card > summary.panel-sum::before {
  content: "▸ ";
  color: var(--muted);
  font-weight: 700;
}
details.card[open] > summary.panel-sum::before,
details.gs-server-panel[open] > summary.panel-sum::before { content: "▾ "; }
.gs-server-panel {
  display: block;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.gs-server-panel > summary.panel-sum {
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  list-style: none;
}
.gs-server-panel > summary.panel-sum::-webkit-details-marker { display: none; }
.gs-server-panel > summary.panel-sum h3 {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}
.gs-server-panel > summary.panel-sum::before {
  content: "▸ ";
  color: var(--muted);
  font-weight: 700;
}
.pager { justify-content: space-between; margin-top: 10px; }
.mobile-only { display: none; }
.list-cards { display: none; }
.perm-grid {
  display: grid;
  gap: 6px 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.perm-grid .inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.list-kv .muted { display: block; margin-bottom: 2px; }
.shop-card-head {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}
.shop-card-head .drag-handle {
  align-self: start;
  height: 44px;
  min-width: 28px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  text-align: center;
}
.shop-card-head > span:empty {
  display: block;
  min-width: 28px;
  height: 0;
}
.shop-card-head img { width: 44px; height: 44px; object-fit: contain; }
.shop-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-card-grid .span2 { grid-column: 1 / -1; }
.shop-item-card .row { flex-wrap: wrap; }
.shop-item-card .row > input, .shop-item-card .row > select { flex: 1 1 90px; width: auto; min-width: 0; }
.sell-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-top: 10px;
}
.sell-row img { width: 48px; height: 48px; object-fit: contain; }
.sell-actions { display: flex; gap: 8px; align-items: center; }
.sell-row input { width: 7.5em; text-align: center; margin: 0; }
/* 玩家管理：即時狀態四格 */
#page-players .server-live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 900px) {
  #page-players .server-live-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.stat-card .points { font-size: 22px; }

/* 後台長表單：有改動才跳出固定儲存列 */
.admin-sticky-save {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--bg-2) 94%, transparent);
  border-top: 1px solid var(--accent);
  box-shadow: 0 -10px 32px color-mix(in srgb, var(--accent) 22%, transparent);
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.admin-sticky-save.is-dirty {
  display: flex;
}
.admin-sticky-save .btn { min-width: 120px; }
.admin-sticky-save .btn.sticky-reset { min-width: 96px; }
.admin-sticky-save .muted {
  margin: 0;
  font-size: 13px;
  color: var(--accent-2);
  font-weight: 700;
}
body.admin-ui .wrap {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 800px) {
  html, body { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
  .wrap { padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px)); overflow-x: hidden; }
  body.admin-ui .wrap { padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)); }
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }
  .brand { flex: 1 1 calc(100% - 120px); max-width: calc(100% - 4px); }
  .brand > div:not(.logo),
  #siteName { font-size: 15px; letter-spacing: 0; }
  .topbar > .row {
    flex: 1 1 100%;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .theme-pick-label { display: none; }
  .theme-pick select {
    min-width: 72px;
    max-width: 96px;
    padding: 6px 8px;
    font-size: 13px;
  }
  #serverBadge { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #ver { flex: 0 0 auto; }
  input, select, textarea { font-size: 16px; padding: 12px; max-width: 100%; }
  input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; font-size: inherit; }
  input[type="date"], input[type="datetime-local"] { min-width: 0; max-width: 100%; }
  .date-filter input[type="date"] { width: 9.6em; padding: 8px; font-size: 16px; }
  .btn { padding: 12px 14px; min-height: 44px; }
  .auth { margin: 6vh auto; max-width: none; }
  .auth .row { display: grid; grid-template-columns: 1fr 1fr; }
  .tabs { margin: 4px 0 12px; width: 100%; max-width: 100%; }
  .tab, .hist-tab { flex: 1; text-align: center; padding: 10px 8px; }
  .home-grid { grid-template-columns: 1fr; }
  .grid-shop { grid-template-columns: 1fr 1fr; gap: 10px; }
  .item img { width: 56px; height: 56px; }
  .cat-row { flex-wrap: wrap; overflow: visible; max-width: 100%; }
  #btnCheckin, #btnBind, #pauseSave, .admin-sticky-save .btn { width: 100%; }
  .admin-sticky-save { justify-content: stretch; flex-direction: column; align-items: stretch; }
  .admin-sticky-save .muted { margin-right: 0; }
  .sidebar { flex-direction: column; gap: 12px; width: 100%; }
  .sidebar > div { width: 100%; }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    padding: 10px 12px;
  }
  .nav button, .nav a {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
    border-radius: 999px;
    padding: 8px 12px;
    min-height: 36px;
    font-size: 13px;
  }
  .nav-rest { display: none; }
  .field-row { grid-template-columns: 1fr; width: 100%; }
  #page-dash { grid-template-columns: 1fr 1fr; }
  #page-dash > .card:not(.stat-card) { grid-column: 1 / -1; }
  .desktop-table { display: none !important; }
  .player-cards, .list-cards { display: grid; gap: 10px; margin-top: 10px; min-width: 0; width: 100%; }
  .card { overflow-x: hidden; }
  .mobile-only {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    max-width: 100%;
    white-space: normal;
  }
  .mobile-only input[type="checkbox"] { width: auto; flex: 0 0 auto; }
  .pack-line { grid-template-columns: 28px 36px 1fr auto; }
  .pack-line input[type="number"] { grid-column: 3; }
  .modal { max-width: none; max-height: 90vh; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; }
  .sell-row { grid-template-columns: 48px minmax(0, 1fr); }
  .sell-actions { grid-column: 1 / -1; }
  .sell-actions .btn { flex: 1; }
}

.guide-sum {
  cursor: pointer; font-weight: 700; font-size: 1.05rem; list-style: none;
}
.guide-sum::-webkit-details-marker { display: none; }
.guide-sum::before { content: "▸ "; color: var(--muted); }
details[open] > .guide-sum::before { content: "▾ "; }
.guide-steps { margin: 8px 0 0; padding-left: 4px; line-height: 1.55; list-style: none; }
.guide-steps li { margin: 4px 0; }
.guide-steps li.done { color: var(--muted); }
.guide-steps li.done .guide-txt { text-decoration: line-through; }
.guide-steps li.current { color: var(--accent-2); font-weight: 700; }
.guide-n { display: inline-block; min-width: 1.4em; font-weight: 700; }
.task-pick {
  display: flex; flex-wrap: wrap; gap: 6px 12px; max-height: 180px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.15);
  margin-top: 6px;
}
.task-pick-item { margin: 0; font-size: 13px; }
.checkin-medals {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 10px 0 4px; min-height: 0;
}
.medal {
  --m: #8a6a4a; --m2: #c4a484; --glow: transparent;
  width: 56px; height: 56px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.45), transparent 42%),
    radial-gradient(circle at 70% 75%, rgba(0,0,0,.25), transparent 50%),
    linear-gradient(145deg, var(--m2), var(--m));
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.35), 0 0 12px var(--glow);
  display: grid; place-items: center; text-align: center;
  position: relative; flex: 0 0 auto;
}
.medal::before {
  content: "PAL"; position: absolute; top: 5px; left: 0; right: 0;
  font-size: 7px; letter-spacing: .08em; color: rgba(255,255,255,.7); font-weight: 700;
}
.medal-num {
  font-size: 15px; font-weight: 800; line-height: 1; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.medal-unit { display: block; font-size: 9px; font-weight: 600; color: rgba(255,255,255,.85); margin-top: 1px; }
.medal.bronze { --m: #6b4423; --m2: #c08a52; }
.medal.silver { --m: #5a6570; --m2: #c8d0d8; }
.medal.gold { --m: #9a6b12; --m2: #f0d060; --glow: rgba(240, 200, 80, .35); }
.medal.platinum { --m: #3d5a80; --m2: #a8d4ff; --glow: rgba(140, 200, 255, .35); }
.medal.locked {
  filter: grayscale(.85) brightness(.55); opacity: .55;
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
}
.medal-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.medal-label { font-size: 10px; color: var(--muted); }
.item-fav {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(0,0,0,.35); color: #bbb; font-size: 16px; line-height: 1;
}
.item-fav.on { color: #f5c542; }
.card.item { position: relative; }
#checkinPointsBreak { margin: 4px 0 0; line-height: 1.45; font-size: 12px; }
.hist-icon {
  width: 28px; height: 28px; border-radius: 8px; object-fit: contain;
  vertical-align: middle; margin-right: 6px; background: rgba(0,0,0,.2);
}
.hist-icons { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.daily-fx {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(120,80,255,.25), rgba(80,200,160,.2));
  border: 1px solid var(--line); font-weight: 700; text-align: center;
  animation: dailyPop .7s ease;
}
@keyframes dailyPop {
  0% { transform: scale(.92); opacity: 0; }
  40% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.task-progress { margin: 6px 0 10px; }
.task-progress-bar {
  height: 8px; border-radius: 4px; background: var(--line); overflow: hidden;
}
.task-progress-bar > span {
  display: block; height: 100%; background: linear-gradient(90deg, #6c8cff, #5bc4a8);
  border-radius: 4px; transition: width .25s ease;
}
.streak-warn {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(192, 57, 43, .12); border: 1px solid rgba(192, 57, 43, .35);
  color: #c0392b; font-size: 13px;
}
.conn-health-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: #95a5a6; box-shadow: 0 0 0 2px rgba(0,0,0,.06);
}
.conn-health-dot.good { background: #27ae60; }
.conn-health-dot.warn { background: #f39c12; }
.conn-health-dot.bad { background: #c0392b; }
.ot-rest-warn {
  margin: 8px 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(192, 57, 43, .1); border: 1px solid rgba(192, 57, 43, .3);
  color: #c0392b; font-size: 13px;
}
