/* AstroShare 四色体系 (需求3, 2026-10-19)
 * 深空藏蓝 #0C1226 / 月光白 #EDE6D6 / 星野金 #F2B84B / 远山蓝 #1E2C4F
 * WCAG 硬约束(合规已实测):
 *   ① 远山蓝与藏蓝相邻 1.35:1 不达标 → 边界/描边用月光白系 rgba(237,230,214,.14);
 *      文字用月光白或星野金, 远山蓝仅作背景面
 *   ② 星野金按钮文字必须用深空藏蓝(白字 1.79:1 不达标; 藏蓝字 10.38:1 ✅)
 */
:root {
  --bg: #0C1226;
  --bg-soft: #111B38;
  --card: rgba(30, 44, 79, 0.55);
  --card-solid: #1E2C4F;
  --border: rgba(237, 230, 214, 0.14);
  --text: #EDE6D6;
  --text-dim: #8A94B0;
  --accent: #F2B84B;
  --accent-2: #D89A2B;
  --gold-soft: rgba(242, 184, 75, 0.16);
  --gold-line: rgba(242, 184, 75, 0.42);
  --danger: #FF6B7A;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(242, 184, 75, 0.07), transparent 60%),
    radial-gradient(900px 500px at 10% 0%, rgba(30, 44, 79, 0.55), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Segoe UI", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  background: rgba(12, 18, 38, 0.82);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
}
.topbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 32px;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 8px rgba(242, 184, 75, 0.25);
}
.brand-logo img {
  width: 32px; height: 32px; object-fit: contain;
  border-radius: 8px;
}
.brand-logo-text {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--bg);
}
.brand-text { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: 0.8px; }
.brand-dot { color: var(--accent); margin-right: 4px; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--text-dim); padding: 8px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 500; transition: all 0.2s ease;
  position: relative;
}
.nav a:hover { color: var(--text); background: rgba(237, 230, 214, 0.06); }
.nav a.active {
  color: #FFE9B8; background: var(--gold-soft);
  box-shadow: 0 0 0 1px var(--gold-line);
}

/* ---------- 主体 ---------- */
.main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }
.footer { text-align: center; color: var(--text-dim); font-size: 12.5px; padding: 26px 0 30px; opacity: 0.75; }
.footer .footer-meta { margin-left: 10px; }
.footer .footer-admin { color: var(--text-dim); text-decoration: none; margin: 0 4px; }
.footer .footer-admin:hover { color: var(--text); }

/* ---------- 提示 ---------- */
.flashes { max-width: 1280px; margin: 14px auto 0; padding: 0 20px; }
.flash { padding: 10px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 8px; border: 1px solid var(--border); }
.flash-ok { background: rgba(63, 190, 130, 0.12); color: #7be0ae; }
.flash-error { background: rgba(255, 107, 122, 0.12); color: #ff9aa5; }

/* ---------- 主页工具条 ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 16px 0 20px; position: sticky; top: 56px; z-index: 40;
  background: linear-gradient(180deg, rgba(12, 18, 38, 0.92), rgba(12, 18, 38, 0.75) 80%, transparent);
  padding: 10px 0;
}
.toolbar input[type="search"], .toolbar select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; outline: none;
}
.toolbar input[type="search"] { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar select { cursor: pointer; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text-dim);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--gold-soft); border-color: var(--gold-line); color: var(--accent); }

/* ---------- 拼接作品复选框 ---------- */
.mosaic-toggle { position: relative; cursor: pointer; user-select: none; }
.mosaic-toggle-ui {
  border: 1px solid var(--border); background: var(--card); color: var(--text-dim);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; display: flex; align-items: center; gap: 4px;
  transition: all 0.15s ease;
}
.mosaic-toggle-ui:hover { color: var(--text); }
.mosaic-toggle input[type="checkbox"] { display: none; }
.mosaic-toggle input[type="checkbox"]:checked + .mosaic-toggle-ui {
  background: var(--gold-soft); border-color: var(--gold-line); color: var(--accent);
}
.mosaic-check { display: inline-block; width: 14px; text-align: center; opacity: 0; transition: opacity 0.15s ease; }
.mosaic-toggle input[type="checkbox"]:checked + .mosaic-toggle-ui .mosaic-check { opacity: 1; }

/* 需求14: 移动端尽量一行显示工具条 — 收窄内边距/字号/间距, 允许搜索框收缩 */
@media (max-width: 520px) {
  .toolbar { gap: 6px; }
  .toolbar input[type="search"] { min-width: 0; max-width: none; }
  .toolbar input[type="search"], .toolbar select { padding: 6px 10px; font-size: 12.5px; }
  .mosaic-toggle-ui { padding: 5px 10px; font-size: 12px; }
}

/* ---------- 瀑布流 (Masonry horizontalOrder, 需求17 R-C) ---------- */
.wall { position: relative; margin: 0 auto; }
.wall-item {
  margin-bottom: 16px; border-radius: 16px;
  overflow: hidden; background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); cursor: pointer; position: relative;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
}
.wall-item:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: var(--gold-line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--gold-line);
  z-index: 2;
}
.wall-img {
  display: block; width: 100%; background: #0C1226; position: relative;
  overflow: hidden;
}
.wall-img img {
  width: 100%; display: block; min-height: 120px;
  opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease;
  transform: scale(1);
}
.wall-img img.loaded { opacity: 1; }
.wall-item:hover .wall-img img.loaded {
  transform: scale(1.04);
}
.wall-img::after {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.4) 100%);
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none; z-index: 1;
}
.wall-item:hover .wall-img::after { opacity: 1; }
.wall-time {
  position: absolute; top: 10px; left: 12px; font-size: 11px; color: rgba(255,255,255,0.85);
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px);
  padding: 4px 10px; border-radius: 20px; z-index: 2;
  transition: background 0.3s ease;
}
.wall-item:hover .wall-time { background: rgba(0, 0, 0, 0.7); }
.wall-meta {
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(30, 44, 79, 0.9) 0%, rgba(17, 27, 56, 0.95) 100%);
}
.wall-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-sub { font-size: 12px; color: var(--text-dim); margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-sub .code { color: var(--accent); margin-right: 8px; }
.empty-tip { color: var(--text-dim); text-align: center; padding: 60px 0; font-size: 14px; }
#sentinel { height: 10px; }
.loader { text-align: center; color: var(--text-dim); font-size: 13px; padding: 18px 0 30px; }

/* ---------- 详情页 ---------- */
.detail-hero {
  max-width: 1000px; margin: 0 auto;
  border-radius: 20px; overflow: hidden;
  border: 1px solid var(--border);
  background: #0C1226;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s ease;
}
.detail-hero:hover { box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--gold-line); }
.detail-hero img {
  width: 100%; display: block;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.detail-hero:hover img { transform: scale(1.02); }
.detail-title { margin: 20px 0 10px; font-size: 24px; font-weight: 800; }
.detail-title .code { color: var(--accent); margin-left: 10px; font-size: 16px; font-weight: 600; }
.spec { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-top: 8px; }
.spec th, .spec td { padding: 11px 16px; font-size: 13.5px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: none; }
.spec th { color: var(--text-dim); font-weight: 500; width: 180px; white-space: nowrap; background: rgba(237, 230, 214, 0.03); }
.spec td { color: var(--text); }
.spec .grp td { background: var(--gold-soft); color: #FFEDC2; font-weight: 600; font-size: 12.5px; letter-spacing: 1px; }
.spec .grp.sub td { background: rgba(237, 230, 214, 0.06); color: var(--text-dim); letter-spacing: 0.5px; font-size: 12px; font-weight: 600; }
.spec .grp.sub2 td { background: none; color: var(--accent); letter-spacing: 0.5px; font-size: 12px; font-weight: 700; }
.backlink { display: inline-block; margin-bottom: 14px; color: var(--text-dim); font-size: 13px; }
.backlink:hover { color: var(--text); }

/* ---------- 梅西耶专题 ---------- */
.messier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.m-cell { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--card-solid); cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; position: relative; aspect-ratio: 1 / 1.25; display: flex; flex-direction: column; }
.m-cell:hover { transform: translateY(-2px); border-color: var(--gold-line); }
.m-cell img { width: 100%; flex: 1; object-fit: cover; display: block; }
.m-cell .ph { flex: 1; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #1E2C4F, #0C1226); color: rgba(237, 230, 214, 0.20); font-size: 22px; font-weight: 800; }
.m-cell .cap { font-size: 11px; text-align: center; padding: 5px 4px; color: var(--text-dim); background: rgba(0,0,0,0.35); }
.m-cell .cap b { color: var(--text); font-weight: 700; }
.m-cell.empty { cursor: default; opacity: 0.85; }
.m-cell .m-badge { position: absolute; top: 8px; left: 8px; z-index: 2; background: rgba(8, 12, 26, 0.78); color: #FFE9B8; font-size: 11.5px; font-weight: 800; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 999px; border: 1px solid rgba(242, 184, 75, 0.35); }

/* ---------- 后台 ---------- */
.admin-wrap { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
@media (max-width: 860px) { .admin-wrap { grid-template-columns: 1fr; } }
.admin-side { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-lg); padding: 14px; height: fit-content; position: sticky; top: 76px; }
.admin-side a { display: block; color: var(--text-dim); padding: 9px 12px; border-radius: 10px; font-size: 14px; margin-bottom: 2px; }
.admin-side a:hover, .admin-side a.on { background: var(--gold-soft); color: #FFEDC2; }
.panel { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-lg); padding: 16px; }
.stat .num { font-size: 24px; font-weight: 800; color: #FFE9B8; }
.stat .lab { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.tbl th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.tbl tr:hover td { background: rgba(237, 230, 214, 0.02); }
.tbl .thumb { width: 72px; border-radius: 8px; display: block; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.wide { grid-column: 1 / -1; }
.form-item label { font-size: 12.5px; color: var(--text-dim); }
.form-item label .req { color: var(--danger); margin-left: 3px; }
.form-item input, .form-item select, .form-item textarea, #assoc-q {
  background: rgba(237, 230, 214, 0.05); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; outline: none; font-family: inherit;
  transition: border-color 0.15s ease;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus, #assoc-q:focus { border-color: var(--gold-line); }
.form-item textarea { min-height: 84px; resize: vertical; }

/* 下拉菜单暗色适配 (BOSS反馈: 原生弹层白底浅字看不清)
 * select 本体已是暗色, 但展开的下拉弹层由浏览器/OS 渲染, 默认白底+浅字对比度不足。
 * ① :root 已设 color-scheme:dark 令弹层按暗色渲染; ② 此处显式兜底 option 配色。 */
select { color-scheme: dark; }
select option {
  background-color: var(--card-solid);
  color: var(--text);
}
fieldset.fgroup { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px 18px; margin-bottom: 16px; }
fieldset.fgroup legend { padding: 0 8px; font-size: 13px; color: #FFEDC2; font-weight: 600; letter-spacing: 1px; }
.btn {
  display: inline-block; border: none; cursor: pointer; border-radius: 999px;
  padding: 10px 22px; font-size: 14px; font-weight: 700; color: var(--bg);
  background: linear-gradient(135deg, var(--accent), #E0A33A);
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-ghost { background: var(--card-solid); border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: linear-gradient(135deg, #E25B6B, #B43A4A); color: #FFF5F5; }
.btn-ghost.disabled, .btn-danger.disabled, .btn.disabled { opacity: 0.35; pointer-events: none; cursor: default; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--text-dim); }
.totp-box { text-align: center; padding: 10px 0; }
.totp-box .qr svg { width: 220px; height: 220px; background: #fff; border-radius: 14px; padding: 10px; }
.otp-input { font-size: 26px; letter-spacing: 10px; text-align: center; width: 220px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-dim); margin: 12px 0; }
.region-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.channel-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 8px; align-items: end; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12.5px; }

/* ---------- 区域(需求5 新增) ---------- */
/* ---------- 需求16: 星表联想 UI (7 类零定义补全, WCAG AA) ---------- */
.assoc-search { position: relative; }
.assoc-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  z-index: 30;
  background: var(--card-solid);           /* #1E2C4F 暗底面板 */
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.assoc-item {
  display: block; width: 100%; text-align: left;
  min-height: 44px;                        /* 移动端触控目标 ≥44px */
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  background: var(--bg-soft);              /* 列表行 #111B38 */
  border: none; border-bottom: 1px solid var(--border);
  color: var(--text);                      /* 月光白 AA 11.7:1 */
  cursor: pointer;
}
.assoc-item:hover, .assoc-item:focus-visible {
  background: #2A3B63;                     /* hover 提亮, 文字仍 AA */
}
.assoc-empty {
  min-height: 44px; padding: 10px 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #B8C0D9;         /* 暗底 AA 7.1:1 (dim 居中) */
  background: var(--card-solid);
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.assoc-chip-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 10px; margin-bottom: 8px;
}
.assoc-chip-name {
  color: var(--text); font-size: 14px; font-weight: 600;  /* AA 11.7:1 */
}
.assoc-chip-code {
  color: var(--accent);                    /* 星野金 #F2B84B AA 9.5:1 */
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12.5px; letter-spacing: 0.4px;
  background: var(--gold-soft); border-radius: 999px; padding: 2px 9px;
}

.capture-region {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: rgba(12, 18, 38, 0.55); padding: 12px 14px; margin-bottom: 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.capture-region.active { border-color: var(--gold-line); box-shadow: 0 0 0 1px var(--gold-line); }
.region-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; cursor: pointer; user-select: none;
}
.region-title { font-size: 13.5px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; }
.region-header .hint { font-weight: 400; }

/* ---------- 需求7: 免责文案 + 详情页星表字段 ---------- */
.footer .footer-disclaimer {
  max-width: 860px; margin: 6px auto 0; padding: 0 16px;
  color: var(--text); opacity: 1; line-height: 1.7;
  overflow-wrap: anywhere;
}
.detail-disclaimer {
  color: var(--text-dim); font-size: 12px; line-height: 1.7;
  margin-top: 12px; max-width: 860px; overflow-wrap: anywhere;
}
.spec td { overflow-wrap: anywhere; }   /* 防长英文/连续编号撑破单元格 (UI §2.4.2) */
/* ---------- 联系站长页 (需求10) ---------- */
.contact-card { max-width: 560px; margin: 30px auto; text-align: center; border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-lg); padding: 34px 28px; }
.contact-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.contact-sub { color: var(--text-dim); font-size: 14px; line-height: 1.8; margin-bottom: 18px; }
.contact-email a { color: var(--accent); font-size: 20px; font-weight: 700; letter-spacing: 0.3px; word-break: break-all; }
.contact-email a:hover { text-decoration: underline; }
.contact-note { color: var(--text-dim); font-size: 12.5px; margin-top: 20px; }
@media (max-width: 640px) {
  /* 详情页表格移动端堆叠 (UI §2.4.1 方案A): 标签在上、值在下 */
  .spec, .spec tbody, .spec tr, .spec th, .spec td { display: block; width: 100%; }
  .spec th { width: 100%; white-space: normal; background: none; }
  .spec td { padding-left: 0; }
}
