.calendar-shell { max-width: 960px; margin: 28px auto; padding: 16px 12px 100px; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0; }
.calendar-toolbar button, .calendar-toolbar input { font: inherit; padding: 10px 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: white; color: #0f172a; }
.calendar-week, #calendarDays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-week { text-align: center; font-weight: 700; margin-bottom: 10px; }
.mansion-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 128px; padding: 8px 3px; border: 1px solid #dbe3ed; border-radius: 12px; background: white; color: #0f172a; cursor: pointer; font: inherit; }
.mansion-day strong { font-size: 26px; }
.mansion-day small { font-size: 11px; overflow-wrap: anywhere; }
.mansion-day[aria-pressed="true"] { outline: 3px solid currentColor; outline-offset: -3px; background: #fffdf5; }
.mansion-day[aria-current="date"] > span { font-weight: 900; text-decoration: underline; }
.good { color: #15803d; } .bad { color: #b91c1c; }
#mansionDetail { margin: 18px 0; padding: 16px; border-radius: 12px; background: #f1f5f9; color: #0f172a; line-height: 1.8; }
.calendar-note { color: #64748b; line-height: 1.6; }
@media (max-width: 480px) { .calendar-shell { padding-left: 6px; padding-right: 6px; } .calendar-week, #calendarDays { gap: 3px; } .mansion-day { min-height: 120px; } .mansion-day small { font-size: 9px; } }
/* The reference book uses green for medium, blue for good, red for unfavorable. */
.mansion-green, #dayDialog[data-color="green"] { --mansion-ink: #39763c; color: var(--mansion-ink); }
.mansion-blue, #dayDialog[data-color="blue"] { --mansion-ink: #293b89; color: var(--mansion-ink); }
.mansion-red, #dayDialog[data-color="red"] { --mansion-ink: #a32d40; color: var(--mansion-ink); }
.book-legend { display: flex; flex-wrap: wrap; gap: 10px 20px; font-weight: 700; font-size: 13px; }
.mansion-day { background: #fffef9; border-color: #c9c4b9; border-radius: 3px; min-height: 152px; }
.mansion-day > span, .mansion-day .day-pillar { color: #333; }
.mansion-day strong { font-family: 'Noto Serif CJK SC', 'SimSun', serif; font-size: 32px; font-weight: 400; }
.mansion-day .mansion-rating { font-weight: 700; margin-top: auto; }
.mansion-day:focus-visible, .calendar-toolbar button:focus-visible { outline: 3px solid #475569; outline-offset: 2px; }
#dayDialog { width: min(560px, calc(100% - 32px)); max-height: 85dvh; overflow-y: auto; box-sizing: border-box; border: 1px solid #c9c4b9; border-top: 5px solid var(--mansion-ink); border-radius: 12px; background: #fffef9; padding: 24px; box-shadow: 0 20px 70px #0004; }
#dayDialog::backdrop { background: #0f172a88; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.detail-header h2 { color: var(--mansion-ink); font-size: 36px; margin: 6px 0; }
#detailDate { color: #64748b; font-size: 13px; margin: 0; }
#closeDetail { background: transparent; color: #334155; border: 1px solid #c9c4b9; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.detail-rating { color: var(--mansion-ink); font-weight: 800; }
#detailMeaning { font-family: 'Noto Sans Khmer', 'Khmer OS', 'Leelawadee UI', sans-serif; font-size: 18px; line-height: 2; }
.pillar-details { color: #334155; background: #f2efe7; padding: 14px; border-radius: 8px; margin: 20px 0; }
.pillar-details h3 { margin: 0 0 12px; }.pillar-details h3 span { float: right; }
.pillar-details dl { margin: 0; }.pillar-details dt { font-size: 12px; color: #64748b; }.pillar-details dd { margin: 4px 0 12px; font-weight: 700; }
#dayDialog details { color: #475569; line-height: 1.9; } #dayDialog summary { cursor: pointer; }
@media (max-width: 480px) { .mansion-day { min-height: 145px; } .mansion-day strong { font-size: 28px; } #dayDialog { padding: 18px; } }
.mansion-day .day-officer { color: #334155; border-top: 1px solid #d8d3c8; padding-top: 5px; width: 100%; line-height: 1.8; }
.officer-details { color: #334155; border-top: 1px solid #d8d3c8; margin-top: 20px; padding-top: 8px; }
.officer-details h4 { margin: 12px 0 6px; }
.officer-details p { margin: 0 0 14px; font-family: 'Noto Sans Khmer', 'Khmer OS', 'Leelawadee UI', sans-serif; line-height: 2; }
.mansion-day .day-pillar { font-size: 11px; line-height: 1.5; font-weight: 600; }
@media (max-width: 480px) { .mansion-day .day-pillar { font-size: 9px; } }
.mansion-day .day-pillar[data-element], .pillar-details [data-element] { color: var(--element-color); }
[data-element="wood"] { --element-color: #16a34a; }
[data-element="fire"] { --element-color: #dc2626; }
[data-element="earth"] { --element-color: #b45309; }
[data-element="metal"] { --element-color: #9ca3af; }
[data-element="water"] { --element-color: #2563eb; }
