/**
 * 全站统一视觉层（最后加载，只覆盖外观，不改任何业务逻辑）
 *
 * 基准：资讯 / 游戏 / 金融
 * - 控件高度 36–40，圆角 10–12
 * - 卡片 16–18 圆角，1px 浅描边，不用重阴影
 * - 分段切换统一为：浅底容器 + 选中蓝底白字
 * - 页面标题、说明、工具栏、内容区统一纵向节奏
 */

:root {
  --ui-primary: var(--color-primary-solid, #0071E3);
  --ui-primary-soft: var(--color-primary-soft, rgba(0, 113, 227, .10));
  --ui-border: var(--color-border, rgba(120, 120, 128, .18));
  --ui-border-strong: var(--color-border-strong, rgba(120, 120, 128, .30));
  --ui-surface: var(--color-surface, #fff);
  --ui-sunken: var(--color-surface-sunken, rgba(120, 120, 128, .08));
  --ui-text: var(--color-text-primary, #1D1D1F);
  --ui-text-2: var(--color-text-secondary, #555);
  --ui-text-3: var(--color-text-tertiary, #888);
  --ui-radius-card: 18px;
  --ui-radius-control: 10px;
  --ui-control-h: 38px;
}

/* ------------------------------------------------------------ 页面节奏 */
.st,
.tf2,
.ct,
.fin-body,
.game-main,
.hub-main {
  --ui-gap: 16px;
}

.st-head,
.tf2-head,
.page-head,
.hb-hero {
  margin-bottom: 18px;
}

.st-head h1,
.tf2-title,
.page-title {
  letter-spacing: -.01em;
}

/* ------------------------------------------------------------ 卡片 */
.tool-card,
.hb-card,
.hb-entry,
.src-card,
.game-card,
.ty-card,
.ty-board,
.tf2-pane,
.ct-card,
.panel,
.fin-group,
.country-card,
.music-card,
.news-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  background: var(--ui-surface);
  box-shadow: none;
}

.tool-card {
  padding: 16px;
  border-radius: 14px;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}

.tool-card:hover {
  border-color: var(--ui-border-strong);
  transform: translateY(-1px);
}

.src-card,
.game-card,
.ty-card,
.ty-board,
.tf2-pane,
.ct-card,
.country-card,
.music-card,
.news-card {
  overflow: hidden;
}

/* 卡片标题与内容内边距统一，避免各模块标题贴边 */
.src-head,
.game-card-head,
.ty-board-head,
.tf2-pane-head,
.ty-card-head {
  padding-left: 0;
  padding-right: 0;
}

/* ------------------------------------------------------------ 按钮 */
.btn,
.hb-btn,
.st-btn,
.ty-new,
.ty-start,
.ty-end,
.auth-btn,
.tf2-modal-x,
.ct-close {
  box-sizing: border-box;
  min-height: var(--ui-control-h);
  border-radius: var(--ui-radius-control);
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}

.btn,
.hb-btn,
.st-btn,
.ty-new,
.ty-start {
  border: 1px solid var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text);
}

.btn:hover,
.hb-btn:hover,
.st-btn:hover,
.ty-new:hover,
.ty-start:hover:not(:disabled) {
  border-color: var(--ui-border-strong);
  background: var(--color-hover, rgba(120, 120, 128, .06));
}

.btn-primary,
.hb-btn-primary {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  color: #fff;
}

.ty-end,
.auth-btn.primary {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  color: #fff;
}

.ty-end:disabled,
.ty-start:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ty-new {
  height: var(--ui-control-h);
  padding: 0 14px;
  color: var(--ui-primary);
}

/* ------------------------------------------------------------ 分段切换 */
.country-continents,
.board-tabs,
.wealth-tabs,
.wealth-chart-tabs,
.tf2-tabs,
.ty-seg,
.game-switch,
.pill-tabs,
.mp-tabs,
.ft-tabs,
.nv-tabs,
.ph-tabs,
.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--ui-sunken);
}

.country-continent-btn,
.board-tab,
.wealth-tab,
.wealth-chart-tab,
.tf2-tab,
.ty-seg-btn,
.game-switch-btn,
.pill-tab,
.mp-tab,
.ft-tab,
.nv-tab,
.ph-tab,
.auth-tab {
  box-sizing: border-box;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.country-continent-btn:hover,
.board-tab:hover,
.wealth-tab:hover,
.wealth-chart-tab:hover,
.tf2-tab:hover,
.ty-seg-btn:hover,
.game-switch-btn:hover,
.pill-tab:hover,
.mp-tab:hover,
.ft-tab:hover,
.nv-tab:hover,
.ph-tab:hover,
.auth-tab:hover {
  color: var(--ui-text);
}

.country-continent-btn.is-on,
.board-tab.on,
.wealth-tab.on,
.wealth-chart-tab.on,
.tf2-tab.on,
.ty-seg-btn.on,
.game-switch-btn.is-on,
.pill-tab.is-on,
.mp-tab.is-on,
.ft-tab.on,
.nv-tab.on,
.ph-tab.on,
.auth-tab.is-on {
  background: var(--ui-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: none;
}

.country-continent-btn b {
  margin-left: 4px;
  font-weight: 600;
  opacity: .7;
}

.country-continent-btn.is-on b {
  opacity: .9;
}

/* 标签 / 状态胶囊 */
.hb-chip,
.algo-chip,
.as-chip,
.nm-chip,
.fin-metal-chip {
  box-sizing: border-box;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-surface);
  color: var(--ui-text-2);
  font-size: 12px;
  cursor: pointer;
}

.hb-chip.is-on,
.algo-chip.is-on,
.as-chip.is-on,
.nm-chip.is-on,
.fin-metal-chip.is-on {
  border-color: var(--ui-primary);
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

/* ------------------------------------------------------------ 输入框 / 搜索 */
.input,
.field input,
.field select,
.field textarea,
.st-search,
.tf2-search,
.ty-input,
.search-field,
.fin-search-wrap .search-field {
  box-sizing: border-box;
  min-height: var(--ui-control-h);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  background: var(--ui-surface);
  color: var(--ui-text);
}

.input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.st-search:focus-within,
.tf2-search:focus-within,
.ty-input:focus,
.search-field:focus-within {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px var(--ui-primary-soft);
  outline: none;
}

/* ------------------------------------------------------------ 金融 / 国家 / 财富 */
.fin-group {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.fin-group-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}

.country-card {
  padding: 14px 16px;
  transition: border-color .15s ease, transform .15s ease;
}

.country-card:hover {
  border-color: var(--ui-border-strong);
  transform: translateY(-1px);
}

.country-continents {
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.wealth-table-wrap {
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  overflow: hidden;
}

.wealth-table thead th {
  background: var(--ui-sunken);
  color: var(--ui-text-2);
  font-size: 12px;
  font-weight: 600;
}

/* ------------------------------------------------------------ 资讯 / 游戏 / 城市 */
.game-switch {
  gap: 2px;
}

.game-switch-btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.game-switch-btn.is-on {
  background: var(--ui-primary);
  color: #fff;
}

.board-tabs {
  margin: 12px 0 16px;
}

/* ------------------------------------------------------------ 打字 / 交通 / 设备 */
.st-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.st-tab {
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-surface);
}

.st-tab.on {
  border-color: var(--ui-primary);
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

.ty-page {
  gap: 18px;
}

.ty-card {
  padding: 18px 20px;
}

.ty-text {
  border-radius: 14px;
  border-color: var(--ui-border);
}

.tf2-tabs {
  margin-bottom: 12px;
}

.tf2-pane {
  border-radius: 16px;
}

/* ------------------------------------------------------------ AI 训练题（Tailwind 页面） */
#app {
  color: var(--ui-text);
}

#app button {
  border-radius: 10px;
  font-weight: 600;
}

#app .rounded-2xl,
#app .rounded-xl,
#app .rounded-3xl {
  border-radius: 16px !important;
}

#app .bg-blue-500,
#app .bg-blue-600,
#app .bg-indigo-500,
#app .bg-indigo-600 {
  background-color: var(--ui-primary) !important;
}

#app .text-blue-500,
#app .text-blue-600,
#app .text-indigo-500,
#app .text-indigo-600 {
  color: var(--ui-primary) !important;
}

#app .border-blue-500,
#app .border-blue-600 {
  border-color: var(--ui-primary) !important;
}

#app .bg-blue-50,
#app .bg-indigo-50 {
  background-color: var(--ui-primary-soft) !important;
}

#app .shadow-2xl,
#app .shadow-xl {
  box-shadow: 0 18px 50px rgba(0, 0, 0, .10) !important;
}

/* ------------------------------------------------------------ 小屏统一 */
@media (max-width: 720px) {
  .country-continents,
  .board-tabs,
  .wealth-tabs,
  .wealth-chart-tabs,
  .tf2-tabs,
  .ty-seg,
  .game-switch {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .country-continent-btn,
  .board-tab,
  .wealth-tab,
  .wealth-chart-tab,
  .tf2-tab,
  .ty-seg-btn,
  .game-switch-btn {
    flex: none;
  }
}

/* 左右分栏的卡片必须从同一顶部开始：压掉主题里给纵向堆叠面板加的 margin */
.about-grid .panel + .panel,
.io-grid > .panel + .panel,
.cal-layout > .panel + .panel,
.tf2-body > .panel + .panel {
  margin-top: 0 !important;
}
.about-grid > .panel {
  align-self: stretch;
  height: 100%;
}

/* 全站左右分栏：宽度可以按设计不同，但左右两栏必须从同一顶部开始、同一底部结束 */
.io-grid,
.about-grid,
.cal-layout,
.tf2-body,
.ty-page,
.nm,
.mp-city {
  align-items: stretch !important;
}
.io-grid > .io-pane,
.about-grid > .panel,
.cal-layout > .panel,
.tf2-body > .tf2-pane,
.ty-page > .ty-main,
.ty-page > .ty-side,
.nm > .panel,
.mp-city > * {
  height: 100%;
  min-height: 0;
}
