/* 二次元日历 · 响应式月历 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg1: #fdf2f8;        /* 粉 */
  --bg2: #eef2ff;        /* 淡紫 */
  --ink: #3f3a5a;
  --sub: #8a86a8;
  --pink: #ec4899;
  --pink-soft: #fce7f3;
  --violet: #8b5cf6;
  --card: #ffffff;
  --line: #f1e6f0;
  --today: #c4b5fd;
  --ok: #f59e0b;
}

html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  /* 渐变底色作 fallback，其上叠 miku_desktop.jpg 壁纸 + 淡粉紫遮罩保证可读性 */
  background-color: var(--bg1);
  background-image: linear-gradient(rgba(253, 242, 248, 0.80), rgba(238, 242, 255, 0.84)),
                    url("miku_desktop.jpg");
  background-size: cover, cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
}

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.50);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand::after {
  content: " · 生日与纪念日"; font-size: 12px; font-weight: 400; color: var(--sub); margin-left: 6px;
}
.nav { display: flex; align-items: center; gap: 8px; }
.title-area { display: flex; gap: 6px; }
.sel {
  font-size: 16px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  background: rgba(255, 255, 255, 0.70); cursor: pointer;
}
.icon-btn {
  width: 36px; height: 36px; font-size: 22px; line-height: 1;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.70); cursor: pointer;
  color: var(--ink); transition: all .15s;
}
.icon-btn:hover { background: var(--pink-soft); color: var(--pink); }
.plain-btn {
  font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, 0.70); cursor: pointer; color: var(--ink); transition: all .15s;
}
.plain-btn:hover { background: var(--pink-soft); color: var(--pink); }

/* ---- 搜索 ---- */
.search-box { position: relative; margin-left: auto; flex: 0 1 260px; }
.search-box input {
  width: 100%; padding: 9px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 20px; outline: none;
  background: rgba(255, 255, 255, 0.70); color: var(--ink); transition: border .15s;
}
.search-box input:focus { border-color: var(--pink); background: rgba(255, 255, 255, 0.88); }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; z-index: 60;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(80, 60, 120, .12); max-height: 320px; overflow: auto;
}
.search-results .sr-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.search-results .sr-item:last-child { border-bottom: none; }
.search-results .sr-item:hover { background: var(--pink-soft); }
.sr-item .sr-title { font-size: 14px; font-weight: 600; }
.sr-item .sr-date { font-size: 12px; color: var(--sub); margin-top: 2px; }
.hidden { display: none !important; }

/* ---- 日历 ---- */
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.calendar {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(120, 90, 160, .10);
}
.week-row, .grid-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
}
.week-row { background: linear-gradient(90deg, rgba(252, 231, 243, 0.55), rgba(243, 232, 255, 0.55)); }
.week-cell {
  text-align: center; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--violet);
}
.day-cell {
  min-height: 92px; padding: 8px 10px; cursor: pointer;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  transition: background .12s; position: relative;
}
.grid-row .day-cell:nth-child(7n) { border-right: none; }
.day-cell:hover { background: rgba(252, 231, 243, 0.55); }
.day-cell.other-month { background: rgba(250, 247, 252, 0.18); color: #c9c4dd; }
.day-cell.today { box-shadow: inset 0 0 0 2px var(--today); }
/* 当前浏览（选中）的日期：粉色高亮，优先于"今天" */
.day-cell.selected {
  box-shadow: inset 0 0 0 2px var(--pink);
  background: rgba(236, 72, 153, 0.10);
}
.day-cell.selected.today { box-shadow: inset 0 0 0 3px var(--pink), inset 0 0 0 6px var(--today); }
.day-num { font-size: 15px; font-weight: 600; }
.day-cell.other-month .day-num { font-weight: 400; }
.badge-row { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  font-size: 11px; line-height: 1; padding: 4px 7px; border-radius: 999px; font-weight: 600;
}
.badge-birth { background: var(--pink); color: #fff; }
.badge-event { background: var(--violet); color: #fff; }
.month-hint { text-align: center; color: var(--sub); font-size: 12px; margin-top: 12px; }

/* ---- 生日热度 Top 20 概览 ---- */
.top20-section { margin-top: 28px; }
.top20-section h2 { font-size: 16px; color: var(--violet); margin-bottom: 12px; }
.top20-grid { display: flex; flex-direction: column; gap: 12px; }  /* 竖排长条卡片 */
.t20-card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.50); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; cursor: pointer; transition: transform .12s, background .12s;
}
.t20-card:hover { background: rgba(255, 255, 255, 0.78); transform: translateY(-2px); }
.t20-rank {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(236, 72, 153, .4);
}
.t20-img {
  width: 110px; height: 110px; flex: none;
  object-fit: contain;              /* 完整展示，不裁剪 */
  background: #f5f0fa; border-radius: 10px; display: block;
}
.t20-img-empty { display: flex; align-items: center; justify-content: center; font-size: 34px; }
.t20-info { flex: 1; min-width: 0; }
.t20-name {
  font-size: 15px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.t20-bday-btn {
  appearance: none; display: inline-block; max-width: 100%;
  font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--pink); text-align: left;
  background: linear-gradient(135deg, #fff 0%, var(--pink-soft) 100%);
  border: 1px solid rgba(236, 72, 153, .35); border-radius: 9px;
  padding: 5px 12px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: all .15s;
}
.t20-bday-btn:hover { background: var(--pink); color: #fff; box-shadow: 0 2px 10px rgba(236, 72, 153, .3); }
.t20-bday-btn:disabled { opacity: .55; cursor: wait; }
.t20-greet {
  margin-top: 7px; padding: 9px 12px;
  background: #fffafc; border: 1.5px dashed rgba(236, 72, 153, .45); border-radius: 9px;
  font-size: 13px; line-height: 1.8; color: var(--ink);
  overflow-wrap: anywhere; white-space: pre-wrap;
  cursor: pointer; user-select: text; -webkit-user-select: text;
}
.t20-greet.copied { background: #ffe4ef; border-color: #ec4899; }
.t20-greetwrap { margin-top: 7px; }
.t20-greetwrap .t20-greet { margin-top: 0; }
.t20-regen {
  margin-top: 6px; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #fff, var(--pink-soft));
  border: 1px solid rgba(236, 72, 153, .35); border-radius: 50%;
  color: var(--pink); cursor: pointer;
}
.t20-regen:hover { background: var(--pink); color: #fff; }
.t20-regen:disabled { opacity: .55; cursor: wait; }
.t20-regen.spin svg { animation: t20spin .9s linear infinite; }
@keyframes t20spin { to { transform: rotate(360deg); } }
.t20-detail { font-size: 12px; color: var(--sub); margin-top: 4px; line-height: 1.7; }
/* 长文本自动换行；续行悬挂缩进 3em（对齐"萌点："等三字字段标签） */
.t20-detail div {
  overflow-wrap: anywhere;
  padding-left: 3em;
  text-indent: -3em;
}
.top20-actions { margin-top: 14px; text-align: center; }
.show-all-btn {
  font-size: 14px; font-weight: 600; color: var(--pink);
  border: 1px solid rgba(236, 72, 153, .4); border-radius: 20px;
  padding: 9px 28px; background: rgba(255, 255, 255, 0.55); cursor: pointer;
  transition: all .15s;
}
.show-all-btn:hover { background: var(--pink-soft); }
.show-all-btn:disabled { opacity: .5; cursor: wait; }
.empty-tip { color: var(--sub); font-size: 13px; text-align: center; padding: 26px 0; }
@media (max-width: 480px) {
  .t20-img { width: 84px; height: 84px; }
}

/* ---- 响应式 ---- */
@media (max-width: 720px) {
  .brand::after { display: none; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .search-box { flex: 1 1 100%; order: 9; margin-left: 0; }
  .day-cell { min-height: 64px; padding: 5px 6px; }
  .day-num { font-size: 13px; }
  .badge { font-size: 10px; padding: 3px 5px; }
  .week-cell { padding: 7px 0; font-size: 12px; }
  .day-panel { width: 100vw; max-width: 100vw; }
}
@media (max-width: 420px) {
  .day-cell { min-height: 56px; }
  .title-area .sel { font-size: 14px; padding: 5px 7px; }
}
