/* 亲子活动日历 —— 移动端优先 */
:root {
  --fg: #1f2933;
  --muted: #616e7c;
  --line: #e4e7eb;
  --bg: #f7f9fa;
  --card: #ffffff;
  --accent: #c2410c;
  --accent-soft: #fff1e7;
  --today: #176b3a;
  --today-soft: #e7f5ec;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.5;
}

/* 登录页 */
#loginPanel {
  max-width: 320px; margin: 18vh auto 0; padding: 0 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
#loginPanel h2 { font-size: 18px; margin-bottom: 12px; }
#loginPanel label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
#loginPanel input {
  width: 100%; margin-top: 4px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
#loginPanel button {
  width: 100%; margin-top: 16px; padding: 10px;
  border: 0; border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 15px;
}
#loginMsg { margin-top: 10px; font-size: 13px; color: var(--accent); min-height: 1em; }

/* 头部 */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}
.hrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
h1 { font-size: 18px; }
.hlinks { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.hlinks a { color: var(--muted); text-decoration: none; }
.hlinks button {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 6px; padding: 2px 8px; font-size: 12px;
}
.controls { display: flex; gap: 10px; flex-wrap: wrap; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: var(--card); color: var(--muted);
  padding: 5px 12px; font-size: 13px;
}
.seg button.on { background: var(--accent); color: #fff; }

/* 导航 */
#calNav {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px;
}
#rangeLabel { font-size: 16px; font-weight: 600; min-width: 110px; text-align: center; }
#calNav button {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; padding: 4px 12px; font-size: 15px; color: var(--fg);
}
#todayBtn { font-size: 13px; color: var(--muted); }

/* 月视图网格: 手机上整体加宽横向滑动, 每列 110px, 活动名两行可读 */
#calendar {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px;
}
.mgrid {
  display: grid; grid-template-columns: repeat(7, 110px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
  width: max-content;
}
.whead { text-align: center; font-size: 12px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.cell { min-height: 64px; padding: 3px; border-top: 1px solid var(--line); min-width: 0; cursor: pointer; }
.cell:nth-child(7n+8) { border-left: 1px solid var(--line); }
.cell.out .dnum { color: #cbd2d9; }
.cell.today { background: var(--today-soft); }
.cell.today .dnum { color: var(--today); font-weight: 700; }
.dnum { font-size: 12px; color: var(--muted); }
/* 月视图 chip: 首行时间, 名字最多两行; 点击进活动详情 */
.chip {
  font-size: 10px; line-height: 1.3; margin-top: 2px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 4px; padding: 1px 3px;
  max-width: 100%; overflow: hidden;
  cursor: pointer;
}
.chip:active { opacity: 0.6; }
.chip .t { display: block; font-size: 9px; color: var(--muted); }
.chip .n {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; word-break: break-word;
}
/* 周视图 chip: 内联完整详情 */
.chip.big {
  font-size: 13px; padding: 6px 8px; color: var(--fg);
  background: var(--accent-soft);
}
.chip.big .dname { font-weight: 600; }
.chip.big i { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 2px; }
.chip.big .loc { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.chip.big i.reg, .chip.big .reg {
  display: block; font-size: 11px; margin-top: 2px;
  color: var(--accent); font-weight: 600;
}
.more { font-size: 10px; color: var(--muted); margin-top: 2px; cursor: pointer; padding: 1px 0; }
.more:active { opacity: 0.6; }

/* 周视图: 纵向 7 行 */
.wgrid { display: flex; flex-direction: column; gap: 6px; }
.wrow {
  display: flex; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px;
}
.wday { width: 52px; flex: none; text-align: center; padding-top: 4px; }
.wday .wname { display: block; font-size: 12px; color: var(--muted); }
.wday .wdate { display: block; font-size: 15px; font-weight: 600; }
.wday.today .wdate { color: var(--today); }
.wev { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }

/* 活动列表 */
#agenda { padding: 16px 10px 40px; }
#agenda h2 { font-size: 15px; margin: 0 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.hist { font-size: 13px; font-weight: 400; color: var(--muted); }
.item {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px;
  padding: 10px 12px; cursor: pointer;
}
.item:active { background: var(--bg); }
.item .chev { color: var(--muted); font-size: 12px; }
.item .name { font-weight: 600; flex: 1; min-width: 120px; }
.item .time { color: var(--muted); font-size: 13px; }
.item.done .name { color: var(--muted); }
.badge {
  font-size: 11px; border-radius: 4px; padding: 1px 5px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.st1 { background: var(--today-soft); color: var(--today); }
.badge.st2 { background: #eef1f4; color: var(--muted); }
.badge.wait { background: #fdf3d7; color: #8a6d1a; }

.empty { text-align: center; color: var(--muted); padding: 30px 0; }
footer { text-align: center; color: #9aa5b1; font-size: 12px; padding-bottom: 30px; }

/* 桌面增强: 容器够宽, 月网格自适应列宽, 不需要滚动 */
@media (min-width: 720px) {
  body { max-width: 860px; margin: 0 auto; }
  #calendar { padding: 0; }
  .mgrid { grid-template-columns: repeat(7, 1fr); width: auto; }
  .cell { min-height: 92px; }
  .chip { font-size: 11px; }
  #agenda { padding: 16px 0 40px; }
}
