/* --- 基本スタイル --- */
:root {
    --font-family-base: 'M PLUS Rounded 1c', sans-serif;
    --color-text: #5a5a5a;
    --color-background: #fff;
    --color-border: #e0e0e0;
    --color-accent-light: #fdf6f6;
    /* Pale pink */
    --color-accent-medium: #f8e8e8;
    /* Light pink for hover/focus */
    --color-accent-dark: #e8f8f0;
    /* Mint green */
    --color-gold: #e1c699;
    --color-silver: #c0c0c0;
    --color-weekday: #a0a0a0;
    --color-event-bg: #f5f5f5;
    /* Event day background */
    --color-today-bg: #fff0f5;
    /* Today background */
    --color-today-text: #d1455f;
    --color-other-month: #ccc;
    --calendar-max-width: 650px;
    --border-radius: 12px;
    /* Slightly more rounded */
    --gradient-bg: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    /* Background gradient */
}

html {
    scroll-behavior: smooth;
    /* Smooth scrolling for page-top link */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-family-base);
    background: var(--gradient-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* メインコンテンツエリア */
.main-content-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* --- カレンダーウィジェット --- */
.calendar-widget {
    background-color: rgba(255, 255, 255, 0.95);
    /* Slightly less transparent */
    padding: 25px;
    /* More padding */
    border-radius: var(--border-radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    max-width: var(--calendar-max-width);
    width: 100%;
    border: 3px solid transparent;
    /* Border space for current month */
    transition: border-color 0.3s ease;
}

/* 今月表示用の枠線 */
.calendar-widget.is-current-month {
    border-color: var(--color-gold);
    /* Example: gold border */
}

/* --- カレンダーヘッダー --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    /* タイトル追加のため少し詰める */
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.calendar-title {
    font-size: 1.5em;
    /* Larger title */
    font-weight: 700;
    color: #444;
    /* Darker title text */
    margin: 0;
    position: relative;
    padding-right: 50px;
    /* Space for badge */
    transition: color 0.3s ease;
}

/* 今月表示用のバッジ */
.calendar-title.is-current-month::after {
    content: '今月';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--color-gold);
    /* Match border */
    color: white;
    font-size: 0.6em;
    padding: 4px 8px;
    /* Slightly larger badge */
    border-radius: 10px;
    font-weight: bold;
    line-height: 1;
}

.calendar-nav {
    background: none;
    border: none;
    font-size: 2em;
    /* Larger arrows */
    color: #999;
    cursor: pointer;
    padding: 0 10px;
    transition: color 0.2s ease;
}

.calendar-nav:hover:not(:disabled) {
    color: #555;
}

.calendar-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.calendar-nav:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
    border-radius: 4px;
    /* Optional: add rounding to focus outline */
}

/* --- カレンダーコンテンツタイトル --- */
.calendar-content-title {
    text-align: center;
    font-size: 1.1em;
    /* ヘッダータイトルより少し小さめ */
    font-weight: 700;
    color: var(--color-gold);
    /* アクセントカラー使用 */
    margin-top: 10px;
    /* ヘッダーとの間隔 */
    margin-bottom: 15px;
    /* テーブルとの間隔 */
    letter-spacing: 1px;
    /* 文字間隔 */
}


/* --- カレンダー本体 --- */
.calendar-body {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.calendar-body th {
    padding: 10px 5px;
    /* More padding */
    font-size: 0.9em;
    color: var(--color-weekday);
    border-bottom: 2px solid var(--color-border);
    /* Thicker bottom border */
    font-weight: 700;
}

.calendar-body td {
    padding: 8px 5px;
    /* Adjusted padding */
    border: 1px solid #f0f0f0;
    position: relative;
    height: 120px;
    /* Increased height for more info */
    vertical-align: top;
    font-size: 0.85em;
    /* Base font size for cell */
    transition: background-color 0.2s ease;
}

/* --- 日付セル共通 --- */
.calendar-day {
    cursor: default;
    /* Default cursor */
}

/* フォーカススタイル */
.calendar-day[tabindex="0"]:focus {
    outline: 2px solid var(--color-gold);
    outline-offset: -1px;
    /* Inside border */
    z-index: 1;
    background-color: var(--color-accent-medium);
}


/* 日付数字 */
.calendar-day__date {
    display: block;
    margin-bottom: 5px;
    font-weight: 700;
    font-size: 1.1em;
    /* Relative to cell font size */
    color: #666;
}

/* --- イベントがある日のスタイル --- */
.calendar-day--event-day {
    background-color: var(--color-event-bg);
    cursor: help;
    /* Indicate more info available */
}

.calendar-day--event-day:hover {
    background-color: #eee;
    /* Slight hover effect */
}

.calendar-day__event-info {
    font-size: 0.9em;
    /* Relative to cell font size */
    text-align: left;
    padding: 0 4px;
    /* Inner padding */
    color: #555;
    max-height: calc(100% - 35px);
    /* Adjust based on date number height+margin */
    overflow-y: auto;
    /* Scroll if content exceeds height */
    /* Simple scrollbar styling (optional) */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

/* Webkit scrollbar styling */
.calendar-day__event-info::-webkit-scrollbar {
    width: 4px;
}

.calendar-day__event-info::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 2px;
}


.calendar-day__event-title {
    font-weight: 700;
    font-size: 1.05em;
    /* Slightly larger than details */
    margin-bottom: 4px;
    color: #333;
    display: flex;
    align-items: center;
}

.calendar-day__event-title .moon-icon {
    margin-right: 4px;
    font-size: 1.3em;
    vertical-align: middle;
}

.calendar-day__event-details p {
    margin: 2px 0;
    font-size: 0.95em;
    display: flex;
    align-items: flex-start;
    /* Align icon top with text */
    line-height: 1.4;
}

.calendar-day__event-details p .icon {
    margin-right: 5px;
    font-size: 1em;
    /* Icon size relative to p */
    min-width: 1.2em;
    text-align: center;
    padding-top: 0.1em;
    /* Fine-tune vertical alignment */
}

/* --- イベントがない日のスタイル --- */
.calendar-day--no-event {
    /* background-color: #fafafa; */
    /* Optional different bg */
}

/* 今月の月情報 (イベントがない日用) */
.monthly-moon-info {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    font-size: 0.85em;
    /* Relative to cell font size */
    color: #aaa;
    white-space: nowrap;
    /* Prevent wrapping */
}

.monthly-icon {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.7);
    /* Slight bg for readability */
    padding: 1px 3px;
    border-radius: 4px;
}

.monthly-icon .moon-icon {
    font-size: 1.1em;
    /* Icon size */
    margin-right: 2px;
}

.monthly-date {
    font-size: 0.9em;
    /* Date number size */
    font-weight: bold;
}

/* --- その他の日付スタイル --- */
.calendar-day--other-month {
    color: var(--color-other-month);
    background-color: #fdfdfd !important;
    /* Override event/today bg */
    cursor: default;
}

.calendar-day--other-month .calendar-day__date,
.calendar-day--other-month .monthly-moon-info {
    opacity: 0.5;
}

.calendar-day.today .calendar-day__date {
    background-color: var(--color-today-bg);
    color: var(--color-today-text);
    font-weight: bold;
    border-radius: 50%;
    /* Circle around today's date */
    width: 1.8em;
    /* Adjust size */
    height: 1.8em;
    /* Adjust size */
    display: inline-flex !important;
    /* Override display block */
    justify-content: center;
    align-items: center;
    margin: 0 auto 5px auto;
    /* Center the circle */
}

/* --- フッター --- */
footer {
    background-color: rgba(0, 0, 0, 0.05);
    /* Subtle background */
    padding: 20px;
    text-align: center;
    color: #555;
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    box-sizing: border-box;
}

footer .social-links {
    margin-bottom: 10px;
}

footer .social-links a {
    display: inline-block;
    margin: 0 8px;
    /* More space */
    padding: 6px 15px;
    /* More padding */
    border-radius: 18px;
    /* More rounded */
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--color-gold);
    /* Use accent color */
    font-size: 0.9em;
    font-weight: 700;
    /* Bolder */
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

footer .social-links a:hover {
    background-color: var(--color-gold);
    color: white;
}

footer .copyright {
    font-size: 0.8em;
    color: #777;
    margin: 0;
}

/* --- ページトップボタン --- */
.page-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px 15px;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.2em;
    opacity: 0;
    /* Initially hidden */
    visibility: hidden;
    /* Initially hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
    z-index: 100;
}

.page-top.show {
    /* Class added by JS */
    opacity: 1;
    visibility: visible;
}

.page-top:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.page-top:focus-visible {
    /* Added focus style */
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}


/* --- レスポンシブ対応 --- */
@media (max-width: 600px) {
    body {
        padding: 1em;
    }

    .main-content-area {
        padding: 10px;
    }

    .calendar-widget {
        padding: 15px;
    }

    .calendar-header {
        margin-bottom: 8px;
        /* タイトル追加のため調整 */
        padding-bottom: 10px;
    }

    .calendar-title {
        font-size: 1.2em;
        padding-right: 40px;
        /* Adjust badge space */
    }

    .calendar-title.is-current-month::after {
        font-size: 0.55em;
        padding: 3px 6px;
    }

    .calendar-nav {
        font-size: 1.8em;
    }

    /* ★★★ レスポンシブでのコンテンツタイトル調整 ★★★ */
    .calendar-content-title {
        font-size: 1em;
        margin-top: 8px;
        margin-bottom: 12px;
    }

    .calendar-body th {
        font-size: 0.8em;
        padding: 8px 3px;
    }

    .calendar-body td {
        padding: 6px 3px;
        height: 100px;
        /* Adjust height */
        font-size: 0.8em;
    }

    .calendar-day__date {
        font-size: 1em;
        /* Adjust relative size */
    }

    .calendar-day.today .calendar-day__date {
        width: 1.6em;
        height: 1.6em;
        font-size: 1em;
        /* Reset size for consistency */
    }

    .calendar-day__event-info {
        font-size: 0.85em;
        /* Adjust relative size */
        max-height: calc(100% - 30px);
    }

    .calendar-day__event-title {
        font-size: 1em;
        /* Adjust relative size */
    }

    .calendar-day__event-details p {
        font-size: 0.9em;
        /* Adjust relative size */
    }

    .monthly-moon-info {
        font-size: 0.8em;
        /* Adjust relative size */
        gap: 4px;
    }

    .monthly-icon .moon-icon {
        font-size: 1em;
    }

    .monthly-date {
        font-size: 0.85em;
    }

    footer .social-links a {
        padding: 5px 12px;
        font-size: 0.85em;
    }

    footer .copyright {
        font-size: 0.75em;
    }

    .page-top {
        bottom: 15px;
        right: 15px;
        padding: 8px 12px;
        font-size: 1.1em;
    }
}

@media (max-width: 420px) {
    .calendar-body td {
        height: 90px;
        /* Further adjust height */
        font-size: 0.75em;
    }

    .calendar-day__event-info {
        font-size: 0.8em;
        /* Adjust relative size */
    }

    .monthly-moon-info {
        font-size: 0.75em;
        /* Adjust relative size */
    }
}

/* --- 他の占いへのリンク --- */
.other-fortune-links {
    text-align: center;
    padding: 30px 20px;
    /* 上下の余白 */
    background-color: var(--card-bg, #fff);
    /* 背景はカードと同じか白 */
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(200, 200, 230, 0.1);
    /* 軽い影 */
    border: 1px solid var(--border-color, #eee);
    max-width: 900px;
    /* 他のセクションと幅を合わせる */
    margin: 0 auto 40px auto;
    /* 下マージンを追加 */
}

.other-fortune-links h2 {
    font-size: 1.4rem;
    color: var(--text-dark, #333);
    margin-bottom: 25px;
}

.link-button-container {
    display: flex;
    flex-wrap: wrap;
    /* スマホで折り返す */
    gap: 20px;
    justify-content: center;
}

.fortune-link-button {
    display: inline-flex;
    /* アイコンとテキストを横並び */
    align-items: center;
    padding: 12px 25px;
    border-radius: 30px;
    /* 丸みのあるボタン */
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
    color: var(--text-dark, #333);
}

.fortune-link-button .icon {
    margin-right: 10px;
    font-size: 1.2em;
    /* アイコンサイズ */
}

/* 個別の色設定 (おみくじと星座占いの色) */
.fortune-link-button.omikuji {
    background-color: var(--accent-color, #fff5cc);
    /* ライトイエロー系 */
}

.fortune-link-button.omikuji:hover {
    background-color: #fff0b3;
    /* 少し濃いイエロー */
}

.fortune-link-button.fortune {
    background-color: var(--secondary-color, #f0eaff);
    /* ラベンダー系 */
}

.fortune-link-button.fortune:hover {
    background-color: #e6d9ff;
    /* 少し濃いラベンダー */
}


.fortune-link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    /* ホバー時の下線不要 */
    color: var(--text-dark, #333);
    /* ホバー時の文字色維持 */
}