/* ============================================================
   大肥鱼控制台 · 深色玻璃拟态主题
   ============================================================ */

:root {
  --bg: #080a11;
  --bg-soft: #0d1019;
  --panel: rgba(255, 255, 255, 0.038);
  --panel-strong: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eceffa;
  --text-dim: #a2a9c0;
  --text-mute: #6b7288;
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-grad: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  --sidebar-w: 234px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 背景光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(167, 139, 250, 0.18), transparent 60%),
    radial-gradient(760px 480px at 92% 8%, rgba(244, 114, 182, 0.14), transparent 62%),
    radial-gradient(700px 500px at 60% 108%, rgba(56, 189, 248, 0.08), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
}

/* ============================== 侧栏 ============================== */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 22px;
}

.logo {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 10px 26px -10px rgba(167, 139, 250, 0.9);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.brand-text p {
  font-size: 11.5px;
  color: var(--text-mute);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
  text-align: left;
}

.nav-item svg {
  width: 17px; height: 17px;
  flex: 0 0 17px;
  fill: currentColor;
  opacity: 0.75;
  transition: opacity 0.18s ease;
}

.nav-item:hover {
  background: var(--panel);
  color: var(--text);
  transform: translateX(2px);
}
.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: linear-gradient(90deg, rgba(167,139,250,0.20), rgba(244,114,182,0.08));
  color: #fff;
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-grad);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.9);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 12px 4px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-mute);
}

.live-dot {
  width: 7px; height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: background 0.3s;
}
.live-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ============================== 主区 ============================== */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 30px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 10, 17, 0.55);
  backdrop-filter: blur(14px);
}

.topbar-title h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
.topbar-title p {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 2px;
}

.pills { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: background 0.25s, box-shadow 0.25s;
}
.pill.on {
  border-color: rgba(52, 211, 153, 0.4);
  color: #c8f7e5;
  background: rgba(52, 211, 153, 0.09);
}
.pill.on .dot { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.pill.off {
  border-color: rgba(251, 113, 133, 0.35);
  color: #ffd0d8;
  background: rgba(251, 113, 133, 0.08);
}
.pill.off .dot { background: var(--err); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 30px 40px;
  scrollbar-gutter: stable;
}

/* 滚动条 */
.content::-webkit-scrollbar,
.nav::-webkit-scrollbar,
.console::-webkit-scrollbar { width: 9px; height: 9px; }
.content::-webkit-scrollbar-thumb,
.nav::-webkit-scrollbar-thumb,
.console::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.11);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); background-clip: content-box; }

/* ============================== 视图切换 ============================== */
.view { display: none; animation: fadeUp 0.28s ease both; }
.view.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}

/* ============================== Hero ============================== */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 30px 32px;
  margin-bottom: 22px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    radial-gradient(700px 260px at 0% 0%, rgba(167,139,250,0.20), transparent 62%),
    radial-gradient(520px 240px at 100% 100%, rgba(244,114,182,0.15), transparent 60%),
    rgba(255,255,255,0.032);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,0.05) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: sheen 7s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { transform: translateX(-120%); }
  75%, 100% { transform: translateX(120%); }
}

.tag {
  display: inline-block;
  padding: 4px 11px;
  margin-bottom: 13px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  color: #e9d5ff;
  background: rgba(167, 139, 250, 0.16);
  border: 1px solid rgba(167, 139, 250, 0.32);
}

.hero-text h3 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 7px;
  background: linear-gradient(120deg, #fff 20%, #c4b5fd 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-text p {
  color: var(--text-dim);
  font-size: 13.5px;
  max-width: 460px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.hero-orb {
  position: relative;
  width: 132px; height: 132px;
  flex: 0 0 132px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.18) inset,
    0 24px 60px -18px rgba(167,139,250,0.85);
  animation: float 6s ease-in-out infinite;
}
.hero-orb span {
  font-size: 46px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.hero-orb::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid rgba(167,139,250,0.32);
  animation: ripple 3.4s ease-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}
@keyframes ripple {
  0%   { transform: scale(0.94); opacity: 0.85; }
  100% { transform: scale(1.18); opacity: 0; }
}

/* ============================== 卡片 ============================== */
.card {
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head h4 {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: 0.2px;
}

.chip {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--panel-strong);
  border: 1px solid var(--border);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  align-items: start;
}

/* 统计卡 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 17px 19px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: var(--panel-strong);
}

.stat-label {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 7px;
}
.stat-value {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: linear-gradient(120deg, #fff, #b9a6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}
.stat-value.ok {
  background: linear-gradient(120deg, #d1fae5, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-value.warn {
  background: linear-gradient(120deg, #ffe4c4, #fb7185);
  -webkit-background-clip: text;
  background-clip: text;
}
.stat-sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-mute);
}

/* 键值行 */
.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.07);
  font-size: 13px;
}
.kv:last-of-type { border-bottom: 0; }
.kv span { color: var(--text-mute); }
.kv b { font-weight: 600; color: var(--text); text-align: right; word-break: break-all; }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.6;
}

/* 白名单位置 + 打开配置文件 */
.config-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.config-file-row .hint { margin: 0; flex: 1 1 240px; }
.config-file-row .btn { flex: 0 0 auto; }

/* ============================== 角色卡 ============================== */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.card-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.card-item:hover {
  border-color: var(--border-strong);
  background: var(--panel-strong);
  transform: translateY(-1px);
}
.card-item.current {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.10);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.12) inset;
}

.card-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}
.card-item-head b {
  font-size: 13.5px;
  font-weight: 620;
}
.card-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}
.card-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.card-current {
  font-size: 12px;
  color: var(--ok);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.10);
  border: 1px solid rgba(52, 211, 153, 0.32);
}
.chip.chip-on {
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.38);
  background: rgba(52, 211, 153, 0.12);
}

/* ---- 角色卡网格（新） ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}

.card-grid .empty { grid-column: 1 / -1; }

/* ---- 实体角色卡：正反两面 + 3D 翻牌 ---- */
.charcard {
  --cc: #7aa2f7;
  position: relative;
  height: 306px;
  perspective: 1200px;
  outline: none;
  cursor: pointer;
  transition: transform 0.22s ease;
}
.charcard:hover { transform: translateY(-4px); }
.charcard:focus-visible .charcard-face {
  box-shadow: 0 0 0 2px var(--cc), 0 22px 44px -24px rgba(0, 0, 0, 0.95);
}

.charcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.charcard.flipped .charcard-inner { transform: rotateY(180deg); }

.charcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06),
                                      rgba(255, 255, 255, 0.022));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06),
              0 12px 26px -22px rgba(0, 0, 0, 0.9);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}
.charcard:hover .charcard-face {
  border-color: color-mix(in srgb, var(--cc) 55%, var(--border));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
              0 26px 46px -24px rgba(0, 0, 0, 0.95);
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .charcard:hover .charcard-face { border-color: var(--cc); }
}
.charcard.current .charcard-face {
  border-color: var(--cc);
  box-shadow: inset 0 0 0 1px var(--cc),
              0 0 26px -8px var(--cc),
              0 18px 36px -24px rgba(0, 0, 0, 0.9);
}

.charcard-front { isolation: isolate; }
.charcard-front::before {
  content: "";
  position: absolute;
  right: -70px;
  top: -95px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--cc);
  opacity: 0.17;
  filter: blur(48px);
  pointer-events: none;
}
.charcard-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  background: linear-gradient(90deg, var(--cc),
              rgba(255, 255, 255, 0.2) 62%, transparent 96%);
}
.charcard-watermark {
  position: absolute;
  right: 0;
  bottom: -18px;
  font-size: 108px;
  line-height: 1;
  opacity: 0.13;
  transform: rotate(-8deg);
  pointer-events: none;
  user-select: none;
}
.cc-badges {
  position: absolute;
  top: 13px;
  right: 13px;
  display: flex;
  gap: 5px;
  z-index: 2;
}
.cc-badge {
  font-size: 10px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: rgba(10, 13, 22, 0.6);
  backdrop-filter: blur(5px);
}
.cc-badge-on {
  color: #06251a;
  font-weight: 700;
  border-color: transparent;
  background: var(--ok);
  box-shadow: 0 0 14px -2px rgba(52, 211, 153, 0.75);
}
.charcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0 10px;
  min-width: 0;
}
.charcard-emoji {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.18),
                                      rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18),
              0 8px 18px -12px var(--cc);
}
.charcard-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.charcard-tagline {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.6;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.charcard-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
  margin: 8px 0 10px;
}
.cc-tag {
  font-size: 10.5px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  color: #d3d8ea;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.cc-tag.muted { color: var(--text-mute); opacity: 0.7; }
.charcard-foot-hint {
  margin-top: auto;
  font-size: 10.5px;
  color: var(--text-mute);
  letter-spacing: 0.3px;
}

/* 背面 */
.charcard-back {
  transform: rotateY(180deg);
  cursor: default;
  background: linear-gradient(180deg, #171c2a, #0f131d);
}
.cc-back-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.cc-back-emoji {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}
.cc-back-title {
  font-size: 14.5px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-return {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.cc-return:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.cc-back-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.cc-back-body::-webkit-scrollbar { width: 4px; }
.cc-back-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
}
.cc-back-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.cc-back-row > span:first-child {
  flex: 0 0 56px;
  color: var(--text-mute);
}
.cc-back-row em { font-style: normal; color: var(--text-dim); }
.cc-back-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cc-back-tags .cc-tag { font-size: 9.5px; padding: 4px 7px; }
.cc-color-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.cc-back-text {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
}
.cc-back-text b,
.cc-back-openers b {
  color: var(--text);
  font-weight: 600;
  margin-right: 5px;
}
.cc-back-openers { font-size: 11px; color: var(--text-dim); }
.cc-back-openers ol { margin: 4px 0 0 16px; padding: 0; }
.cc-back-openers li { margin: 3px 0; line-height: 1.45; }
.cc-back-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cc-back-foot .card-current { font-size: 11px; }

/* 切换时：翻起、放大、推到前面 */
@keyframes cardSwitch {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(0deg) scale(1.06) translateY(-10px); }
  100% { transform: rotateY(0deg) scale(1.05) translateY(-6px); }
}
.charcard.switching { z-index: 6; }
.charcard.switching .charcard-inner {
  animation: cardSwitch 0.45s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
.charcard.switching .charcard-face {
  box-shadow: 0 30px 60px -22px var(--cc),
              0 0 0 1px var(--cc);
}

@media (prefers-reduced-motion: reduce) {
  .charcard,
  .charcard-inner,
  .charcard-face { transition: none; }
  .charcard:hover { transform: none; }
  .charcard.switching .charcard-inner { animation: none; }
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
  border-radius: 8px;
  gap: 4px;
}

/* ====================== 塔罗牌堆（Deck） ====================== */
.deck-stage {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 14px 0 8px;
  min-height: 540px;
  overflow: hidden;
}
.deck {
  position: relative;
  width: min(100%, 1180px);
  height: 534px;
  transition: height 0.42s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.deck:not(.ready) .deck-card { transition: none; }
.deck.busy { pointer-events: none; }

.deck-card {
  --cc: #7aa2f7;
  position: absolute;
  left: 50%;
  top: 0;
  width: 320px;
  height: 460px;
  perspective: 1400px;
  transform:
    translate(calc(-50% + var(--x, 0px)), var(--y, 0px))
    rotate(var(--r, 0deg)) scale(var(--s, 1));
  transform-origin: 50% 12%;
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1) var(--d, 0ms),
    opacity 0.32s ease var(--d, 0ms);
  will-change: transform;
  outline: none;
  z-index: 10;
}
.deck-card.is-preview { cursor: pointer; }
.deck-card:focus-visible .deck-front {
  box-shadow: 0 0 0 2px var(--cc),
              0 24px 48px -26px rgba(0, 0, 0, 0.95);
}
.deck-card.is-preview:hover .deck-front {
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
              0 30px 54px -26px rgba(0, 0, 0, 0.98);
}

.deck-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.deck-card.detail-flipped .deck-card-inner { transform: rotateY(180deg); }

.deck-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07),
                                      rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07),
              0 18px 34px -26px rgba(0, 0, 0, 0.95);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

/* 正面 */
.deck-front {
  isolation: isolate;
  background:
    radial-gradient(240px 210px at 82% 6%, rgba(255, 255, 255, 0.06), transparent 62%),
    linear-gradient(180deg, #1b2233 0%, #10141e 100%);
}
.deck-front::before {
  content: "";
  position: absolute;
  right: -60px;
  top: -100px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--cc);
  opacity: 0.2;
  filter: blur(52px);
  pointer-events: none;
}

/* 塔罗牌面：只取塔罗图上 60% 的立绘区做背景，下半文字交给 HTML */
.deck-front.has-tarot { justify-content: flex-end; }
.deck-front.has-tarot::before { display: none; }
.deck-tarot-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64%;
  overflow: hidden;
  z-index: 0;
  background: #0d1018;
}
.deck-tarot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  display: block;
  transform: translateY(-2.65%);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.deck-card.is-preview:hover .deck-tarot { transform: translateY(-2.65%) scale(1.035); }
.deck-tarot-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 10, 16, 0.14) 0%,
                    rgba(8, 10, 16, 0.02) 34%,
                    rgba(8, 10, 16, 0.10) 58%,
                    rgba(13, 16, 24, 0.94) 100%),
    linear-gradient(90deg, rgba(8, 10, 16, 0.30) 0%,
                    transparent 22%, transparent 78%,
                    rgba(8, 10, 16, 0.30) 100%);
}
.deck-tarot-frame::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent,
              rgba(212, 175, 55, 0.55), transparent);
}
.deck-front.has-tarot .deck-band { z-index: 2; opacity: 0.72; }
.deck-front.has-tarot .deck-watermark { display: none; }
.deck-front.has-tarot .deck-arcana,
.deck-front.has-tarot .deck-head,
.deck-front.has-tarot .deck-tagline,
.deck-front.has-tarot .deck-tags,
.deck-front.has-tarot .deck-front-foot { position: relative; z-index: 1; }
.deck-front.has-tarot .deck-arcana {
  position: absolute;
  top: 12px;
  left: 14px;
  z-index: 3;
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.58);
  border: 1px solid rgba(212, 175, 55, 0.38);
  backdrop-filter: blur(5px);
}
.deck-arcana {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: #e8cf85;
  margin: 0 0 6px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}
.deck-front.has-tarot .deck-head { margin: 0 0 8px; }
.deck-front.has-tarot .deck-name { font-size: 20px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95); }
.deck-front.has-tarot .deck-tagline {
  min-height: 0;
  -webkit-line-clamp: 1;
  color: #efe6cf;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
}
.deck-front.has-tarot .deck-tags { margin: 9px 0 6px; }
.deck-front.has-tarot .cc-tag {
  background: rgba(12, 12, 18, 0.58);
  border-color: rgba(212, 175, 55, 0.28);
}
.deck-front.has-tarot .deck-front-foot { margin-top: 0; justify-content: flex-start; }
.deck-front.has-tarot .deck-hint { color: rgba(232, 225, 208, 0.62); }
.cc-badge-tarot {
  color: #f0d98a;
  border-color: rgba(212, 175, 55, 0.65);
  background: rgba(38, 30, 8, 0.72);
}
.deck-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 7px;
  background: linear-gradient(90deg, var(--cc),
              rgba(255, 255, 255, 0.22) 62%, transparent 96%);
}
.deck-watermark {
  position: absolute;
  right: -4px;
  bottom: -22px;
  font-size: 132px;
  line-height: 1;
  opacity: 0.12;
  transform: rotate(-8deg);
  pointer-events: none;
  user-select: none;
}
.deck-badges {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 5px;
  z-index: 2;
}
.deck-detail {
  position: absolute;
  top: 45px;
  right: 14px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 22, 0.55);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.deck-detail:hover { color: #fff; border-color: var(--cc); }
.deck-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  min-width: 0;
}
.deck-emoji {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  border-radius: 15px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.18),
                                      rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18),
              0 10px 22px -14px var(--cc);
}
.deck-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-tagline {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  min-height: 42px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deck-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 10px;
}
.deck-front-foot {
  margin-top: auto;
  display: flex;
  justify-content: center;
}
.deck-use { width: 100%; padding: 9px 12px; font-size: 12.5px; }
.deck-use.is-current { opacity: 0.75; }

/* 牌背（牌堆里只露背面） */
.deck-cover {
  background:
    radial-gradient(220px 220px at 76% 16%, rgba(255, 255, 255, 0.1), transparent 62%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 2px,
                              transparent 2px 11px),
    linear-gradient(160deg, #1c2231, #0d1018 72%);
  border-color: rgba(255, 255, 255, 0.15);
  align-items: center;
  justify-content: center;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease;
}
.deck-card.is-stacked .deck-cover { opacity: 1; visibility: visible; }
.deck-card.is-stacked .deck-front { visibility: hidden; }
.deck-cover-mark {
  font-size: 64px;
  color: rgba(255, 255, 255, 0.22);
  line-height: 1;
}
.deck-cover-ring {
  position: absolute;
  inset: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.04);
}
.deck-cover-word {
  position: absolute;
  bottom: 22px;
  font-size: 9px;
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.28);
}

/* 使用中 / 主设 */
.deck-card.is-current .deck-front,
.deck-card.is-current .deck-cover {
  border-color: var(--cc);
  box-shadow: inset 0 0 0 1px var(--cc),
              0 0 34px -9px var(--cc),
              0 20px 40px -26px rgba(0, 0, 0, 0.95);
}

/* 背面详情 */
.deck-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #171c2a, #0f131d);
  cursor: default;
}
.deck-back-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}
.deck-back-emoji {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
}
.deck-back-title {
  font-size: 15px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deck-return {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.deck-return:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.deck-back-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.deck-back-body::-webkit-scrollbar { width: 4px; }
.deck-back-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 2px;
}

/* 发牌动画：向左滑出并翻面 / 下一张翻上来 */
@keyframes dealOutNext {
  0% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% - 150px), 12px) rotateY(-180deg) scale(0.86); opacity: 0; }
}
@keyframes dealInNext {
  0% { transform: translate(-50%, 30px) rotateY(180deg) scale(0.94); opacity: 0; }
  60% { opacity: 1; }
  78% { transform: translate(-50%, -12px) rotateY(0deg) scale(1.02); opacity: 1; }
  100% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
}
@keyframes dealOutPrev {
  0% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + 150px), 12px) rotateY(180deg) scale(0.86); opacity: 0; }
}
@keyframes dealInPrev {
  0% { transform: translate(-50%, -26px) rotateY(-180deg) scale(0.94); opacity: 0; }
  60% { opacity: 1; }
  78% { transform: translate(-50%, -8px) rotateY(0deg) scale(1.02); opacity: 1; }
  100% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
}
.deck-card.deal-out-next {
  animation: dealOutNext 0.46s cubic-bezier(0.4, 0, 0.6, 1) both;
  z-index: 120 !important;
}
.deck-card.deal-in-next {
  animation: dealInNext 0.46s cubic-bezier(0.2, 0.8, 0.25, 1) both;
  z-index: 121 !important;
}
.deck-card.deal-out-prev {
  animation: dealOutPrev 0.46s cubic-bezier(0.4, 0, 0.6, 1) both;
  z-index: 120 !important;
}
.deck-card.deal-in-prev {
  animation: dealInPrev 0.46s cubic-bezier(0.2, 0.8, 0.25, 1) both;
  z-index: 121 !important;
}

/* 真正启用时的「翻起推到前面」 */
@keyframes cardActivate {
  0% { transform: translate(-50%, 0) rotateY(0deg) scale(1); }
  45% { transform: translate(-50%, -16px) rotateY(180deg) scale(1.05); }
  100% { transform: translate(-50%, -10px) rotateY(360deg) scale(1.04); }
}
.deck-card.activating {
  animation: cardActivate 0.52s cubic-bezier(0.2, 0.8, 0.25, 1) both;
  z-index: 130 !important;
}

/* 牌堆 / 摊开控件 */
.deck-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.deck-controls[hidden] { display: none; }
.deck-current-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 190px;
  font-size: 13px;
  color: var(--text);
}
.deck-current-name b { font-size: 14px; font-weight: 700; }
.deck-current-name .deck-emoji {
  width: auto;
  height: auto;
  flex: 0 0 auto;
  font-size: 15px;
  background: none;
  box-shadow: none;
  border-radius: 0;
}
.deck-state {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-mute);
  border: 1px solid var(--border);
}
.deck-state.on {
  color: #06251a;
  font-weight: 700;
  background: var(--ok);
  border-color: transparent;
  box-shadow: 0 0 12px -2px rgba(52, 211, 153, 0.7);
}

/* 空状态 */
.deck-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 0;
  text-align: center;
}
.deck-empty[hidden] { display: none; }
.deck-empty-card {
  width: 180px;
  height: 258px;
  display: grid;
  place-items: center;
  font-size: 42px;
  color: rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(160px 160px at 76% 16%, rgba(255, 255, 255, 0.09), transparent 62%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 2px,
                              transparent 2px 11px),
    linear-gradient(160deg, #1c2231, #0d1018 72%);
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .deck-card { width: 250px; height: 360px; }
  .deck-name { font-size: 19px; }
  .deck-face { padding: 16px; }
  .deck-stage { min-height: 450px; }
}
@media (max-width: 520px) {
  .deck-card { width: 210px; height: 302px; }
  .deck-face { padding: 14px; border-radius: 16px; }
  .deck-head { margin: 12px 0 7px; gap: 8px; }
  .deck-emoji { width: 40px; height: 40px; flex-basis: 40px; font-size: 22px; }
  .deck-name { font-size: 17px; }
  .deck-tagline { font-size: 11.5px; min-height: 32px; -webkit-line-clamp: 2; }
  .deck-tags { gap: 4px; margin: 7px 0 8px; }
  .deck-tags .cc-tag { font-size: 8.5px; padding: 4px 6px; }
  .deck-tags .cc-tag:nth-child(n + 4) { display: none; }
  .deck .deck-nav,
  .deck .deck-hint { display: none; }
  .deck-watermark { font-size: 92px; }
  .deck-badges { top: 9px; right: 9px; gap: 4px; }
  .cc-badge { font-size: 9px; padding: 3px 6px; }
  .deck-detail-btn { top: 32px; right: 8px; font-size: 9px; padding: 2px 7px; }
  .deck-back-title { font-size: 12.5px; }
  .deck-back-body { gap: 5px; }
  .deck-current-name { order: -1; width: 100%; min-width: 0; }
  .deck-stage { min-height: 380px; padding-top: 8px; }
  .deck-controls { gap: 8px; }
}
@media (max-width: 400px) {
  .deck-card { width: 160px; height: 230px; }
  .deck-face { padding: 10px; border-radius: 14px; }
  .deck-name { font-size: 14px; }
  .deck-emoji { width: 32px; height: 32px; flex-basis: 32px; font-size: 18px; }
  .deck-tagline { font-size: 10px; min-height: 28px; }
  .deck-tags .cc-tag { font-size: 8px; padding: 3px 5px; }
  .deck-tags .cc-tag:nth-child(n + 3) { display: none; }
  .cc-badge { font-size: 8px; padding: 2px 5px; }
  .deck-detail-btn { top: 27px; font-size: 8px; }
  .deck-watermark { font-size: 72px; }
  .deck-stage { min-height: 330px; }
}
@media (prefers-reduced-motion: reduce) {
  .deck,
  .deck-card,
  .deck-card-inner,
  .deck-face { transition: none; }
  .deck-card.deal-out-next,
  .deck-card.deal-in-next,
  .deck-card.deal-out-prev,
  .deck-card.deal-in-prev,
  .deck-card.activating { animation: none; }
}

/* ---- 翻张按钮 / 摊开详情 / 放大卡层 ---- */
.deck-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  z-index: 4;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 11, 18, 0.58);
  color: #fff;
  font-family: inherit;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.deck-nav:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--cc);
  transform: translateY(-50%) scale(1.07);
}
.deck-nav-prev { left: 8px; }
.deck-nav-next { right: 8px; }
.deck:not(.expanded) .deck-card:not(.is-preview) .deck-nav { display: none; }
.deck.expanded .deck-nav { display: none; }
.deck:not(.expanded) .deck-detail-btn { display: none; }
.deck.expanded .deck-detail-btn { display: inline-flex; }
.deck-detail-btn {
  position: absolute;
  top: 45px;
  right: 12px;
  z-index: 3;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 13, 22, 0.6);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.deck-detail-btn:hover { color: #fff; border-color: var(--cc); }
.deck-front-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.deck-hint { font-size: 10.5px; color: var(--text-mute); letter-spacing: 0.2px; }
.deck-card.detail-flipped { z-index: 140 !important; }
.deck.expanded .deck-card { cursor: pointer; }
.deck.expanded .deck-card:hover .deck-front {
  transform: translateY(-6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
              0 32px 56px -26px rgba(0, 0, 0, 0.98);
}
.deck.expanded .deck-card.is-preview .deck-front {
  border-color: var(--cc);
  box-shadow: inset 0 0 0 1px var(--cc),
              0 0 30px -8px var(--cc);
}

/* 翻张：当前牌翻面沉底 + 下一张升上来 */
@keyframes flipOutNext {
  0% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + 8px), 18px) rotateY(-180deg) scale(0.96); opacity: 1; }
}
@keyframes flipOutPrev {
  0% { transform: translate(-50%, 0) rotateY(0deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% - 8px), 18px) rotateY(180deg) scale(0.96); opacity: 1; }
}
@keyframes coverIn {
  0%, 44% { opacity: 0; visibility: hidden; }
  55%, 100% { opacity: 1; visibility: visible; }
}
@keyframes riseTop {
  0% {
    transform: translate(calc(-50% + var(--x)), calc(var(--y) + 10px))
               scale(calc(var(--s) * 0.975));
  }
  100% {
    transform: translate(calc(-50% + var(--x)), var(--y))
               rotate(var(--r)) scale(var(--s));
  }
}
.deck-card.flip-out-next,
.deck-card.flip-out-prev {
  z-index: 130 !important;
}
.deck-card.flip-out-next { animation: flipOutNext 0.4s cubic-bezier(0.4, 0, 0.6, 1) both; }
.deck-card.flip-out-prev { animation: flipOutPrev 0.4s cubic-bezier(0.4, 0, 0.6, 1) both; }
.deck-card.flip-out-next .deck-front,
.deck-card.flip-out-prev .deck-front { visibility: visible; }
.deck-card.flip-out-next .deck-cover,
.deck-card.flip-out-prev .deck-cover {
  animation: coverIn 0.4s linear both;
}
.deck-card.rise-top {
  animation: riseTop 0.3s cubic-bezier(0.2, 0.8, 0.25, 1) 0.1s both;
  z-index: 131 !important;
}

/* 放大看设定：居中大卡层 */
.deck-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.deck-modal-mask[hidden] { display: none; }
.deck-modal-mask.show { opacity: 1; }
.deck-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-height: 96vh;
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.deck-modal-mask.show .deck-modal { transform: scale(1); }
.deck-modal-flipper {
  position: relative;
  width: min(432px, 86vw);
  height: min(621px, 74vh);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.25, 1);
}
.deck-modal-mask.flip .deck-modal-flipper { transform: rotateY(180deg); }
.deck-modal-face {
  position: absolute;
  inset: 0;
  padding: 24px;
  border-radius: 22px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.98);
}
.deck-modal-front { isolation: isolate; }
.deck-modal-face.has-tarot .deck-tarot-frame { height: 70%; }
.deck-modal-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #171c2a, #0f131d);
}
.deck-modal-back .deck-back-body { gap: 10px; }
.deck-modal-back .cc-back-row { font-size: 13px; }
.deck-modal-back .cc-back-text { font-size: 13px; line-height: 1.7; }
.deck-modal-back .cc-back-openers { font-size: 12.5px; }
.deck-modal-back .cc-back-tags .cc-tag { font-size: 10.5px; padding: 5px 8px; }
.deck-modal-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.deck-modal-foot .btn { padding: 8px 16px; font-size: 12.5px; }
@media (max-width: 520px) {
  .deck-modal-flipper { width: min(360px, 88vw); height: min(540px, 72vh); }
  .deck-modal-face { padding: 18px; }
  .deck-modal-foot { width: 100%; }
  .deck-modal-foot .btn { flex: 1 1 40%; }
}
@media (prefers-reduced-motion: reduce) {
  .deck-modal-mask,
  .deck-modal,
  .deck-modal-flipper { transition: none; }
}

/* ---- 角色卡弹窗表单 ---- */
.modal-wide { width: min(760px, 94vw); }
.modal-tip {
  margin-bottom: 14px;
  padding: 9px 12px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  border-radius: 10px;
  border: 1px dashed rgba(167, 139, 250, 0.32);
  background: rgba(167, 139, 250, 0.08);
}
.modal-tip code {
  color: #d9c8ff;
  background: rgba(167, 139, 250, 0.16);
  padding: 1px 5px;
  border-radius: 5px;
}
.card-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}
.card-form-grid .field { margin-bottom: 10px; }
.card-form-grid .span2 { grid-column: 1 / -1; }
.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}
.emoji-opt {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.emoji-opt:hover { transform: translateY(-1px); border-color: var(--accent); }
.emoji-opt.on {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.35), rgba(244, 114, 182, 0.25));
  border-color: rgba(167, 139, 250, 0.8);
}
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.color-opt {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.color-opt:hover { transform: scale(1.08); }
.color-opt.on { border-color: #fff; transform: scale(1.1); }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] {
  width: 52px;
  height: 38px;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
.opener-list { display: flex; flex-direction: column; gap: 8px; }
.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 2px;
}
.check-field > span { margin: 0; color: var(--text-dim); }
.check-field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

@media (max-width: 720px) {
  .card-form-grid { grid-template-columns: 1fr; }
}

/* ============================== 按钮 ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease,
              background 0.2s ease, border-color 0.2s ease, opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 12px 28px -12px rgba(167, 139, 250, 0.95);
}
.btn-primary:hover {
  box-shadow: 0 16px 34px -12px rgba(244, 114, 182, 0.85);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--panel-strong);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,0.11); }

.btn-danger {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.35);
  color: #ffc7d0;
}
.btn-danger:hover { background: rgba(251, 113, 133, 0.2); }

.w-full { width: 100%; }

.link {
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.18s, color 0.18s;
}
.link:hover { background: rgba(167,139,250,0.14); color: #cbb6ff; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================== 表单 ============================== */
.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field > .field-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-mute);
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 64px; }

/* 密码框在部分浏览器里会继承白色背景，这里强制压平 */
input[type="password"] {
  background: rgba(0, 0, 0, 0.28);
  -webkit-text-security: disc;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-mute);
  opacity: 0.75;
}

/* 浏览器自动填充会刷成亮黄色，这里盖掉 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px rgba(14, 16, 24, 1) inset;
  transition: background-color 9999s ease-in-out 0s;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.16);
  background: rgba(0, 0, 0, 0.36);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
select option { background: #14161f; color: var(--text); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  cursor: pointer;
}
.switch input { accent-color: var(--accent); }

.empty {
  margin: auto;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.9;
  padding: 40px 0;
}
.empty small { color: #565d72; font-size: 12px; }

/* ============================== 表情包 ============================== */
.uploader {
  padding: 26px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1.5px dashed rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.05);
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.uploader:hover, .uploader.drag {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.75);
  transform: translateY(-2px);
}
.uploader b { color: var(--accent); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.tag-pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.18s;
}
.tag-pill:hover {
  background: rgba(167,139,250,0.18);
  border-color: rgba(167,139,250,0.45);
  color: #fff;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 14px;
}

.sticker {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  aspect-ratio: 1 / 1;
  transition: transform 0.22s ease, border-color 0.22s, box-shadow 0.22s;
}
.sticker:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: rgba(167,139,250,0.5);
  box-shadow: 0 18px 34px -18px rgba(167,139,250,0.8);
}
.sticker img {
  width: 100%; height: 100%;
  object-fit: contain;
  background:
    repeating-conic-gradient(rgba(255,255,255,0.045) 0% 25%, transparent 0% 50%)
    50% / 18px 18px;
  display: block;
}
.sticker-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 9px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  font-size: 11px;
  color: #d8dcea;
  opacity: 1;
  transform: none;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.sticker:hover .sticker-meta { opacity: 1; transform: none; }
.sticker-tags { color: #c4b5fd; }
.sticker-actions {
  position: absolute;
  top: 7px; right: 7px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s;
}
.sticker:hover .sticker-actions { opacity: 1; }
.icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.62);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.18s, transform 0.15s;
}
.icon-btn:hover { background: rgba(0,0,0,0.85); transform: scale(1.08); }
.icon-btn.del:hover { background: rgba(251,113,133,0.8); }

/* ============================== 日志 ============================== */
.console, .mini-log {
  font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.75;
  color: #cfd6e8;
  background: rgba(0, 0, 0, 0.42);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.console { height: 62vh; }
.mini-log { height: 208px; }

.log-time { color: #5f6880; }
.log-INFO { color: #a9b4cc; }
.log-WARNING { color: #fbbf24; }
.log-ERROR { color: #fb7185; }
.log-ok { color: #34d399; }

/* ============================== 播放器 ============================== */
.player { margin-top: 14px; }
.player audio {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  filter: invert(0.92) hue-rotate(180deg) saturate(0.6);
}

/* ============================== 人物画像 ============================== */
.profile-list { display: flex; flex-direction: column; gap: 10px; max-height: 560px; overflow-y: auto; }

.profile-row {
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  transition: border-color 0.2s, background 0.2s;
}
.profile-row:hover { border-color: rgba(167,139,250,0.35); background: rgba(167,139,250,0.06); }

.profile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.profile-name { font-size: 13px; font-weight: 600; }
.profile-msg { font-size: 11px; color: var(--text-mute); }
.profile-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 5px; }
.tag-pill.tiny { font-size: 10.5px; padding: 2px 8px; background: rgba(167,139,250,0.16); color: #ddd0ff; border-color: rgba(167,139,250,0.3); }
.tag-pill.tiny.owner {
  background: linear-gradient(135deg, rgba(251,191,36,0.28), rgba(244,114,182,0.22));
  border-color: rgba(251,191,36,0.55);
  color: #ffe9b0;
}
.profile-row.is-admin { border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.05); }

.profile-ops {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(255,255,255,0.07);
}
.profile-ops .link { font-size: 11px; opacity: 0.65; transition: opacity 0.15s, color 0.15s; }
.profile-ops .link:hover { opacity: 1; }
.profile-ops .op-del:hover { color: var(--err); }
.profile-imp { font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px; }
.profile-aff { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-mute); }
.aff-bar { flex: 1; height: 4px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.aff-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f472b6, #a78bfa); border-radius: 99px; }
.profile-att { font-size: 11px; color: var(--text-mute); margin-top: 5px; }
.muted { color: var(--text-mute); font-size: 11px; }

/* ============================== 数据页 ============================== */
.storage-list { display: flex; flex-direction: column; gap: 9px; }

.storage-row {
  display: grid;
  grid-template-columns: 84px 1fr 74px 28px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.storage-label { color: var(--text-dim); }
.storage-size { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.storage-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
}
.storage-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent-grad);
  transition: width 0.4s ease;
}
.storage-lock { font-size: 10.5px; color: var(--text-mute); text-align: center; }
.storage-row .icon-btn { width: 22px; height: 22px; font-size: 11px; }

.archive-list { display: flex; flex-direction: column; gap: 7px; max-height: 260px; overflow-y: auto; }
.archive-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255,255,255,0.03);
  font-size: 12px;
}
.archive-scope { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-meta { color: var(--text-mute); font-size: 11px; }

.card.danger {
  border-color: rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.04);
}

/* ============================== 二维码登录 ============================== */
.login-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
@media (max-width: 860px) {
  .login-pair { grid-template-columns: 1fr; }
}

.login-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.16);
  min-height: 96px;
}
.login-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
}
.login-body {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 60px;
}
.login-body img {
  width: 128px;
  height: 128px;
  border-radius: 8px;
  background: #fff;
  padding: 5px;
  flex: 0 0 auto;
}
.login-body .login-text { flex: 1; min-width: 0; line-height: 1.7; }
.login-body .login-ok { color: var(--ok); font-weight: 600; }
.login-body .login-big { font-size: 15px; font-weight: 700; color: var(--text); }

/* ============================== 弹窗 ============================== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fadeUp 0.18s ease both;
}
.modal-mask[hidden] { display: none; }

.modal {
  width: min(460px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: #12151f;
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.95);
  padding: 18px 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex: 0 0 auto; }
.modal-head h4 { font-size: 15px; }
.modal-body { min-height: 0; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  flex: 0 0 auto;
  padding-top: 8px;
  background: #12151f;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-body img {
  width: 120px; height: 120px;
  object-fit: contain;
  border-radius: 12px;
  margin: 0 auto 14px;
  display: block;
  background: repeating-conic-gradient(rgba(255,255,255,0.05) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
  border: 1px solid var(--border);
}
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.emo-chip {
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.16s;
  user-select: none;
}
.emo-chip:hover { border-color: rgba(167,139,250,0.5); color: #fff; }
.emo-chip.on {
  background: linear-gradient(135deg, rgba(167,139,250,0.35), rgba(244,114,182,0.25));
  border-color: rgba(167,139,250,0.75);
  color: #fff;
}
.emo-chip .n { opacity: 0.6; margin-left: 4px; font-size: 10px; }

/* ============================== Toast ============================== */
.toast-wrap {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 99;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(24, 27, 38, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 40px -18px rgba(0,0,0,0.95);
  font-size: 13px;
  color: var(--text);
  animation: toastIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  backdrop-filter: blur(12px);
}
.toast.out { animation: toastOut 0.25s ease forwards; }
.toast::before {
  content: "";
  width: 3px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent-grad);
  flex: 0 0 3px;
}
.toast.err::before { background: linear-gradient(180deg, #fb7185, #f43f5e); }
.toast.ok::before { background: linear-gradient(180deg, #34d399, #10b981); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px) scale(0.96); }
}

/* ============================== 说明列表 ============================== */
.tips { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.tips li {
  position: relative;
  padding-left: 20px;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.75;
}
.tips li::before {
  content: "";
  position: absolute;
  left: 3px; top: 9px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-grad);
}
.tips code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.08);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  color: #d9c9ff;
}

/* ============================== 响应式 ============================== */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .topbar { padding: 16px 18px 12px; flex-direction: column; align-items: flex-start; }
  .content { padding: 18px; }
  .hero { flex-direction: column; text-align: left; }
  .hero-orb { display: none; }
}
/* 手机打开控制台 */
.phone-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.phone-qr {
  width: 148px; height: 148px; flex: 0 0 148px;
  border-radius: 14px; padding: 8px;
  background: #fff;
  box-shadow: 0 6px 20px -10px rgba(0,0,0,0.6);
}
.phone-qr img { width: 100%; height: 100%; display: block; border-radius: 8px; }
.phone-info { min-width: 220px; flex: 1; }
.phone-info code {
  padding: 1px 5px; border-radius: 5px;
  background: rgba(255,255,255,0.08); font-size: 12px;
}
/* 二维码旁边的「换一张」 */
.qr-refresh {
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: 0.18s;
}
.qr-refresh:hover { border-color: var(--accent); color: var(--text); }
.qr-refresh:disabled { opacity: 0.55; cursor: default; }
/* 开关行 */
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}
.switch-row input { width: 16px; height: 16px; accent-color: var(--accent); }

/* 模型后端切换（人设页小卡片） */
#llmBackendCard .kv b { max-width: 55%; }
#llmBackendHint { margin-top: 2px; min-height: 16px; }
#llmBackendHint:empty { display: none; }
#llmBackendSelect:disabled { opacity: 0.55; cursor: not-allowed; }
#llmBackendSelect optgroup { background: #14161f; color: var(--text-dim); }

/* 小屏塔罗卡：下半区更矮，藏掉一句话标签，保证名字/标签/提示不挤 */
@media (max-width: 560px) {
  .deck-front.has-tarot .deck-tagline { display: none; }
  .deck-front.has-tarot .deck-tags { margin: 4px 0 2px; }
  .deck-front.has-tarot .deck-arcana { top: 8px; left: 9px; font-size: 9px; padding: 2px 6px; }
  /* 小屏放不下「主设」徽章，避免和左上角塔罗序号撞在一起 */
  .deck-front.has-tarot .cc-badge:not(.cc-badge-on):not(.cc-badge-tarot) { display: none; }
}

/* 动作图多选（建卡表单） */
.action-picker{display:flex;flex-wrap:wrap;gap:8px 16px;margin-top:6px}
.action-picker label{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--text,#d8dbe6);cursor:pointer}
.action-picker input{accent-color:#7aa2f7}

/* ============================== 服务监控 ============================== */
.svc-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.svc-summary { font-size: 15px; font-weight: 600; }
.svc-summary .svc-ok { color: var(--ok); }
.svc-summary .svc-warn { color: var(--warn); }
.svc-toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.svc-card {
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}
.svc-card:hover { border-color: var(--border-strong); background: var(--panel-strong); }
.svc-card.busy { opacity: 0.6; pointer-events: none; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.svc-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.svc-title h4 {
  font-size: 14.5px; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.svc-key {
  font-size: 10.5px; color: var(--text-mute);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
}
.svc-dot {
  width: 9px; height: 9px; flex: 0 0 9px;
  border-radius: 50%; background: #4b5266;
}
.svc-dot.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14); }
.svc-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.14); }
.svc-dot.off { background: #4b5266; }
.svc-badge {
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-dim); white-space: nowrap;
}
.svc-badge.on {
  color: var(--ok); border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
}
.svc-badge.warn {
  color: var(--warn); border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}
.svc-badge.off { color: var(--text-mute); }
.svc-meta { margin-top: 11px; font-size: 13px; color: var(--text); }
.svc-sub { margin-top: 3px; font-size: 12px; color: var(--text-dim); }
.svc-detail {
  margin-top: 7px; font-size: 12px; color: var(--text-mute);
  min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.svc-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.svc-foot { margin-top: 16px; line-height: 1.7; }
.svc-log-path {
  font-size: 11.5px; color: var(--text-mute);
  margin-bottom: 8px; word-break: break-all;
}
.svc-log {
  height: 46vh; overflow: auto; margin: 0;
  padding: 12px 14px; border-radius: 12px;
  background: #0b0e16; border: 1px solid var(--border);
  font-family: "Cascadia Code", "Consolas", ui-monospace, monospace;
  font-size: 12px; line-height: 1.7; color: #cfd6e8;
  white-space: pre-wrap; word-break: break-word;
}
@media (max-width: 720px) {
  .svc-toolbar { flex-direction: column; align-items: stretch; }
  .svc-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   对外回复卡片（抖音好友 / B站 评论）
   只作用于 .social-card，不影响其它卡片
   ============================================================ */
.card.social-card {
  padding: 20px 24px;
}

.social-intro {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}
.social-intro b { color: var(--text); font-weight: 600; }

/* 总开关：整行可点，右侧状态徽标 */
.social-master {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 20px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.social-master-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.social-master-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.social-master-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.social-master-title { font-size: 13px; font-weight: 600; color: var(--text); }
.social-master-note { font-size: 11.5px; color: var(--text-mute); }
.social-master .chip { margin-left: auto; flex: 0 0 auto; }

/* 抖音 / B站 两列 */
.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
  align-items: start;
}
.social-col > :last-child { margin-bottom: 0; }

/* 区块标题 */
.section-subtitle {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.2px;
}
@supports (color: color-mix(in srgb, red, white)) {
  .section-subtitle { color: color-mix(in srgb, var(--accent) 72%, #fff); }
}

/* 列内开关 */
.social-switch { margin: 0 0 12px; font-size: 13px; }
.social-switch input { flex: 0 0 auto; }

/* 勾选框：暗色下也分得清「空」和「勾上」 */
.social-card input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.social-card input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 9px;
  transform: scale(0);
  background: var(--accent);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transition: transform 0.12s ease-in-out;
}
.social-card input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.16);
}
.social-card input[type="checkbox"]:checked::before { transform: scale(1); }
.social-card input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.55);
  outline-offset: 2px;
}

/* 字段：label 在上、控件在下 */
.social-field { margin-bottom: 14px; }
.social-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.social-field-hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-mute);
}
input.social-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
}
input.social-input[type="number"] {
  width: 120px;
  flex: 0 0 auto;
}
.social-num {
  display: flex;
  align-items: center;
  gap: 8px;
}
.social-unit {
  font-size: 12px;
  color: var(--text-mute);
  white-space: nowrap;
}

/* 底部按钮区 */
.social-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.social-footer .hint { margin: 0; }
.social-footer .hint:empty { display: none; }
.social-footer #btnSocialSave { margin-left: auto; }

@media (max-width: 900px) {
  .social-grid { grid-template-columns: 1fr; }
}


/* ============================== 二维码登录页 ============================== */
.login-page {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-page-card { text-align: center; }
.login-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.login-status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}
.login-status-copy { min-width: 0; flex: 1; }
.login-status-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}
.login-status-desc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-dim);
  word-break: break-word;
}
.login-account {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--text-mute);
  word-break: break-all;
}
.login-status.is-ready {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}
.login-status.is-ready .login-status-dot {
  background: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.16);
}
.login-status.is-ready .login-status-title { color: #7dd3fc; }
.login-status.is-stale {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.09);
}
.login-status.is-stale .login-status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.16);
}
.login-status.is-stale .login-status-title { color: var(--warn); }
.login-status.is-ok {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
}
.login-status.is-ok .login-status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}
.login-status.is-ok .login-status-title { color: var(--ok); }
.login-status.is-bad {
  border-color: rgba(251, 113, 133, 0.55);
  background: rgba(251, 113, 133, 0.1);
}
.login-status.is-bad .login-status-dot {
  background: var(--err);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.18);
}
.login-status.is-bad .login-status-title { color: var(--err); }
.login-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 22px 0 20px;
}
.login-qr-frame {
  position: relative;
  width: min(300px, 84vw);
  aspect-ratio: 1 / 1;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
}
.login-qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
.login-qr-frame img[hidden] { display: none; }
.login-qr-empty {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  color: #5b6274;
  background: repeating-linear-gradient(
    135deg, #f2f3f7 0 8px, #e9ebf2 8px 16px);
}
.login-qr-empty[hidden] { display: none; }
.login-qr-hint {
  font-size: 12.5px;
  color: var(--text-dim);
}
.login-actions { justify-content: center; }
.login-account-actions {
  justify-content: center;
  margin-top: 10px;
}
.login-account-actions[hidden] { display: none !important; }
.login-msg { min-height: 18px; }
.login-msg:empty { display: none; }
.login-watch {
  font-size: 11.5px;
  color: var(--text-mute);
}
.login-help { text-align: left; }
.login-steps {
  margin: 0 0 10px 18px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.9;
}
@media (max-width: 720px) {
  .login-page { max-width: 100%; }
  .login-actions .btn { flex: 1 1 auto; }
}

/* ============================== 概览：最近作品 / 服务健康 ============================== */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.work-item {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel);
}
.work-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}
.work-item:hover img { transform: scale(1.035); }

.health-list { display: flex; flex-direction: column; gap: 8px; }
.health-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.health-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
}
.health-meta { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }

@media (max-width: 720px) {
  .works-grid { gap: 8px; }
  .health-row { padding: 9px 10px; }
  .health-meta { display: none; }
}

/* 窄屏：设置类表单一律单列，避免 minmax(340px) 在手机宽度下横向溢出 */
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .content { padding: 16px 14px 32px; }
}

