/* 许愿池：整体克制正式，用池水蓝和一点硬币金做点缀 */
:root {
  --bg: #f3f6fa;
  --surface: #ffffff;
  --ink: #1b2433;
  --ink-2: #465267;
  --muted: #6b7489;
  --line: #e2e7ef;
  --line-strong: #cdd5e2;

  --pool-1: #0a3556;
  --pool-2: #125c93;
  --pool-3: #2a83c2;
  --pool-soft: #e8f2fb;

  --gold: #efb030;
  --gold-deep: #d99a14;
  --gold-ink: #5f4100;
  --gold-soft: #fff5dc;

  --danger: #c2410c;
  --danger-soft: #fff1ea;
  --ok: #15803d;
  --ok-soft: #e9f7ee;

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 55, .05), 0 1px 3px rgba(15, 30, 55, .06);
  --shadow-md: 0 4px 14px rgba(15, 30, 55, .08), 0 1px 3px rgba(15, 30, 55, .06);
  --shadow-lg: 0 24px 60px rgba(10, 40, 70, .25);
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--pool-2); }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 8px;
  font-weight: 600; font-size: 14px; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn:disabled { cursor: default; opacity: .6; }
.btn:focus-visible, .seg-btn:focus-visible, .vote:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible {
  outline: 3px solid rgba(42, 131, 194, .35); outline-offset: 2px;
}
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 36px; font-size: 16px; border-radius: 999px; letter-spacing: .08em; }
.btn-block { width: 100%; }
.btn-gold { background: var(--gold); color: #3a2800; box-shadow: 0 6px 18px rgba(239, 176, 48, .35); }
.btn-gold:hover:not(:disabled) { background: var(--gold-deep); transform: translateY(-1px); }
.btn-primary { background: var(--pool-2); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--pool-1); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--pool-3); color: var(--pool-2); }
/* 深蓝底上的次要按钮 */
.btn-glass { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .45); color: #fff; font-weight: 500; }
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, .2); border-color: #fff; }

.input, .select {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.7; resize: vertical; min-height: 140px; }
.input::placeholder { color: #a3abbb; }
.input:focus, .select:focus { outline: none; border-color: var(--pool-3); box-shadow: 0 0 0 3px rgba(42, 131, 194, .15); }
.select { width: auto; min-width: 140px; padding-right: 28px; cursor: pointer; }

.seg { display: inline-flex; padding: 3px; background: #e6ebf2; border-radius: 9px; }
.seg-btn {
  height: 30px; padding: 0 16px; border: 0; border-radius: 7px; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.seg-btn.active { background: var(--surface); color: var(--pool-2); box-shadow: var(--shadow-sm); }

.link-btn { padding: 0; border: 0; background: none; color: var(--pool-2); font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- 顶部：池水 ---------- */
/* 公司logo浮在左上角。logo是深蓝字，直接放在深蓝背景上看不清，所以衬一块白色圆角底 */
.hero-brand {
  position: absolute; top: 20px; left: 28px; z-index: 2;
  padding: 8px 14px; background: #fff; border-radius: 10px;
  box-shadow: 0 4px 16px rgba(4, 24, 44, .25);
}
.hero-brand img { display: block; height: 34px; width: auto; }

.hero {
  position: relative; overflow: hidden;
  padding: 64px 20px 100px;
  color: #fff; text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 115%, rgba(120, 190, 240, .35), transparent 70%),
    linear-gradient(165deg, var(--pool-1) 0%, var(--pool-2) 62%, var(--pool-3) 100%);
}
/* 水面上的几圈涟漪 */
.hero::before, .hero::after {
  content: ""; position: absolute; left: 50%; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10); transform: translateX(-50%);
  pointer-events: none;
}
.hero::before { width: 1100px; height: 260px; bottom: -120px; }
.hero::after { width: 700px; height: 160px; bottom: -70px; border-color: rgba(255, 255, 255, .14); }
.hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.hero-title { margin: 0; font-size: 42px; font-weight: 700; letter-spacing: .14em; text-indent: .14em; }
/* 窄屏折行时尽量断在标点后面，别把“许个愿”拆开；实在放不下再随便断 */
.hero-subtitle { margin: 10px 0 0; font-size: 18px; opacity: .95; text-wrap: balance; word-break: keep-all; overflow-wrap: anywhere; }
.hero-intro {
  max-width: 640px; margin: 18px auto 0;
  font-size: 14.5px; line-height: 1.85; opacity: .82; white-space: pre-line;
}
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 14px; margin-top: 28px; min-height: 48px; }
.hero-actions .btn-glass { padding: 0 26px; letter-spacing: .02em; }
.closed-note {
  display: inline-block; padding: 10px 22px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); font-size: 15px;
}
.hero-stats { margin: 18px 0 0; font-size: 13px; opacity: .75; min-height: 1.6em; }
.waves { position: absolute; left: 0; bottom: -1px; width: 100%; height: 70px; display: block; }
.wave-back { fill: rgba(255, 255, 255, .10); }
.wave-front { fill: var(--bg); }

/* ---------- 高频词 ---------- */
.cloud {
  margin: 4px 0 18px; padding: 18px 24px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.cloud-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-bottom: 8px; }
.cloud-title { margin: 0; font-size: 16px; font-weight: 700; }
.cloud-note { margin: 0; color: var(--muted); font-size: 12.5px; }
/* 每个词的位置由app.js里的layoutCloud算好 */
.cloud-words {
  position: relative; max-width: 1000px; margin: 6px auto 0;
  background: radial-gradient(ellipse closest-side, var(--pool-soft), rgba(232, 242, 251, 0));
}
/* 词像水泡一样依次浮上来，之后在原地轻轻漂着 */
.kw {
  position: absolute; left: 0; top: 0;
  padding: 2px 10px; border: 0; border-radius: 999px; background: transparent;
  line-height: 1.4; cursor: pointer; white-space: nowrap;
  transition: background-color .2s, color .2s, opacity .2s, transform .2s;
  animation: kw-in .7s cubic-bezier(.2, .8, .3, 1.3) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.kw span { display: inline-block; animation: kw-float var(--dur, 5s) ease-in-out var(--phase, 0s) infinite alternate; }
.kw:hover { background: var(--pool-soft); transform: scale(1.08); }
.kw:focus-visible { outline: 3px solid rgba(42, 131, 194, .35); outline-offset: 1px; }
.kw.active { background: var(--gold); color: #3a2800; transform: scale(1.08); }
.cloud-words.has-active .kw:not(.active) { opacity: .5; }
.cloud-words.has-active .kw:not(.active):hover { opacity: 1; }
.kw-1 { font-size: 14px; font-weight: 500; }
.kw-2 { font-size: 17px; font-weight: 600; }
.kw-3 { font-size: 22px; font-weight: 600; }
.kw-4 { font-size: 29px; font-weight: 700; }
.kw-5 { font-size: 38px; font-weight: 700; }
.kc-0 { color: #0a3556; }
.kc-1 { color: #125c93; }
.kc-2 { color: #1f6f8b; }
.kc-3 { color: #3b5bab; }
.kc-4 { color: #2a74b0; }
@keyframes kw-in { from { opacity: 0; transform: translateY(18px) scale(.6); } }
@keyframes kw-float { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) {
  .kw, .kw span { animation: none; }
}

.filter-note { margin: -8px 0 14px; color: var(--ink-2); font-size: 13px; }
.filter-note .link-btn { margin-left: 10px; }
mark { padding: 0 1px; border-radius: 3px; background: #ffe9a8; color: inherit; }

/* ---------- 许愿墙 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px 20px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 20px; }
.toolbar .search { flex: 1 1 260px; max-width: 420px; margin-left: auto; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; align-items: start; }

.card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 18px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card.hot { border-color: #f3d58c; }
/* 演示页面上的示例卡片：浅底色、虚线边框，和真实许愿区分开 */
.card.example { background: #f7f9fc; border-style: dashed; border-color: var(--line-strong); box-shadow: none; }
.card.flash { animation: flash 2.6s ease-out; }
@keyframes flash {
  0%, 30% { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(239, 176, 48, .35); }
  100% { border-color: var(--line); box-shadow: var(--shadow-sm); }
}
.card-head { display: flex; align-items: flex-start; gap: 8px; }
.card-title { flex: 1; margin: 0; font-size: 16px; line-height: 1.5; font-weight: 700; word-break: break-word; }
.badge-hot {
  flex: none; margin-top: 2px; padding: 1px 8px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold-ink); font-size: 12px; font-weight: 600;
}
.card-detail {
  margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
.card-detail.clamped { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.card .more { align-self: flex-start; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--line);
}
/* 部门名可能很长（如“卫星运营与数据应用部”），允许折行，日期不能被截掉 */
.card-meta { color: var(--muted); font-size: 12.5px; line-height: 1.5; min-width: 0; }
.card-meta .dot { margin: 0 6px; }
.card-meta .when { white-space: nowrap; }

.vote {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 6px 0 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.vote:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-ink); }
.vote-count {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: #eef1f6; color: var(--ink); font-size: 12.5px; line-height: 22px; text-align: center;
}
.vote.voted { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }
.vote.voted:hover:not(:disabled) { background: #ffeec2; }
.vote:disabled { cursor: progress; }
.vote.voted .vote-count { background: var(--gold); color: #3a2800; }
.vote.pop .vote-count { animation: pop .35s ease-out; }
@keyframes pop { 50% { transform: scale(1.35); } }

.empty { padding: 56px 20px 40px; text-align: center; }
.empty-art { width: 120px; height: 60px; }
.empty-art ellipse { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.empty-title { margin: 12px 0 4px; font-size: 16px; font-weight: 600; color: var(--ink-2); }
.empty-sub { margin: 0; color: var(--muted); }
.empty-link { margin-top: 12px; font-size: 14px; }

.footer { padding: 40px 20px 36px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- 许愿弹窗 ---------- */
.dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgba(8, 36, 60, .5); backdrop-filter: blur(2px); }
.dialog[open] { animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 4px; }
.dlg-head h2 { margin: 0; font-size: 19px; }
.icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: #eef1f6; color: var(--ink); }
.dlg-body { padding: 10px 24px 4px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; }

.form-tip { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

/* 示例弹窗：标题和底部按钮固定，中间的示例列表单独滚动 */
.dialog-wide { width: min(940px, calc(100vw - 32px)); }
.dialog-wide[open] { display: flex; flex-direction: column; }
.ex-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 12px; }
.ex-lead { margin: 0 0 14px; color: var(--ink-2); font-size: 13.5px; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.ex-card { padding: 14px 16px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; }
.ex-title { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }
.ex-line { margin: 6px 0 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.7; }
.ex-tag {
  display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 5px;
  background: #e6ebf2; color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 20px; vertical-align: 1px;
}
.ex-tag.want { background: var(--gold-soft); color: var(--gold-ink); }

.field { position: relative; display: block; margin-bottom: 16px; }
.field .label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field .label em { margin-left: 3px; color: var(--danger); font-style: normal; }
.field .label small { margin-left: 6px; color: var(--muted); font-weight: 400; font-size: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row .field { margin-bottom: 8px; }
.counter { position: absolute; top: 1px; right: 0; color: var(--muted); font-size: 12px; }
.counter.full { color: var(--danger); }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
.form-error {
  margin: 8px 0 0; padding: 8px 12px; border-radius: 8px;
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 100;
  max-width: calc(100vw - 32px); padding: 11px 22px; border-radius: 999px;
  background: #1f2937; color: #fff; font-size: 14px; box-shadow: var(--shadow-md);
  opacity: 0; transform: translate(-50%, 8px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

/* ---------- 后台 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(165deg, var(--pool-1), var(--pool-2) 70%, var(--pool-3));
}
.login-card {
  width: 360px; max-width: 100%; padding: 32px 28px 28px;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo { display: block; height: 36px; width: auto; margin: 0 auto 6px; }
.login-card h1 { margin: 14px 0 4px; font-size: 20px; }
.login-card p.muted { margin: 0 0 18px; font-size: 13px; }
.login-card .input { height: 42px; margin-bottom: 12px; }
.login-card .form-error { margin: -4px 0 12px; text-align: left; }
.login-card .btn { height: 42px; }

.admin-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.brand img { display: block; height: 26px; width: auto; }
.brand-sep { width: 1px; height: 20px; background: var(--line-strong); }
.spacer { flex: 1; }
.admin-main { max-width: 1440px; margin: 0 auto; padding: 20px 24px 40px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tile-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.tile-label { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.tile-num.on { color: var(--ok); font-size: 18px; line-height: 1.6; }
.tile-num.off { color: var(--danger); font-size: 18px; line-height: 1.6; }

.admin .toolbar { margin: 0 0 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table.data { width: 100%; min-width: 1100px; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  position: sticky; top: 0; padding: 10px 12px;
  background: #f5f7fb; border-bottom: 1px solid var(--line);
  color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-align: left; white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfd; }
table.data tr.is-hidden td { background: #fafafa; color: var(--muted); }
table.data tr.is-hidden .cell-title { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.col-id { width: 64px; } .col-dept { width: 110px; } .col-contact { width: 170px; } .col-votes { width: 70px; }
.col-time { width: 150px; } .col-ip { width: 170px; } .col-status { width: 80px; } .col-op { width: 96px; }
td.num { font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.cell-title { font-weight: 700; margin-bottom: 4px; word-break: break-word; }
.cell-detail { color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; word-break: break-word; cursor: pointer; border-radius: 4px; }
.cell-detail:focus-visible { outline: 3px solid rgba(42, 131, 194, .35); outline-offset: 2px; }
.cell-detail.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cell-contact { word-break: break-all; }
.cell-empty { padding: 48px 12px !important; text-align: center; color: var(--muted); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag-on { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: #eef0f3; color: var(--muted); }
.table-note { margin: 10px 2px 0; color: var(--muted); font-size: 12.5px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
  .hero-brand { top: 12px; left: 12px; padding: 5px 9px; border-radius: 8px; }
  .hero-brand img { height: 24px; }
  .brand img { height: 22px; }
  .hero { padding: 64px 16px 84px; }
  .hero-title { font-size: 32px; }
  .hero-subtitle { font-size: 16px; }
  .hero-intro { font-size: 13.5px; text-align: left; }
  .container { padding: 0 16px 16px; }
  .toolbar .search { max-width: none; margin-left: 0; }
  .cloud { padding: 14px 12px 14px; }
  .kw { padding: 2px 7px; }
  .kw-1 { font-size: 13px; }
  .kw-2 { font-size: 15px; }
  .kw-3 { font-size: 18px; }
  .kw-4 { font-size: 22px; }
  .kw-5 { font-size: 28px; }
  .kw-minor { display: none; }
  .grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .ex-grid { grid-template-columns: 1fr; }
  .hero-actions .btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
  .dlg-head, .dlg-body, .dlg-foot { padding-left: 18px; padding-right: 18px; }
  .admin-bar { padding: 10px 16px; flex-wrap: wrap; }
  .admin-main { padding: 16px; }
}
