/* 平台公共样式：配色、字体、按钮、表单、弹窗、提示 */
:root {
  --room: #0b100e;
  --room-2: #121a17;
  --panel: #18221e;
  --panel-2: #1f2b26;
  --line: rgba(232, 220, 190, 0.12);
  --line-strong: rgba(232, 220, 190, 0.24);
  --text: #ece6d6;
  --text-dim: #a8a493;
  --text-faint: #6f7468;
  --brass: #cfa95e;
  --brass-hi: #e8c77f;
  --brass-lo: #8c6c33;
  --felt: #12573f;
  --felt-hi: #1b6e51;
  --felt-lo: #093424;
  --red: #d2493a;
  --green: #4fbf7f;
  --cream: #f6f1e4;
  --radius: 10px;
  --serif: 'Songti SC', 'STSong', 'Noto Serif SC', 'Source Han Serif SC', serif;
  --sans: -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --num: 'SF Mono', ui-monospace, 'Menlo', 'Consolas', monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--room);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(207, 169, 94, 0.08), transparent 60%),
    radial-gradient(900px 600px at 50% 110%, rgba(18, 87, 63, 0.18), transparent 60%),
    var(--room);
  background-attachment: fixed;
}
a {
  color: var(--brass-hi);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
.num {
  font-variant-numeric: tabular-nums;
}
.hidden {
  display: none !important;
}
.dim {
  color: var(--text-dim);
}
.faint {
  color: var(--text-faint);
}
.pos {
  color: var(--green);
}
.neg {
  color: var(--red);
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(11, 16, 14, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brass-hi);
  white-space: nowrap;
}
.brand small {
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-size: 13px;
  margin-left: 8px;
}
.topbar .spacer {
  flex: 1;
}
.chip-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--num);
  font-size: 14px;
  white-space: nowrap;
}
.chip-balance::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--brass) 0 30deg, #f3e6c4 30deg 60deg);
  box-shadow: inset 0 0 0 3px #7a5a24;
}

/* 按钮 */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.05s;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--brass-lo);
  background: #26342e;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  border-color: var(--brass);
  color: #1d160a;
  font-weight: 600;
}
.btn.primary:hover {
  background: linear-gradient(180deg, #f2d595, var(--brass-hi));
}
.btn.danger {
  border-color: rgba(210, 73, 58, 0.5);
  color: #f1b0a6;
}
.btn.danger:hover {
  background: rgba(210, 73, 58, 0.16);
}
.btn.ghost {
  background: transparent;
}
.btn.sm {
  padding: 4px 10px;
  font-size: 13px;
}
.btn.lg {
  padding: 12px 22px;
  font-size: 16px;
}

/* 表单 */
label.field {
  display: block;
  margin-bottom: 14px;
}
label.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #0e1512;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(207, 169, 94, 0.18);
}
input[type='range'] {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  accent-color: var(--brass);
}
.form-error {
  color: #f1a196;
  font-size: 13px;
  min-height: 20px;
}

/* 卡片面板 */
.panel {
  background: linear-gradient(180deg, var(--panel), #141c19);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 6, 5, 0.66);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade 0.15s ease;
}
.modal {
  width: min(460px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 22px 18px;
}
.modal.wide {
  width: min(860px, 100%);
}
.modal h3 {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--brass-hi);
}
.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}

/* 轻提示 */
#toast-root {
  position: fixed;
  left: 50%;
  top: 70px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(24, 34, 30, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 14px;
  animation: toast-in 0.2s ease;
}
.toast.error {
  border-color: rgba(210, 73, 58, 0.6);
  color: #f6c2b9;
}
.toast.ok {
  border-color: rgba(79, 191, 127, 0.5);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* 数据表格 */
table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.grid th,
table.grid td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
table.grid th {
  font-weight: 500;
  color: var(--text-dim);
  font-size: 13px;
  white-space: nowrap;
}
table.grid td.r,
table.grid th.r {
  text-align: right;
}
table.grid tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.tag.gold {
  color: var(--brass-hi);
  border-color: var(--brass-lo);
}
.tag.red {
  color: #f1a196;
  border-color: rgba(210, 73, 58, 0.5);
}
.tag.green {
  color: #9be0b8;
  border-color: rgba(79, 191, 127, 0.45);
}

/* 扑克牌（各页面共用） */
.card {
  --w: 44px;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  width: var(--w);
  height: calc(var(--w) * 1.4);
  border-radius: calc(var(--w) * 0.12);
  background: linear-gradient(160deg, #fffdf6, var(--cream) 60%, #e9e1cc);
  color: #1a1a1a;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 3px 8px rgba(0, 0, 0, 0.35);
  font-family: var(--num);
  font-weight: 700;
  line-height: 1;
  user-select: none;
  flex: none;
}
.card .rk {
  position: absolute;
  top: 8%;
  left: 10%;
  font-size: calc(var(--w) * 0.36);
  letter-spacing: -0.04em;
}
.card .st {
  position: absolute;
  right: 8%;
  bottom: 4%;
  font-size: calc(var(--w) * 0.56);
}
.card .st-sm {
  position: absolute;
  top: calc(8% + var(--w) * 0.38);
  left: 12%;
  font-size: calc(var(--w) * 0.26);
}
.card.red {
  color: #c4302b;
}
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(207, 169, 94, 0.22) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(-45deg, rgba(207, 169, 94, 0.22) 0 2px, transparent 2px 7px),
    linear-gradient(160deg, #1d5c46, #0c3727);
  box-shadow:
    inset 0 0 0 2px #e9dcbc,
    inset 0 0 0 4px #0c3727,
    0 3px 8px rgba(0, 0, 0, 0.35);
}
.card.slot {
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 0 0 1px rgba(232, 220, 190, 0.16);
}
.card.dimmed {
  filter: brightness(0.55) saturate(0.6);
}
.card.hl {
  box-shadow:
    0 0 0 2px var(--brass-hi),
    0 0 14px rgba(232, 199, 127, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.35);
}
.mini-cards {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}
.mini-cards .card {
  --w: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
