:root {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #172835;
  background: #edf2f5;
  --accent: #075d5b;
  --muted: #4c5e69;
  --border: #d3dee4;
}
* { box-sizing: border-box; }
body { margin: 0; }
header { min-height: 64px; padding: 12px clamp(18px, 5vw, 70px); background: #122833; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
main { width: min(1120px, calc(100% - 36px)); margin: 32px auto 64px; }
.auth { min-height: 100vh; display: grid; place-items: center; }
.auth main { max-width: 420px; margin: 20px; padding: 32px; }
.auth .brand { color: var(--accent); }
.brand { font-weight: 750; font-size: 20px; }
.brand small { margin-left: 8px; font-size: 13px; font-weight: 450; }
h1 { margin: 0 0 12px; font-size: 28px; }
h2 { margin: 0 0 10px; font-size: 20px; }
p { margin: 0 0 12px; }
[role="status"]:empty { display: none; }
[role="status"] { color: #854022; }
.panel, dialog { background: white; border: 1px solid var(--border); border-radius: 8px; padding: clamp(16px, 3vw, 27px); }
.panel h2 { overflow-wrap: anywhere; }
.summary { border-top: 1px solid var(--border); padding-block: 14px; }
.summary p { margin-bottom: 0; }
dialog { width: min(480px, calc(100% - 32px)); color: inherit; }
dialog::backdrop { background: #0d2435a0; }
.player-connections { width: min(760px, calc(100% - 32px)); box-sizing: border-box; }
.player-connections .cell-value { overflow-wrap: anywhere; }
.stack { display: grid; gap: 16px; }
.section-head, .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-head { justify-content: space-between; }
.section-head h1 { margin: 0; }
.route-owner { display: grid; gap: 4px; width: min(100%, 18rem); min-width: 0; }
form, label { display: grid; gap: 8px; }
form { gap: 16px; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
#grant-fields { max-width: 640px; }
#grant-dialog { width: min(560px, calc(100% - 32px)); }
#grant-dialog .actions { justify-content: flex-end; }
#grant-error { color: #9c2929; margin: 0; }
#password-fields[hidden] { display: none; }
#customer-dialog p { margin: 0; }
#customer-error { color: #9c2929; }
#customer-target { overflow-wrap: anywhere; }
#customers td { vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.grant-list { display: grid; gap: 10px; }
.grant-card { padding: 12px; border: 1px solid var(--border); border-radius: 7px; }
.grant-card h2 { font-size: 16px; }
.grant-card p { margin: 6px 0; }
.grant-card .actions { margin-top: 10px; }
label { font-weight: 600; }
input, select, textarea, button { font: inherit; border-radius: 7px; min-height: 42px; }
input, select, textarea { border: 1px solid #aebfc9; padding: 7px 10px; width: 100%; color: inherit; background: #fff; }
.check { display: flex; align-items: center; }
.check input { width: auto; min-height: auto; }
.sdk-auth-setting .muted { margin: 0; }
.switch-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.switch-control {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 44px;
}
.switch-control input {
  position: absolute;
  inset: 0;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.switch-track {
  width: 46px;
  height: 26px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: #637683;
  pointer-events: none;
}
.switch-track::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
}
.switch-control input:checked + .switch-track { background: var(--accent); }
.switch-control input:checked + .switch-track::before { transform: translateX(20px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid #288fbe; outline-offset: 2px; }
.switch-control input:disabled + .switch-track { opacity: .55; }
@media (forced-colors: active) {
  .switch-track { border-color: ButtonText; }
  .switch-track::before { background: ButtonText; }
}
button { border: 1px solid var(--accent); background: var(--accent); color: white; padding: 7px 14px; font-weight: 650; cursor: pointer; }
button.secondary { color: #213847; background: #f4f7f9; border-color: var(--border); }
button.danger { color: #9c2929; background: #fff3f3; border-color: #e4b8b8; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #288fbe; outline-offset: 2px; }
a { color: var(--accent); display: inline-block; margin-top: 16px; }
.row-action { display: inline-flex; align-items: center; min-height: 38px; margin: 0; padding: 6px 13px;
  border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: white; font-weight: 650; text-decoration: none; }
.row-action.secondary { background: #f4f7f9; color: #213847; border-color: var(--border); }
.row-action:hover { text-decoration: underline; }
.row-action[hidden] { display: none; }
.account-context { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.account-context strong { margin-left: 6px; color: #172835; }
#customer-list td a, #back-to-users a { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.node-confirmed { color: #13704f; font-weight: 600; }
.node-unconfirmed { color: #97610b; }
.home-overview { display: grid; gap: 20px; }
.home-heading, .home-detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.home-heading h1 { margin: 0; font-size: clamp(25px, 2.4vw, 33px); line-height: 1.2; }
.home-updated { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.home-updated:empty { display: none; }
.home-notice { margin: 0; padding: 12px 16px; border: 1px solid #edcdb9; border-radius: 10px; background: #fff8f3; }
.home-cards { display: grid; grid-template-columns: minmax(0, 1.15fr) repeat(2, minmax(0, 1fr)); gap: 14px; }
.home-stat, .home-detail {
  min-width: 0;
  border-radius: 12px;
  box-shadow: 0 2px 8px #12283308;
}
.home-stat { display: grid; align-content: start; gap: 7px; padding: 17px 20px; }
.home-stat h2 { margin: 0; color: var(--muted); font-size: 14px; font-weight: 650; }
.home-stat strong {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: clamp(27px, 3vw, 42px);
  line-height: 1.06;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.home-stat p, .home-stat a, .home-detail a { margin: 0; font-size: 13px; line-height: 1.45; }
.home-stat p { color: var(--muted); overflow-wrap: anywhere; }
.home-stat p:empty { min-height: 1.45em; }
.home-stat a, .home-detail-head a { width: fit-content; font-weight: 650; text-decoration: none; }
.home-stat a:hover, .home-detail a:hover { text-decoration: underline; }
.home-featured {
  grid-row: span 2;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid #176260;
  background: linear-gradient(135deg, #16363f, #105754);
  color: #fff;
}
.home-featured h2, .home-featured p { color: #d2ece9; }
.home-featured strong { align-self: center; font-size: clamp(38px, 5.3vw, 72px); }
.home-featured-detail { display: grid; gap: 9px; }
.home-featured progress {
  appearance: none;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #ffffff34;
  color: #85ddd0;
}
.home-featured progress::-webkit-progress-bar { background: transparent; }
.home-featured progress::-webkit-progress-value { border-radius: 99px; background: #85ddd0; }
.home-featured progress::-moz-progress-bar { border-radius: 99px; background: #85ddd0; }
.home-details { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; }
.home-detail { padding: 0; }
.home-detail-head { padding: 16px 20px; border-bottom: 1px solid #e0e9ed; }
.home-detail-head h2 { margin: 0; font-size: 17px; }
.home-detail table { white-space: normal; }
.home-detail th, .home-detail td { padding: 10px 12px; border-color: #e3ebef; overflow-wrap: anywhere; }
.home-detail th:first-child, .home-detail td:first-child { padding-left: 20px; }
.home-detail th:last-child, .home-detail td:last-child { padding-right: 20px; }
.home-detail th { background: #f7f9fa; color: var(--muted); font-weight: 600; }
.home-detail td { font-size: 14px; }
.home-detail .pagination { padding: 12px 20px; }
.home-node-id, .home-rule-count { font-weight: 650; }
.home-node-ip, .home-rule-count, .home-expiry-time { font-variant-numeric: tabular-nums; }
.home-node-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #edf2f5;
  color: #465a66;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.home-node-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.home-node-state[data-state="已同步"] { color: #17694b; background: #e6f5eb; }
.home-node-state[data-state="同步中"] { color: #7a500e; background: #fff3da; }
.home-node-state[data-state="离线"] { color: #993e3e; background: #fbecec; }
.home-empty {
  margin: 16px 20px;
  padding: 20px 12px;
  border: 1px dashed #ccdce3;
  border-radius: 9px;
  background: #f7f9fa;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
@media (max-width: 1080px) {
  .home-details { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .home-overview { gap: 14px; }
  .home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .home-stat { padding: 14px; }
  .home-featured { grid-column: 1 / -1; grid-row: auto; grid-template-rows: auto; }
  .home-detail-head { padding: 13px 14px; }
  .home-detail tbody { gap: 8px; padding: 10px; }
  .home-detail tbody tr { padding: 5px 10px; }
  .home-overview .home-detail td { padding: 5px 0; }
  .home-detail .pagination { padding: 2px 14px 10px; }
  .home-empty { margin: 12px 14px; }
}
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { background: #f2f6f8; font-size: 13px; }
.metric { display: inline-block; margin: 4px 24px 18px 0; }
.metric strong { display: block; color: var(--accent); font-size: 26px; }
ul { padding-left: 22px; margin-bottom: 0; }
li { padding: 4px 0; }

.admin-directory { display: grid; gap: 16px; min-width: 0; }
.admin-directory > #games:empty { display: none; }
.directory-notice {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid #d3dee4;
  border-radius: 10px;
  background: #fff;
}
.directory-panel {
  min-width: 0;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 2px 8px #12283308;
}
.directory-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e9ed;
}
.directory-head h2 { margin: 0; font-size: 17px; }
.directory-panel table { white-space: normal; }
.directory-panel th, .directory-panel td {
  padding: 12px 16px;
  vertical-align: top;
  border-color: #e3ebef;
  overflow-wrap: anywhere;
}
.directory-panel th { background: #f7f9fa; color: var(--muted); font-weight: 600; }
.directory-panel td { font-size: 14px; }
.directory-panel .pagination { padding: 12px 16px; }
.directory-name { font-size: 15px; color: #172835; }
#customers td:first-child { width: 19%; }
#customers td:last-child { width: 246px; }
#customer-list td { vertical-align: middle; }
.admin-directory .actions { gap: 7px; }
.admin-directory .actions button, .admin-directory .row-action, .game-panel .directory-head button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}
.admin-directory .row-action:hover, .admin-directory .secondary:hover { background: #e8f1f3; }
.admin-directory .danger:hover { background: #fce7e7; }
.directory-panel .grant-card { padding: 13px; border-color: #deeaee; border-radius: 9px; background: #f8fafb; }
.grant-card h3, .game-rules-title { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.directory-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 8px 16px; margin: 11px 0; }
.directory-facts dt { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.directory-facts dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.grant-status {
  flex: none;
  padding: 3px 9px;
  border-radius: 99px;
  background: #edf2f5;
  color: #465a66;
  font-size: 12px;
  font-weight: 650;
}
.grant-status[data-status="active"] { color: #17694b; background: #e6f5eb; }
.grant-status[data-status="scheduled"] { color: #7a500e; background: #fff3da; }
.grant-status:is([data-status="expired"], [data-status="disabled"]) { color: #993e3e; background: #fbecec; }
.directory-account {
  padding: 14px 20px;
  border: 1px solid #b6d6d0;
  border-radius: 12px;
  background: #e6f3f0;
  color: #13524e;
}
.directory-account span { color: #456560; font-size: 13px; }
.directory-account h2 { margin: 4px 0 0; font-size: 19px; overflow-wrap: anywhere; }
.game-title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; min-width: 0; }
.game-title h2 { min-width: 0; }
.game-facts { margin: 14px 20px; }
.game-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 20px 16px; }
.game-metrics .metric {
  display: grid;
  align-content: start;
  gap: 5px;
  margin: 0;
  padding: 12px;
  border: 1px solid #deeaee;
  border-radius: 9px;
  background: #f8fafb;
  overflow-wrap: anywhere;
}
.game-metrics .metric strong { font-size: clamp(17px, 2.2vw, 25px); font-variant-numeric: tabular-nums; }
.game-metrics .metric small { color: var(--muted); font-size: 12px; }
.game-rules-title { padding: 0 20px 9px; }
.directory-dialog { border-radius: 12px; }
.directory-dialog :is(h2, p) { margin: 0; }
.directory-dialog .actions { justify-content: flex-end; }
.node-picker { border: 1px solid var(--border); border-radius: 8px; }
.node-picker summary { padding: 10px 12px; cursor: pointer; }
#node-options { max-height: 240px; overflow: auto; padding: 8px 12px 12px; }
#node-options .check { min-height: 32px; overflow-wrap: anywhere; }
#node-options input { flex-shrink: 0; }
.directory-dialog .account-context { padding: 10px 12px; border-radius: 8px; background: #eef5f4; }
.directory-dialog input, .directory-dialog select, .directory-dialog textarea { min-width: 0; }
@media (max-width: 768px) {
  .admin-directory { gap: 12px; }
  .directory-head, .directory-account { padding: 12px 14px; }
  .directory-panel tbody { gap: 8px; padding: 10px; }
  .directory-panel tbody tr { padding: 5px 10px; }
  .directory-panel td { padding: 5px 0; }
  .admin-directory .actions button, .admin-directory .row-action, .game-panel .directory-head button { min-height: 40px; }
  #customers td:first-child, #customers td:last-child { width: 100%; }
  #customers td[data-label="游戏授权"], #customers td[data-label="操作"] { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .directory-panel .pagination { padding: 0 12px 10px; }
  .game-facts { margin: 12px 14px; }
  .game-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 14px 14px; gap: 8px; }
  .game-devices { grid-column: 1 / -1; }
  .game-rules-title { padding: 0 14px; }
}
