:root {
  --canvas: #eef1ee;
  --paper: #ffffff;
  --ink: #18211e;
  --muted: #68736f;
  --faint: #929b97;
  --line: #d8dedb;
  --line-strong: #c5ceca;
  --sidebar: #14231f;
  --sidebar-raised: #20312c;
  --sidebar-ink: #f4f7f5;
  --accent: #c94a34;
  --accent-dark: #a63827;
  --accent-soft: #fcebe7;
  --green: #177554;
  --green-soft: #e7f4ed;
  --amber: #a86d15;
  --amber-soft: #fff5de;
  --red: #b9332b;
  --red-soft: #fcebea;
  --blue: #326f9f;
  --blue-soft: #eaf3fa;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(14, 31, 25, .05), 0 8px 24px rgba(14, 31, 25, .04);
  --sidebar-width: 244px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}
button, input, select, textarea { letter-spacing: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(201, 74, 52, .24); outline-offset: 2px; }
::selection { background: #f2b7aa; color: #31120c; }

.app-shell { min-height: 100vh; }
.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.loading { color: var(--muted); text-align: center; padding: 96px 20px; }
.loading::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 12px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Application shell */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; min-height: 48px; padding: 0 8px; }
.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  border: 2px solid #f2d477;
  border-radius: 50%;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  background: #f2d477;
  transform: translateX(-50%);
}
.brand-mark::before { top: 0; width: 2px; height: 100%; }
.brand-mark::after { top: 50%; width: 100%; height: 2px; transform: translate(-50%, -50%); }
.brand-mark i {
  position: absolute;
  z-index: 1;
  width: 7px;
  height: 7px;
  background: var(--sidebar);
  border: 2px solid #f2d477;
  border-radius: 50%;
}
.brand-mark i:first-child { top: 6px; left: 6px; }
.brand-mark i:last-child { right: 6px; bottom: 6px; }
.brand-mark.mini { width: 27px; height: 27px; border-width: 1.5px; }
.brand-mark.mini::before { width: 1.5px; }
.brand-mark.mini::after { height: 1.5px; }
.brand-mark.mini i { width: 5px; height: 5px; border-width: 1.5px; background: var(--sidebar); }
.brand-mark.mini i:first-child { top: 4px; left: 4px; }
.brand-mark.mini i:last-child { right: 4px; bottom: 4px; }
.brand-copy { display: flex; align-items: baseline; gap: 7px; margin-left: 12px; }
.brand-copy strong { font-size: 19px; line-height: 1; }
.brand-copy small { color: #a9b7b1; font-size: 12px; }
.nav-label {
  margin: 35px 10px 10px;
  color: #7f918a;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
#topnav { display: flex; flex-direction: column; gap: 3px; }
#topnav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 45px;
  padding: 0 12px;
  border-radius: 5px;
  color: #b7c3be;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 550;
  transition: background-color .16s ease, color .16s ease;
}
#topnav a:hover { background: rgba(255, 255, 255, .055); color: #fff; }
#topnav a.active { background: var(--sidebar-raised); color: #fff; }
#topnav a.active::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px 0 0 2px;
}
.nav-index {
  width: 23px;
  color: #71837c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
}
#topnav a.active .nav-index { color: #f28a76; }
.sidebar-foot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: auto;
  padding: 16px 11px 4px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.status-dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 5px;
  background: #67d49e;
  border: 2px solid rgba(103, 212, 158, .22);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(103, 212, 158, .1);
}
.sidebar-foot strong { display: block; color: #dfe7e3; font-size: 11.5px; }
.sidebar-foot small { display: block; color: #7f918a; font-size: 10.5px; }
.mobilebar, .sidebar-scrim, .sidebar-close { display: none; }

main {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 42px 42px 84px;
}
.page-head {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
  padding-top: 24px;
}
.page-head::before {
  content: "TACTICAL WORKSPACE";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
}
.page-head h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.22;
  font-weight: 760;
}
.page-head p {
  max-width: 620px;
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
}

/* Dashboard */
.command-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  min-height: 264px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #1a2a26;
  color: #fff;
}
.command-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .13;
  background-image:
    linear-gradient(rgba(255,255,255,.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.22) 1px, transparent 1px);
  background-size: 34px 34px;
  pointer-events: none;
}
.hero-copy {
  position: relative;
  z-index: 1;
  align-self: center;
  padding: 40px 46px;
}
.hero-kicker {
  margin-bottom: 11px;
  color: #f2d477;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 800;
}
.hero-title {
  max-width: 680px;
  margin: 0;
  font-size: 35px;
  line-height: 1.18;
  font-weight: 770;
}
.hero-desc {
  max-width: 590px;
  margin: 13px 0 22px;
  color: #bbcac4;
  font-size: 13.5px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.btn.light { background: #f8f5ea; border-color: #f8f5ea; color: #1a2a26; }
.btn.light:hover { background: #f2d477; border-color: #f2d477; color: #1a2a26; }
.btn.ghost-dark { background: transparent; border-color: #536761; color: #eef4f1; }
.btn.ghost-dark:hover { border-color: #eef4f1; color: #fff; }
.hero-visual {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 230px;
}
.card-stack-visual { position: relative; width: 194px; height: 178px; }
.visual-card {
  position: absolute;
  width: 116px;
  height: 164px;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 7px;
  background: #263b35;
  box-shadow: 0 18px 30px rgba(0, 0, 0, .24);
}
.visual-card::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 4px;
}
.visual-card::after {
  content: "";
  position: absolute;
  top: 26px;
  left: 50%;
  width: 48px;
  height: 48px;
  transform: translateX(-50%);
  border: 12px solid #f2d477;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #14231f, 0 0 0 13px rgba(242, 212, 119, .16);
}
.visual-card.one { top: 10px; left: 8px; transform: rotate(-10deg); background: #24433b; }
.visual-card.two { top: 5px; right: 10px; transform: rotate(9deg); background: #a13e2e; }
.visual-card.three { top: 1px; left: 39px; background: #23342f; }
.visual-card.three::after { border-color: #f07761; box-shadow: 0 0 0 1px #14231f, 0 0 0 13px rgba(240, 119, 97, .15); }
.hero-stamp {
  position: absolute;
  right: 24px;
  bottom: 20px;
  color: rgba(255, 255, 255, .45);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
}
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.metric-strip .stat { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.metric-strip .stat:last-child { border-right: 0; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr); gap: 18px; }
.quick-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
}
.quick-label {
  margin-right: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.signal-row { display: grid; grid-template-columns: 108px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.signal-row:last-child { border-bottom: 0; }
.signal-row dt { color: var(--muted); font-size: 12px; }
.signal-row dd { margin: 0; font-weight: 600; }
.warning-callout {
  margin: 2px 0 18px;
  padding: 12px 14px;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber);
  color: #594115;
  font-size: 12.5px;
}
.drill-list { list-style: none; margin: 0; padding: 0; counter-reset: drills; }
.drill-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  counter-increment: drills;
}
.drill-list li::before {
  content: counter(drills, decimal-leading-zero);
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
}
.drill-list li:last-child { border-bottom: 0; }

/* Shared layout */
.panel {
  margin-bottom: 18px;
  padding: 22px 24px;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 740;
}
.panel h2::before {
  content: "";
  width: 4px;
  height: 14px;
  flex: none;
  background: var(--accent);
  border-radius: 1px;
}
.panel h2 .tag { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  position: relative;
  min-width: 0;
  min-height: 126px;
  padding: 19px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  width: 26px;
  height: 3px;
  background: var(--accent);
}
.stat .num {
  overflow: hidden;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.25;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat .lbl { margin-top: 8px; color: var(--muted); font-size: 11.5px; font-weight: 650; }
.stat .sub { margin-top: 3px; overflow-wrap: anywhere; color: var(--faint); font-size: 10.5px; }
.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.empty-tip { padding: 28px 12px; color: var(--muted); font-size: 12.5px; text-align: center; }
.kv { font-size: 13px; }
.kv > div { padding: 5px 0; }
.kv b { display: inline-block; min-width: 92px; color: var(--muted); font-weight: 550; }

/* Data tables */
table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th {
  background: #f1f4f2;
  color: #52605a;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}
th:first-child { border-radius: 4px 0 0 4px; }
th:last-child { border-radius: 0 4px 4px 0; }
tbody tr:hover td, tr:hover td { background: #fafcfb; }
tr:last-child td { border-bottom: 0; }

/* Labels and controls */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #f7f9f8;
  color: #52605a;
  font-size: 10.5px;
  line-height: 1.3;
  white-space: nowrap;
}
.chip.hot { background: var(--accent-soft); border-color: #efb5a9; color: var(--accent-dark); }
.chip.ok { background: var(--green-soft); border-color: #b7ddc9; color: var(--green); }
.chip.warn { background: var(--amber-soft); border-color: #ecd499; color: var(--amber); }
.chip.bad { background: var(--red-soft); border-color: #efbbb7; color: var(--red); }
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent-dark); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button.danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
button:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 38px; min-width: 38px; padding: 0; font-size: 19px; }
.icon-action { width: 31px; min-width: 31px; min-height: 31px; padding: 0; font-size: 17px; line-height: 1; }
input, select, textarea {
  width: auto;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #9aa39f; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 74, 52, .1); }
label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
form.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; }
form.form-grid .wide { grid-column: 1 / -1; }
form.form-grid input, form.form-grid select { width: 100%; }

/* Deck builder */
.builder { display: grid; grid-template-columns: 300px minmax(400px, 1fr) 332px; gap: 16px; align-items: start; }
.builder .panel { margin-bottom: 0; }
.builder .panel:first-child,
.builder .panel:last-child { position: sticky; top: 18px; }
.pool-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pool-filters button { min-height: 31px; padding: 4px 10px; border-radius: 999px; font-size: 11px; }
.pool-filters button.on { background: var(--sidebar); border-color: var(--sidebar); color: #fff; }
.pool-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.pool-selects select { width: 100%; min-height: 31px; padding: 3px 6px; font-size: 11.5px; }
.pool-selects select:last-child { grid-column: 1 / -1; }
.pool-list { max-height: calc(100vh - 300px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #bdc7c2 transparent; }

/* 卡池图片网格 */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.cardtile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.cardtile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.cardtile img { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: cover; background: #eef1f0; }
.cardtile .tinfo { padding: 5px 7px 6px; border-top: 1px solid var(--line); }
.cardtile .tname {
  display: block; overflow: hidden; font-size: 11px; font-weight: 700;
  text-overflow: ellipsis; white-space: nowrap;
}
.cardtile .tsub { display: block; overflow: hidden; color: var(--muted); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.cardtile .tcnt {
  position: absolute; top: 6px; left: 6px; padding: 2px 7px;
  border-radius: 999px; background: var(--sidebar); color: #fff;
  font-size: 10px; font-weight: 700; box-shadow: 0 1px 4px rgba(14, 31, 25, .3);
}
.cardtile .tadd {
  position: absolute; right: 6px; bottom: 44px; width: 27px; min-width: 27px; min-height: 27px;
  padding: 0; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 17px; line-height: 1; opacity: 0; transition: opacity .12s ease;
}
.cardtile:hover .tadd, .cardtile:focus-within .tadd { opacity: 1; }
.cardtile .tadd:hover { background: var(--accent-dark); }

/* 卡牌详情弹窗 */
.cardmodal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(11, 20, 17, .62);
  backdrop-filter: blur(2px);
}
.cmbox {
  position: relative; display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
  gap: 20px; width: min(780px, 100%); max-height: 88vh; overflow-y: auto;
  padding: 22px; border-radius: 14px; background: var(--paper); box-shadow: 0 24px 70px rgba(9, 20, 16, .35);
}
.cmbox .cmclose {
  position: absolute; top: 10px; right: 10px; width: 30px; min-width: 30px; min-height: 30px;
  padding: 0; border-radius: 50%; background: #eef2ef; font-size: 15px;
}
.cmimg img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #eef1f0; }
.cminfo h3 { margin: 0 0 4px; font-size: 17px; }
.cminfo .kv { margin: 10px 0; }
.cmblock { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12.5px; }
.cmblock p { margin: 3px 0 0; color: #3d4a45; line-height: 1.7; }

.deckrow img.dthumb {
  width: 27px; min-width: 27px; height: 38px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line); background: #eef1f0;
}
.deck-progress { margin-bottom: 12px; }
.deck-progress .bar { height: 9px; overflow: hidden; background: #e6ebe8; border-radius: 2px; }
.deck-progress .bar i { display: block; height: 100%; background: var(--accent); transition: width .15s ease; }
.deck-progress .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.deckrow { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 7px 3px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.deckrow .nm { min-width: 0; flex: 1; font-weight: 650; }
.deckrow .nm small { display: block; overflow: hidden; color: var(--muted); font-size: 9.5px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.deckrow .ct { min-width: 22px; text-align: center; font-weight: 750; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 29px; min-width: 29px; min-height: 29px; padding: 0; font-size: 15px; }
.deckcats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.savedeck { display: flex; gap: 8px; margin-bottom: 14px; }
.savedeck input { min-width: 0; flex: 1; }
.deck-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 7px; }
.deck-note-input { width: 100%; min-height: 34px; margin-bottom: 14px; font-size: 12px; }
.saved-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.saved-head h2 { margin: 0 0 10px; }

/* 卡组库（左列表 + 右卡面） */
.decklib-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.decklib-side { position: sticky; top: 18px; }
.decklib-newbtn { width: 100%; margin-bottom: 12px; }
.decklib-importbtn { width: 100%; margin-bottom: 12px; }
.decklib-tools { display: grid; grid-template-columns: 1fr 104px; gap: 7px; margin-bottom: 12px; }
.decklib-tools input, .decklib-tools select { width: 100%; min-height: 34px; }
.decklib-list {
  display: grid; gap: 8px; align-content: start;
  max-height: calc(100vh - 320px); overflow-y: auto; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: #bdc7c2 transparent;
}
.deckitem {
  padding: 10px 12px 9px; border: 1px solid var(--line); border-radius: 8px;
  background: #fafcfb; cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.deckitem:hover { border-color: var(--accent); }
.deckitem.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.deckitem-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.deckitem-head b { min-width: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.deckitem small {
  display: block; overflow: hidden; margin-top: 3px; color: var(--muted);
  font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap;
}
.decklib-detailhead {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px 16px; margin-bottom: 6px;
}
.decklib-titlewrap { min-width: 0; }
.decklib-titlewrap h2 { margin-bottom: 0; flex-wrap: wrap; overflow-wrap: anywhere; }
.decklib-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.decklib-actions button { min-height: 32px; font-size: 11.5px; }
.decklib-note {
  margin: 4px 0 10px; padding: 9px 12px; border-left: 3px solid var(--line-strong);
  background: #f6f8f7; color: #45524d; font-size: 12px;
}
.decklib-cardgrid { margin-bottom: 8px; }
.minibox {
  position: relative; width: min(460px, 100%); max-height: 88vh; overflow-y: auto;
  padding: 22px; border-radius: 12px; background: var(--paper);
  box-shadow: 0 24px 70px rgba(9, 20, 16, .35);
}
.minibox .cmclose {
  position: absolute; top: 10px; right: 10px; width: 30px; min-width: 30px;
  min-height: 30px; padding: 0; border-radius: 50%; background: #eef2ef; font-size: 15px;
}
.minibox-title { margin: 0 0 14px; font-size: 17px; }
.minibox-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* 卡表导入弹窗 */
.importbox {
  position: relative; width: min(720px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 24px; border-radius: 12px; background: var(--paper);
  box-shadow: 0 24px 70px rgba(9, 20, 16, .35);
}
.importbox .cmclose {
  position: absolute; top: 12px; right: 12px; width: 31px; min-width: 31px;
  min-height: 31px; padding: 0; border-radius: 50%; background: #eef2ef; font-size: 15px;
}
.import-title { margin: 0 0 4px; font-size: 19px; }
.import-ta { width: 100%; min-height: 168px; font-size: 12px; line-height: 1.65; }
.import-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.import-row input { flex: 1; }
.import-result { margin-top: 4px; }

/* Advisor and reports */
.scorehead { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; }
.score-ring {
  width: 70px;
  height: 70px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 5px solid var(--line);
  border-radius: 50%;
  background: #fbfcfb;
}
.score-ring .n { font-size: 20px; font-weight: 780; line-height: 1; }
.score-ring .u { color: var(--muted); font-size: 9px; }
.scorehead .g { font-size: 15px; font-weight: 740; }
.scorehead .d { color: var(--muted); font-size: 10.5px; }
.checks { margin-top: 12px; }
.check { display: flex; gap: 9px; margin-bottom: 3px; padding: 7px 8px; border-left: 2px solid var(--line); background: #f8faf9; font-size: 11.5px; }
.check:last-child { margin-bottom: 0; }
.check .ico { width: 14px; flex: none; font-weight: 800; text-align: center; }
.check.ok { border-color: var(--green); } .check.ok .ico { color: var(--green); }
.check.warn { border-color: var(--amber); } .check.warn .ico { color: var(--amber); }
.check.bad { border-color: var(--red); } .check.bad .ico { color: var(--red); }
.check.info .ico { color: var(--blue); }
.partbars { margin: 12px 0 4px; }
.partbar { display: grid; grid-template-columns: 68px 1fr 39px; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 10.5px; }
.partbar .bar { height: 5px; overflow: hidden; background: #e8ecea; border-radius: 1px; }
.partbar .bar i { display: block; height: 100%; background: var(--accent); }
.advice { margin: 8px 0 0; padding-left: 20px; }
.advice li { margin-bottom: 7px; font-size: 12px; }
.vsrow { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.vsrow:last-child { border-bottom: 0; }
.vsrow b { color: var(--accent-dark); }

/* AI 构筑顾问（自动强度分析 + 对话微调） */
.ai-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-head .tag { margin-left: auto; }
.ai-stale {
  margin-bottom: 8px; padding: 6px 9px; border-left: 2px solid var(--amber);
  border-radius: 0 4px 4px 0; background: var(--amber-soft);
  color: var(--amber); font-size: 11px;
}
.ai-loading { display: flex; align-items: center; gap: 9px; margin: 8px 0; color: var(--muted); font-size: 12px; }
.ai-loading::before {
  content: ""; width: 14px; height: 14px; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.ai-actions { display: flex; gap: 8px; margin-top: 10px; }
.ai-md { font-size: 12px; line-height: 1.7; }
.ai-md > :first-child { margin-top: 0; }
.ai-md > :last-child { margin-bottom: 0; }
.ai-md p { margin: .4em 0; }
.ai-md ul, .ai-md ol { margin: .4em 0; padding-left: 1.35em; }
.ai-md li { margin: .25em 0; }
.ai-md h1, .ai-md h2, .ai-md h3, .ai-md h4 {
  margin: .9em 0 .35em; font-size: 13px; font-weight: 740;
}
.ai-md strong { font-weight: 700; }
.ai-md code { padding: 1px 4px; border-radius: 3px; background: #eef2ef; font-size: .92em; }
.ai-log {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; overflow-y: auto; margin: 2px 0 8px; padding: 2px 2px 6px;
}
.ai-msg { max-width: 94%; padding: 8px 11px; border-radius: 10px; font-size: 12px; line-height: 1.65; }
.ai-msg.user {
  align-self: flex-end; background: var(--accent-soft);
  border: 1px solid #f0d6ce; white-space: pre-wrap;
}
.ai-msg.ai { align-self: flex-start; background: #f8faf9; border: 1px solid var(--line); }
.ai-typing { color: var(--muted); animation: aiBlink 1.2s ease-in-out infinite; }
@keyframes aiBlink { 50% { opacity: .35; } }
.ai-sendrow { display: flex; gap: 8px; align-items: flex-end; }
.ai-sendrow textarea { flex: 1; min-height: 44px; max-height: 160px; font-size: 12px; }
.rec { padding: 15px 16px; border-left: 3px solid var(--accent); background: #fafcfb; }
.rec + .rec { margin-top: 10px; }
.rec .t { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.rec .t b { font-size: 14px; }
.rec .t .rk { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 800; }
.rec p { margin: 7px 0 0; color: #45524d; font-size: 12px; }

/* 卡组库 · AI 侧栏（右侧可收缩整列） */
:root { --ai-rail-w: clamp(360px, 34vw, 520px); }
.ai-rail-toggle {
  position: fixed; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 45;
  padding: 16px 7px; border: 0; border-radius: 8px 0 0 8px;
  background: var(--accent); color: #fff;
  writing-mode: vertical-rl; letter-spacing: .18em;
  font-size: 12.5px; font-weight: 700;
  box-shadow: -4px 0 14px rgba(166, 56, 39, .25);
  transition: opacity .2s ease;
}
.ai-rail-toggle:hover { background: var(--accent-dark); color: #fff; }
body.rail-open .ai-rail-toggle { opacity: 0; pointer-events: none; }
.ai-rail {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 46;
  display: flex; flex-direction: column;
  width: var(--ai-rail-w); max-width: 100vw;
  background: var(--paper); border-left: 1px solid var(--line);
  box-shadow: -14px 0 36px rgba(14, 31, 25, .10);
  transform: translateX(100%); visibility: hidden;
  transition: transform .28s ease, visibility 0s linear .28s;
}
body.rail-open .ai-rail { transform: none; visibility: visible; transition: transform .28s ease; }
body.rail-open .workspace { margin-right: var(--ai-rail-w); }
.workspace { transition: margin-right .28s ease; }
.ai-rail-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px 14px 18px;
  border-bottom: 1px solid var(--line); background: #fafcfb;
}
.ai-rail-title { flex: 1; min-width: 0; }
.ai-rail-title b { font-size: 14px; }
.ai-rail-title small {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: 11.5px;
}
.ai-rail-head .tag { flex: none; }
.ai-rail-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 18px 0; }
.ai-rail-chip { min-height: 30px; padding: 5px 12px; border-radius: 999px; font-size: 12px; }
.ai-rail-minis { display: flex; gap: 8px; padding: 10px 18px 0; }
.ai-rail-mini { min-height: 28px; padding: 4px 10px; font-size: 11.5px; border-radius: 6px; }
.ai-hist-item {
  display: flex; gap: 6px; align-items: flex-start;
  margin-bottom: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fafcfb; cursor: pointer;
}
.ai-hist-item:hover { border-color: var(--accent); }
.ai-hist-main { flex: 1; min-width: 0; }
.ai-hist-main b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px;
}
.ai-hist-preview {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: 2px; color: #45524d; font-size: 12px;
}
.ai-hist-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.ai-prefs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-prefs select { min-height: 30px; padding: 4px 8px; font-size: 11.5px; }
.ai-advisor .ai-prefs { margin: 8px 0 2px; }
.ai-rail .ai-prefs { padding: 10px 18px 0; }
.ai-rail .ai-prefs:empty, .ai-advisor .ai-prefs:empty { display: none; }
.ai-rail .ai-log {
  flex: 1; min-height: 0; max-height: none;
  margin: 12px 18px; padding: 0 2px 2px;
  overflow-y: auto;
}
.ai-rail .ai-msg { font-size: 13px; max-width: 92%; }
.ai-rail .ai-msg.user { max-width: 86%; }
.ai-rail .ai-md { font-size: 13px; }
.ai-rail .ai-md h1, .ai-rail .ai-md h2, .ai-rail .ai-md h3, .ai-rail .ai-md h4 { font-size: 14px; }
.ai-rail-send { padding: 12px 18px 16px; border-top: 1px solid var(--line); background: #fafcfb; }
.ai-rail-send textarea { min-height: 66px; font-size: 13px; }
.ai-rail-tag { margin-bottom: 5px; color: var(--accent-dark); font-size: 10px; font-weight: 800; letter-spacing: .06em; }
@media (max-width: 720px) {
  .ai-rail-toggle { padding: 14px 6px; }
  .ai-rail { width: 100%; border-left: 0; }
  body.rail-open .workspace { margin-right: 0; }
}

/* Notes */
.notes-layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 18px; align-items: start; }
.notes-layout > .panel:first-child { position: sticky; top: 18px; }
.notes-nav { max-height: calc(100vh - 185px); overflow-y: auto; }
.notes-nav a {
  display: block;
  overflow: hidden;
  padding: 6px 9px;
  border-left: 2px solid transparent;
  color: var(--ink);
  font-size: 11.5px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-nav a:hover { background: #f3f6f4; }
.notes-nav a.active { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent-dark); font-weight: 700; }
.group-title {
  margin: 14px 0 4px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 760;
  text-transform: uppercase;
}
.md { max-width: 920px; }
.md h1 { margin: 0 0 18px; padding-bottom: 13px; border-bottom: 1px solid var(--line); font-size: 26px; line-height: 1.3; }
.md h2 { margin: 30px 0 12px; font-size: 18px; }
.md h3 { margin: 24px 0 9px; font-size: 15px; }
.md p, .md li { font-size: 13px; line-height: 1.85; }
.md code { padding: 2px 5px; border-radius: 3px; background: #eef2ef; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.md pre { overflow-x: auto; padding: 15px 17px; border-radius: 5px; background: #18211e; color: #e8efeb; }
.md pre code { padding: 0; background: none; color: inherit; }
.md blockquote { margin: 16px 0; padding: 8px 15px; border-left: 3px solid var(--accent); background: var(--accent-soft); color: #495650; }
.md blockquote p { margin: 0; }
.md a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.md table { margin: 16px 0; }
.crumb { padding-bottom: 9px; border-bottom: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Tactical dashboard refresh */
.compact-hero { min-height: 216px; align-items: end; }
.compact-hero .hero-copy { max-width: 620px; }
.hero-focus { width: min(310px, 100%); padding: 18px 20px; border: 1px solid rgba(255,255,255,.17); background: rgba(255,255,255,.07); color: #fff; }
.hero-focus .focus-label { display: block; margin-bottom: 8px; color: #f2d477; font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.hero-focus strong { display: block; font-size: 19px; line-height: 1.35; }
.hero-focus span:last-child { display: block; margin-top: 7px; color: #b4c7bd; font-size: 11.5px; }
.dashboard-grid-new { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); }
.panel-kicker { margin-bottom: 5px; color: var(--accent); font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.action-stack { display: grid; gap: 8px; }
.action-card { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 13px 12px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .15s ease, transform .15s ease, background-color .15s ease; }
.action-card:hover { border-color: var(--accent); background: #fffaf8; transform: translateX(2px); }
.action-num, .experiment-no { color: var(--accent); font: 800 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.action-copy b, .action-copy small { display: block; }
.action-copy b { font-size: 13px; }
.action-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.action-cta { color: var(--accent-dark); font-size: 11px; font-weight: 700; white-space: nowrap; }
.focus-panel { background: #f6faf7; }
.radar-line { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.radar-line span { color: var(--muted); }
.radar-line b { max-width: 72%; text-align: right; }
.tier-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.tier-pill { padding: 4px 8px; background: #e8f1ec; color: #3e6152; font-size: 10px; }
.tier-pill.hot { background: var(--accent-soft); color: var(--accent-dark); }
.dashboard-lower, .analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr); gap: 18px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin-bottom: 0; }
.text-link { color: var(--accent-dark); font-size: 11.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.mini-match-list { border-top: 1px solid var(--line); }
.mini-match { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.mini-date { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.mini-match-main b, .mini-match-main span { display: block; }
.mini-match-main b { font-size: 12px; }
.mini-match-main span { color: var(--muted); font-size: 11px; }
.signal-list { margin: 0; padding: 0; list-style: none; }
.signal-list li { position: relative; padding: 9px 0 9px 17px; border-bottom: 1px solid var(--line); font-size: 12px; }
.signal-list li::before { content: ""; position: absolute; top: 17px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.source-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 4px 0 18px; padding: 10px 12px; border: 1px dashed var(--line-strong); color: var(--muted); font-size: 10.5px; }
.source-strip > span:first-child { color: var(--ink); font-weight: 700; }
.source-link { color: var(--accent-dark); text-decoration: none; }
.source-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.source-note { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; margin-top: 12px; color: var(--muted); font-size: 10.5px; }
.source-note > span:first-child { color: var(--ink); font-weight: 700; }
.source-note small { color: var(--faint); }
.analysis-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; padding: 10px 12px; background: #e6ece8; border: 1px solid var(--line); }
.analysis-toolbar select { min-height: 34px; }
.toolbar-label { margin-right: 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.analysis-metrics { margin-bottom: 18px; }
.analysis-tip { margin-top: 13px; padding: 9px 11px; background: var(--blue-soft); color: #3a5d76; font-size: 11px; }
.compact-table { min-width: 0; }
.compact-table th, .compact-table td { padding: 8px 9px; }
.order-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.order-card { padding: 12px; border: 1px solid var(--line); background: #fafcfb; }
.order-card span, .order-card small { display: block; color: var(--muted); font-size: 11px; }
.order-card b { display: block; margin: 4px 0; font-size: 24px; }
.order-card .bar, .mistake-bar .bar { height: 6px; margin-top: 9px; background: #e5ebe7; }
.order-card .bar i, .mistake-bar .bar i { display: block; height: 100%; background: var(--green); }
.mistake-bar { margin: 12px 0; }
.mistake-label { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.mistake-label b { color: var(--accent-dark); }
.mistake-bar .bar i { background: var(--accent); }
.experiment { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 12px; border-left: 3px solid var(--accent); background: #fff9f7; }
.experiment b { font-size: 13px; }
.experiment p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.meta-rank-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.meta-rank { display: grid; grid-template-columns: 25px 1fr; gap: 8px; padding: 10px; border: 1px solid var(--line); }
.meta-rank b, .meta-rank small { display: block; }
.meta-rank b { font-size: 11.5px; }
.meta-rank small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.rank-no { color: var(--accent); font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.empty-analysis { text-align: center; padding: 42px 20px; }

/* Meta page */
.meta-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.meta-status { min-height: 118px; padding: 16px 17px; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.meta-status strong, .meta-status span, .meta-status small { display: block; }
.meta-status strong { margin: 4px 0 7px; font-size: 17px; }
.meta-status span { color: var(--muted); font-size: 12px; }
.meta-status small { margin-top: 8px; color: var(--faint); font-size: 10px; }
.meta-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 18px; }
.meta-local, .meta-advice { margin-bottom: 18px; }
.confidence-badge { padding: 4px 8px; background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 700; white-space: nowrap; }
.meta-lead { margin: -4px 0 16px; color: var(--muted); font-size: 12px; }
.tier-list { border-top: 1px solid var(--line); }
.tier-row-large { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tier-rank { color: var(--accent); font: 800 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.tier-row-large b, .tier-row-large small { display: block; }
.tier-row-large small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.meta-sample { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 13px; font-size: 11px; }
.meta-sample b { margin-right: 4px; }
.decision-list { margin: 0 0 18px; padding: 0; list-style: none; counter-reset: decision; }
.decision-list li { display: grid; grid-template-columns: 27px 1fr; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.decision-list li span { color: var(--accent); font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.meta-controls { display: flex; gap: 7px; margin-bottom: 12px; }
.meta-controls input { flex: 1; min-width: 120px; }
.meta-controls select { min-width: 100px; }
.meta-table { min-width: 760px; }
.meta-table td:first-child { white-space: nowrap; }
.meta-table td:first-child .rank-no { display: inline-block; width: 24px; }
.archetype-card { padding: 15px 16px; border: 1px solid var(--line); background: #fafcfb; }
.archetype-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.archetype-head b, .archetype-head small { display: block; }
.archetype-head small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.archetype-card p { min-height: 72px; margin: 12px 0; color: #45524d; font-size: 11.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.archetype-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.checklist-panel { margin-bottom: 4px; }

/* Match log */
.mistake-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check-option { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin: 0; padding: 5px 9px; border: 1px solid var(--line); background: #fafcfb; color: var(--ink); font-size: 11px; font-weight: 500; cursor: pointer; }
.check-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.check-option input { width: 14px; min-height: 14px; accent-color: var(--accent); }
.history-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.history-tools input { min-width: 190px; }
.history-tools select, .history-tools button { min-height: 34px; }
.history-list { display: grid; gap: 8px; }
.history-card { display: grid; grid-template-columns: 70px 1fr 31px; gap: 12px; align-items: start; padding: 13px 0; border-top: 1px solid var(--line); }
.history-result time { display: block; margin-top: 6px; color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.history-main b { font-size: 12.5px; }
.history-main p { margin: 6px 0 0; font-size: 11.5px; }
.history-meta { margin-top: 4px; color: var(--muted); font-size: 10.5px; }
.history-card .icon-action { opacity: .65; }
.history-card:hover .icon-action { opacity: 1; }

/* External information and tournament views */
.news-list { border-top: 1px solid var(--line); }
.news-row, .event-row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.news-row:hover, .event-row:hover { color: var(--accent-dark); }
.news-row time, .event-row time { color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.news-row b, .news-row small, .event-row b, .event-row small { display: block; }
.news-row b, .event-row b { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.news-row small, .event-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.news-row > span, .event-row > span { color: var(--accent); font-size: 11px; white-space: nowrap; }
.info-source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.info-source-card { display: flex; flex-direction: column; min-height: 92px; padding: 11px 12px; border: 1px solid var(--line); background: #fafcfb; color: var(--ink); text-decoration: none; }
.info-source-card:hover { border-color: var(--accent); background: #fffaf8; }
.info-source-card .source-kind { color: var(--accent); font: 800 9px ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.info-source-card b { margin-top: 7px; font-size: 11.5px; line-height: 1.4; }
.info-source-card small { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: 10px; }
.dashboard-tier { display: block; }
.dashboard-tier > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dashboard-tier b, .dashboard-tier small { display: block; }
.dashboard-tier small { margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.data-explain { margin-bottom: 10px; padding: 9px 11px; background: var(--blue-soft); color: #3a5d76; font-size: 11px; }
.battle-table { min-width: 680px; }
.field-signal { display: grid; gap: 8px; }
.signal-card { position: relative; display: grid; grid-template-columns: 74px 1fr; column-gap: 8px; padding: 12px; border: 1px solid var(--line); background: #fafcfb; }
.signal-card > span { color: var(--muted); font-size: 10px; }
.signal-card > b { font-size: 12px; }
.signal-card > small { grid-column: 2; margin-top: 3px; color: var(--muted); font-size: 10.5px; }
.signal-card > i { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-strong); }
.signal-card > i.hot { background: var(--accent); }
.signal-card > i.ok { background: var(--green); }
.signal-card > i.warn { background: var(--amber); }
.event-list { border-top: 1px solid var(--line); }
.event-row { grid-template-columns: 78px 1fr auto; }
.mark-count-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.mark-count { padding: 10px 8px; border: 1px solid var(--line); text-align: center; background: #fafcfb; }
.mark-count b, .mark-count strong, .mark-count small { display: block; }
.mark-count b { color: var(--accent); font: 800 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.mark-count strong { margin: 4px 0 1px; font-size: 19px; }
.mark-count small { color: var(--muted); font-size: 9px; }
.signal-stack { display: grid; gap: 8px; }
.version-signal { padding: 11px 12px 10px; border: 1px solid var(--line); background: #fafcfb; }
.version-signal > b { display: block; margin-top: 7px; font-size: 13px; }
.version-signal p { margin: 4px 0; color: var(--muted); font-size: 11px; }
.version-signal small { color: var(--faint); font-size: 10px; }
.card-legal-table { min-width: 760px; }
.card-legal-table td:nth-child(4) { max-width: 180px; }
.personal-analysis { margin-top: 18px; }
.personal-analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .75fr); gap: 18px; }
.archetype-original { display: block; margin: 3px 0 0 24px; color: var(--faint); font-size: 9.5px; font-weight: 500; }
.table-action { min-height: 28px; padding: 4px 8px; color: var(--accent-dark); font-size: 10.5px; }
.deckmodalbox { position: relative; width: min(940px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px; border-radius: 10px; background: var(--paper); box-shadow: 0 24px 70px rgba(9, 20, 16, .35); }
.deckmodalbox .cmclose { position: absolute; top: 12px; right: 12px; width: 31px; min-width: 31px; min-height: 31px; padding: 0; border-radius: 50%; background: #eef2ef; font-size: 15px; }
.deckmodal-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; padding-right: 42px; }
.deckmodal-title h2 { margin: 0; font-size: 21px; }
.deckmodal-title h2::before { display: none; }
.deckmodal-intro { max-width: 780px; font-size: 11.5px; }
.deck-sample-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.deck-sample-tabs button { min-height: 31px; padding: 5px 9px; font-size: 10.5px; }
.deck-sample-tabs button.on { background: var(--sidebar); border-color: var(--sidebar); color: #fff; }
.deck-sample-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-bottom: 13px; font-size: 11px; }
.deck-sample-meta b { color: var(--ink); }
.deck-sample-meta span { color: var(--muted); }
.deck-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.deck-section { min-width: 0; padding: 12px; border: 1px solid var(--line); background: #fafcfb; }
.deck-section h3 { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 9px; font-size: 12px; }
.deck-section h3 span { color: var(--muted); font-size: 10px; font-weight: 500; }
.deck-card-list { display: grid; gap: 5px; }
.deck-card-row { display: grid; grid-template-columns: 30px 1fr; gap: 7px; align-items: center; min-height: 34px; padding-bottom: 5px; border-bottom: 1px solid #e8eeea; }
.deck-card-img, .deck-card-placeholder { width: 30px; height: 42px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); background: #edf2ef; }
.deck-card-placeholder { display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 11px; }
.deck-card-row b, .deck-card-row small { display: block; }
.deck-card-row b { font-size: 10.5px; line-height: 1.35; }
.deck-card-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.legal-card-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); max-height: 850px; overflow-y: auto; padding: 2px; }
.legal-card-tile { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease; }
.legal-card-tile:hover, .legal-card-tile:focus-visible { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); outline: none; }
.legal-card-tile > img { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: cover; background: #eef1f0; }
.legal-card-copy { padding: 6px 7px 7px; }
.legal-card-copy b, .legal-card-copy span, .legal-card-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legal-card-copy b { font-size: 11px; }
.legal-card-copy span { margin-top: 2px; color: var(--accent-dark); font-size: 9.5px; }
.legal-card-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }

@media (max-width: 1260px) {
  .builder { grid-template-columns: 272px minmax(360px, 1fr); }
  .builder .panel:last-child { position: static; grid-column: 1 / -1; }
  .builder .panel:first-child { top: 16px; }
}

@media (max-width: 1040px) {
  main { padding: 34px 28px 72px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .builder { grid-template-columns: 1fr; }
  .builder .panel:first-child, .builder .panel:last-child { position: static; grid-column: auto; }
  .pool-list { max-height: 560px; }
  form.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid-new, .meta-layout, .dashboard-lower, .analysis-grid { grid-template-columns: 1fr; }
  .meta-overview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .personal-analysis-grid { grid-template-columns: 1fr; }
  .decklib-layout { grid-template-columns: 1fr; }
  .decklib-side { position: static; }
  .decklib-list { max-height: 320px; }
}

@media (max-width: 820px) {
  .workspace { margin-left: 0; padding-top: 58px; }
  .cmbox { grid-template-columns: 1fr; }
  .cmimg img { max-width: 260px; margin: 0 auto; }
  .sidebar {
    width: min(86vw, 290px);
    transform: translateX(-102%);
    box-shadow: none;
    transition: transform .2s ease;
  }
  body.nav-open { overflow: hidden; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 14px 0 42px rgba(0, 0, 0, .22); }
  .sidebar-close { display: inline-flex; margin-left: auto; border-color: rgba(255, 255, 255, .12); background: transparent; color: #fff; }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 20;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(7, 16, 13, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .sidebar-scrim { display: block; opacity: 1; pointer-events: auto; }
  .mobilebar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 15;
    height: 58px;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    background: var(--sidebar);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .menu-toggle { width: 38px; min-width: 38px; min-height: 38px; border-color: rgba(255, 255, 255, .14); background: transparent; color: #fff; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; font-size: 13px; }
  .mobile-status { color: #7e978d; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 800; }
  main { padding: 26px 18px 60px; }
  .compact-hero { min-height: 0; align-items: stretch; }
  .hero-focus { width: 100%; margin-top: 16px; }
  .meta-overview { grid-template-columns: 1fr; }
  .meta-controls { flex-wrap: wrap; }
  .meta-controls input { flex-basis: 100%; }
  .meta-rank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-source-grid { grid-template-columns: 1fr; }
  .mark-count-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deckmodalbox { padding: 18px; }
  .deck-sections { grid-template-columns: 1fr; }
  .legal-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-tools { width: 100%; }
  .history-tools input { flex: 1; min-width: 0; }
  .page-head { display: block; }
  .page-head h1 { font-size: 25px; }
  .page-head p { margin-top: 7px; text-align: left; }
  .command-hero { grid-template-columns: minmax(0, 1fr) 220px; }
  .hero-copy { padding: 32px 28px; }
  .hero-title { font-size: 29px; }
  .card-stack-visual { transform: scale(.78); }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-strip .stat:nth-child(2) { border-right: 0; }
  .metric-strip .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .notes-layout > .panel:first-child { position: static; }
  .notes-nav { max-height: 260px; }
}

@media (max-width: 580px) {
  main { padding: 22px 14px 52px; }
  .panel { padding: 18px 16px; }
  .command-hero { grid-template-columns: 1fr; min-height: 0; }
  .hero-copy { padding: 29px 22px 20px; }
  .hero-title { font-size: 27px; }
  .hero-visual { min-height: 176px; overflow: hidden; }
  .card-stack-visual { transform: translateY(-5px) scale(.76); }
  .hero-stamp { right: 14px; bottom: 12px; }
  .metric-strip .stat { min-height: 116px; padding: 17px 15px; }
  .stat .num { font-size: 22px; }
  .grid-4 { grid-template-columns: 1fr; }
  .quick-links { align-items: stretch; }
  .quick-label { width: 100%; }
  .quick-links .btn { flex: 1 1 calc(50% - 8px); }
  .signal-row { grid-template-columns: 82px 1fr; }
  form.form-grid { grid-template-columns: 1fr; }
  form.form-grid .wide { grid-column: auto; }
  .deck-actions input { width: 100%; flex-basis: 100%; }
  .notes-layout { gap: 12px; }
  .md h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ================= 在线对战 ================= */

/* 牌桌全屏模式：隐藏应用侧栏，工作区全宽 */
body.battle-mode .sidebar { display: none; }
body.battle-mode .workspace { margin-left: 0; }
body.battle-mode { background: #0d1b16; }

.bt-app {
  --bt-felt-a: #143026;
  --bt-felt-b: #0f231c;
  --bt-line: rgba(255, 255, 255, .09);
  --bt-ink: #eef4ef;
  --bt-muted: #93a89d;
  --bt-gold: #e8c96a;
  display: grid;
  grid-template-rows: 48px 1fr;
  min-height: calc(100vh - 1px);
  background:
    radial-gradient(1200px 500px at 50% 30%, rgba(64, 120, 92, .35), transparent 70%),
    linear-gradient(180deg, var(--bt-felt-a), var(--bt-felt-b) 85%);
  color: var(--bt-ink);
}

/* ---- 顶栏 ---- */
.bt-head {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: rgba(8, 20, 15, .55);
  border-bottom: 1px solid var(--bt-line);
  backdrop-filter: blur(4px);
  position: sticky; top: 0; z-index: 20;
}
.bt-head-room { display: flex; align-items: center; gap: 8px; }
.bt-code {
  font-size: 20px; letter-spacing: .3em; color: var(--bt-gold);
  font-weight: 800; text-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}
.bt-mini {
  border: 1px solid var(--bt-line); background: rgba(255, 255, 255, .06);
  color: var(--bt-ink); border-radius: 6px; padding: 4px 10px; font-size: 12px;
  cursor: pointer; transition: background .15s;
}
.bt-mini:hover { background: rgba(255, 255, 255, .14); }
.bt-head-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.bt-head-info .chip { background: rgba(255, 255, 255, .08); color: var(--bt-ink); border: 1px solid var(--bt-line); }
.bt-head-info .chip.ok { background: rgba(23, 117, 84, .55); border-color: transparent; }
.bt-turnchip { animation: btpulse 1.6s ease-in-out infinite; }
@keyframes btpulse { 50% { box-shadow: 0 0 0 5px rgba(23, 117, 84, .25); } }
.bt-opp { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--bt-muted); }
.bt-opp .chip { margin-left: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #6b7d73; display: inline-block; }
.dot.on { background: #3ecf8e; box-shadow: 0 0 6px rgba(62, 207, 142, .8); }
.bt-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bt-endturn { padding: 5px 14px; border-radius: 6px; border: none; cursor: default; opacity: .55; font-size: 12.5px; }
.bt-endturn.ready {
  opacity: 1; cursor: pointer;
  animation: btpulse 1.6s ease-in-out infinite;
  background: linear-gradient(180deg, #e0563e, #c33f2b);
}

/* ---- 主体 ---- */
.bt-main { display: grid; grid-template-columns: 1fr 268px; min-height: 0; }
.bt-center {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  padding: 10px 14px 12px; gap: 8px; overflow-y: auto;
}
.bt-banner {
  min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 14px;
  border-radius: 8px; font-size: 13px; color: var(--bt-muted); text-align: center; flex-wrap: wrap;
}
.bt-banner.setup { background: rgba(232, 201, 106, .1); border: 1px dashed rgba(232, 201, 106, .35); color: var(--bt-gold); }
.bt-banner.ended { background: rgba(232, 201, 106, .12); border: 1px solid rgba(232, 201, 106, .4); color: var(--bt-ink); flex-direction: column; gap: 6px; padding: 12px; }
.bt-banner.ended b { font-size: 19px; color: var(--bt-gold); }
.bt-banner-actions { display: flex; gap: 8px; }
.bt-banner-actions button {
  border: 1px solid var(--bt-line); background: rgba(255, 255, 255, .07); color: var(--bt-ink);
  border-radius: 6px; padding: 6px 14px; cursor: pointer;
}
.bt-banner-actions button.primary { background: var(--accent); border-color: transparent; }

/* ---- 一侧场地 ---- */
.bt-side { display: flex; flex-direction: column; gap: 7px; }
.bt-side.active-turn .bt-row.active-row .bslot.active { box-shadow: 0 0 0 2px rgba(232, 201, 106, .8), var(--bt-slot-shadow, 0 8px 20px rgba(0,0,0,.35)); }
.bt-side-info { display: flex; align-items: center; gap: 12px; font-size: 12px; flex-wrap: wrap; }
.bt-side-info .bt-name { color: var(--bt-ink); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.bt-side-info .chip { background: rgba(232, 201, 106, .15); border: 1px solid rgba(232, 201, 106, .3); color: var(--bt-gold); }
.bt-board-rows { display: flex; flex-direction: column; gap: 7px; }
.bt-row { display: flex; gap: 7px; align-items: stretch; justify-content: center; }
.bt-row.bench { flex-wrap: wrap; }

/* 对手手牌（背面小卡） */
.bt-opphand { display: flex; justify-content: center; gap: 0; min-height: 46px; align-items: center; }
.bt-opphand .bcard { margin-left: -18px; }
.bt-opphand .bcard:first-child { margin-left: 0; }
.bt-peek-strip { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.bt-peek-strip .bcard { width: 58px; }

/* ---- 卡牌 ---- */
.bcard {
  position: relative; width: var(--cw, 80px); flex: none;
  border-radius: 7px; user-select: none; -webkit-user-drag: none;
  transition: transform .18s cubic-bezier(.2, .75, .25, 1), box-shadow .18s;
}
.bcard img {
  display: block; width: 100%; aspect-ratio: 245 / 342; object-fit: cover;
  border-radius: inherit; background: #223;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.bcard.back { width: var(--cw, 46px); }
.bcard.back .backpat {
  width: 100%; aspect-ratio: 245 / 342; border-radius: inherit;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #295b46, #173226);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .14);
  display: flex; align-items: center; justify-content: center;
  color: rgba(232, 201, 106, .75); font-size: 10px; font-weight: 800; letter-spacing: .12em;
}
.bcard.tiny { --cw: 36px; }
.bcard.slot-card { --cw: 76px; }
.bcard.slot-card.big { --cw: 104px; }
.bcard.hand-card { --cw: 106px; }
.bcard.pile-top { --cw: 46px; }
.bcard.stadium-card { --cw: 62px; transform: rotate(-90deg); }
.bcard.stadium-card:hover { transform: rotate(-90deg) scale(1.08); }
.draggable { cursor: grab; }
.drag-src { opacity: .25; }
.bcard.sel { outline: 3px solid var(--bt-gold); outline-offset: 2px; }
.bcard.top::after {
  content: "TOP"; position: absolute; top: -8px; right: -6px;
  background: var(--bt-gold); color: #142; font-size: 9px; font-weight: 800;
  border-radius: 4px; padding: 1px 5px;
}
.bt-ghost { position: fixed; pointer-events: none; z-index: 1000; opacity: .85; transform: scale(1.06) rotate(2deg); }
.bt-ghost-fly { transition: none; }

/* ---- 槽位 ---- */
.bslot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 84px; min-height: 122px; padding: 6px 4px 4px;
  border-radius: 10px; border: 1.5px dashed rgba(255, 255, 255, .16);
  justify-content: flex-start;
}
.bslot.active { min-width: 118px; min-height: 152px; border-color: rgba(232, 201, 106, .5); }
.bslot .bslot-empty { color: rgba(255, 255, 255, .28); font-size: 11px; margin-top: 42px; }
.bslot.active .bslot-empty { margin-top: 56px; }
.bslot.filled { border-style: solid; border-color: transparent; }
.bslot.droppable:hover { border-color: rgba(62, 207, 142, .5); }
.bslot-name {
  font-size: 10.5px; color: var(--bt-muted); max-width: 108px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bstack-badge {
  position: absolute; top: -7px; left: -7px; z-index: 3;
  background: #326f9f; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; box-shadow: 0 2px 5px rgba(0,0,0,.4);
}
.bslot-chips { display: flex; gap: 3px; position: absolute; top: 4px; right: 4px; flex-wrap: wrap; max-width: 70%; justify-content: flex-end; }
.bdmg {
  background: #d8362a; color: #fff; border-radius: 50%;
  min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800; box-shadow: 0 2px 6px rgba(0,0,0,.5), inset 0 0 0 2px rgba(255,255,255,.35);
  animation: btdmgpop .3s cubic-bezier(.2,1.6,.4,1);
}
@keyframes btdmgpop { from { transform: scale(1.7); } }
.bstatus {
  background: rgba(20, 30, 25, .85); border: 1px solid rgba(255,255,255,.25);
  color: #ffd9a8; border-radius: 4px; font-size: 10px; font-weight: 700; padding: 0 4px;
}
.battach { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.battach-chip {
  border: none; cursor: pointer; border-radius: 12px; padding: 1px 7px;
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.battach-chip b { opacity: .85; margin-left: 2px; font-size: 9.5px; }
.battach-chip.tool { background: rgba(139, 92, 24, .55); }
.bslot.shake { animation: btshake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes btshake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
.bt-float-dmg {
  position: absolute; left: 50%; top: 30%; transform: translateX(-50%);
  color: #ff8d7e; font-size: 26px; font-weight: 900; z-index: 30;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .7); pointer-events: none;
  animation: btfloatup 1s ease-out forwards;
}
@keyframes btfloatup { to { transform: translate(-50%, -46px); opacity: 0; } }

/* ---- 区域堆 ---- */
.bt-piles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.bt-pile {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px 5px; border-radius: 9px; cursor: default;
  background: rgba(0, 0, 0, .18); border: 1px solid rgba(255, 255, 255, .07);
  min-width: 74px;
}
.bt-pile[data-drop] { cursor: pointer; }
.bt-pile-cards { position: relative; height: 66px; width: 48px; }
.bt-pile-cards i {
  position: absolute; inset: 0; border-radius: 6px;
  background: linear-gradient(160deg, #295b46, #173226);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.bt-pile-cards i:nth-child(2) { transform: translate(-3px, 3px) rotate(-4deg); }
.bt-pile-cards i:nth-child(3) { transform: translate(3px, -2px) rotate(3deg); }
.bt-pile .bcard.pile-top { position: absolute; left: 0; top: 0; --cw: 48px; }
.bt-pile b { font-size: 11.5px; color: var(--bt-ink); }
.bt-pile small { font-size: 11px; color: var(--bt-muted); font-weight: 700; }
.bt-pile.deck .bt-pile-cards::after {
  content: "回合"; position: absolute; right: -8px; top: -6px;
  background: #326f9f; color: #fff; font-size: 9px; padding: 1px 4px; border-radius: 3px;
}
.bt-pile.prizes .bt-pile-cards::after {
  content: "★"; position: absolute; right: -8px; top: -8px;
  color: var(--bt-gold); font-size: 13px; text-shadow: 0 0 6px rgba(232,201,106,.8);
}

/* ---- 场地 ---- */
.bt-stadium {
  width: 110px; min-height: 122px; margin-left: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed rgba(255, 255, 255, .14); border-radius: 10px;
  position: relative;
}
.bt-stadium.has { border-style: solid; border-color: rgba(232, 201, 106, .35); }
.bt-stadium-empty { color: rgba(255,255,255,.25); font-size: 11px; }
.bt-stadium.has .bcard { position: absolute; left: 22px; top: 29px; }

/* ---- 手牌 ---- */
.bt-hand {
  display: flex; justify-content: center; align-items: flex-end;
  min-height: 158px; padding: 14px 0 6px; gap: 0; position: relative;
}
.bt-hand .hand-card {
  margin-left: -26px; transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0));
  transform-origin: 50% 130%;
}
.bt-hand .hand-card:first-child { margin-left: 0; }
.bt-hand .hand-card:hover, .bt-hand .hand-card:focus-visible {
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--ty, 0px) - 26px)) scale(1.16);
  z-index: 99 !important;
}
.bt-hand.crowded .hand-card { margin-left: -40px; }
.bt-hand-empty { color: var(--bt-muted); align-self: center; }

/* ---- 拖放高亮 ---- */
.drop-hint { border-color: #3ecf8e !important; box-shadow: 0 0 0 3px rgba(62, 207, 142, .3) !important; }
.drop-bad { border-color: rgba(216, 54, 42, .6) !important; }

/* ---- 开局布置条 ---- */
.bt-setup-bar { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.bt-setup-bar button {
  border: 1px solid var(--bt-line); background: rgba(255, 255, 255, .07);
  color: var(--bt-ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 12.5px;
}
.bt-setup-bar button.primary { background: var(--accent); border-color: transparent; }

/* ---- 等待界面 ---- */
.bt-wait { display: flex; align-items: center; justify-content: center; flex: 1; padding: 30px 0; }
.bt-wait-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 660px; }
.bt-wait-card {
  display: flex; flex-direction: column; gap: 9px; align-items: flex-start;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--bt-line);
  border-radius: 12px; padding: 22px; min-width: 240px;
}
.bt-wait-card b { font-size: 16px; }
.bt-wait-card button {
  border: 1px solid var(--bt-line); background: rgba(255,255,255,.07); color: var(--bt-ink);
  border-radius: 6px; padding: 7px 16px; cursor: pointer;
}
.bt-wait-card button.primary, .bt-wait-card button.big { background: var(--accent); border-color: transparent; font-weight: 700; padding: 9px 22px; }
.bt-wait-card.empty { align-items: center; text-align: center; border-style: dashed; }
.bt-code-big {
  font-size: 44px; font-weight: 900; letter-spacing: .28em; color: var(--bt-gold);
  text-shadow: 0 3px 12px rgba(232, 201, 106, .35); margin-left: .28em;
}
.bt-wait-start { grid-column: 1 / -1; display: flex; justify-content: center; }

/* ---- 日志 ---- */
.bt-log {
  border-left: 1px solid var(--bt-line); background: rgba(8, 20, 15, .5);
  display: flex; flex-direction: column; min-height: 0;
}
.bt-log-title {
  padding: 10px 14px; font-size: 11px; font-weight: 800; letter-spacing: .14em;
  color: var(--bt-muted); text-transform: uppercase; border-bottom: 1px solid var(--bt-line);
}
.bt-log-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.bt-log-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.5; color: #c9d6cd; }
.bt-log-row .bt-log-who {
  flex: none; width: 46px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700; font-size: 11px; padding-top: 1px;
}
.bt-log-row.mine .bt-log-who { color: #7fd4a8; }
.bt-log-row.opp .bt-log-who { color: #8db9e8; }
.bt-log-row.sys .bt-log-who { color: var(--bt-muted); }
.bt-log-row.k-flip { color: var(--bt-gold); }
.bt-log-row.k-attack { color: #ffb3a6; }
.bt-log-row.k-end { color: var(--bt-gold); font-weight: 700; }
.bt-log-sep {
  margin: 5px 0; padding: 3px 8px; background: rgba(255,255,255,.07); border-radius: 5px;
  color: var(--bt-ink); font-size: 11.5px; text-align: center;
}

/* ---- 弹出菜单 ---- */
.bt-menu {
  position: fixed; z-index: 1200; min-width: 180px; max-width: 300px;
  background: #fff; border-radius: 9px; padding: 5px;
  box-shadow: 0 10px 34px rgba(5, 15, 10, .5), 0 0 0 1px rgba(0, 0, 0, .06);
  max-height: 74vh; overflow-y: auto;
}
.bt-menu button {
  display: flex; align-items: baseline; gap: 8px; width: 100%; text-align: left;
  border: none; background: none; padding: 8px 11px; border-radius: 6px;
  font-size: 13px; cursor: pointer; color: var(--ink); font-family: inherit;
}
.bt-menu button:hover:not(:disabled) { background: var(--accent-soft); }
.bt-menu button.danger { color: var(--red); }
.bt-menu button.danger:hover:not(:disabled) { background: var(--red-soft); }
.bt-menu button.header { font-size: 10.5px; font-weight: 800; color: var(--muted); cursor: default; letter-spacing: .08em; }
.bt-menu button.header:hover { background: none; }
.bt-menu button:disabled { opacity: .45; cursor: default; }
.bt-menu button small { color: var(--muted); font-size: 10.5px; }
.bt-menu-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.bt-atk-line { display: inline-flex; align-items: center; gap: 6px; }
.bt-atk-line i { color: var(--muted); font-style: normal; font-size: 11px; }
.edot {
  display: inline-flex; width: 15px; height: 15px; border-radius: 50%;
  align-items: center; justify-content: center; color: #fff; font-size: 9px; font-style: normal;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5);
}

/* ---- 浮层 ---- */
.bt-ovl {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(6, 14, 11, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.bt-ovl-box {
  background: var(--paper); color: var(--ink); border-radius: 14px;
  padding: 20px; max-width: min(920px, 94vw); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  animation: btovlin .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes btovlin { from { transform: translateY(14px) scale(.97); opacity: 0; } }
.bt-ovl-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.bt-ovl-actions button {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px;
  padding: 8px 16px; cursor: pointer; font-family: inherit;
}
.bt-ovl-actions button.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 700; }
.bt-pile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.bt-pile-grid.big { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.bt-retreat-list { display: flex; flex-direction: column; gap: 5px; max-height: 240px; overflow-y: auto; }
.bt-retreat-opt { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* ---- 抛硬币 ---- */
.bt-coin-ovl .bt-ovl-box { background: transparent; box-shadow: none; padding: 0; text-align: center; }
.bt-coin-wrap { display: flex; gap: 22px; justify-content: center; perspective: 700px; margin: 26px 0 18px; }
.bt-coin {
  width: 92px; height: 92px; position: relative; transform-style: preserve-3d;
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.5));
}
.bt-coin .coin-face {
  position: absolute; inset: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; backface-visibility: hidden;
  border: 5px solid #b98f2e;
}
.bt-coin .front {
  background: radial-gradient(circle at 32% 28%, #ffe9a8, #e8c96a 55%, #c79b33);
  color: #7a5b12;
}
.bt-coin .back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 32% 28%, #b8b2a6, #8e887c 55%, #6f6a60);
  color: #403c35;
}
.bt-coin-result { min-height: 34px; color: #fff; font-size: 20px; }
.bt-coin-ovl .panel-kicker { color: #cbb86a; }

/* ---- 回合横幅 / 展示 / 飘字 ---- */
.bt-turn-banner {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.9);
  z-index: 950; pointer-events: none; opacity: 0;
  font-size: 40px; font-weight: 900; letter-spacing: .1em; color: #fff;
  text-shadow: 0 4px 26px rgba(0, 0, 0, .8), 0 0 60px rgba(232, 201, 106, .5);
  transition: opacity .3s, transform .35s cubic-bezier(.2, .9, .3, 1.3);
  white-space: nowrap;
}
.bt-turn-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.bt-turn-banner.opp { color: #c9d6ff; }
.bt-turn-banner.attack { font-size: 30px; color: #ffb3a6; }
.bt-reveal {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -30%) scale(.6);
  z-index: 960; display: flex; flex-direction: column; gap: 10px; align-items: center;
  opacity: 0; transition: all .3s cubic-bezier(.2,.9,.3,1.3); pointer-events: none;
}
.bt-reveal.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.bt-reveal .bcard { --cw: 230px; }
.bt-reveal .chip { background: rgba(0,0,0,.6); color: #fff; }

/* ---- 提示条 ---- */
.bt-toast-wrap {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 1300; display: flex; flex-direction: column; gap: 7px; align-items: center;
  pointer-events: none;
}
.bt-toast {
  background: rgba(12, 26, 20, .92); color: #eef4ef; border: 1px solid rgba(255,255,255,.14);
  padding: 9px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 26px rgba(0,0,0,.45);
  animation: bttoastin .28s cubic-bezier(.2,.9,.3,1.2);
  transition: opacity .3s, transform .3s;
}
.bt-toast.bad { border-color: rgba(216, 54, 42, .6); color: #ffc9c2; }
.bt-toast.warn { border-color: rgba(232, 201, 106, .5); color: #ffe9b0; }
.bt-toast.out { opacity: 0; transform: translateY(8px); }
@keyframes bttoastin { from { opacity: 0; transform: translateY(12px); } }

/* ---- 大厅 ---- */
.bt-lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bt-lobby-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); }
.bt-lobby-card b { font-size: 14.5px; }
.bt-lobby-card select, .bt-lobby-card input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; font-family: inherit; font-size: 13px; background: #fff; }
.bt-lobby-card .primary { align-self: flex-start; }
.bt-code-in { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; text-align: center; font-size: 16px !important; }
.bt-lobby-name { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-width: 340px; }
.bt-lobby-name input { padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 7px; font-family: inherit; font-size: 14px; }
.bt-resume { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.bt-resume-btn {
  align-self: flex-start; display: inline-flex; gap: 10px; align-items: center;
  border: 1px dashed var(--line-strong); background: var(--green-soft); color: var(--ink);
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.bt-resume-btn b { font-size: 16px; letter-spacing: .2em; color: var(--green); }
.bt-howto { margin-top: 16px; }
.bt-howto summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.bt-howto-body { margin-top: 10px; font-size: 13px; }
.bt-howto-body ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.bt-howto-body code { background: var(--canvas); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.bt-manual summary { cursor: pointer; list-style: none; }
.bt-manual summary::-webkit-details-marker { display: none; }
.bt-manual summary .section-heading { pointer-events: none; }
.bt-manual[open] summary { margin-bottom: 12px; }
.history-card.online .history-main { cursor: pointer; }

/* ---- 战报 ---- */
.bt-report .bt-ovl-box { max-width: 720px; }
.bt-report-head { margin-bottom: 14px; }
.bt-report-tl { max-height: 56vh; overflow-y: auto; border-top: 1px solid var(--line); }
.bt-report-row { display: flex; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.bt-report-who { flex: none; width: 72px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 响应式 ---- */
@media (max-width: 1080px) {
  .bt-main { grid-template-columns: 1fr; }
  .bt-log { display: none; }
  .bt-app.log-open .bt-log {
    display: flex; position: fixed; right: 0; top: 48px; bottom: 0; width: 280px;
    z-index: 60; box-shadow: -12px 0 30px rgba(0,0,0,.4);
  }
}
@media (max-width: 720px) {
  .bt-code { font-size: 16px; letter-spacing: .18em; }
  .bt-head { flex-wrap: wrap; padding: 6px 10px; position: static; }
  .bt-lobby-grid { grid-template-columns: 1fr; }
  .bcard.hand-card { --cw: 84px; }
  .bt-hand.crowded .hand-card { margin-left: -48px; }
  .bcard.slot-card { --cw: 58px; }
  .bcard.slot-card.big { --cw: 76px; }
  .bslot { min-width: 64px; min-height: 102px; }
  .bslot.active { min-width: 88px; min-height: 128px; }
  .bt-row { gap: 4px; }
  .bt-stadium { display: none; }
  .bt-turn-banner { font-size: 26px; }
}

/* ---- 牌桌布局紧凑化：区域堆贴边竖排，适配 900px 高度 ---- */
body.battle-mode main { padding: 0; }
.bt-center { padding: 8px 12px 10px; gap: 6px; }
.bt-side { position: relative; padding-right: 106px; }
.bt-piles.side {
  position: absolute; right: 0; top: 0; bottom: 0;
  flex-direction: column; justify-content: space-evenly; align-items: stretch;
  width: 98px; gap: 6px;
}
.bt-piles.side .bt-pile { min-width: 0; width: 98px; padding: 4px 4px 3px; border-radius: 8px; }
.bt-piles.side .bt-pile-cards { height: 40px; width: 30px; }
.bt-piles.side .bcard.pile-top { --cw: 30px; }
.bt-piles.side .bt-pile b { font-size: 10px; }
.bt-piles.side .bt-pile small { font-size: 10px; }
.bt-piles.side .bt-pile[data-drop] { cursor: pointer; }
.bt-hand { min-height: 148px; padding: 10px 0 4px; }
@media (max-width: 720px) {
  .bt-side { padding-right: 0; }
  .bt-piles.side { position: static; width: auto; flex-direction: row; flex-wrap: wrap; }
  .bt-piles.side .bt-pile { width: auto; }
}

/* 900px 视口内的最终收紧 */
.bt-center { gap: 5px; padding: 6px 12px 6px; }
.bt-opphand { min-height: 44px; }
.bcard.hand-card { --cw: 96px; }
.bt-hand { min-height: 140px; padding: 6px 0 2px; }
.bt-banner { min-height: 28px; }
.bt-hand { min-height: 132px; }

/* ---- 视觉验收修复 ---- */
.bt-hand .hand-card { margin-left: -18px; }
.bt-hand.crowded .hand-card { margin-left: -30px; }
.bt-hand .hand-card:hover, .bt-hand .hand-card:focus-visible {
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--ty, 0px) - 44px)) scale(1.5);
  z-index: 99 !important;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .5));
}
.bt-piles.side { justify-content: center; gap: 10px; top: 50%; transform: translateY(-50%); }
.bt-pile.empty { opacity: .5; }
.bt-pile.empty .bt-pile-cards i { background: linear-gradient(160deg, #1c3a2d, #12241b); }
.bt-pile.deck .bt-pile-cards::after {
  background: rgba(232, 201, 106, .92); color: #143026; font-weight: 800;
}
.bt-mini { background: rgba(255, 255, 255, .12); font-weight: 600; }
.bt-mini:hover { background: rgba(255, 255, 255, .24); }
.bt-log-row { color: #d5e0d8; }
.bt-log-list { color: #aebfb4; }
.bcard.back .backpat { color: rgba(232, 201, 106, .5); font-size: 0; }
.bcard.back .backpat::after {
  content: "◆"; font-size: 14px;
}
.bt-setup-bar { margin-top: 2px; }
