/* ============================================================
 * refine.css — 视觉精修层（TDesign 视觉语言）
 * 仅覆盖呈现属性（圆角 / 阴影 / 间距节奏 / 交互态 / 焦点 / 安全区），
 * 不改动任何 DOM 结构、class 名、颜色语义与功能逻辑。
 * 本文件必须最后引入。
 * ============================================================ */

/* ---------- 基础：字体 / 焦点 / 过渡 ---------- */
:root,
body {
  font-family: var(--font-sans);
}
button,
a,
input,
select,
textarea,
[data-order] {
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
button:focus-visible,
a:focus-visible,
[data-order]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent, var(--gold));
  outline-offset: 2px;
}
::selection {
  background: var(--accent, var(--gold));
  color: var(--on, #fff);
}

/* ---------- 主按钮：状态色阶 + 焦点环 ---------- */
.xp-shell .primary,
dialog .primary,
.primary {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
}
.xp-shell .primary:hover,
dialog .primary:hover,
.primary:hover {
  background: var(--accent-hover, var(--accent, var(--gold)));
  border-color: var(--accent-hover, var(--accent, var(--gold)));
  filter: none;
}
.xp-shell .primary:active,
dialog .primary:active,
.primary:active {
  background: var(--accent-active, var(--accent, var(--gold)));
  transform: translateY(1px);
  box-shadow: none;
}
.xp-shell .primary:focus-visible,
dialog .primary:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-ring, rgba(0, 0, 0, 0.18));
}

/* ---------- 次级按钮 / 胶囊开关 ---------- */
.soft,
.tiny,
.seg button,
.xp-shell .soft,
.xp-shell .tiny,
.xp-shell .seg button {
  border-radius: var(--radius-sm);
}
.game-switch,
.seg {
  border-radius: var(--radius-pill);
}
.game-switch button {
  border-radius: var(--radius-pill);
}

/* ---------- 卡片：统一圆角与分层阴影 ---------- */
.xp-paper,
.panel,
.metric,
.guest-recent,
.profile-group,
.album-piece,
.price-section,
.report-sheet,
.report-line,
.settle-item,
.studio-tally,
.membership-info {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.lounge-banner,
.promo-stage,
.brief-cover,
.boss-pass,
.club-feature,
.member-shop {
  border-radius: var(--radius-xl);
}
/* 可点击卡片悬浮抬升 */
.album-piece > button:first-child img,
.promo-stage .lounge-banner {
  transition: transform var(--dur-m) var(--ease-out);
}
.album-piece:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

/* ---------- 输入框 / 选择器：聚焦态统一 ---------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea,
.xp-search {
  border-radius: var(--radius-sm);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-ring, rgba(0, 0, 0, 0.14));
  outline: none;
}

/* ---------- 徽章 / 标签：收紧字重与间隙 ---------- */
.badge {
  border-radius: var(--radius-xs);
  letter-spacing: 0.02em;
}
.xp-main .tabs button,
.tabs button,
.album-tabs button {
  border-radius: var(--radius-sm);
}

/* ---------- 表格：表头与行高节奏 ---------- */
th {
  letter-spacing: 0.04em;
}
tbody tr[data-order] {
  transition: background var(--dur) var(--ease);
}

/* ---------- 弹窗：上层阴影 + 精致头部 ---------- */
dialog {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
}
dialog dialog,
dialog[open] {
  animation: pop 0.2s var(--ease-out);
}
.dialog-head {
  border-bottom: 1px solid var(--border);
}
.form-actions {
  gap: var(--sp-2);
}
.form-actions .primary {
  min-width: 104px;
}

/* ---------- VIP 服务卡片：修正暗色背景上的标题对比度 ---------- */
.xp-vip .service-tile strong {
  color: #f6e7d6;
}
.xp-vip .service-tile .tile-icon {
  background: #6a5266;
  color: #ffe0ae;
}

/* ---------- 经营简报：柱状图与提示卡 ---------- */
.brief-alert {
  border-radius: var(--radius-sm);
  padding: 13px 10px;
}
.brief-alert:hover {
  background: var(--wash);
  border-radius: var(--radius-sm);
}
.bar-track > i {
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: height var(--dur-m) var(--ease-out);
}

/* ---------- 轮播控制条 ---------- */
.slide-controls {
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(8px);
}
.slide-controls button {
  border-radius: var(--radius-pill);
  transition: background var(--dur) var(--ease);
}
.slide-controls button:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- 移动端：安全区 / 触控热区 ---------- */
@media (max-width: 760px) {
  .xp-head,
  header {
    padding-top: env(safe-area-inset-top);
    height: calc(61px + env(safe-area-inset-top));
  }
  .xp-shell {
    padding-bottom: calc(75px + env(safe-area-inset-bottom));
  }
  .xp-mobile {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  /* 触控热区不小于 44px */
  .tabs button,
  .xp-main .tabs button,
  .album-tabs button,
  .game-switch button,
  .pager button,
  .iconbtn,
  .xp-mobile button,
  .xp-nav button,
  .slide-controls button {
    min-height: var(--tap);
  }
  .album-tabs button {
    min-height: 40px;
  }
  .slide-controls button {
    min-height: 40px;
    width: 40px;
  }
  /* 底部导航当前项指示条 */
  .xp-mobile button[aria-current] {
    position: relative;
  }
  .xp-mobile button[aria-current]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent, var(--gold));
  }
  dialog {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

/* ---------- 减少动态偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
