/* 猫窝共用样式：第二版「暖纸」风格。配色见 design/README.md，插画在 /img/art/。 */
:root {
  --bg: #F7EEE1; --card: #FBF5EC; --white: #FFFBF5; --border: #EADCC8; --line: #D9C6AC;
  --text: #2A1F17; --text2: #4A3B2F; --muted: #85715F;
  --accent: #B8612E; --accent-hover: #96491D; --accent-line: #D9874F; --accent-soft: #F6E2CC;
  --danger: #A2402A;
  --ok-bg: #E4E6CC; --ok-text: #5E6B32;
  --secret-bg: #F6DCD3; --secret-text: #A9503C;
  --shadow: 0 1px 2px rgba(120, 80, 40, .06), 0 4px 14px rgba(120, 80, 40, .07);
  --tabbar-h: 68px;
}
body.night {
  --bg: #1F1E1D; --card: #2A2927; --white: #30302E; --border: #3A3936; --line: #4A4945;
  --text: #F0EEE6; --text2: #E5E3DA; --muted: #B7B5AD;
  --accent: #C6613F; --accent-hover: #D9764F; --accent-line: #E38B6D; --accent-soft: #3A2A24;
  --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased; transition: background-color .4s, color .4s;
  min-height: 100vh;
}
/* 纸张纹理：很淡的噪点，只在白天 */
body:not(.night) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
.serif { font-family: "Noto Serif SC", serif; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

header.bar { display: flex; align-items: center; gap: 10px; padding: 14px 0 10px; }
.icon-btn {
  width: 44px; height: 44px; border: none; background: transparent; color: var(--text); padding: 0; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; text-decoration: none;
}
.icon-btn:hover { background: var(--card); }
.pill { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: var(--card); color: var(--text2); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pill.ok { background: var(--ok-bg); color: var(--ok-text); }
.pill.secret { background: var(--secret-bg); color: var(--secret-text); }

.btn {
  height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--card); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
body.night .btn.danger { color: #E38B6D; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

input, textarea, select {
  font: inherit; color: var(--text); background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; width: 100%; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-line); }
label.field { display: block; font-size: 12px; color: var(--muted); margin: 14px 0 6px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.section-title { font-size: 13px; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 0; line-height: 1.7; }

/* 小节标题：像刷了一笔的纸签，后面一条细线 */
.ribbon { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.ribbon .tag {
  font-family: "Noto Serif SC", serif; font-weight: 600; font-size: 19px; color: var(--text); padding: 5px 16px 5px 12px;
  background: linear-gradient(100deg, transparent 0, #EFDCC2 6%, #F2E2CB 90%, transparent 100%); border-radius: 6px 14px 8px 12px;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.ribbon .rule { flex-grow: 1; height: 1px; background: var(--accent-line); opacity: .55; }
.ribbon .more { font-size: 14px; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; background: var(--white); border: 1px solid var(--border); color: var(--text2);
  overflow: hidden; font-family: "Noto Serif SC", serif;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.me { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-soft); }
body.night .avatar.me { background: var(--text); color: var(--bg); }

/* 插画装饰：不挡点击 */
.deco { position: absolute; pointer-events: none; user-select: none; -webkit-user-select: none; }
.art { display: block; pointer-events: none; user-select: none; -webkit-user-select: none; }

/* 底部四个按钮 */
.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(251, 245, 236, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 18px rgba(120, 80, 40, .06);
}
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tabbar a {
  height: 52px; border-radius: 18px; text-decoration: none; color: var(--text2); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.tabbar a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 28px); transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; display: none; max-width: calc(100% - 32px); z-index: 60;
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* 底部弹出的小面板 */
.sheet-mask { position: fixed; inset: 0; z-index: 40; background: rgba(42, 31, 23, .32); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(42, 31, 23, .18);
}
.sheet-panel .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet-panel h2 { font-family: "Noto Serif SC", serif; font-size: 22px; margin: 0 0 4px; }

/* 狼人杀的投票结果：按「谁被投了」分组装在一个框里（房间页和归档页共用） */
.votebox { align-self: stretch; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); font-size: 13px; }
.votebox .vb-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.votebox .vb-row { padding: 6px 0; border-top: 1px dashed var(--border); }
.votebox .vb-title + .vb-row { border-top: none; }
.votebox .vb-to { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; color: var(--text); }
.votebox .vb-row.top .vb-to { color: var(--accent); }
.votebox .vb-n { font-weight: 600; white-space: nowrap; }
.votebox .vb-from { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.votebox .abstain .vb-to { font-weight: 400; color: var(--muted); }
