/* 天黑请开会 —— 现代清爽底 + 狼人杀游戏细节 */
:root {
  --bg: #f6f4ef;            /* 羊皮纸暖白 */
  --card: #ffffff;
  --ink: #2b2b33;
  --ink-soft: #6b6b76;
  --line: #e8e4da;
  --accent: #6d5ef0;        /* 夜幕紫 */
  --accent-soft: #efeaff;
  --gold: #e8a13c;          /* 烛光金 */
  --free: #3fae7a;          /* 空闲绿 */
  --free-deep: #1d7a4f;
  --danger: #e05c5c;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(43, 43, 51, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

#app { max-width: 720px; margin: 0 auto; padding: 20px 16px 80px; }

/* ---- 顶部招牌 ---- */
.brand { text-align: center; padding: 28px 0 8px; }
.brand .moon { font-size: 40px; display: inline-block; animation: sway 4s ease-in-out infinite; }
@keyframes sway { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.brand h1 { font-size: 30px; letter-spacing: 4px; margin-top: 6px; }
.brand p { color: var(--ink-soft); margin-top: 6px; font-size: 14px; letter-spacing: 1px; }

/* ---- 卡牌 ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 18px;
  animation: deal 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes deal {
  from { opacity: 0; transform: translateY(18px) rotate(-1deg) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h2 .tag { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 2px 10px; font-weight: 600; }

label.field { display: block; margin-bottom: 14px; font-size: 13px; color: var(--ink-soft); }
label.field span { display: block; margin-bottom: 6px; font-weight: 600; }

/* 日期选择器：整块可点，右侧显示星期 */
.date-picker { position: relative; display: flex; align-items: center; }
.date-picker input[type="date"] { flex: 1; padding-right: 52px; cursor: pointer; font-weight: 600; }
.date-picker input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; right: 8px; width: 32px; height: 32px; cursor: pointer; }
.date-picker .weekday { position: absolute; right: 34px; font-size: 12px; color: var(--accent); font-weight: 700; pointer-events: none; }
input[type="text"], input[type="date"], input[type="number"], select {
  width: 100%; padding: 11px 12px; font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; background: #fbfaf7; outline: none;
}
input:focus, select:focus { border-color: var(--accent); background: #fff; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

button {
  font-family: inherit; cursor: pointer; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; transition: transform 0.12s, box-shadow 0.12s;
}
button:active { transform: scale(0.96); }
.btn-primary {
  width: 100%; padding: 14px; color: #fff; font-size: 16px; letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent), #8b7cf6);
  box-shadow: 0 8px 20px rgba(109, 94, 240, 0.35);
}
.btn-primary:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; }
.btn-ghost { padding: 9px 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.btn-gold { padding: 9px 16px; background: #fdf3e2; color: #b0782a; font-size: 13px; }
.btn-danger { padding: 9px 16px; background: #fdecec; color: var(--danger); font-size: 13px; }

.hint { font-size: 12px; color: var(--ink-soft); margin-top: 10px; line-height: 1.6; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---- 参会人勾选 ---- */
.member-picker { max-height: 190px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px; background: #fbfaf7; }
.member-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.member-item:hover { background: var(--accent-soft); }
.member-item input { width: 16px; height: 16px; accent-color: var(--accent); }
.member-item.myself span { color: var(--accent); font-weight: 700; }

/* ---- 返回条 ---- */
.nav-back {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  padding: 8px 14px 8px 10px; border-radius: 99px; background: var(--card);
  box-shadow: var(--shadow); font-size: 13px; font-weight: 700; color: var(--ink);
  text-decoration: none; transition: transform 0.12s, background 0.15s;
}
.nav-back:hover { background: var(--accent-soft); transform: translateX(-2px); }
.nav-back .arrow { font-size: 15px; line-height: 1; }

/* ---- 身份条 ---- */
.whoami { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 99px; padding: 8px 14px; box-shadow: var(--shadow); margin-top: 16px; }
.whoami img, .whoami .avatar-ph { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.whoami b { font-size: 14px; }
.whoami .role { margin-left: auto; font-size: 12px; color: var(--gold); font-weight: 700; }

/* ---- 日历格子 ---- */
.grid-wrap { overflow-x: auto; margin-top: 6px; }
.cal { display: grid; gap: 3px; user-select: none; touch-action: pan-y; }
.cal .corner { font-size: 10px; }
.cal .day-head { font-size: 12px; font-weight: 700; text-align: center; padding: 6px 2px; border-radius: 8px; background: #f3f1ea; }
.cal .day-head small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 10px; margin-top: 2px; }
.cal .hour-label { font-size: 10px; color: var(--ink-soft); text-align: right; padding-right: 5px; align-self: center; }
.cell {
  height: 30px; border-radius: 7px; background: #f1efe8; border: 1.5px solid transparent;
  transition: background 0.15s, border 0.15s, transform 0.1s; position: relative; overflow: hidden;
}
.cell.mine { background: var(--free); }
.cell.mine.edge { transform: scale(1.06); }
.cell.picking { border-color: var(--free-deep); }
/* 看大家：只在共同有空的格子里叠一个小人图标，不动任何背景色 */
.cell.final { background: var(--gold) !important; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(232,161,60,0.5); } 50% { box-shadow: 0 0 0 7px rgba(232,161,60,0); } }

.grid-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.legend { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--ink-soft); margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -2px; }
.legend .heat-note { font-style: normal; color: #9a9c8c; font-size: 11px; }
/* 热力渐变条：右侧标注"共同有空" */

/* 日期列头上的"当天全部有空" */
.day-head .day-all {
  display: block; width: 100%; margin-top: 4px; padding: 2px 0; font-size: 10px; font-weight: 700;
  background: #fff; color: var(--accent); border: 1px solid var(--line); border-radius: 6px;
}
.day-head .day-all:hover { background: var(--accent-soft); }
.day-head .day-all.on { background: var(--free); color: #fff; border-color: var(--free); }

/* ---- 玩家列表 ---- */
.players { display: flex; flex-wrap: wrap; gap: 8px; }
.player { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; font-size: 13px; background: #f3f1ea; }
.player img, .player .avatar-ph { width: 24px; height: 24px; border-radius: 50%; background: #ddd; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.player.done { background: #e6f5ee; color: var(--free-deep); font-weight: 600; }
.player.waiting { color: var(--ink-soft); }
.player .dot { font-size: 10px; }

.progress-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.progress-bar { flex: 1; height: 8px; border-radius: 99px; background: #eee; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--free), var(--free-deep)); border-radius: 99px; transition: width 0.5s; }

/* ---- 天亮结算 ---- */
.daybreak { text-align: center; padding: 10px 0 4px; }
.daybreak .sun { font-size: 44px; display: inline-block; animation: rise 0.8s ease-out both; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.daybreak h3 { margin-top: 8px; font-size: 19px; }
.window-list { margin-top: 14px; display: grid; gap: 8px; }
.window-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; background: #f8fbf6; border: 1.5px solid #dcecdf; font-size: 14px; }
.window-item b { color: var(--free-deep); }
.window-item.can-pick { cursor: pointer; }
.window-item.can-pick:hover { border-color: var(--gold); background: #fdf8ee; }

.final-banner { text-align: center; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, #fdf3e2, #fde8c8); margin-top: 6px; }
.final-banner .gavel { font-size: 36px; }
.final-banner h3 { margin-top: 6px; font-size: 18px; color: #8a5a1d; }
.final-banner p { margin-top: 4px; color: #a5712f; font-size: 14px; }

.share-box { display: flex; gap: 8px; margin-top: 12px; }
.share-box input { flex: 1; font-size: 12px; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 99px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.25s, bottom 0.25s; z-index: 99;
}
.toast.show { opacity: 1; bottom: 56px; }

.section-gap { margin-top: 26px; }
.creator-only { border: 1.5px dashed var(--gold); }
.empty-tip { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 20px 0; }

/* ---- 历史局记录 ---- */
.record-list { display: grid; gap: 8px; }
.record-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; background: #f7f6f1;
  text-decoration: none; color: var(--ink); transition: background 0.15s, transform 0.12s;
}
.record-row:hover { background: #f1efe9; transform: translateX(2px); }
.record-row b { font-size: 14px; display: block; }
.record-row small { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.record-right { text-align: right; font-size: 13px; white-space: nowrap; }
.record-right small { margin-top: 2px; }
