/* ==========================================================================
   深水城跑团辅助站点 · 统一设计令牌与移动端优先样式表
   遵循：单主强调色（黄铜金）、三层明度拉开、无实心彩色胶囊、无虚线框、375px 优先
   ========================================================================== */

:root {
  /* 背景三层明度 */
  --bg-page:    #f3ece0;
  --bg-card:    #fffdf8;
  --bg-sunken:  #ebe2d2;

  /* 文字与分割线 */
  --ink-strong: #2b2118;
  --ink:        #4a3f33;
  --ink-muted:  #8a7c6b;
  --line:       #e2d6c3;

  /* 唯一主强调色：黄铜金 */
  --accent:     #a8742a;
  --accent-hv:  #8f6120;
  --accent-soft: rgba(168, 116, 42, 0.11);
  --accent-ink: #ffffff;

  /* 稀有度色（仅用于色条、稀有度文字、图标光晕） */
  --r-common:    #8c8c8c;
  --r-uncommon:  #3e8e4f;
  --r-rare:      #2f6db5;
  --r-veryrare:  #7b4bb7;
  --r-legendary: #c9731f;
  --r-artifact:  #b23a3a;

  --danger:      #b23a3a;
  --danger-soft: rgba(178, 58, 58, 0.09);

  /* 字体与圆角与阴影 */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-sans:  "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  --radius-card: 12px;
  --radius-btn:  8px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(43, 33, 24, 0.06), 0 4px 12px rgba(43, 33, 24, 0.06);
  --shadow-lift: 0 8px 24px rgba(43, 33, 24, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: clip;
  background-color: var(--bg-page);
  background-image: radial-gradient(rgba(43, 33, 24, 0.03) 1px, transparent 0);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.tnum { font-variant-numeric: tabular-nums; }

/* DM Mode Thin 4px Top Strip (Only rendered on dm.html) */
.dm-top-strip {
  position: fixed; top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent); z-index: 200;
}
body.is-dm-page { padding-top: 4px; }

/* ===== COMPACT STICKY HEADER (<= 96px on desktop) ===== */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
body.is-dm-page .site-header { top: 4px; }

.header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
}

.status-bar {
  height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand-compact {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-star { color: var(--accent); font-size: 15px; flex-shrink: 0; }
.brand-phase {
  font-family: var(--font-sans); font-size: 12px; font-weight: 500; color: var(--ink-muted);
}

.status-metrics { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.metric-item { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 700; color: var(--ink-strong); }
.metric-gold { color: var(--accent); }
.heat-pips { display: inline-flex; gap: 3px; align-items: center; }
.heat-pip { width: 8px; height: 8px; transform: rotate(45deg); border: 1.5px solid var(--line); background: var(--bg-card); }
.heat-pip.on { background: var(--danger); border-color: var(--danger); }

.desktop-nav {
  height: 44px; display: flex; align-items: stretch; gap: 28px;
  border-top: 1px solid rgba(226, 214, 195, 0.65);
}
.nav-tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: var(--ink-muted);
  position: relative; padding: 0 4px; display: inline-flex; align-items: center; gap: 6px;
  transition: color 150ms;
}
.nav-tab:hover { color: var(--ink-strong); }
.nav-tab.active { color: var(--ink-strong); }
.nav-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--accent); border-radius: 3px 3px 0 0;
}

/* Mobile Bottom Tab Bar (4 tabs) */
.mobile-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; height: 58px; z-index: 45;
  background: var(--bg-card); border-top: 1px solid var(--line);
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mnav-btn {
  appearance: none; border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-muted); font-size: 12px; font-weight: 600;
}
.mnav-btn svg { width: 20px; height: 20px; }
.mnav-btn.active { color: var(--accent); }
.mobile-nav.with-battle { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.battle-nav-link { text-decoration: none; color: #865817; }

/* ===== MAIN SHELL ===== */
.page-main {
  max-width: 1280px; margin: 0 auto; padding: 24px 20px 104px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.btn-primary {
  appearance: none; border: none; background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius-btn); padding: 10px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 150ms; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:hover { background: var(--accent-hv); }
.btn-outline {
  appearance: none; border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-strong);
  border-radius: var(--radius-btn); padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color 150ms, background 150ms;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-outline:hover { border-color: var(--accent); background: #fffbf2; }
.btn-ghost {
  appearance: none; border: none; background: transparent; color: var(--accent);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-btn);
}
.btn-ghost:hover { background: var(--accent-soft); }

/* ===== SHOP SHOWCASE HOME ===== */
.shop-search-hero {
  position: relative; margin-bottom: 24px;
}
.shop-search-hero input {
  width: 100%; height: 46px; padding: 0 16px 0 42px;
  border-radius: var(--radius-btn); border: 1px solid var(--line);
  background: var(--bg-card); color: var(--ink-strong); font-size: 15px;
  box-shadow: var(--shadow-card); outline: none;
}
.shop-search-hero input:focus { border-color: var(--accent); }
.search-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-muted); pointer-events: none;
}

.shelf-block { margin-bottom: 28px; }
.shelf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.shelf-title {
  font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--ink-strong);
  line-height: 1.3; display: flex; align-items: center; gap: 8px;
}
.shelf-title .star { color: var(--accent); }

.char-switcher {
  display: inline-flex; background: var(--bg-sunken); padding: 3px;
  border-radius: var(--radius-btn); gap: 2px;
}
.char-pill {
  appearance: none; border: none; background: transparent; color: var(--ink-muted);
  padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 150ms;
}
.char-pill.active {
  background: var(--bg-card); color: var(--ink-strong);
  box-shadow: 0 1px 3px rgba(43, 33, 24, 0.12);
}

/* Horizontal Scroll Track for Showcase */
.h-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(276px, 310px);
  gap: 16px; overflow-x: auto; padding: 4px 2px 10px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.h-track.rec-track { grid-auto-columns: minmax(292px, 1fr); }
.h-track::-webkit-scrollbar { height: 6px; }
.h-track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

.browse-all-wrap {
  text-align: center; padding: 12px 0 8px;
}
.browse-all-btn {
  padding: 13px 32px; font-size: 15px; border-radius: var(--radius-btn);
  box-shadow: var(--shadow-card);
}

/* ===== ALL-ITEMS SECONDARY VIEW (Single-row Compact Toolbar) ===== */
.catalog-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.catalog-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.tool-search {
  flex: 1; min-width: 180px; height: 40px; padding: 0 12px;
  border-radius: var(--radius-btn); border: 1px solid var(--line);
  background: var(--bg-card); color: var(--ink-strong); font-size: 14px; outline: none;
}
.tool-search:focus { border-color: var(--accent); }
.tool-select {
  height: 40px; padding: 0 10px; border-radius: var(--radius-btn);
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-strong);
  font-size: 14px; cursor: pointer;
}
.tool-btn {
  height: 40px; padding: 0 12px; border-radius: var(--radius-btn);
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink-strong);
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.tool-btn.has-filters { border-color: var(--accent); color: var(--accent); }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-btn); overflow: hidden; }
.view-toggle button {
  height: 38px; width: 38px; border: none; background: var(--bg-card); color: var(--ink-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.view-toggle button.active { background: var(--bg-sunken); color: var(--ink-strong); }

.active-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px;
}
.active-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--ink-strong); font-size: 12px; font-weight: 600;
}
.active-chip button {
  border: none; background: transparent; color: var(--ink-muted); cursor: pointer; font-size: 13px; line-height: 1;
}
.catalog-count { font-size: 13px; color: var(--ink-muted); margin-left: auto; }

/* ===== PRODUCT CARD (Exact Section 6 Spec!) ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
}

.item-card {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--card-rar, var(--r-common));
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  scroll-snap-align: start;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

/* Rarity variable bindings */
.rar-common    { --card-rar: var(--r-common);    --card-glow: rgba(140, 140, 140, 0.12); }
.rar-uncommon  { --card-rar: var(--r-uncommon);  --card-glow: rgba(62, 142, 79, 0.12); }
.rar-rare      { --card-rar: var(--r-rare);      --card-glow: rgba(47, 109, 181, 0.12); }
.rar-veryrare  { --card-rar: var(--r-veryrare);  --card-glow: rgba(123, 75, 183, 0.13); }
.rar-legendary { --card-rar: var(--r-legendary); --card-glow: rgba(201, 115, 31, 0.14); }
.rar-artifact  { --card-rar: var(--r-artifact);  --card-glow: rgba(178, 58, 58, 0.13); }

/* DM Locked High-Tier Preview (NO dashed borders!) */
.item-card.is-locked {
  filter: saturate(0.35);
  opacity: 0.68;
}
.lock-corner {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; font-weight: 700; color: var(--ink-muted);
  background: var(--bg-sunken); padding: 2px 8px; border-radius: var(--radius-pill);
}

/* Quick Add "+" Icon (hover on desktop, subtle top-right) */
.quick-plus {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--accent);
  font-size: 17px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 150ms, background 150ms;
  z-index: 2;
}
.item-card:hover .quick-plus, .quick-plus.in-cart { opacity: 1; }
.quick-plus:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.quick-plus.in-cart { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 12px; }

/* DM Card Hover "⋯" Trigger */
.dm-card-more {
  position: absolute; top: 10px; right: 44px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
  font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 150ms; z-index: 3;
}
.item-card:hover .dm-card-more, .dm-hover-card:hover .dm-card-more { opacity: 1; }

.card-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-right: 26px;
}
.card-icon {
  width: 56px; height: 56px; border-radius: 10px; flex-shrink: 0;
  background: var(--card-glow, rgba(140, 140, 140, 0.1));
  color: var(--card-rar, var(--r-common));
  display: flex; align-items: center; justify-content: center;
}
.card-icon svg { width: 32px; height: 32px; }

.card-titles { min-width: 0; }
.card-name {
  font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink-strong);
  line-height: 1.3; margin-bottom: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub {
  font-size: 12px; font-weight: 600; color: var(--ink-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub .rar-txt { color: var(--card-rar, var(--r-common)); }

.card-oneliner {
  font-size: 15px; color: var(--ink); line-height: 1.5; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 44px;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 10px; border-top: 1px solid rgba(226, 214, 195, 0.7);
}
.card-who { font-size: 13px; color: var(--ink-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price {
  font-size: 17px; font-weight: 700; color: var(--accent); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-price.unaffordable { color: var(--ink-muted); }

/* List View Mode */
.shop-list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  position: relative;
  display: grid; grid-template-columns: 40px minmax(140px, 1.1fr) 2fr auto auto;
  align-items: center; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-left: 3px solid var(--card-rar, var(--r-common));
  border-radius: var(--radius-btn); padding: 10px 14px; cursor: pointer;
}
.list-row:hover { box-shadow: var(--shadow-card); }
.list-row.is-locked { filter: saturate(0.35); opacity: 0.68; }
.list-ico {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--card-glow); color: var(--card-rar);
  display: flex; align-items: center; justify-content: center;
}
.list-ico svg { width: 22px; height: 22px; }

/* DM High-Tier Separate Section */
.dm-locked-section {
  margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line);
}
.dm-locked-title {
  font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink-muted);
  margin-bottom: 14px;
}

/* ===== SLIDE-OVER / BOTTOM-SHEET DRAWERS (Detail & Filters) ===== */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(43, 33, 24, 0.44);
  z-index: 100; display: none; justify-content: flex-end;
}
.drawer-mask.open { display: flex; }
.drawer-panel {
  width: min(100vw, 420px); height: 100%; background: var(--bg-card);
  box-shadow: var(--shadow-lift); display: flex; flex-direction: column;
  animation: slideInRight 160ms ease;
}
@keyframes slideInRight { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.drawer-close {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg-page); color: var(--ink-strong); font-size: 16px; cursor: pointer;
}
.drawer-body {
  flex: 1; overflow-y: auto; padding: 20px;
}
.drawer-foot {
  padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-card);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}

.detail-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.detail-icon {
  width: 96px; height: 96px; border-radius: 14px; flex-shrink: 0;
  background: var(--card-glow); color: var(--card-rar);
  display: flex; align-items: center; justify-content: center;
}
.detail-icon svg { width: 54px; height: 54px; }
.detail-name { font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--ink-strong); line-height: 1.3; }
.detail-rar { font-size: 13px; font-weight: 700; color: var(--card-rar); margin-top: 4px; }

.detail-meta-row {
  display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 12px;
  background: var(--bg-sunken); border-radius: var(--radius-btn);
  font-size: 13px; color: var(--ink); margin-bottom: 16px;
}
.detail-meta-row strong { color: var(--ink-strong); }
.detail-oneliner {
  font-size: 17px; font-weight: 600; color: var(--ink-strong); line-height: 1.5; margin-bottom: 16px;
}
.detail-why {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 12px 14px; margin-bottom: 16px;
}
.detail-why-head { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.detail-why p { font-size: 14px; color: var(--ink-strong); }

.detail-rules {
  border: 1px solid var(--line); border-radius: var(--radius-btn); margin-bottom: 14px;
}
.detail-rules summary {
  padding: 11px 14px; font-weight: 600; color: var(--ink-strong); cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.detail-rules summary::after { content: "▾"; color: var(--ink-muted); }
.detail-rules[open] summary::after { content: "▴"; }
.detail-rules-body {
  padding: 0 14px 14px; font-size: 14px; color: var(--ink); white-space: pre-line;
  border-top: 1px solid var(--line); padding-top: 12px;
}
.detail-source { font-size: 12px; color: var(--ink-muted); }

/* Filter Drawer Controls */
.fg-group { margin-bottom: 20px; }
.fg-label { font-size: 13px; font-weight: 700; color: var(--ink-strong); margin-bottom: 8px; display: block; }
.fg-options { display: flex; flex-wrap: wrap; gap: 8px; }
.fg-opt {
  appearance: none; border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
  padding: 6px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; cursor: pointer;
}
.fg-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ===== FLOATING CART BAR (P2) ===== */
.cart-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(94vw, 760px); z-index: 50;
  background: var(--ink-strong); color: #fffdf8;
  border-radius: var(--radius-card); padding: 12px 16px;
  box-shadow: var(--shadow-lift);
  display: none; align-items: center; justify-content: space-between; gap: 12px;
}
.cart-bar.visible { display: flex; }
.cart-text { font-size: 14px; }
.cart-text strong { color: #f2cf88; font-variant-numeric: tabular-nums; }
.cart-text .over { color: #ff8e85; }
.cart-acts { display: flex; gap: 8px; flex-shrink: 0; }
.cart-copy-btn {
  appearance: none; border: none; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: var(--radius-btn); font-size: 13px; font-weight: 700; cursor: pointer;
}
.cart-ghost-btn {
  appearance: none; border: 1px solid rgba(255,255,255,0.28); background: transparent; color: #f3ece0;
  padding: 8px 12px; border-radius: var(--radius-btn); font-size: 13px; font-weight: 600; cursor: pointer;
}

/* ===== INFO BOARD TAB ===== */
.board-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.board-hero h1 { font-family: var(--font-serif); font-size: 28px; font-weight: 600; color: var(--ink-strong); line-height: 1.3; }
.board-hero-sub { font-size: 14px; color: var(--ink-muted); margin-top: 2px; }

.tldr-card {
  background: var(--bg-card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius-card); padding: 16px 18px; margin-bottom: 24px; box-shadow: var(--shadow-card);
}
.tldr-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; color: var(--ink-strong); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.tldr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; list-style: none; }
.tldr-grid li {
  background: var(--bg-page); border-radius: var(--radius-btn); padding: 10px 12px;
  font-size: 14px; color: var(--ink-strong); font-weight: 500;
}
.tldr-idx { font-weight: 700; color: var(--accent); margin-right: 6px; }

.b-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 24px 0 12px;
}
.b-sec-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--ink-strong); }

.b-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.b-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.b-grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 20px; }

.b-card {
  position: relative; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 16px; box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform 150ms, box-shadow 150ms;
}
.b-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.b-card.is-new { background: linear-gradient(180deg, #fffdf4, #fbf5e6); border-color: rgba(168, 116, 42, 0.45); }

.new-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(168, 116, 42, 0.35);
  padding: 0 7px; border-radius: var(--radius-pill); margin-left: 6px; vertical-align: middle;
}
.b-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.b-card-name { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--ink-strong); line-height: 1.3; }
.b-status { font-size: 12px; font-weight: 600; color: var(--ink-muted); white-space: nowrap; }
.b-status.accent { color: var(--accent); }
.b-status.danger { color: var(--danger); }

.b-face {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg-sunken); border-radius: var(--radius-btn);
  margin: 10px 0; font-size: 13px;
}
.b-bullets { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.b-bullets li { font-size: 14px; color: var(--ink); padding-left: 14px; position: relative; }
.b-bullets li::before { content: "·"; position: absolute; left: 2px; font-weight: 800; color: var(--accent); }
.b-expand {
  display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-muted);
}
.b-card.open .b-expand { display: block; }

.b-panel {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 18px; box-shadow: var(--shadow-card);
}
.b-slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.b-slot {
  position: relative; padding: 11px 12px; border-radius: var(--radius-btn);
  background: var(--bg-page); border: 1px solid var(--line); cursor: pointer;
}
.b-slot.is-new { background: #fbf4e2; border-color: rgba(168, 116, 42, 0.45); }
.b-slot-name { font-weight: 700; color: var(--ink-strong); font-size: 14px; }
.b-slot-sub { font-size: 12.5px; color: var(--ink-muted); }

.b-collapse {
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px;
}
.b-collapse summary {
  font-size: 14px; font-weight: 700; color: var(--ink-strong); cursor: pointer;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.b-collapse summary::after { content: "▾"; color: var(--ink-muted); }
.b-collapse[open] summary::after { content: "▴"; }
.b-chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.b-chip {
  font-size: 14px; color: var(--ink); background: var(--bg-page);
  border: 1px solid var(--line); padding: 4px 10px; border-radius: var(--radius-btn);
}

.b-quests { display: flex; flex-direction: column; gap: 10px; }
.b-quest {
  position: relative; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-btn);
  background: var(--bg-page); border: 1px solid var(--line); border-left: 3px solid var(--accent);
}
.b-quest.urgent { border-left-color: var(--danger); }
.b-quest-title { font-size: 15px; font-weight: 700; color: var(--ink-strong); }
.b-quest-sub { font-size: 13.5px; color: var(--ink-muted); margin-top: 2px; }

/* ===== CHEATSHEET TAB (P2) ===== */
.cs-notices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cs-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-btn); padding: 10px 14px; font-size: 14px;
}
.cs-notice-close {
  border: none; background: transparent; color: var(--ink-muted); font-size: 16px; cursor: pointer; padding: 2px 6px;
}

.cs-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.cs-avatars { display: flex; gap: 8px; flex-wrap: wrap; }
.cs-av-btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-card); color: var(--ink);
  padding: 7px 14px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.cs-av-btn.active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.cs-av-dot { width: 22px; height: 22px; border-radius: 50%; background: rgba(43,33,24,0.12); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.cs-av-btn.active .cs-av-dot { background: rgba(255,255,255,0.22); }

.cs-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cs-grid.single-focus { grid-template-columns: minmax(0, 680px); justify-content: center; }
.pc-card {
  position: relative; background: var(--bg-card); border: 1px solid var(--line);
  border-top: 3px solid var(--accent); border-radius: var(--radius-card);
  padding: 18px; box-shadow: var(--shadow-card);
}
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.pc-name { font-family: var(--font-serif); font-size: 22px; font-weight: 600; color: var(--ink-strong); line-height: 1.3; }
.pc-cls { font-size: 13px; color: var(--ink-muted); }

/* Prominent 28px HP & AC */
.pc-vitals {
  display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 10px; margin-bottom: 14px;
}
.vital-big {
  background: var(--bg-page); border: 1px solid var(--line); border-radius: var(--radius-btn);
  padding: 10px 12px; text-align: center;
}
.vital-big-k { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.vital-big-v { font-size: 28px; font-weight: 700; color: var(--ink-strong); line-height: 1.15; font-variant-numeric: tabular-nums; }
.vital-big-note { font-size: 11px; color: var(--ink-muted); }

.vital-subs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
}
.vital-sub {
  background: var(--bg-sunken); border-radius: 6px; padding: 6px 8px;
  display: flex; flex-direction: column; justify-content: center;
}
.vital-sub-k { font-size: 11px; color: var(--ink-muted); }
.vital-sub-v { font-size: 13.5px; font-weight: 700; color: var(--ink-strong); }

/* Local combat tracker: scoped to the cheatsheet, never styled as a DM edit panel. */
.cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pc-card { min-width: 0; }
.pc-card.is-concentrating {
  border-top-color: #74519d;
  box-shadow: inset 0 2px 0 #cfab61, var(--shadow-card);
}
.pc-tracker {
  margin: 0 0 14px; border: 1px solid #ceba91; border-radius: 10px;
  background: #f6ecd5; color: #38291e; min-width: 0;
  font-size: .875rem; line-height: 1.35;
}
.pc-tracker summary {
  list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px;
  padding: 5px 10px; min-height: 36px; cursor: pointer;
}
.pc-tracker summary::-webkit-details-marker { display: none; }
.pc-tracker summary::after { content: "▸"; color: #675139; margin-inline-start: auto; }
.pc-tracker[open] summary::after { content: "▾"; }
.tracker-summary-state { color: #68513a; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.is-concentrating .tracker-summary-state { color: #64408b; font-weight: 700; }
.tracker-body { border-top: 1px solid #dbc9a7; padding: 8px; display: grid; gap: 8px; min-width: 0; }
.tracker-health { display: grid; gap: 6px; min-width: 0; }
.tracker-hp-top, .tracker-conc, .tracker-rest, .tracker-inline, .tracker-extra, .tracker-pet {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
}
.tracker-hp-top { justify-content: space-between; }
.tracker-hp-top strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.tracker-hp-top small { font-weight: 500; }
.tracker-btn, .tracker-pip {
  min-width: 34px; min-height: 34px; border: 1px solid #bdab85; border-radius: 6px;
  appearance: none; background: #fffbef; color: #43301e; cursor: pointer;
  font: inherit; font-weight: 700; padding: 3px 7px; touch-action: manipulation;
}
.tracker-btn:hover, .tracker-pip:hover { background: #eee0bc; }
.pc-tracker :is(button,input,summary):focus-visible { outline: 2px solid #74519d; outline-offset: 2px; }
.tracker-btn:disabled { opacity: .55; cursor: default; }
.tracker-btn[data-track="edit-temp"] { color: #21557a; background: #e2f0f7; border-color: #8caac0; }
.tracker-btn[data-track="hp"][data-n^="-"] { color: #812c35; }
.tracker-btn[data-track="hp"]:not([data-n^="-"]) { color: #265d42; }
.tracker-hp-keys { display: grid; grid-template-columns: repeat(6, minmax(34px, 1fr)); gap: 4px; }
.tracker-hp-keys .tracker-btn { padding-inline: 1px; }
.tracker-hp-meter { height: 7px; border-radius: 10px; background: #dfd2b7; overflow: hidden; }
.tracker-hp-meter span { display: block; height: 100%; border-radius: inherit; background: #397451; }
.tracker-hp-meter span[data-band="mid"] { background: #a36a19; }
.tracker-hp-meter span[data-band="low"] { background: #8e2837; }
.tracker-conc [aria-checked="true"] { background: #efe2f6; color: #57367d; border-color: #9772ae; }
.tracker-body input {
  min-width: 0; min-height: 34px; font: inherit; border: 1px solid #bdab85;
  border-radius: 6px; background: #fffbef; color: #38291e; padding: 4px 7px;
}
.tracker-conc .tracker-spell { flex: 1 1 125px; }
.tracker-inline {
  padding: 5px; border: 1px solid #dbc9a7; background: #fff7e4; border-radius: 6px;
}
.tracker-inline label { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tracker-inline input[type="number"] { width: 5.2rem; }
.tracker-ledger { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.tracker-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px;
  min-width: 0; padding: 1px 6px; border: 1px solid #ded0b2; border-radius: 6px; background: #fff9e9;
}
.tracker-row.is-pact { border-color: #ae8b55; background: #f2e7f7; }
.tracker-row-head { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; column-gap: 5px; padding-block: 3px; }
.tracker-row-head > span { overflow-wrap: anywhere; }
.tracker-row-head > strong { margin-inline-start: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tracker-tag { border-radius: 3px; padding: 0 4px; color: #60462b; background: #eee0c3; font-size: .75rem; }
.tracker-row.is-pact .tracker-tag { color: #59317a; background: #ead7f2; }
.tracker-pips { display: flex; flex-wrap: wrap; align-items: center; }
.tracker-pip { min-width: 28px; padding: 0; border-color: transparent; background: transparent; display: grid; place-items: center; }
.tracker-pip span { width: 15px; height: 15px; border: 2px solid #8e6229; border-radius: 50%; background: transparent; }
.tracker-pip[aria-pressed="true"] span { background: #a7752d; box-shadow: inset 0 0 0 2px #fbecbd66; }
.tracker-row.is-pact .tracker-pip span { border-color: #765391; }
.tracker-row.is-pact .tracker-pip[aria-pressed="true"] span { background: #765391; }
.tracker-extra small, .tracker-muted { color: #68513a; font-size: .8125rem; }
.tracker-pet span { flex: 1 1 auto; }
.tracker-pet-meter { flex: 1 1 100%; height: 6px; accent-color: #397451; }
.tracker-pet, .tracker-rest { border-top: 1px solid #deccaa; padding-top: 6px; }
.tracker-rest [data-track="reset"] { margin-inline-start: auto; background: transparent; border-color: transparent; font-size: .8125rem; }
.tracker-rest [data-confirm="true"] { background: #f6dcae; border-color: #9a662c; color: #5a351a; }

.eco-block { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.eco-row { display: flex; align-items: flex-start; gap: 10px; }
.eco-lbl {
  width: 44px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); text-align: center; padding: 4px 0; border-radius: 6px;
}
.eco-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.eco-chip {
  font-size: 13.5px; color: var(--ink-strong); background: var(--bg-page);
  border: 1px solid var(--line); padding: 3px 9px; border-radius: 6px;
}
.eco-more-btn {
  border: none; background: transparent; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 3px 4px;
}

.pc-tips-details {
  border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px;
}
.pc-tips-details summary {
  font-size: 14px; font-weight: 600; color: var(--ink-strong); cursor: pointer; list-style: none;
  display: flex; justify-content: space-between;
}
.pc-tips-details summary::after { content: "▾"; color: var(--ink-muted); }
.pc-tips-details[open] summary::after { content: "▴"; }
.pc-tips-list { list-style: none; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.pc-tips-list li { font-size: 14px; color: var(--ink); padding-left: 14px; position: relative; }
.pc-tips-list li::before { content: "·"; position: absolute; left: 2px; font-weight: 800; color: var(--accent); }

/* ===== SPELLS COMPENDIUM TAB ===== */
.sp-quick-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-bottom: 12px; max-width: 100%;
}
.sp-quick-bar .char-switcher { flex-wrap: wrap; max-width: 100%; }
.sp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.sp-card {
  background: var(--bg-card); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-card); padding: 14px 16px; box-shadow: var(--shadow-card);
  cursor: pointer; transition: transform 150ms, box-shadow 150ms; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
}
.sp-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.sp-card.is-mythos { border-left-color: var(--r-veryrare); background: linear-gradient(180deg, #fffdf9, #f7f3fb); }
.sp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sp-name { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--ink-strong); line-height: 1.3; }
.sp-en { font-size: 12px; color: var(--ink-muted); }
.sp-lv { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; }
.sp-meta { font-size: 12.5px; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.sp-sum { font-size: 14px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sp-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-muted); padding-top: 8px; border-top: 1px solid rgba(226,214,195,0.7); }

/* ===== DM FLOATING GEAR FAB & MENU (Only on dm.html) ===== */
.dm-fab-wrap { position: fixed; right: 20px; bottom: 84px; z-index: 70; }
.dm-fab {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--ink-strong); color: #fffdf8; font-size: 22px;
  box-shadow: var(--shadow-lift); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.dm-fab:hover { background: var(--accent); }
.dm-menu {
  position: absolute; right: 0; bottom: 62px; width: 240px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift); padding: 8px; display: none; flex-direction: column; gap: 4px;
}
.dm-menu.open { display: flex; }
.dm-menu-item {
  appearance: none; border: none; background: transparent; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-btn); font-size: 13.5px; font-weight: 600;
  color: var(--ink-strong); cursor: pointer; display: flex; align-items: center; justify-content: space-between;
}
.dm-menu-item:hover { background: var(--bg-page); }
.dm-menu-item.danger { color: var(--danger); }
.dm-menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* Modal & Editor Form */
.modal-mask {
  position: fixed; inset: 0; background: rgba(43, 33, 24, 0.5);
  z-index: 130; display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal-mask.open { display: flex; }
.modal-box {
  width: min(94vw, 620px); max-height: 86vh; overflow-y: auto;
  background: var(--bg-card); border-radius: var(--radius-card); padding: 20px;
  box-shadow: var(--shadow-lift); border: 1px solid var(--line);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--ink-strong); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.ef-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ef-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.ef-field.full { grid-column: 1 / -1; }
.ef-field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.ef-field input, .ef-field select, .ef-field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-btn);
  background: var(--bg-page); color: var(--ink-strong); font-family: inherit; font-size: 14px;
}
.ef-field textarea { min-height: 76px; resize: vertical; }
.ef-field textarea.tall { min-height: 140px; }

.site-footer {
  max-width: 1280px; margin: 24px auto 0; padding: 16px 20px 32px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 24px); overflow-wrap: anywhere;
  background: var(--ink-strong); color: #fffdf8; padding: 9px 18px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lift); display: none; z-index: 220;
}
.toast.show { display: block; }

/* ===== RESPONSIVE (Tablet & 375px Mobile Priority) ===== */
@media (max-width: 1024px) {
  .b-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .b-grid-3, .b-grid-2, .tldr-grid, .cs-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .header-inner { padding: 0 12px; }
  .desktop-nav { display: none; }
  .mobile-nav { display: grid; }
  .brand-phase { display: none; }
  .status-metrics { gap: 10px; }
  .metric-item { font-size: 13px; }

  .page-main { padding: 14px 12px 132px; max-width: 100vw; overflow-x: clip; }
  .shelf-title { font-size: 19px; }
  .h-track { grid-auto-columns: min(300px, calc(100% - 28px)); max-width: 100%; }
  .h-track.rec-track { grid-auto-columns: min(320px, calc(100% - 16px)); }
  .cs-av-btn { padding: 6px 10px; font-size: 13px; }

  .shop-grid, .sp-list { grid-template-columns: 1fr; }
  .catalog-toolbar { max-width: 100%; }
  .catalog-toolbar .tool-search { min-width: 0; width: 100%; flex-basis: 100%; }
  .catalog-toolbar .tool-select { max-width: 100%; }
  .b-grid-4, .b-slots, .ef-grid { grid-template-columns: 1fr; }
  .pc-vitals { grid-template-columns: 1fr 1fr; }
  .vital-subs { grid-column: 1 / -1; }

  .quick-plus { opacity: 0.9; }
  .dm-card-more { opacity: 0.9; }

  /* Mobile Bottom Sheet Drawers (85% screen height) */
  .drawer-mask { align-items: flex-end; justify-content: center; }
  .drawer-panel {
    width: 100vw; max-height: 85vh; height: auto;
    border-radius: 16px 16px 0 0; animation: slideInUp 170ms ease;
  }
  @keyframes slideInUp { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }

  /* Cart bar sits cleanly above mobile bottom tab bar */
  .cart-bar { bottom: 68px; width: 94vw; padding: 10px 12px; flex-wrap: wrap; }
  .dm-fab-wrap { bottom: 136px; right: 14px; }
  .list-row { grid-template-columns: 36px 1fr auto; }
  .list-row .list-desc, .list-row .list-who { display: none; }
}
.site-footer #dashboard-dm-entry:not([hidden]){display:inline-block;background:none;border:0;color:inherit;font:inherit;opacity:.72;cursor:pointer}
.dashboard-modal{color:var(--ink);background:var(--paper,#f4e7cb);border:1px solid #936b35;border-radius:12px;width:min(740px,94vw);max-height:90dvh;padding:16px;overflow:auto}
.dashboard-modal::backdrop{background:#160e0ac7}
.dashboard-modal header,.dashboard-actions{display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap}
.dashboard-modal h2{font-size:1.1rem;margin:0}
.dashboard-modal p[role=status]{margin:10px 0}
.dashboard-modal :is(form,label){display:grid;gap:5px}
.dashboard-modal :is(input:not([type=checkbox]),textarea,select){font:inherit;font-size:16px;min-width:0;width:100%;max-width:100%;border:1px solid #9e7b49;border-radius:5px;padding:6px;background:#fff9ea;color:#392519}
.dashboard-modal textarea{resize:vertical}
.dashboard-fields details{padding:9px 0;border-top:1px solid #a4804c66}
.dashboard-fields summary{cursor:pointer;font-weight:700}
.dashboard-fields fieldset{min-width:0;margin:7px 0;padding:8px;border:1px solid #a4804c66;border-radius:6px;display:grid;gap:6px}
.dashboard-fields label{margin:4px 0}
.dashboard-fields fieldset .btn{justify-self:start}
