/* =========================================================
   落朵机器人论坛 · 样式（色彩渲染 + kiosk 触屏优先）
   调色板：生态绿(主) / 暖珊瑚(强调·机器人温度) / 琥珀(高亮)
   ========================================================= */

:root {
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --primary: #11A675;
  --primary-strong: #0C8A60;
  --primary-soft: #E4F5EC;
  --accent: #FF6B6B;
  --accent-soft: #FFE9E9;
  --amber: #F5A524;
  --amber-soft: #FDF1DA;
  --text: #1E2A24;
  --muted: #6E7C74;
  --border: #EAE5DC;
  --shadow: 0 6px 24px rgba(20, 40, 30, .08);
  --shadow-lg: 0 18px 50px rgba(20, 40, 30, .18);
  --radius: 16px;
  --radius-sm: 10px;
}

[data-theme="dark"] {
  --bg: #0E1512;
  --surface: #16201B;
  --surface-2: #1B261F;
  --primary: #2DD4A0;
  --primary-strong: #23B98C;
  --primary-soft: #11302A;
  --accent: #FF7A85;
  --accent-soft: #3A1F22;
  --amber: #FBBF24;
  --amber-soft: #2E2410;
  --text: #E8F0EC;
  --muted: #93A69C;
  --border: #26332C;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--amber));
  box-shadow: var(--shadow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; }
.brand-text span { font-size: 12px; color: var(--muted); }

.search { flex: 1; max-width: 460px; }
.search input {
  width: 100%; height: 42px; padding: 0 16px;
  border: 1px solid var(--border); border-radius: 22px;
  background: var(--surface-2); color: var(--text); font-size: 14px;
  outline: none; transition: border .2s, box-shadow .2s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.top-actions { display: flex; align-items: center; gap: 12px; }
.machine-chip {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--primary-strong);
  background: var(--primary-soft); padding: 7px 13px; border-radius: 20px;
}
.machine-chip .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 0 var(--primary); animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); font-size: 18px; transition: transform .15s, background .2s;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--surface-2); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-strong); box-shadow: var(--shadow); }
.btn.soft { background: var(--primary-soft); color: var(--primary-strong); border: none; }
.btn.block { width: 100%; margin-top: 10px; }

/* ---------- 三栏布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 290px;
  gap: 22px; max-width: 1320px; margin: 22px auto; padding: 0 22px;
  align-items: start;
}
.rail {
  position: sticky; top: 86px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.rail-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 4px 2px 10px; letter-spacing: .3px; }
.sort-title { margin-top: 18px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cat {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--radius-sm); font-size: 14px;
  color: var(--text); cursor: pointer; transition: background .15s, color .15s;
}
.cat:hover { background: var(--surface-2); }
.cat.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.cat-ico { font-size: 17px; }

.sort-tabs { display: flex; gap: 8px; }
.sort {
  flex: 1; padding: 9px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600;
}
.sort.active { background: var(--amber-soft); color: var(--amber); border-color: transparent; }

/* ---------- 话题流 ---------- */
.feed { min-width: 0; }
.robot-host {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, var(--primary-soft), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.robot-ava {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; background: #fff; box-shadow: var(--shadow);
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.robot-text { flex: 1; line-height: 1.4; }
.robot-text strong { font-size: 15px; }
.robot-text p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.robot-text .at { color: var(--accent); font-weight: 700; }

.feed-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 14px; }
.feed-head h2 { font-size: 19px; margin: 0; }
.online { font-size: 13px; color: var(--primary-strong); }

.topic-list { display: flex; flex-direction: column; gap: 14px; }
.topic-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s;
  animation: rise .35s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ava {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; flex: none;
}
.tc-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tc-author { font-size: 13px; font-weight: 600; }
.tc-time { font-size: 12px; color: var(--muted); }
.tag {
  margin-left: auto; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 20px;
  background: var(--primary-soft); color: var(--primary-strong); white-space: nowrap;
}
.tc-title { font-size: 16px; font-weight: 700; margin: 2px 0 6px; line-height: 1.4; }
.tc-excerpt { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-foot { display: flex; align-items: center; gap: 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.tc-foot .stat { display: flex; align-items: center; gap: 6px; }
.tc-foot .hot { color: var(--accent); font-weight: 700; }
.tc-foot .spacer { margin-left: auto; }

/* ---------- 机子面板 ---------- */
.machine-card { margin-bottom: 18px; }
.mc-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.mc-ico { font-size: 28px; }
.mc-head strong { display: block; font-size: 14px; }
.mc-sub { font-size: 12px; color: var(--muted); }
.mc-stats { list-style: none; display: flex; padding: 0; margin: 0 0 12px; gap: 8px; }
.mc-stats li {
  flex: 1; text-align: center; background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 4px; display: flex; flex-direction: column; gap: 2px;
}
.mc-stats b { font-size: 19px; color: var(--primary-strong); }
.mc-stats span { font-size: 11px; color: var(--muted); }
.mc-bar { height: 7px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-bottom: 12px; }
.mc-fill { display: block; height: 100%; width: 72%; border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--amber)); transition: width .6s ease; }
.mc-tip { font-size: 12px; color: var(--muted); margin: 10px 2px 0; line-height: 1.5; }

.hot-card { padding-top: 4px; }
.hot-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hot-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
}
.hot-item:hover { background: var(--surface-2); }
.hot-rank { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--amber-soft); color: var(--amber); flex: none; }
.hot-name { font-size: 13px; }

/* ---------- 弹层 ---------- */
/* 关键修复：强制 hidden 属性生效。否则 .overlay( display:grid )/.skeleton-wrap( display:flex )
   会覆盖浏览器默认的 [hidden]{display:none}，导致弹层与骨架屏常驻显示并遮住页面
   （登录框关不掉、按钮点不到、点叉无反应）。 */
[hidden] { display: none !important; }

.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(10, 18, 14, .5); backdrop-filter: blur(4px); padding: 24px;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: min(720px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg);
  animation: pop .25s cubic-bezier(.2,.9,.3,1.2);
}
.modal.small { width: min(400px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 15px;
}
.modal h3 { margin: 0 0 6px; font-size: 19px; }
.modal input, .modal textarea {
  width: 100%; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 14px;
  outline: none; font-family: inherit; resize: vertical;
}
.modal input:focus, .modal textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.muted { color: var(--muted); font-size: 13px; }
.hint { font-size: 13px; color: var(--accent); min-height: 18px; margin: 8px 2px 0; }

/* ---------- 详情 ---------- */
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.detail-title { font-size: 22px; font-weight: 800; margin: 8px 0 14px; line-height: 1.4; }
.post-main {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; line-height: 1.7; font-size: 15px;
}
.robot-answer {
  display: flex; gap: 12px; margin: 16px 0; padding: 14px 16px;
  background: linear-gradient(120deg, var(--primary-soft), var(--surface));
  border: 1px dashed color-mix(in srgb, var(--primary) 50%, var(--border)); border-radius: var(--radius);
}
.robot-answer .ava { background: linear-gradient(135deg, var(--primary), var(--amber)); }
.ra-body strong { color: var(--primary-strong); }
.ra-body p { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: var(--text); }
.ra-loading { color: var(--muted); animation: raPulse 1.2s ease-in-out infinite; }
@keyframes raPulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.ra-sign { color: var(--muted); font-size: 13px; margin-top: 8px !important; }

.replies-title { font-size: 15px; font-weight: 700; margin: 20px 0 10px; }
.reply {
  display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border);
}
.reply .body { flex: 1; min-width: 0; }
.reply .r-author { font-size: 13px; font-weight: 700; }
.reply .r-text { font-size: 14px; line-height: 1.6; margin: 3px 0 0; }
.reply .r-foot { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; gap: 14px; }
.reply .r-foot .like { cursor: pointer; }
.reply .r-foot .like.on { color: var(--accent); font-weight: 700; }

/* ---------- 骨架屏 ---------- */
.skeleton-wrap { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.sk {
  height: 96px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--text); color: var(--surface); padding: 12px 22px; border-radius: 24px;
  font-size: 14px; z-index: 80; box-shadow: var(--shadow-lg); animation: rise .3s ease;
}

/* ---------- 响应式 / kiosk ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail.left { order: 1; }
  .feed { order: 2; }
  .rail.right { order: 3; }
}
@media (min-width: 1600px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr) 320px; max-width: 1500px; }
}

/* ---------- 站点信息栏（备案/日期/版本/在线文档） ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 22px 26px; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--border); margin-top: 10px; background: var(--surface);
}
.sf-item { white-space: nowrap; }
.sf-sep { color: var(--border); }
.sf-link { color: var(--primary-strong); text-decoration: none; font-weight: 600; transition: color .15s; }
.sf-link:hover { color: var(--primary); text-decoration: underline; }
.sf-muted { opacity: .85; }
