:root {
  --bg: #0b0e13;
  --panel: #121821;
  --card: #171e29;
  --line: #2a3545;
  --text: #e8eef7;
  --muted: #93a0b3;
  --accent: #3b82f6;
  --ok: #34d399;
  --bad: #f87171;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 50%),
              linear-gradient(180deg, #101623, var(--bg));
  min-height: 100vh;
}
.hidden { display: none !important; }
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.auth-box { max-width: 420px; margin: 10vh auto; }
h1 { margin: 0; font-size: 26px; }
.sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.top {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 18px; flex-wrap: wrap;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 6px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 6px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0d121a; color: var(--text); margin-bottom: 10px;
}
input[type="checkbox"], input[type="radio"] {
  width: auto; min-width: 16px; height: auto; margin: 0 8px 0 0; padding: 0;
  vertical-align: middle; flex-shrink: 0; accent-color: var(--accent);
}
.row label, label.row {
  display: inline-flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; white-space: nowrap; margin-bottom: 0; color: var(--text); font-size: 13px;
}
.row label input[type="checkbox"], label.row input[type="checkbox"] {
  margin: 0;
}
.btn {
  border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #243041; }
.btn.danger { background: #b91c1c; }
.btn.ok { background: #059669; }
.challenge-aid {
  text-align: left; width: 100%; box-sizing: border-box;
  border-radius: 10px; border: 1px solid var(--line); background: #1a2332;
  color: inherit; padding: 12px 14px; cursor: pointer;
}
.challenge-aid:hover { border-color: var(--accent); background: #243041; }
.challenge-aid .t { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.challenge-aid .s { font-size: 12px; color: var(--muted); line-height: 1.4; word-break: break-all; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  background: #1a2332; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; cursor: pointer;
}
.tab.active { color: #fff; background: #2563eb; border-color: #2563eb; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.muted { color: var(--muted); }
.logs { max-height: 110px; overflow: auto; color: var(--muted); font-size: 12px; white-space: pre-wrap; }
#toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none;
  background: rgba(17, 24, 39, 0.96); border: 1px solid var(--line); padding: 14px 18px; border-radius: 12px;
  z-index: 1000; max-width: min(92vw, 420px); text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.45);
  font-size: 15px; line-height: 1.45; pointer-events: none;
}
#toast.bad { border-color: var(--bad); color: #fecaca; }
#toast.ok { border-color: var(--ok); color: #bbf7d0; }
.auth-error {
  display: none; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca; font-size: 13px; line-height: 1.4;
}
.auth-error.on { display: block; }
.acct-list { display: flex; flex-direction: column; gap: 10px; }
.acct-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.acct-card .line1 { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.acct-card .title { font-weight: 700; font-size: 15px; word-break: break-all; }
.acct-card .meta { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.acct-card .money { margin-top: 6px; font-size: 13px; }
.acct-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.acct-card .actions .btn { padding: 8px 12px; font-size: 13px; }
.status-pill {
  flex-shrink: 0; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  background: #243041; color: var(--muted);
}
.status-pill.on { background: rgba(52,211,153,.15); color: var(--ok); }
.status-pill.bad { background: rgba(248,113,113,.15); color: var(--bad); }
.status-pill.wait { background: rgba(59,130,246,.15); color: #93c5fd; }
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow: auto;
}
.sheet-mask.hidden { display: none !important; }
.sheet {
  width: min(100%, 520px); max-height: min(86vh, 760px);
  display: flex; flex-direction: column;
  background: #141b26; border: 1px solid var(--line); border-radius: 16px;
  padding: 0; box-shadow: 0 16px 48px rgba(0,0,0,.45);
  margin: auto;
}
.sheet.sheet-lg { width: min(100%, 640px); }
.sheet-head { padding: 16px 16px 0; flex-shrink: 0; }
.sheet-body {
  padding: 12px 16px; overflow: auto; flex: 1; min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #3b4a63 transparent;
}
.sheet-body::-webkit-scrollbar { width: 8px; height: 8px; }
.sheet-body::-webkit-scrollbar-track { background: transparent; }
.sheet-body::-webkit-scrollbar-thumb {
  background: #3b4a63; border-radius: 999px; border: 2px solid transparent;
  background-clip: padding-box;
}
.sheet-body::-webkit-scrollbar-thumb:hover { background: #526380; background-clip: padding-box; }
.sheet-foot {
  padding: 12px 16px 16px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; flex-shrink: 0;
}
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sheet-sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.sheet-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px; margin-top: 10px; flex-shrink: 0;
}
.sheet-tab {
  background: #1a2332; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 12px;
}
.sheet-tab.active { color: #fff; background: #2563eb; border-color: #2563eb; }
.idle-panel.hidden { display: none !important; }
.check-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;
}
@media (max-width: 520px) { .check-grid { grid-template-columns: 1fr; } }
.check-grid label.row {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: #0d121a; border: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.map-toolbar input { flex: 1; min-width: 140px; margin-bottom: 0; }
.map-selected {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; margin-bottom: 10px;
}
.map-selected-list {
  display: flex; flex-direction: column; flex-wrap: nowrap; gap: 8px;
  max-height: 220px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: #3b4a63 transparent;
}
.map-selected-list::-webkit-scrollbar { width: 8px; }
.map-selected-list::-webkit-scrollbar-thumb { background: #3b4a63; border-radius: 999px; }
.map-sel-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 10px;
  background: #0d121a; border: 1px solid var(--line);
}
.map-sel-info { flex: 1; min-width: 120px; }
.map-sel-info .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-sel-info .id { color: var(--muted); font-size: 12px; margin-top: 2px; }
.map-sel-row .map-atk {
  width: 110px; margin: 0; padding: 6px 8px; font-size: 12px; flex-shrink: 0;
}
.map-sel-num {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  color: var(--muted); font-size: 12px;
}
.map-sel-num input {
  width: 58px; margin: 0; padding: 6px 6px; font-size: 12px;
}
.ly-bag { display: flex; flex-direction: column; gap: 8px; min-height: 420px; }
.ly-bag-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ly-bag-title { font-size: 15px; font-weight: 700; }
.ly-bag-title b { color: var(--ok); font-weight: 700; margin-left: 6px; }
.ly-bag-body {
  display: grid; grid-template-columns: 1fr 88px; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #0d121a; padding: 10px;
  min-height: 420px;
}
.ly-bag-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ly-bag-page { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.ly-bag-page.hidden { display: none; }
.ly-bag-nav { display: flex; flex-direction: column; gap: 6px; }
.ly-bag-nav button {
  width: 100%; padding: 10px 6px; border-radius: 8px; border: 1px solid var(--line);
  background: #121821; color: var(--text); cursor: pointer; font-size: 13px;
}
.ly-bag-nav button.active {
  border-color: rgba(59,130,246,.55); background: rgba(59,130,246,.18); color: #93c5fd;
}
.ly-bag-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ly-bag-tools .ly-inline-num {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 13px;
}
.ly-bag-tools .ly-inline-num input[type="number"] {
  width: 64px; height: 28px; margin: 0; padding: 0 6px;
}
.ly-bag-table-wrap {
  flex: 1; min-height: 160px; max-height: 320px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px;
  scrollbar-width: thin; scrollbar-color: #3b4a63 transparent;
}
.ly-bag-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ly-bag-table th, .ly-bag-table td {
  padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left;
}
.ly-bag-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: #121821; }
.ly-bag-table th:nth-child(1), .ly-bag-table td:nth-child(1) { width: 44px; text-align: center; }
.ly-bag-table th:nth-child(3), .ly-bag-table td:nth-child(3) { width: 64px; text-align: right; }
.ly-bag-table th:nth-child(4), .ly-bag-table td:nth-child(4) { width: 72px; text-align: center; color: var(--muted); }
.ly-bag-table tbody tr { cursor: pointer; }
.ly-bag-table tbody tr:hover td { background: rgba(255,255,255,.03); }
.ly-bag-table tbody tr.selected td { background: rgba(59,130,246,.16); }
.ly-bag-hint { color: var(--muted); font-size: 12px; }
.ly-bag-opt-groups {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 220px; overflow: auto; margin-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: #3b4a63 transparent;
}
.ly-bag-opt-group {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #0a0e14;
}
.ly-bag-opt-group > strong {
  display: block; color: #93c5fd; font-size: 12px; margin-bottom: 4px; font-weight: 600;
}
.ly-bag-opt-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px;
}
.ly-bag-opt-group label {
  display: inline-flex; align-items: center; gap: 4px; margin: 0; min-width: 0;
  font-size: 12px; white-space: nowrap; overflow: hidden; cursor: pointer;
}
.ly-bag-opt-group label span { overflow: hidden; text-overflow: ellipsis; }
.ly-bag-opt-group input { width: auto; margin: 0; }
@media (max-width: 900px) {
  .ly-bag-body { grid-template-columns: 1fr; }
  .ly-bag-nav { flex-direction: row; flex-wrap: wrap; }
  .ly-bag-nav button { width: auto; flex: 1; }
  .ly-bag-opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.map-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px; font-size: 12px;
  background: rgba(59,130,246,.18); color: #93c5fd; border: 1px solid rgba(59,130,246,.35);
  cursor: pointer;
}
.map-chip .x { opacity: .7; }
.map-groups {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; max-height: 72px; overflow: auto;
  scrollbar-width: thin; scrollbar-color: #3b4a63 transparent;
}
.map-groups::-webkit-scrollbar { height: 6px; }
.map-groups::-webkit-scrollbar-thumb { background: #3b4a63; border-radius: 999px; }
.map-group-btn {
  border: 1px solid var(--line); background: #1a2332; color: var(--muted);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.map-group-btn.active { background: #243041; color: #fff; border-color: #3b82f6; }
.map-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
}
.map-card {
  text-align: left; border: 1px solid var(--line); background: #0d121a; color: var(--text);
  border-radius: 10px; padding: 10px; cursor: pointer; font-size: 12px; line-height: 1.35;
}
.map-card:hover { border-color: #3b82f6; }
.map-card.on {
  border-color: #3b82f6; background: rgba(59,130,246,.12);
  box-shadow: inset 0 0 0 1px rgba(59,130,246,.35);
}
.map-card .name { font-weight: 600; font-size: 13px; }
.map-card .id { color: var(--muted); margin-top: 2px; }
.map-empty { color: var(--muted); font-size: 12px; padding: 12px 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; font-size: 13px; margin-bottom: 12px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-all; }
.tag {
  display: inline-block; margin: 0 6px 6px 0; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; background: #243041; color: var(--muted);
}
.tag.on { background: rgba(52,211,153,.15); color: var(--ok); }
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #243041; color: var(--muted); font-size: 12px; margin-right: 6px;
}
.gate-card { text-align: left; }
.gate-card a {
  display: block; padding: 14px 16px; margin-top: 10px; border-radius: 12px;
  background: #1a2332; border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.gate-card a:hover { border-color: var(--accent); }
.gate-card .t { font-weight: 700; }
.gate-card .d { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 隐私模式：进服设置中已填敏感字段用圆点遮盖（取消勾选即恢复可见） */
body.privacy-on #setRemark,
body.privacy-on #setServerId,
body.privacy-on #setServerName,
body.privacy-on #setPlayerId,
body.privacy-on #setRoleName {
  -webkit-text-security: disc;
  text-security: disc;
}

/* —— chat sheet (moved from index.html inline) —— */
.role-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-height: 0; }
.role-links a {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: #1e3a5f; color: #93c5fd; text-decoration: none; font-size: 12px;
  border: 1px solid #2563eb;
}
.role-links a:hover { background: #2563eb; color: #fff; }
.chat-list {
  height: min(56vh, 480px); overflow: auto; background: #0f172a;
  border: 1px solid #243041; border-radius: 10px; padding: 10px; font-size: 13px;
  line-height: 1.55;
}
.chat-line { margin-bottom: 6px; word-break: break-word; }
.chat-line .ch { color: #64748b; margin-right: 4px; }
.chat-line .who { color: #93c5fd; margin-right: 6px; cursor: pointer; }
.chat-input-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.chat-input-row input { flex: 1; margin: 0; min-width: 0; }
.chat-channel-dd { position: relative; flex-shrink: 0; }
.chat-channel-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 72px; height: 40px; padding: 0 10px;
  border: 1px solid #334155; border-radius: 10px;
  background: #1e293b; color: #e2e8f0; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chat-channel-btn .caret { font-size: 10px; opacity: .75; }
.chat-channel-menu {
  position: absolute; left: 0; bottom: calc(100% + 6px);
  min-width: 132px; max-height: min(50vh, 320px); overflow: auto;
  padding: 6px; border-radius: 12px; border: 1px solid #334155;
  background: #0f172a; box-shadow: 0 -8px 24px rgba(0,0,0,.35); z-index: 40;
}
.chat-channel-menu.hidden { display: none !important; }
.chat-channel-menu button {
  display: block; width: 100%; text-align: left;
  border: 0; border-radius: 8px; background: transparent;
  color: #cbd5e1; padding: 10px 12px; font-size: 14px; cursor: pointer;
}
.chat-channel-menu button.active { background: #2563eb; color: #fff; }
.chat-channel-menu button:not(.active):active { background: #1e293b; }
.chat-hint { color: #94a3b8; font-size: 12px; margin-top: 6px; min-height: 18px; }
