
  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  :root {
    --bg: #f2f2f7;
    --card: #ffffff;
    --header-bg: #ffffff;
    --primary: #e53935;
    --today-bg: #e53935;
    --today-text: #ffffff;
    --text-main: #1c1c1e;
    --text-sub: #8e8e93;
    --text-red: #e53935;
    --text-week: #8e8e93;
    --border: #e5e5ea;
    --cell-border: #ececec;
    --hk-badge: #e53935;
    --cn-badge: #ff8f00;
    --radius: 16px;
    --shadow: 0 2px 12px rgba(0,0,0,0.07);
  }

  html, body {
    height: 100%;
    background: var(--bg);
    font-family: -apple-system, 'PingFang HK', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-main);
    overflow-x: hidden;
  }

  #app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100%;
  }

  /* ── Top Header ── */
  #top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .header-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  #top-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-main);
  }

  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .today-pill {
    display: inline-flex;
    align-items: center;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
  }

  .refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f7;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    gap: 4px;
    transition: background 0.15s;
    -webkit-appearance: none;
    appearance: none;
  }

  .refresh-btn:active {
    background: #e5e5ea;
  }

  .refresh-icon {
    font-size: 13px;
    line-height: 1;
  }

  .legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
  }

  .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-sub);
  }

  .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
  }

  .legend-dot.hk { background: var(--hk-badge); }
  .legend-dot.cn { background: var(--cn-badge); }

  /* ── Scroll Container ── */
  #scroll-container {
    padding: 16px 12px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  /* ── Month Card ── */
  .month-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .month-header {
    padding: 16px 18px 10px;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .month-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.2px;
  }

  .month-year {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-sub);
  }

  /* ── Weekday Row ── */
  .weekday-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--cell-border);
    border-bottom: 1px solid var(--cell-border);
  }

  .weekday-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-week);
    padding: 6px 0;
  }

  .weekday-label.red { color: var(--text-red); }

  /* ── Days Grid ── */
  .days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* draw column dividers via background */
  }

  /* ── Day Cell ── */
  .day-cell {
    /* fixed column width via grid, height auto-expands */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 3px 7px;
    min-width: 0;
    border-right: 1px solid var(--cell-border);
    border-bottom: 1px solid var(--cell-border);
    position: relative;
  }

  /* Remove right border on last column */
  .day-cell:nth-child(7n) {
    border-right: none;
  }

  .day-num-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
    flex-shrink: 0;
  }

  .day-num {
    font-size: 18px;
    font-weight: 500;
    line-height: 1;
  }

  /* Today */
  .day-cell.today .day-num-wrap {
    background: var(--today-bg);
  }
  .day-cell.today .day-num {
    color: var(--today-text);
    font-weight: 700;
  }

  /* Red day */
  .day-cell.red-day:not(.today) .day-num { color: var(--text-red); }

  /* ── Holiday Badges ── */
  .badges {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
  }

  .badge {
    font-size: 9px;
    line-height: 1.3;
    text-align: center;
    width: 100%;
    padding: 1px 2px;
    border-radius: 3px;
    white-space: normal;       /* allow wrap */
    word-break: keep-all;
    overflow-wrap: anywhere;
    font-weight: 500;
  }

  .badge.hk {
    background: #ffebee;
    color: #c62828;
  }

  .badge.cn {
    background: #fff8e1;
    color: #e65100;
  }

  /* ── Empty cell ── */
  .day-cell.empty {
    border-right: 1px solid var(--cell-border);
    border-bottom: 1px solid var(--cell-border);
    min-height: 52px;
  }
  .day-cell.empty:nth-child(7n) {
    border-right: none;
  }

  /* ── Year separator ── */
  .year-sep {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-sub);
    letter-spacing: 2px;
    padding: 4px 0 2px;
  }
