/* ==========================================================================
   黑猫 iCloud — 公共接码页（页面布局与主题层）
   ========================================================================== */

body.blackcat-video-body {
  position: relative;
}

.blackcat-app {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(1140px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
}

/* ---------------- 顶栏 ---------------- */

.blackcat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.blackcat-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}
.blackcat-brand:hover { text-decoration: none; }

.blackcat-brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-1);
}
.blackcat-brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }

.blackcat-brand-copy { display: grid; gap: 0; }
.blackcat-brand-copy strong { color: var(--ink); font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.blackcat-brand-copy strong b { color: var(--brand-ink); font-weight: 700; }

.blackcat-header-actions { display: flex; align-items: center; gap: 18px; }

.blackcat-service {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}
.blackcat-service i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.14);
}

/* ---------------- 主区域 ---------------- */

.blackcat-video-main {
  display: grid;
  width: 100%;
  align-items: start;
  align-content: start;
  padding: 24px 0 48px;
}

.blackcat-query-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  grid-auto-rows: minmax(338px, auto);
  gap: 24px;
  width: 100%;
}

.blackcat-query-layout .blackcat-video-console {
  display: flex;
  flex-direction: column;
  min-height: 338px;
  height: 100%;
}

.blackcat-query-layout .blackcat-video-console .blackcat-form { flex: 1 1 auto; align-content: start; }

.blackcat-mail-console.blackcat-results {
  min-height: 338px;
  height: 100%;
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

/* ---------------- 查询表单 ---------------- */

.blackcat-result-title { display: flex; align-items: baseline; gap: 10px; }
.blackcat-result-title h2 { font-size: 18px; font-weight: 680; letter-spacing: -0.02em; }
.blackcat-result-title strong { color: var(--text-3); font-size: 12px; font-weight: 520; }
.blackcat-result-title strong b { color: var(--brand-ink); font-weight: 700; }

.blackcat-mail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.blackcat-form { display: grid; gap: 16px; }

.blackcat-field { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 620; }
.blackcat-field-title { display: flex; justify-content: space-between; gap: 16px; }

.blackcat-input-shell {
  position: relative;
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.blackcat-input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(154, 100, 22, 0.28);
}

.blackcat-input-shell input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
}
.blackcat-input-shell input::placeholder { color: var(--text-3); }
.blackcat-token-shell input { padding-right: 76px !important; }

.blackcat-input-actions { position: absolute; top: 5px; right: 5px; display: flex; align-items: center; gap: 5px; }

.blackcat-token-toggle {
  min-width: 60px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 12px;
}

.blackcat-status {
  margin: 0;
  padding: 11px 13px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.blackcat-status.error { color: var(--danger); background: var(--danger-soft); border-color: #f3c2bd; }
.blackcat-status.success { color: var(--success); background: var(--success-soft); border-color: #bfe6cc; }

.blackcat-submit {
  min-height: 46px;
  padding: 10px 18px;
  color: #fff;
  background: var(--primary);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 660;
  letter-spacing: 0.02em;
}
.blackcat-submit:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.blackcat-submit:disabled { opacity: 0.55; cursor: wait; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 960px) {
  .blackcat-query-layout {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    width: 100%;
  }
  .blackcat-query-layout .blackcat-video-console,
  .blackcat-mail-console.blackcat-results { min-height: 0; height: auto; }
}

@media (max-width: 640px) {
  .blackcat-app { width: calc(100% - 28px); }
  .blackcat-header { min-height: 56px; }
  .blackcat-service { display: none; }
  .blackcat-video-main { padding: 16px 0 32px; }
  .blackcat-console, .blackcat-mail-console.blackcat-results { padding: 18px; border-radius: var(--radius); }
  .blackcat-mail-toolbar { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .blackcat-brand-mark, .blackcat-submit, .public-switch-track, .public-switch-thumb { transition: none !important; }
}

/* ========== 视觉打磨 v3：层次、品牌、空态 ========== */

/* 顶栏 */
.blackcat-header { min-height: 68px; }
.blackcat-brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(23, 26, 33, 0.08), inset 0 0 0 1px rgba(185, 130, 47, 0.18);
}
.blackcat-brand-copy strong { font-size: 16px; letter-spacing: -0.015em; }

/* 卡片：柔和层次 */
.blackcat-console,
.blackcat-mail-console.blackcat-results {
  padding: 28px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fdfcfa 100%);
  box-shadow:
    0 1px 2px rgba(23, 26, 33, 0.04),
    0 18px 40px -18px rgba(23, 26, 33, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* 表单 */
.blackcat-field { font-size: 12px; letter-spacing: 0.04em; color: var(--text-2); font-weight: 600; gap: 8px; }
.blackcat-input-shell {
  min-height: 48px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgba(23, 26, 33, 0.04);
}
.blackcat-input-shell input { min-height: 46px; }
.blackcat-input-shell:focus-within {
  border-color: var(--brand-interact);
  box-shadow: 0 0 0 4px rgba(154, 100, 22, 0.16);
}

/* 主按钮 */
.blackcat-submit {
  min-height: 52px;
  border-radius: 12px;
  background: linear-gradient(180deg, #23262f 0%, #12141a 100%);
  border-color: #12141a;
  letter-spacing: 0.06em;
  box-shadow: 0 1px 2px rgba(23, 26, 33, 0.2), 0 10px 24px -12px rgba(23, 26, 33, 0.5);
  transition: transform 160ms var(--spring), box-shadow 160ms var(--spring);
}
.blackcat-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(23, 26, 33, 0.22), 0 16px 32px -14px rgba(23, 26, 33, 0.55);
}
.blackcat-submit:active { transform: translateY(0); }

/* 结果标题：金色圆点 */
.blackcat-result-title h2 { display: inline-flex; align-items: center; gap: 8px; }
.blackcat-result-title h2::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(185, 130, 47, 0.14);
}

/* 空态 */
.public-mail-list.empty { align-content: center; }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 8px; text-align: center; }
.empty-state-icon {
  width: 46px; height: 46px; opacity: 0.9;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9822f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><rect x='2.5' y='4.5' width='19' height='15' rx='3'/><path d='M3 7l9 6 9-6'/></svg>") center / contain no-repeat;
}
.empty-state strong { font-size: 15px; font-weight: 700; color: var(--ink); }
.empty-state small { font-size: 12.5px; color: var(--text-3); line-height: 1.65; }

/* 竖向：桌面居中，窄屏靠上 */
.blackcat-video-main { align-content: center; }
@media (max-width: 960px) { .blackcat-video-main { align-content: start; } }

/* ==================== 深色黑金主题 v4 ==================== */

html { background: #0b0d10; }

body.blackcat-body {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1a1e24;
  --surface-3: #22272e;
  --border: #262b33;
  --border-strong: #353b45;
  --ink: #f4f1ea;
  --text-2: #b6b0a5;
  --text-3: #8a857b;
  --accent: #d4a24c;
  --accent-soft: rgba(212, 162, 76, 0.10);
  --accent-border: rgba(212, 162, 76, 0.30);
  --brand: #d4a24c;
  --brand-ink: #e6bd74;
  --brand-interact: #d4a24c;
  --primary: #d4a24c;
  --primary-hover: #e6bd74;
  --success: #52c98a;
  --success-soft: rgba(82, 201, 138, 0.12);
  --danger: #ff7b6b;
  --danger-soft: rgba(255, 123, 107, 0.12);
  --warn: #e0a44c;
  --warn-soft: rgba(224, 164, 76, 0.12);
  --info: #7aa7ff;
  --info-soft: rgba(122, 167, 255, 0.12);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.55);
  --shadow-2: 0 24px 60px -24px rgba(0, 0, 0, 0.9);
  color: var(--ink);
  background: var(--bg);
}

/* 背景层：顶部金色辉光 */
body.blackcat-body .blackcat-video-background {
  background:
    radial-gradient(1100px 460px at 50% -180px, rgba(212, 162, 76, 0.16), transparent 60%),
    radial-gradient(700px 320px at 92% -80px, rgba(212, 162, 76, 0.06), transparent 62%),
    linear-gradient(180deg, #12151a 0%, #0b0d10 100%);
}

/* 顶栏 */
body.blackcat-body .blackcat-header { border-bottom-color: rgba(255, 255, 255, 0.06); }
body.blackcat-body .blackcat-brand-mark {
  background: #0b0d10;
  border-color: rgba(212, 162, 76, 0.35);
  box-shadow: 0 0 0 1px rgba(212, 162, 76, 0.12), 0 8px 20px -8px rgba(0, 0, 0, 0.9);
}
body.blackcat-body .blackcat-brand-mark img {
  filter: invert(1) sepia(1) saturate(2.4) hue-rotate(-10deg);
}
body.blackcat-body .blackcat-brand-copy strong { color: var(--ink); }
body.blackcat-body .blackcat-brand-copy strong b { color: var(--brand); }
body.blackcat-body .blackcat-service {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
}

/* 卡片 */
body.blackcat-body .blackcat-console,
body.blackcat-body .blackcat-mail-console.blackcat-results {
  background: linear-gradient(180deg, #171b21 0%, #12151a 100%);
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 28px 64px -28px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(212, 162, 76, 0.05);
}

/* 表单 */
body.blackcat-body .blackcat-input-shell {
  background: #0e1116;
  border-color: #2b313a;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}
body.blackcat-body .blackcat-input-shell input { color: var(--ink); }
body.blackcat-body .blackcat-input-shell input::placeholder { color: #6c6862; }
body.blackcat-body .blackcat-input-shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(212, 162, 76, 0.15);
}
body.blackcat-body input:-webkit-autofill,
body.blackcat-body input:-webkit-autofill:hover,
body.blackcat-body input:-webkit-autofill:focus,
body.blackcat-body input:-webkit-autofill:active {
  -webkit-text-fill-color: #f4f1ea !important;
  -webkit-box-shadow: 0 0 0 1000px #0e1116 inset !important;
  caret-color: #f4f1ea !important;
  transition: background-color 5000s ease-in-out 0s;
}
body.blackcat-body .blackcat-token-toggle {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--text-2);
}
body.blackcat-body .blackcat-token-toggle:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }

/* 金色主按钮 */
body.blackcat-body .blackcat-submit {
  background: linear-gradient(180deg, #e6c182 0%, #c8953f 100%);
  border-color: #b8853a;
  color: #14100a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 14px 34px -14px rgba(212, 162, 76, 0.55);
}
body.blackcat-body .blackcat-submit:hover {
  background: linear-gradient(180deg, #f0cd90 0%, #d3a04a 100%);
  border-color: #c8953f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55), 0 20px 44px -16px rgba(212, 162, 76, 0.7);
  transform: translateY(-1px);
}
body.blackcat-body .blackcat-submit:active { transform: translateY(0); }
body.blackcat-body .blackcat-submit:disabled { opacity: 0.6; }

/* 结果区 */
body.blackcat-body .public-switch-track { background: #2a2f37; }
body.blackcat-body .public-switch input:checked + .public-switch-track { background: var(--brand); }
body.blackcat-body .public-switch-thumb { background: #f4f1ea; }
body.blackcat-body .public-query-status {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

/* 空态 */
body.blackcat-body .public-mail-list.empty,
body.blackcat-body .public-mail-detail.empty {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.10);
  color: var(--text-3);
}
body.blackcat-body .empty-state strong { color: var(--ink); }
body.blackcat-body .empty-state small { color: var(--text-3); }
body.blackcat-body .empty-state-icon {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4a24c' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'><rect x='2.5' y='4.5' width='19' height='15' rx='3'/><path d='M3 7l9 6 9-6'/></svg>");
  filter: drop-shadow(0 0 16px rgba(212, 162, 76, 0.35));
}

/* 滚动条 */
body.blackcat-body ::-webkit-scrollbar-thumb {
  background: #2a2f37;
  border-color: transparent;
}

/* ==================== 动效 ==================== */

@media (prefers-reduced-motion: no-preference) {
  @keyframes bc-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes bc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(82, 201, 138, 0.35); }
    50% { box-shadow: 0 0 0 7px rgba(82, 201, 138, 0); }
  }
  @keyframes bc-float {
    0%, 100% { transform: translateY(0); opacity: 0.82; }
    50% { transform: translateY(-4px); opacity: 1; }
  }
  @keyframes bc-glint {
    0% { opacity: 0; transform: translateX(-120%); }
    8% { opacity: 0.55; }
    16% { opacity: 0; transform: translateX(120%); }
    100% { opacity: 0; transform: translateX(120%); }
  }

  /* 卡片入场 */
  body.blackcat-body .blackcat-query-layout > section {
    animation: bc-rise 640ms var(--spring) both;
  }
  body.blackcat-body .blackcat-query-layout > section + section {
    animation-delay: 110ms;
  }

  /* 状态点呼吸 */
  body.blackcat-body .blackcat-service i { animation: bc-pulse 2.8s ease-out infinite; }

  /* 空态图标漂浮 */
  body.blackcat-body .empty-state-icon { animation: bc-float 5s ease-in-out infinite; }

  /* 金色按钮掠过光 */
  body.blackcat-body .blackcat-submit { position: relative; overflow: hidden; }
  body.blackcat-body .blackcat-submit::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 55%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    animation: bc-glint 4.5s ease-in-out 1.2s infinite;
    pointer-events: none;
  }
}

/* 键盘焦点可见 */
body.blackcat-body a:focus-visible,
body.blackcat-body button:focus-visible,
body.blackcat-body input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ==================== 动态背景 v5 ==================== */

body.blackcat-body .blackcat-video-background {
  background: linear-gradient(180deg, #12151a 0%, #0b0d10 100%);
}

body.blackcat-body .blackcat-video-background::before,
body.blackcat-body .blackcat-video-background::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

/* 光晕 A：顶部主金色 */
body.blackcat-body .blackcat-video-background::before {
  width: 1100px;
  height: 1100px;
  top: -560px;
  left: 50%;
  margin-left: -550px;
  background: radial-gradient(circle at 50% 50%,
    rgba(212, 162, 76, 0.22) 0%,
    rgba(212, 162, 76, 0.08) 38%,
    transparent 66%);
}

/* 光晕 B：右下副金色 */
body.blackcat-body .blackcat-video-background::after {
  width: 820px;
  height: 820px;
  right: -280px;
  bottom: -420px;
  background: radial-gradient(circle at 50% 50%,
    rgba(212, 162, 76, 0.14) 0%,
    rgba(160, 110, 40, 0.05) 42%,
    transparent 68%);
}

/* 金色微尘层（复用原本 display:none 的 shade 元素） */
body.blackcat-body .blackcat-video-shade {
  display: block;
  position: absolute;
  inset: -520px 0 0 0;
  background-image:
    radial-gradient(1.6px 1.6px at 18% 22%, rgba(230, 189, 116, 0.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 63% 68%, rgba(230, 189, 116, 0.42), transparent 60%),
    radial-gradient(1.8px 1.8px at 82% 34%, rgba(230, 189, 116, 0.36), transparent 60%),
    radial-gradient(1.3px 1.3px at 37% 82%, rgba(230, 189, 116, 0.46), transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 78%, rgba(230, 189, 116, 0.30), transparent 60%),
    radial-gradient(1.2px 1.2px at 8% 62%, rgba(230, 189, 116, 0.34), transparent 60%);
  background-size: 520px 520px;
  background-repeat: repeat;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 82%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), transparent 82%);
  transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes bc-drift-a {
    0%   { transform: translate3d(-14%, -3%, 0) scale(1); }
    33%  { transform: translate3d(6%, 5%, 0) scale(1.08); }
    66%  { transform: translate3d(14%, -2%, 0) scale(1.04); }
    100% { transform: translate3d(-14%, -3%, 0) scale(1); }
  }
  @keyframes bc-drift-b {
    0%   { transform: translate3d(10%, 6%, 0) scale(1.04); }
    40%  { transform: translate3d(-8%, -4%, 0) scale(1); }
    70%  { transform: translate3d(-14%, 8%, 0) scale(1.10); }
    100% { transform: translate3d(10%, 6%, 0) scale(1.04); }
  }
  @keyframes bc-dust-fall {
    0%   { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-60px, 520px, 0); }
  }

  body.blackcat-body .blackcat-video-background::before {
    animation: bc-drift-a 34s ease-in-out infinite;
  }
  body.blackcat-body .blackcat-video-background::after {
    animation: bc-drift-b 48s ease-in-out infinite;
  }
  body.blackcat-body .blackcat-video-shade {
    animation: bc-dust-fall 78s linear infinite;
  }
}
