  * { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --paper: #f3ead5;
    --paper-deep: #ece0c4;
    --bg: #f3ead5;
    --card: #fffdf6;
    --primary: #a63226;
    --primary-deep: #8c2318;
    --primary-soft: #f7e8e2;
    --text: #3a2a1c;
    --text-sub: #7d6b53;
    --text-muted: #a9987c;
    --border: #e7dcc2;
    --shadow: 0 4px 20px rgba(90, 64, 20, .10);
    --shadow-hover: 0 8px 28px rgba(90, 64, 20, .16);
    --radius: 16px;
    --red: #a63226;
    --orange: #b08323;
    --gold: #b08323;
    --gold-deep: #8a6414;
    --green: #2f7d4f;
  }
  html, body {
    height: 100%;
    overflow-x: hidden;
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", sans-serif;
    background:
      radial-gradient(1200px 500px at 85% -10%, rgba(176,131,35,.10), transparent 60%),
      radial-gradient(900px 400px at 5% 100%, rgba(166,50,38,.08), transparent 55%),
      var(--paper);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
  }
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 32px;
  }
  .app {
    width: 100%;
    max-width: 1440px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
  }
  @media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    body { padding: 12px 10px; }

    /* 顶栏换行：第一行标题+工具箱，第二行导航按钮 */
    .cal-header { flex-wrap: wrap; gap: 12px; padding: 16px 14px 14px; }
    .cal-title { gap: 8px; }
    .cal-title .month { font-size: 24px; letter-spacing: 1px; }
    .tool-link { padding: 8px 12px; margin-left: auto; }
    .cal-nav { flex: 1 1 100%; justify-content: space-between; gap: 4px; }
    .nav-btn { width: 40px; height: 38px; font-size: 15px; }
    .today-btn, .mode-btn { height: 38px; padding: 0 14px; }

    /* 日历主体 */
    .weekdays { padding: 10px 8px 2px; }
    .weekdays span { font-size: 12px; padding: 4px 0; }
    .days { padding: 6px 8px 14px; gap: 3px; }
    .day { border-radius: 9px; padding: 3px 1px; }
    .day .solar { font-size: 17px; }
    .day .lunar { font-size: 10px; margin-top: 2px; }
    .day .festival { font-size: 9px; padding: 1px 3px; border-radius: 6px; }
    .day .dot { width: 4px; height: 4px; margin-top: 4px; }

    /* 全年视图卡片 */
    .year-view { padding: 10px 10px 18px; gap: 10px; }

    /* 月份水印 */
    .month-watermark { font-size: 220px; letter-spacing: -4px; opacity: .06; }

    /* 年份选择弹层防溢出 */
    .year-picker { width: 230px; max-width: calc(100vw - 48px); }

    /* 右侧详情卡片 */
    .side { padding: 18px 16px; gap: 18px; }
    .selected-date { padding: 18px 12px; }
    .selected-date .big { font-size: 40px; }
  }
  @media (max-width: 380px) {
    .cal-title .month { font-size: 21px; }
    .tool-link { font-size: 12px; padding: 7px 10px; }
    .day .solar { font-size: 15px; }
    .day .lunar { font-size: 9px; }
    .month-watermark { font-size: 180px; }
  }
  .card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transition: box-shadow .3s;
  }
  .card:hover { box-shadow: var(--shadow-hover); }
  .card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 50%, var(--primary-deep) 100%);
  }

  /* Header */
  .cal-header {
    padding: 26px 32px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .cal-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .cal-title .month {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .cal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .nav-btn {
    width: 34px;
    height: 34px;
    border: none;
    background: var(--bg);
    color: var(--text-sub);
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .nav-btn:hover { background: var(--primary-soft); color: var(--primary); transform: scale(1.08); }
  .today-btn {
    height: 34px;
    padding: 0 16px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 3px 10px rgba(166,50,38,.3);
  }
  .today-btn:hover { opacity: .92; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(166,50,38,.38); }
  .tool-link {
    text-decoration: none;
    font-size: 13px;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 7px 14px;
    border-radius: 10px;
    transition: all .2s;
    white-space: nowrap;
    font-weight: 500;
  }
  .tool-link:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

  /* Weekdays */
  .weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 16px 20px 6px;
    text-align: center;
  }
  .weekdays span {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 0;
  }
  .weekdays span.weekend { color: var(--red); }

  /* Days grid */
  .days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 10px 16px 22px;
    gap: 6px;
  }
  .day {
    aspect-ratio: 1 / 1.05;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all .2s ease;
    padding: 6px 2px;
    border: 1.5px solid transparent;
  }
  .day:hover {
    background: var(--primary-soft);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(166,50,38,.12);
  }
  .day.outside { opacity: .28; }
  .day.outside:hover { background: var(--bg); transform: none; box-shadow: none; }
  .day .solar {
    font-size: 21px;
    font-weight: 600;
    line-height: 1.1;
  }
  .day .lunar {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 4px;
    line-height: 1;
    font-weight: 500;
  }
  .day.weekend .solar { color: var(--red); }
  .day.today {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    box-shadow: 0 6px 16px rgba(166,50,38,.4);
    border-color: transparent;
  }
  .day.today::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 16px;
    border: 2px solid var(--primary);
    opacity: .5;
    animation: pulse-ring 2s ease-out infinite;
    pointer-events: none;
  }
  @keyframes pulse-ring {
    0% { transform: scale(.98); opacity: .55; }
    70% { transform: scale(1.08); opacity: 0; }
    100% { transform: scale(1.08); opacity: 0; }
  }
  .day.today .solar,
  .day.today .lunar { color: #fff; }
  .day.selected {
    background: var(--primary-soft);
    border-color: var(--primary);
  }
  .day.selected.today { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%); border-color: transparent; }
  .day .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--orange);
    margin-top: 5px;
    flex: 0 0 auto;
  }
  .day .dot.holiday { background: var(--red); }
  .day .dot.jieqi { background: var(--green); }
  .day.today .dot { background: rgba(255,255,255,.85); }
  .day .festival {
    font-size: 11px;
    color: var(--red);
    margin-top: 3px;
    line-height: 1;
    font-weight: 600;
    background: rgba(166,50,38,.08);
    padding: 1px 6px;
    border-radius: 8px;
  }
  .day.today .festival { color: #ffe0dd; background: rgba(255,255,255,.18); }

  /* 视图切换按钮 */
  .mode-btn {
    height: 34px;
    padding: 0 14px;
    border: none;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
  }
  .mode-btn:hover { background: var(--primary); color: #fff; }
  .mode-btn.active { background: var(--primary); color: #fff; }

  /* 年份选择器 */
  .year-picker-wrap { position: relative; display: inline-block; }
  .cal-title .year {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    border: 1px solid var(--primary-soft);
    background: var(--primary-soft);
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 9px;
    transition: all .2s ease;
    font-family: inherit;
    line-height: 1.4;
  }
  .cal-title .year:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(166,50,38,.28);
    transform: translateY(-1px);
  }
  .year-caret { font-size: 10px; opacity: .6; margin-left: 2px; }
  .year-picker {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.10);
    padding: 10px;
    z-index: 100;
    animation: ypFade .18s ease;
  }
  @keyframes ypFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
  .year-picker[hidden] { display: none; }
  .yp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .yp-nav {
    width: 26px; height: 26px;
    border: none;
    background: var(--bg);
    color: var(--text-sub);
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
  }
  .yp-nav:hover { background: var(--primary-soft); color: var(--primary); }
  .yp-decade {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 1px;
  }
  .yp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .yp-cell {
    height: 36px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    border-radius: 9px;
    cursor: pointer;
    transition: all .15s;
  }
  .yp-cell:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
  .yp-cell.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
  .yp-cell.out-of-range { color: var(--text-muted); opacity: .4; cursor: not-allowed; background: transparent; }
  .yp-cell.out-of-range:hover { background: transparent; border-color: var(--border); color: var(--text-muted); }

  /* 全年视图 */
  .year-view {
    display: none;
    padding: 8px 20px 26px;
  }
  body.year-mode .year-view { display: grid; }
  body.year-mode #weekdays,
  body.year-mode .days { display: none; }
  .year-view {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
  @media (max-width: 1100px) { .year-view { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 720px)  { .year-view { grid-template-columns: repeat(2, 1fr); } }
  @media (max-width: 360px)  { .year-view { grid-template-columns: 1fr; } }

  /* 月份背景水印数字 */
  .cal-body { position: relative; }
  .month-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(190px, 50vw, 430px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--primary);
    opacity: .07;
    pointer-events: none;
    user-select: none;
    z-index: 0;
  }
  .cal-body .weekdays,
  .cal-body .days,
  .cal-body .year-view { position: relative; z-index: 1; }
  body.year-mode .month-watermark { display: none; }

  .ym-card {
    background: var(--bg);
    border-radius: 14px;
    padding: 12px 10px 12px;
    transition: all .2s ease;
    border: 1px solid transparent;
  }
  .ym-card:hover {
    box-shadow: 0 6px 18px rgba(166,50,38,.12);
    transform: translateY(-3px);
    border-color: var(--primary-soft);
  }
  .ym-title {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    padding: 4px 0 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background .18s;
  }
  .ym-title:hover { background: var(--primary-soft); }
  .ym-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
    padding-bottom: 3px;
  }
  .ym-weekdays span { padding: 2px 0; }
  .ym-weekdays .we { color: var(--red); }
  .ym-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
  }
  .ym-day {
    position: relative;
    aspect-ratio: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
  }
  .ym-day:hover { background: var(--primary-soft); transform: scale(1.08); }
  .ym-day.outside { color: var(--text-muted); opacity: .35; }
  .ym-day.we { color: var(--red); }
  .ym-day.today { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 3px 8px rgba(166,50,38,.35); }
  .ym-day.selected { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .ym-day.selected.today { background: var(--primary); color: #fff; }
  .ym-day.has-fest::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px; height: 3px;
    border-radius: 50%;
    background: var(--orange);
  }

  /* Sidebar */
  .side {
    padding: 26px 26px;
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .selected-date {
    text-align: center;
    padding: 22px 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    border-radius: 16px;
    color: #fff;
    box-shadow: 0 6px 18px rgba(166,50,38,.25);
    position: relative;
    overflow: hidden;
  }
  .selected-date::after {
    content: "";
    position: absolute;
    top: -40%; right: -20%;
    width: 120px; height: 120px;
    background: rgba(255,255,255,.12);
    border-radius: 50%;
  }
  .selected-date .big {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0,0,0,.12);
  }
  .selected-date .sub {
    font-size: 13px;
    margin-top: 8px;
    opacity: .95;
    position: relative;
    z-index: 1;
  }
  .info-list { display: flex; flex-direction: column; gap: 2px; }
  .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    transition: background .18s;
  }
  .info-row:hover { background: var(--paper-deep); }
  .info-row:last-child { border-bottom: none; }
  .info-row .label { color: var(--text-sub); }
  .info-row .value { color: var(--text); font-weight: 600; }
  .info-row .value.red { color: var(--red); }
  .info-row .value.green { color: var(--green); }
  .section-title {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
    font-weight: 600;
  }
  .lunar-box {
    background: linear-gradient(135deg, #faf2df 0%, #f7ecdf 100%);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    border: 1px solid var(--border);
  }
  .lunar-box .gz {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-deep);
  }
  .lunar-box .gzsub {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 6px;
    line-height: 1.5;
  }
