/* Cinna Cloud Desk — 独立布局层，仅负责视觉与排列，不改变业务钩子。 */
:root {
  --bg: #eef8fb;
  --card: rgba(255, 255, 253, .9);
  --card-strong: #ffffff;
  --border: #c9e0e9;
  --text: #294c5e;
  --dim: #587280;
  --accent: #71b9da;
  --accent2: #a6dcee;
  --shadow: 0 14px 40px rgba(57, 112, 135, .11);
  --glow: 0 8px 20px rgba(78, 153, 187, .16);
  --radius: 24px;
  --veil: linear-gradient(115deg, rgba(238,248,251,.8), rgba(238,248,251,.44) 52%, rgba(238,248,251,.8));
  --hero-op: .72;
}

body {
  background:
    radial-gradient(circle at 78% 10%, rgba(255,255,255,.9), transparent 24%),
    radial-gradient(circle at 8% 92%, rgba(255,219,228,.24), transparent 28%),
    #eef8fb;
}

/* 视频必须位于不透明页面底色之上、内容之下，登录后继续保持播放。 */
.auth-hero { z-index: 0; }
body::before {
  inset: 0;
  z-index: 1;
  background: var(--veil);
  animation: none;
}
body::after {
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 8% 92%, rgba(255,219,228,.18), transparent 30%);
  animation: none;
}
#view-auth, #view-console { position: relative; z-index: 2; }
#view-auth::before { display: none; }
.glass { background: var(--card); border-color: rgba(184, 213, 225, .74); }
.btn.primary, .mode-tab.active, .seg-btn.active, .mode-chip.active {
  color: #173f56;
  background: #a8dfef;
  border: 1px solid #83c6df;
  box-shadow: 0 5px 0 #d2edf5;
}
.btn.primary:hover:not(:disabled) { background: #b9e7f4; }

/* 登录：竖排页签的云端信箱 + 大耳狗明信片，不使用原站左右介绍模板。 */
.auth-wrap {
  max-width: 1220px;
  grid-template-columns: minmax(450px, 520px) minmax(0, 1fr);
  gap: clamp(48px, 7vw, 100px);
  padding: 48px 32px;
}
.auth-card {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-self: center;
  padding: 0;
  overflow: hidden;
  border-radius: 30px;
  box-shadow: 0 24px 60px rgba(64, 119, 141, .15);
}
.auth-top {
  grid-column: 1 / -1;
  padding: 24px 26px 0;
  margin: 0;
}
.auth-tabs {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-self: stretch;
  gap: 8px;
  margin: 22px 0 0;
  padding: 18px 12px;
  border: 0;
  border-radius: 0;
  background: #eaf5f9;
}
.auth-tab {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.auth-tab.active { color: #28566e; box-shadow: 0 5px 14px rgba(67, 123, 145, .1); }
.auth-pane { grid-column: 2; grid-row: 2; min-width: 0; padding: 22px 24px 26px 4px; }
.auth-brand {
  grid-column: 2;
  grid-row: 1;
  text-align: center;
  padding: 0;
}
.auth-brand .brand-line { justify-content: center; }
.auth-brand h1 { font-size: clamp(64px, 7vw, 96px); }
.auth-brand .slogan { margin: 18px auto 0; max-width: 400px; }
.auth-mascot { width: min(360px, 82%); margin-top: 22px; }
.auth-orbits { justify-content: center; max-width: none; }
.auth-cloud { background: #d8edf5; }
.auth-cloud::before, .auth-cloud::after { background: #d8edf5; }

/* 桌面控制台：固定侧栏 + 非对称工作区。 */
#view-console:not(.hidden-view) { display: block; }
.topbar {
  position: fixed;
  inset: 18px auto 18px 18px;
  z-index: 50;
  width: 224px;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  border: 1px solid #c6dee8;
  border-radius: 28px;
  background: rgba(255,255,253,.94);
  box-shadow: 0 18px 46px rgba(54, 110, 132, .12);
}
.topbar-row { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 12px; width: 100%; }
.topbar-row:first-child { flex: 1; }
.topbar .brand { justify-content: center; margin-bottom: 12px; text-align: center; }
.topbar .brand > span { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.35; }
.topbar .brand > span::after { content: 'CLOUD DESK'; margin-top: 4px; color: #7291a1; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.brand-logo { width: 58px; height: 58px; margin-bottom: 7px; }
.topbar .user-email { max-width: 100%; padding: 6px 8px; text-align: center; }
.topbar .token-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 10px;
  border-radius: 20px;
  background: #e7f5fa;
  text-align: center;
}
.topbar .token-chip b { display: block; color: #2e647e; font-size: 25px; line-height: 1.2; }
.topbar .token-chip .peak-badge { margin-top: 6px; }
.topbar-row .spacer { display: block; flex: 1; min-height: 12px; }
.topbar #token-est { text-align: center; line-height: 1.5; }
.topbar #conn-state { text-align: center; font-size: 11px; }
.topbar-row #btn-refresh-balance { width: 100%; margin: 0; }
.topbar-row2 { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.topbar-row2 .theme-anchor, .topbar-row2 .theme-anchor .btn, .topbar-row2 .btn { width: 100%; }
.topbar::after { content: 'CINNA · 云朵工作台'; display: block; margin-top: 16px; color: #7893a0; font-size: 10px; letter-spacing: .08em; text-align: center; }

.console-wrap {
  max-width: none;
  margin: 0;
  padding: 26px 28px 48px 270px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  grid-template-areas:
    'desk desk'
    'accounts stats'
    'accounts spark'
    'accounts add';
  gap: 18px;
  align-items: start;
}
.console-hero {
  grid-area: desk;
  min-height: 92px;
  padding: 4px 150px 12px 4px;
  border: 0;
  border-bottom: 1px solid #cfe3eb;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.console-hero h2 { font-size: 28px; }
.console-hero p { font-size: 13px; }
.console-hero img { width: 140px; right: 6px; bottom: -2px; }
.hero-note { margin-top: 8px; background: #e2f1f7; }
.stat-grid { grid-area: stats; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { padding: 16px; border-radius: 20px; }
.stat-card .stat-v { font-size: 24px; }
.stat-card:nth-child(1) { background: #fff; }
.stat-card:nth-child(2) { background: #e5f4fa; }
.stat-card:nth-child(3) { background: #fff1f4; }
.stat-card:nth-child(4) { background: #fff8df; }
.tok-spark { grid-area: spark; margin: 0; }
.acc-sec { grid-area: accounts; min-width: 0; }
#add-sec { grid-area: add; margin: 0; }
#announcement, #space-notice, #automatch, #kick-notes { grid-column: 1 / -1; }
.card { padding: 22px; border-radius: 26px; }
.acc-head { display: grid; grid-template-columns: 1fr; gap: 16px; }
.mode-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px; border-radius: 20px; }
.mode-tab { justify-content: flex-start; min-height: 48px; padding: 8px 12px; }
.mode-icon { width: 28px; height: 28px; }
.ops-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ops-row .btn { min-width: 0; padding-left: 10px; padding-right: 10px; }
.ops-row .spacer { display: none; }
#fish-ops, #mode-ops { display: contents; }
.acc-table-wrap { overflow-x: auto; }
.acc-table { min-width: 720px; font-size: 12px; }
#add-sec { background: #f9fdfd; border-style: solid; }
#add-sec .add-form { grid-template-columns: 1fr; gap: 10px; }
.empty-art { width: 150px; }
.back-top { bottom: 20px; }

/* 平板与手机：侧栏变为紧凑工作条，内容按使用顺序重排。 */
@media (max-width: 1100px) {
  .topbar {
    position: sticky;
    inset: 0 auto auto;
    width: calc(100% - 24px);
    margin: 12px auto 0;
    padding: 12px 14px;
    border-radius: 24px;
  }
  .topbar-row { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .topbar .brand { margin: 0; text-align: left; }
  .topbar .brand > span { align-items: flex-start; }
  .topbar .brand > span::after { display: none; }
  .brand-logo { width: 40px; height: 40px; margin: 0; }
  .topbar .user-email { max-width: 180px; }
  .topbar .token-chip { flex: 1 1 170px; flex-direction: row; justify-content: center; padding: 8px 12px; }
  .topbar .token-chip b { display: inline; font-size: inherit; }
  .topbar-row .spacer { display: none; }
  .topbar #conn-state { display: none; }
  .topbar-row #btn-refresh-balance { width: auto; }
  .topbar-row2 { display: flex; flex-direction: row; justify-content: flex-end; margin-top: 0; }
  .topbar-row2 .theme-anchor, .topbar-row2 .theme-anchor .btn, .topbar-row2 .btn { width: auto; }
  .topbar::after { display: none; }
  .console-wrap {
    padding: 18px 14px 44px;
    grid-template-columns: minmax(0, 1fr) 250px;
    grid-template-areas:
      'desk desk'
      'stats stats'
      'accounts accounts'
      'spark add';
  }
  .console-hero { min-height: 82px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; gap: 20px; padding: 28px 18px 36px; }
  .auth-brand { grid-column: 1; grid-row: 1; text-align: left; }
  .auth-brand .brand-line { justify-content: flex-start; }
  .auth-brand .slogan { margin: 14px 0 0; }
  .auth-mascot { position: absolute; width: 150px; right: 0; bottom: 38px; margin: 0; }
  .auth-orbits { justify-content: flex-start; max-width: calc(100% - 130px); }
  .auth-card { grid-column: 1; grid-row: 2; display: block; padding: 22px; border-radius: 26px; }
  .auth-top { padding: 0; }
  .auth-tabs { display: flex; flex-direction: row; flex-wrap: wrap; margin: 20px 0; padding: 5px; border-radius: 16px; }
  .auth-tab { width: auto; min-height: 44px; text-align: center; }
  .auth-pane { padding: 0; }
  .console-wrap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'desk' 'stats' 'accounts' 'spark' 'add';
    gap: 12px;
    padding: 16px 10px 42px;
  }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .console-hero { padding-right: 124px; }
  .console-hero h2 { font-size: 22px; }
  .console-hero img { width: 124px; }
  .acc-head { display: flex; }
  .mode-tabs { display: none; }
  .mode-select { display: inline-flex; }
  .ops-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acc-table { min-width: 0; }
  .acc-table .col-game { display: none; }
  .acc-table .col-name { width: 88px; }
  .card { padding: 14px; border-radius: 22px; }
  .back-top { bottom: calc(20px + env(safe-area-inset-bottom)); }
}

.ts-demo {
  padding: 12px 14px;
  border: 1px dashed #a9cbd9;
  border-radius: 14px;
  background: #edf7fa;
  color: #466777;
  font-size: 13px;
  line-height: 1.55;
}

@media (max-width: 520px) {
  .auth-wrap { padding: 20px 12px 28px; }
  .auth-brand h1 { font-size: 48px; }
  .auth-mascot { width: 124px; bottom: 46px; }
  .auth-card { padding: 18px 16px; }
  .auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .auth-tab { width: 100%; padding: 8px 4px; }
  .topbar { width: calc(100% - 20px); margin-top: 10px; padding: 10px; }
  .topbar .brand > span { font-size: 13px; }
  .topbar .user-email { order: 3; max-width: 100%; }
  .topbar .token-chip { flex-basis: 150px; }
  .topbar-row2 { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .topbar-row2 .theme-anchor, .topbar-row2 .theme-anchor .btn, .topbar-row2 .btn { width: 100%; }
  .console-hero { min-height: 108px; padding: 10px 104px 12px 4px; }
  .console-hero h2 { font-size: 19px; }
  .console-hero p { font-size: 12px; line-height: 1.55; }
  .console-hero img { width: 112px; right: -4px; }
  .hero-note, .stat-io { font-size: 12px; }
  .stat-card { padding: 13px; }
  .stat-card .stat-v { font-size: 22px; }
  .ops-row .btn { font-size: 12px; }
  .card { padding: 12px; }

  /* 手机账号改为信息卡，不再把桌面表格硬挤进窄屏。 */
  .acc-table-wrap { overflow: visible; }
  .acc-table, .acc-table tbody { display: block; width: 100%; }
  .acc-table thead { display: none; }
  .acc-table .acc-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    grid-template-areas:
      'check name name menu'
      '. state amount map'
      '. ready ready ready';
    gap: 10px 8px;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid #dcebf0;
  }
  .acc-table .acc-row td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .acc-table .col-check { grid-area: check; min-height: 44px; align-items: center; }
  .acc-table .col-check { display: flex !important; }
  .acc-table td.acc-name {
    grid-area: name;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .acc-table .col-state { grid-area: state; }
  .acc-table .col-amount { grid-area: amount; text-align: right; font-size: 13px; }
  .acc-table .col-map { grid-area: map; text-align: right; font-size: 13px; }
  .acc-table .col-ready { grid-area: ready; color: var(--dim); font-size: 12px; }
  .acc-table .col-menu { grid-area: menu; }
  .acc-table .acc-row > .col-game, .acc-table .acc-row > .col-note { display: none; }
  .acc-table .col-amount::before, .acc-table .col-map::before {
    display: block;
    margin-bottom: 3px;
    color: var(--dim);
    font-size: 12px;
  }
  .acc-table .col-amount::before { content: '金额'; }
  .acc-table .col-map::before { content: '地图·房间'; }
  .acc-table .col-ready::before { content: '准备 · '; }
  .acc-table .badge { font-size: 12px; padding: 4px 7px; }
  .acc-table .sess-check { width: 18px; height: 18px; }
  .acc-table .acc-sub, .acc-table .acc-sub.open { display: none; }
}

/* 轻透磨砂表面：减弱页面遮罩与大面积卡片，让云朵动态贯穿整个工作区。 */
:root {
  --card: rgba(255, 255, 253, .38);
  --veil: linear-gradient(115deg, rgba(238,248,251,.22), rgba(238,248,251,.06) 52%, rgba(238,248,251,.22));
  --hero-op: .92;
}
.auth-hero { filter: saturate(.82) brightness(.72); }
.glass {
  background: var(--card);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}
.auth-card, .topbar { background: rgba(255,255,253,.44); }
.auth-card, .topbar, .stat-card, .tok-spark, #add-sec {
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
}
.auth-tabs { background: rgba(234,245,249,.34); }
.topbar .token-chip { background: rgba(231,245,250,.4); }
.stat-card:nth-child(1) { background: rgba(255,255,255,.32); }
.stat-card:nth-child(2) { background: rgba(229,244,250,.34); }
.stat-card:nth-child(3) { background: rgba(255,241,244,.34); }
.stat-card:nth-child(4) { background: rgba(255,248,223,.36); }
.tok-spark, #add-sec { background: rgba(249,253,253,.34); }
.mode-tabs { background: rgba(237,246,249,.34); }
.acc-table th { background: rgba(239,247,250,.32); }

@media (max-width: 900px) {
  .glass, .auth-card, .topbar, .stat-card, .tok-spark, #add-sec {
    backdrop-filter: blur(7px) saturate(1.06);
    -webkit-backdrop-filter: blur(7px) saturate(1.06);
  }
}

/* 固定侧栏底部的菜单向上展开，紧凑顶栏则保持向下展开。 */
.topbar .more-menu { top: auto; bottom: calc(100% + 8px); }
@media (max-width: 1100px) {
  .topbar .more-menu { top: calc(100% + 8px); bottom: auto; }
}

/* 背景设置：滑块即时调节，触控区域与手机弹窗适配。 */
.bg-settings { display: grid; gap: 18px; }
.bg-settings-note { margin: 0; line-height: 1.6; }
.bg-setting { display: grid; gap: 6px; }
.bg-setting-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; font-weight: 600; }
.bg-setting-head output { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.bg-range { width: 100%; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.bg-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.bg-settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  .auth-mascot { animation: none; }
}
