:root {
  --bg: #0f0e17;
  --card: #1a1825;
  --card2: #232032;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --lu: #ff6b81;       /* 撸 = 红粉 */
  --bulu: #2ed573;     /* 不撸 = 绿 */
  --text: #e8e6f0;
  --muted: #8b87a3;
  --danger: #ff4757;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1d1a2e 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent2); }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 60px; }

/* ===== 居中卡片（登录/注册）===== */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.card {
  background: var(--card);
  border: 1px solid #2a2740;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid #34304d; background: var(--card2); color: var(--text); font-size: 15px;
}
input:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 20px; padding: 12px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.secondary { background: var(--card2); border: 1px solid #34304d; }

.cf-slot { margin-top: 16px; min-height: 65px; }
.cf-slot:empty { min-height: 0; }

.switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.msg { margin-top: 14px; font-size: 14px; padding: 10px 12px; border-radius: 8px; display: none; }
.msg.show { display: block; }
.msg.err { background: rgba(255,71,87,.12); color: #ff8593; }
.msg.ok  { background: rgba(46,213,115,.12); color: #4cd790; }

/* ===== 顶栏 ===== */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { font-size: 20px; font-weight: 700; }
.brand span { color: var(--accent2); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--card2); border: 2px solid #34304d; }
.me .name { font-size: 14px; }
.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.linkbtn:hover { color: var(--text); }

/* ===== 轮盘区 ===== */
.roulette-card { text-align: center; margin-bottom: 22px; }
.wheel-box { position: relative; width: 260px; height: 260px; margin: 8px auto 18px; }
.wheel {
  position: relative;
  width: 100%; height: 100%; border-radius: 50%;
  background: conic-gradient(var(--lu) 0 50%, var(--bulu) 50% 100%);
  border: 6px solid #2a2740; box-shadow: 0 0 0 6px #15131f, 0 14px 40px rgba(0,0,0,.5);
  transition: transform 4s cubic-bezier(.17,.67,.21,1);
}
/* 文字是轮盘的子元素，跟着色块一起转；JS 用 translate(-50%,-50%) rotate(-deg) 让字保持正向 */
.wheel-label {
  position: absolute; top: 50%; left: 50%;
  color: #fff; font-weight: 800; font-size: 22px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform 4s cubic-bezier(.17,.67,.21,1);
}
.wheel-label.lu   { margin-left: 62px; }   /* 撸 → 右半（红）中心 */
.wheel-label.bulu { margin-left: -62px; }  /* 不撸 → 左半（绿）中心 */
.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 22px solid #ffd32a; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); z-index: 2;
}
.result-big { font-size: 30px; font-weight: 800; margin: 6px 0; min-height: 40px; }
.result-big.lu { color: var(--lu); }
.result-big.bulu { color: var(--bulu); }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ===== 图表 ===== */
.section-title { font-size: 16px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.dot.lu { background: var(--lu); } .dot.bulu { background: var(--bulu); }

/* 网格热力图 */
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; font-size: 12px; }
table.grid th, table.grid td { padding: 0; text-align: center; }
table.grid .userc { text-align: left; padding-right: 12px; white-space: nowrap; position: sticky; left: 0; background: var(--card); }
table.grid .userc img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 6px; object-fit: cover; }
.cell { width: 22px; height: 22px; border-radius: 5px; margin: 2px; display: inline-flex; align-items: center; justify-content: center; background: var(--card2); vertical-align: middle; }
.cell.lu { background: var(--lu); } .cell.bulu { background: var(--bulu); }
.daycol { color: var(--muted); font-size: 10px; writing-mode: vertical-rl; height: 46px; }
.ratio { color: var(--muted); padding-left: 10px; white-space: nowrap; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab { padding: 6px 14px; border-radius: 20px; background: var(--card2); border: 1px solid #34304d; color: var(--muted); cursor: pointer; font-size: 13px; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 设置弹层 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { width: 100%; max-width: 360px; }
.modal h3 { margin: 0 0 16px; }
.avatar-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.avatar-edit img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid #34304d; }
.row { display: flex; gap: 10px; }
.row .btn { margin-top: 0; }

/* ===== 手动选择 ===== */
.manual { margin-top: 16px; }
.manual-or { color: var(--muted); font-size: 13px; }
.btn.lu { background: var(--lu); }
.btn.bulu { background: var(--bulu); }

/* ===== 打卡输入区 ===== */
.checkin { margin-top: 22px; padding-top: 18px; border-top: 1px solid #2a2740; text-align: left; }
.checkin-title { font-weight: 700; margin-bottom: 10px; }
textarea#noteInput {
  width: 100%; padding: 11px 13px; border-radius: 10px; resize: vertical;
  border: 1px solid #34304d; background: var(--card2); color: var(--text);
  font: inherit; font-size: 15px;
}
textarea#noteInput:focus { outline: none; border-color: var(--accent); }
.checkin-photo {
  max-width: 100%; max-height: 240px; border-radius: 12px;
  margin: 12px 0 0; display: block; object-fit: cover; border: 1px solid #34304d;
}
.checkin .row .btn { margin-top: 0; }

/* 网格里的打卡相机角标 */
.cam { position: relative; font-size: 11px; line-height: 1; cursor: pointer; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.cam-n {
  position: absolute; top: -6px; right: -8px;
  background: var(--accent); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 13px; height: 13px; line-height: 13px; padding: 0 3px; border-radius: 7px; text-align: center;
}

/* ===== 信息流 ===== */
.feed { display: flex; flex-direction: column; gap: 14px; }
.feed.collapsed > .post-card:nth-child(n+4) { display: none; }
.post-card { background: var(--card2); border: 1px solid #2a2740; border-radius: 12px; padding: 14px 16px; }
.post-top { display: flex; align-items: center; gap: 10px; }
.post-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #34304d; flex: none; }
.post-meta { min-width: 0; }
.post-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.post-time { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; color: #fff; }
.badge.lu { background: var(--lu); } .badge.bulu { background: var(--bulu); }
.post-note { margin: 12px 2px 0; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }

/* 长帖（文字 + 图）整体折叠：max-height 始终在（短帖不会被裁），渐变 + 按钮只在 JS 量到溢出加 has-more 后才出现 */
.post-body { max-height: 300px; overflow: hidden; position: relative; }
.post-body.expanded { max-height: none; }
.post-body.has-more:not(.expanded)::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3em;
  background: linear-gradient(180deg, rgba(35,32,50,0), var(--card2));
  pointer-events: none;
}
.post-expand {
  display: none; margin: 6px 2px 0; padding: 2px 0;
  background: none; border: none; color: var(--accent2); font-size: 13px; cursor: pointer;
}
.post-expand.show { display: inline-block; }
.post-expand:hover { text-decoration: underline; }
.post-img { margin-top: 12px; max-width: 100%; max-height: 60vh; border-radius: 12px; cursor: zoom-in; display: block; }

.post-cmts { margin-top: 12px; }
.post-cmts:empty { margin-top: 0; }
.post-cmts .cmt:last-child { margin-bottom: 0; }
.cmt { display: flex; gap: 10px; margin-bottom: 10px; }
.cmt-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid #34304d; }
.cmt-main { flex: 1; min-width: 0; }
.cmt-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.cmt-head b { color: var(--text); font-size: 13px; }
.cmt-reply-btn { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.cmt-reply-btn:hover { color: var(--accent2); }
.cmt-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.cmt-del:hover { color: var(--danger); }
.cmt-body { color: var(--text); font-size: 14px; margin-top: 2px; word-break: break-word; white-space: pre-wrap; }
.cmt-at { color: var(--accent2); font-weight: 600; margin-right: 2px; }
.cmt-empty { color: var(--muted); font-size: 13px; padding: 8px 2px; text-align: center; }

/* 回复（B 站 / 小黑盒 风格）：子评论缩进，浅一档底色 */
.cmt.cmt-child { margin-left: 38px; background: var(--card); padding: 8px 10px; border-radius: 8px; }
.cmt.cmt-child .cmt-av { width: 24px; height: 24px; }

/* 行内回复输入框：紧跟在被回复评论后 */
.cmt-reply-form { display: flex; gap: 8px; margin: 0 0 10px 38px; }
.cmt-reply-form input {
  flex: 1; padding: 7px 10px; border-radius: 8px;
  border: 1px solid #34304d; background: var(--card); color: var(--text); font-size: 13px;
}
.cmt-reply-form input:focus { outline: none; border-color: var(--accent); }
.cmt-reply-form button {
  border: none; padding: 0 14px; border-radius: 8px; cursor: pointer; font-size: 13px; flex: none;
}
.cmt-reply-form .cmt-reply-send { background: var(--accent); color: #fff; }
.cmt-reply-form .cmt-reply-cancel { background: var(--card2); border: 1px solid #34304d; color: var(--text); }

.comment-form { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #2a2740; }
.comment-form .cmt-in { flex: 1; padding: 9px 12px; border-radius: 9px; border: 1px solid #34304d; background: var(--card); color: var(--text); font-size: 14px; }
.comment-form .cmt-in:focus { outline: none; border-color: var(--accent); }
.comment-form .btn { margin-top: 0; width: auto; padding: 0 16px; flex: none; }

/* 看大图 */
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
