/**
 * 易盘 PC v2 — 工作台式超前 UI
 */
:root {
  --xp-rail: 0px;
  --xp-top: 56px;
  --xp-sub: 44px;
  --xp-max: 1440px;
  --xp-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.xp-grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--c-bg);
  background-image:
    radial-gradient(ellipse 100% 80% at 50% -30%, var(--c-body-glow-1), transparent 50%),
    radial-gradient(ellipse 60% 50% at 100% 50%, var(--c-body-glow-2), transparent 45%),
    linear-gradient(var(--c-border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-border-light) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  mask-image: linear-gradient(to bottom, #000 0%, #000 85%, transparent 100%);
}

/* ===== 动态八卦背景 ===== */
.xp-bagua-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xp-bagua-glow {
  position: absolute;
  width: min(85vh, 85vw);
  height: min(85vh, 85vw);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(45, 212, 191, 0.14) 0%,
    rgba(129, 140, 248, 0.08) 35%,
    transparent 65%);
  animation: xpBaguaGlow 8s ease-in-out infinite;
}
html[data-theme="light"] .xp-bagua-glow {
  background: radial-gradient(circle,
    rgba(13, 148, 136, 0.12) 0%,
    rgba(99, 102, 241, 0.06) 35%,
    transparent 65%);
}

@keyframes xpBaguaGlow {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

.xp-bagua-parallax {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.xp-bagua-layer {
  position: relative;
  width: min(92vh, 920px);
  height: min(92vh, 920px);
  color: var(--c-primary);
}
.xp-bagua-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}

.xp-bagua-outer {
  opacity: 0.09;
  animation: xpBaguaSpinCW 160s linear infinite;
}
html[data-theme="light"] .xp-bagua-outer { opacity: 0.07; color: var(--c-primary-dark); }

.xp-bagua-inner {
  width: min(72vh, 680px);
  height: min(72vh, 680px);
  opacity: 0.11;
  color: var(--c-purple);
  animation: xpBaguaSpinCCW 100s linear infinite;
}
html[data-theme="light"] .xp-bagua-inner { opacity: 0.08; }

.xp-bagua-core {
  width: min(28vh, 240px);
  height: min(28vh, 240px);
  opacity: 0.14;
  animation: xpBaguaSpinCW 60s linear infinite;
}
html[data-theme="light"] .xp-bagua-core { opacity: 0.1; }

@keyframes xpBaguaSpinCW {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes xpBaguaSpinCCW {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}

@media (max-width: 900px) {
  .xp-bagua-layer { width: min(120vw, 720px); height: min(120vw, 720px); }
  .xp-bagua-inner { width: min(95vw, 520px); height: min(95vw, 520px); }
  .xp-bagua-outer { opacity: 0.06; }
  .xp-bagua-inner { opacity: 0.07; }
}

@media (prefers-reduced-motion: reduce) {
  .xp-bagua-outer, .xp-bagua-inner, .xp-bagua-core, .xp-bagua-glow {
    animation: none;
  }
}

/* ===== App shell ===== */
.xp-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Top bar ===== */
.xp-top {
  position: sticky;
  top: 0;
  z-index: 300;
  height: var(--xp-top);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0 16px;
  background: rgba(6, 8, 15, 0.82);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--c-border);
}
html[data-theme="light"] .xp-top {
  background: rgba(248, 250, 252, 0.88);
}

.xp-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--c-text);
  flex-shrink: 0;
  padding-right: 8px;
}
.xp-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: contain;
  border: 1px solid rgba(45, 212, 191, 0.35);
  background: var(--c-surface-2);
  flex-shrink: 0;
}
.xp-logo-text {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.xp-logo-text em {
  font-style: normal;
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.xp-zones {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.xp-zones::-webkit-scrollbar { display: none; }

.xp-zone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-muted);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--xp-ease);
  text-decoration: none;
}
.xp-zone:hover {
  color: var(--c-text);
  background: var(--c-surface);
  border-color: var(--c-border);
  text-decoration: none;
}
.xp-zone.active {
  color: var(--c-primary);
  background: var(--c-primary-soft);
  border-color: rgba(45, 212, 191, 0.35);
  box-shadow: 0 0 20px rgba(45, 212, 191, 0.12);
}
.xp-zone-icon { font-size: 0.95rem; line-height: 1; }

.xp-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.xp-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  min-width: 140px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-muted);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.xp-search-btn:hover {
  border-color: rgba(45, 212, 191, 0.4);
  color: var(--c-text-2);
}
.xp-search-btn kbd {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border);
  font-size: 0.68rem;
  font-family: inherit;
  color: var(--c-muted);
}

.xp-user-chip {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  border: 1px solid rgba(45, 212, 191, 0.25);
  font-family: var(--font-ui);
}

.xp-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ===== Sub navigation ===== */
.xp-subbar {
  position: sticky;
  top: var(--xp-top);
  z-index: 250;
  min-height: var(--xp-sub);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  background: rgba(6, 8, 15, 0.65);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border-light);
  overflow-x: auto;
  scrollbar-width: none;
}
html[data-theme="light"] .xp-subbar {
  background: rgba(248, 250, 252, 0.75);
}
.xp-subbar::-webkit-scrollbar { display: none; }
.xp-subbar:empty { display: none; }

.xp-sub {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--c-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.xp-sub:hover {
  color: var(--c-text);
  background: var(--c-surface);
  text-decoration: none;
}
.xp-sub.active {
  color: var(--c-text);
  background: var(--c-surface-3);
  border-color: var(--c-border);
  font-weight: 600;
}

.xp-page-head {
  margin-bottom: 24px;
}
.xp-page-head h1 {
  font-family: var(--font);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.xp-page-head p {
  color: var(--c-muted);
  font-size: 0.88rem;
  font-family: var(--font-ui);
}

/* ===== Main content ===== */
.xp-main {
  flex: 1;
  width: 100%;
  max-width: var(--xp-max);
  margin: 0 auto;
  padding: 28px 24px 100px;
  animation: xpFadeIn 0.35s var(--xp-ease);
}
@keyframes xpFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ===== Mobile dock ===== */
.xp-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 400;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(6, 8, 15, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--c-border);
  justify-content: space-around;
  gap: 4px;
}
html[data-theme="light"] .xp-dock {
  background: rgba(255, 255, 255, 0.92);
}

.xp-dock-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--c-muted);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  cursor: pointer;
  text-decoration: none;
  border-radius: 10px;
  transition: color 0.15s, background 0.15s;
}
.xp-dock-item .ico { font-size: 1.15rem; line-height: 1; }
.xp-dock-item.active {
  color: var(--c-primary);
  background: var(--c-primary-soft);
}

/* ===== Mobile drawer ===== */
.xp-drawer-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 450;
  background: var(--c-overlay);
}
.xp-drawer-mask.show { display: block; }

.xp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 88vw);
  z-index: 460;
  background: var(--c-surface-2);
  border-left: 1px solid var(--c-border);
  transform: translateX(100%);
  transition: transform 0.3s var(--xp-ease);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.xp-drawer.open { transform: translateX(0); }

.xp-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--c-border);
}
.xp-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.xp-drawer-group-title {
  padding: 12px 18px 4px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  font-family: var(--font-ui);
  text-transform: uppercase;
}
.xp-drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: var(--c-text-2);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  transition: background 0.15s;
}
.xp-drawer-link:hover, .xp-drawer-link.active {
  background: var(--c-primary-soft);
  color: var(--c-primary);
  text-decoration: none;
}

/* ===== Command palette ===== */
.xp-cmd {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(4, 6, 12, 0.65);
  backdrop-filter: blur(8px);
}
.xp-cmd-panel {
  width: 100%;
  max-width: 520px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(45, 212, 191, 0.08);
  overflow: hidden;
  animation: xpCmdIn 0.2s var(--xp-ease);
}
@keyframes xpCmdIn {
  from { opacity: 0; transform: scale(0.96) translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.xp-cmd-input {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-bottom: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text);
  font-size: 1rem;
  font-family: var(--font-ui);
  outline: none;
}
.xp-cmd-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}
.xp-cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.xp-cmd-item:hover, .xp-cmd-item.focused {
  background: var(--c-primary-soft);
}
.xp-cmd-item .ico { font-size: 1.1rem; width: 28px; text-align: center; }
.xp-cmd-item .meta { margin-left: auto; font-size: 0.72rem; color: var(--c-muted); }
.xp-cmd-empty {
  padding: 24px;
  text-align: center;
  color: var(--c-muted);
  font-size: 0.85rem;
}

/* ===== FAB ===== */
.xp-fab {
  position: fixed;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 350;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: var(--c-btn-primary-text);
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(45, 212, 191, 0.35);
  transition: transform 0.2s var(--xp-ease), box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
html[data-theme="light"] .xp-fab { color: #fff; }
.xp-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 12px 40px rgba(45, 212, 191, 0.45);
}
.xp-fab.hidden { display: none; }

@media (max-width: 900px) {
  .xp-zones { display: none; }
  .xp-menu-btn { display: inline-flex; }
  .xp-search-btn span { display: none; }
  .xp-search-btn { min-width: auto; padding: 7px 10px; }
  .xp-search-btn kbd { display: none; }
  .xp-dock { display: flex; }
  .xp-main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .xp-fab { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .xp-logo-text { display: none; }
}

/* ===== Bento home ===== */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.bento-hero {
  grid-column: span 8;
  min-height: 220px;
  padding: 32px 36px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.12), rgba(129, 140, 248, 0.08)),
    var(--c-surface);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.bento-hero::after {
  content: '☯';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  opacity: 0.06;
  pointer-events: none;
}
.bento-hero h2 {
  font-family: var(--font);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  line-height: 1.35;
  margin-bottom: 10px;
  max-width: 420px;
}
.bento-hero h2 .hl {
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bento-hero p {
  color: var(--c-muted);
  font-size: 0.88rem;
  max-width: 400px;
  line-height: 1.65;
  font-family: var(--font-ui);
}
.bento-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.bento-wechat {
  grid-column: span 4;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 12px;
}
.bento-wechat img {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  border: 1px solid var(--c-border);
}
.bento-wechat strong {
  font-family: var(--font);
  color: var(--c-gold);
  font-size: 0.92rem;
}
.bento-wechat span {
  font-size: 0.75rem;
  color: var(--c-muted);
  line-height: 1.5;
  font-family: var(--font-ui);
}

.bento-stat {
  grid-column: span 3;
  padding: 20px 22px;
  border-radius: 16px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  transition: border-color 0.2s, transform 0.2s;
}
.bento-stat:hover {
  border-color: rgba(45, 212, 191, 0.35);
  transform: translateY(-2px);
}
.bento-stat .lbl {
  font-size: 0.7rem;
  color: var(--c-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-ui);
}
.bento-stat .val {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 6px;
  font-family: var(--font-ui);
  color: var(--c-text);
}
.bento-stat .val.teal { color: var(--c-primary); }

.bento-tile {
  grid-column: span 3;
  padding: 20px 18px;
  border-radius: 16px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  transition: all 0.22s var(--xp-ease);
  text-align: left;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
}
.bento-tile:hover {
  border-color: rgba(45, 212, 191, 0.4);
  transform: translateY(-3px);
  box-shadow: var(--shadow), 0 0 24px rgba(45, 212, 191, 0.08);
}
.bento-tile .ico { font-size: 1.6rem; margin-bottom: 10px; display: block; }
.bento-tile .tit { font-weight: 600; font-size: 0.92rem; font-family: var(--font-ui); margin-bottom: 4px; }
.bento-tile .desc { font-size: 0.74rem; color: var(--c-muted); font-family: var(--font-ui); }

@media (max-width: 1100px) {
  .bento-hero, .bento-wechat { grid-column: span 12; }
  .bento-stat, .bento-tile { grid-column: span 6; }
}
@media (max-width: 600px) {
  .bento-stat, .bento-tile { grid-column: span 12; }
  .bento-hero { padding: 24px 20px; min-height: 180px; }
}

/* ===== Paipan studio ===== */
.pp-studio {
  margin: -8px -4px 0;
  min-height: calc(100vh - var(--xp-top) - var(--xp-sub) - 80px);
}
.pp-studio-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 0;
  min-height: inherit;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  overflow: hidden;
  background: var(--c-surface);
}
.pp-studio-form {
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--xp-top) - var(--xp-sub) - 120px);
}
.pp-studio-form-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-3);
}
.pp-studio-form-head h2 {
  font-family: var(--font);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.pp-studio-form-head p {
  font-size: 0.76rem;
  color: var(--c-muted);
  font-family: var(--font-ui);
}
.pp-studio-steps {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}
.pp-step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--c-border);
  transition: background 0.3s;
}
.pp-step.on { background: linear-gradient(90deg, var(--c-primary), var(--c-purple)); }

.pp-studio-form-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
}
.pp-acc {
  border: 1px solid var(--c-border-light);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.pp-acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: none;
  background: var(--c-surface-3);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.pp-acc-head::after {
  content: '▾';
  color: var(--c-muted);
  transition: transform 0.2s;
}
.pp-acc.open .pp-acc-head::after { transform: rotate(180deg); }
.pp-acc-body {
  display: none;
  padding: 14px;
  border-top: 1px solid var(--c-border-light);
}
.pp-acc.open .pp-acc-body { display: block; }

.pp-studio-stage {
  display: flex;
  flex-direction: column;
  min-height: 480px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(45, 212, 191, 0.06), transparent 55%),
    var(--c-surface-2);
}
.pp-stage-toolbar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-3);
  flex-wrap: wrap;
}
.pp-studio.has-result .pp-stage-toolbar { display: flex; }
.pp-stage-toolbar .tit {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--c-primary);
}
.pp-stage-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
}
.pp-result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  color: var(--c-muted);
  padding: 40px 24px;
}
.pp-empty-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px dashed var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 20px;
  animation: xpPulse 3s ease infinite;
}
@keyframes xpPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.15); }
  50% { box-shadow: 0 0 0 16px rgba(45, 212, 191, 0); }
}
.pp-result-empty p { font-family: var(--font-ui); font-size: 0.9rem; }
.pp-result-empty .hint { font-size: 0.78rem; margin-top: 8px; opacity: 0.7; }

@media (max-width: 960px) {
  .pp-studio-layout {
    grid-template-columns: 1fr;
  }
  .pp-studio-form {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
  }
  .pp-studio-form.collapsed .pp-studio-form-body { display: none; }
  .pp-studio.has-result .pp-studio-form-head { cursor: pointer; }
}

/* Override legacy shell when xp-app present */
.xp-app ~ #pc-bg-canvas,
.xp-app ~ .pc-mesh,
.xp-app ~ .pc-bagua-ring { display: none !important; }
/* List pages polish */
.record-card, .lt-card, .xs-card, .lg-card {
  border-radius: 14px;
  transition: transform 0.2s var(--xp-ease), box-shadow 0.2s, border-color 0.2s;
}
.record-card:hover, .lt-card:hover, .xs-card:hover, .lg-card:hover {
  transform: translateX(4px);
}

.tabs {
  border-bottom-color: var(--c-border);
  gap: 2px;
}
.tab {
  border-radius: 8px 8px 0 0;
  padding: 10px 16px;
}
.tab.active {
  background: var(--c-surface-3);
}

.notice-bar {
  border-radius: 12px;
  margin-bottom: 12px;
  font-family: var(--font-ui);
}

body:has(.xp-app) #main-content.xp-main {
  max-height: none;
  overflow: visible;
}

/* ===== AI 对话解卦 ===== */
.ai-chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - var(--xp-top) - var(--xp-sub) - 48px);
  align-items: stretch;
}

.ai-chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px !important;
  max-height: calc(100vh - var(--xp-top) - var(--xp-sub) - 48px);
}

.ai-chat-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-chat-sidebar-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-muted);
  font-family: var(--font-ui);
}

.ai-chat-sidebar-divider {
  height: 1px;
  background: var(--c-border-light);
  margin: 4px 0;
}

.ai-chat-rec-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  max-height: 420px;
}

.ai-chat-rec-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border-light);
  border-radius: 10px;
  background: var(--c-surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
  font-family: inherit;
  color: inherit;
}

.ai-chat-rec-item:hover {
  border-color: var(--c-primary);
  transform: translateX(2px);
}

.ai-chat-rec-item.active {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
}

.ai-chat-rec-item .tit {
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.35;
}

.ai-chat-rec-item .meta {
  font-size: .72rem;
  color: var(--c-muted);
}

.ai-chat-gua-card {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--c-border);
  background: var(--c-surface-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ai-chat-gua-card.active {
  border-style: solid;
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
}

.ai-chat-gua-id {
  font-size: .72rem;
  color: var(--c-muted);
  font-family: var(--font-ui);
}

.ai-chat-main {
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  min-height: calc(100vh - var(--xp-top) - var(--xp-sub) - 48px);
}

.ai-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border-light);
  flex-shrink: 0;
}

.ai-chat-title {
  margin: 0;
  font-size: 1.05rem;
  font-family: var(--font-display);
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ai-chat-quota {
  font-size: .74rem;
  color: var(--c-muted);
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-light);
  font-family: var(--font-ui);
  white-space: nowrap;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 280px;
}

.ai-chat-welcome {
  text-align: center;
  max-width: 520px;
  margin: auto;
  padding: 24px 12px;
}

.ai-chat-welcome-icon {
  font-size: 2.5rem;
  opacity: .35;
  margin-bottom: 8px;
}

.ai-chat-welcome h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
}

.ai-chat-welcome p {
  margin: 0 0 16px;
  color: var(--c-muted);
  font-size: .88rem;
  line-height: 1.65;
}

.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.ai-chat-chip {
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--c-border-light);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  font-size: .78rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: var(--font-ui);
}

.ai-chat-chip:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  color: var(--c-text);
}

.ai-chat-msg {
  max-width: min(88%, 720px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-chat-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-chat-msg.assistant {
  align-self: flex-start;
}

.ai-chat-msg-head {
  font-size: .72rem;
  color: var(--c-muted);
  font-family: var(--font-ui);
  padding: 0 4px;
}

.ai-chat-msg-body {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat-msg.user .ai-chat-msg-body {
  background: linear-gradient(135deg, var(--c-primary), var(--c-purple));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-chat-msg.assistant .ai-chat-msg-body {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-light);
  border-bottom-left-radius: 4px;
}

.ai-chat-msg.typing .ai-chat-msg-body {
  padding: 14px 18px;
}

.ai-chat-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.ai-chat-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-primary);
  opacity: .5;
  animation: aiChatDot 1.2s ease-in-out infinite;
}

.ai-chat-dots i:nth-child(2) { animation-delay: .15s; }
.ai-chat-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes aiChatDot {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.ai-chat-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--c-border-light);
  background: var(--c-surface);
  flex-shrink: 0;
}

.ai-chat-composer textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--c-border-light);
  background: var(--c-surface-2);
  color: var(--c-text);
  font-family: inherit;
  font-size: .9rem;
  line-height: 1.5;
}

.ai-chat-composer textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

.ai-chat-gate {
  max-width: 420px;
  margin: 40px auto;
  padding: 24px;
}

@media (max-width: 900px) {
  .ai-chat-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .ai-chat-sidebar {
    max-height: none;
  }
  .ai-chat-rec-list {
    max-height: 200px;
  }
  .ai-chat-main {
    min-height: 70vh;
  }
  .ai-chat-msg {
    max-width: 95%;
  }
}
