/* ===============================
🎛 基礎參數（放大卡片）
=============================== */
:root{
  --w:92mm;      /* ⭐ 卡片變大 */
  --h:150mm;

  --gap-x:6mm;   /* 兩張卡中間距離 */
  --gap-y:18mm;

  --cell-h:4.8mm;   /* ⭐ 每週行距再加大 */
  --fs-title:3.9mm;
  --fs-week:2.4mm;
  --fs-day:2.4mm;

  --card:#F7FAFB;
  --month-title:#5f7b84;
  --brand:#AEBFC4;

  --offday:#4e6f78;
  --memoday:#8aa4ac;
  --termday:#6f8f98;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  background:#e5e7ea;
  font-family:system-ui,-apple-system,"Noto Sans TC",sans-serif;
}

/* ===============================
🔝 控制列
=============================== */
.topbar{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  border-bottom:1px solid #000;
}

/* ===============================
🧾 A4 紙張
=============================== */
.paper{
  width:210mm;
  height:297mm;
  background:#fff;
  box-shadow:0 10px 40px rgba(0,0,0,.15);
  margin:30px auto;

  display:flex;
  align-items:center;
  justify-content:center;
}

/* ===============================
🖼 版心（兩張卡）
=============================== */
.stage{
  width:calc(var(--w)*2 + var(--gap-x));
  display:grid;
  grid-template-columns:var(--w) var(--w);
  column-gap:var(--gap-x);
  justify-content:center;
}

/* ===============================
🎴 卡片
=============================== */
.card{
  width:var(--w);
  height:var(--h);
  border:1px solid rgba(80,100,110,.45);
  background:var(--card);
  overflow:hidden;
  position:relative;
}

/* ===============================
📌 標頭
=============================== */
.card_head{
  display:flex;
  justify-content:space-between;
  padding:4mm 5mm 2.2mm;
  background:linear-gradient(to right,#eef5f7,#f7fafb);
  font-weight:700;
  color:#5f7b84;
}

/* ===============================
📅 月曆區（放大＋留白）
=============================== */
.months{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:2.8mm;
  padding:3mm 4.5mm 2.2mm;
  margin-top:1.4mm;
}

.month_title{
  display:flex;
  justify-content:space-between;
  font-size:var(--fs-title);
  color:var(--month-title);
  border-bottom:0.45px solid #e0e6e8;
  padding-bottom:.7mm;
  margin-bottom:.7mm;
}

/* ⭐ 星期與日期區的「週距離」來自這裡 */
.grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  gap:.28mm;  /* 橫向微增加 */
}

/* ⭐ 固定兩列：上=日期、下=節日（就算沒節日也保留高度） */
.cell{
  height:var(--cell-h);
  display:grid;
  grid-template-rows: 1fr 1fr;  /* 兩列固定 */
  align-items:center;
  justify-items:center;
}

/* 日期列 */
.solar{
  font-size:var(--fs-day);
  font-weight:600;
  line-height:1;
}

/* 節日列（固定佔位高度） */
.holiday_tag{
  font-size:1.35mm;  /* 你原本的值也行 */
  line-height:1;
  min-height:1.35mm; /* ⭐ 保證第二行高度存在 */
  display:flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap; /* 節日不換行 */
}

/* 沒節日：字隱藏但保留高度 */
.no_tag .holiday_tag{
  visibility:hidden;  /* ⭐ 不佔字，但佔空間 */
}

/* ===============================
🗓 顏色層級
=============================== */
.week{
  font-size:var(--fs-week);
  opacity:.55;
}

.cell.sun,.week.sun{ color:#c00; }
.cell.sat,.week.sat{ color:#c00; }

.cell.offday{ color:var(--offday); font-weight:700; }
.cell.memoday{ color:var(--memoday); }
.cell.termday{ color:var(--termday); font-weight:600; }

/* ===============================
🏷 品牌
=============================== */
.brand{
  position:absolute;
  bottom:2mm;
  right:4.5mm;
  font-size:1.8mm;
  letter-spacing:.18em;
  color:var(--brand);
}

/* ===============================
🌙 農曆指定面板
=============================== */
.lunar_panel{
  padding:10px 16px;
  background:#f2f6f7;
  border-bottom:1px solid #cfd8dc;
}

.lp_title{
  font-size:13px;
  font-weight:700;
  margin-bottom:6px;
  color:#506a72;
}

.lp_row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* ===============================
🌙 農曆顏色系（柔和版）
=============================== */
.cell.lunar_main { color:#c15b4e; font-weight:700; }   /* 除夕初一端午中秋 */
.cell.lunar_minor{ color:#8b6caa; }                   /* 初二三四五 七夕 */
.cell.lunar_term { color:#5b8f9b; font-weight:600; }  /* 春分夏至秋分冬至 */
.cell.lunar_ghost{ color:#6f8f70; }                   /* 中元 */

/* ===============================
🖨 列印模式（完全隔離操作區）
=============================== */
@media print{

  *{
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body > *:not(.paper){
    display:none !important;
  }

  .paper{
    margin:0 auto;
    box-shadow:none;
  }

  .card{
    border:0.7px solid rgba(80,100,110,.55);
    box-shadow: inset 0 0 0 0.3px rgba(255,255,255,.6);
  }
}