body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #f9f9f9;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 15px;
    font-size: 18px; /* 基本のフォントサイズ */
}

body.screenshot-mode {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2d3436;
}

.container {
    position: relative; /* ボタン配置の基準点 */
    width: 100%;
    max-width: 800px; /* 通常時の横幅を少し広げる */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
    padding: 20px 30px;
    box-sizing: border-box;
    transition: max-width 0.3s ease; /* wide-view切り替えアニメーション */
}

.container.wide-view {
    max-width: 1200px; /* 2列表示の時にコンテナを広げる */
}

.container.screenshot-mode {
    width: 1600px; /* 16:9比率の幅を拡大 */
    height: 900px;  /* 16:9比率の高さも拡大 */
    max-width: 1600px;
    border-radius: 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    padding: 40px;
}

.container.screenshot-mode h1#calendar-title {
    font-size: 2.5em; /* スクショモードでタイトルをさらに大きく */
}

.container.screenshot-mode .date-label {
    font-size: 1.2em; /* スクショモードで日付を大きく */
}

.container.screenshot-mode .event-item {
    font-size: 1.1em; /* スクショモードで予定を大きく */
}

/* スクショ時に不要なボタンを非表示 */
.container.screenshot-mode #toggle-view-btn,
.container.screenshot-mode #prev-month-btn,
.container.screenshot-mode #next-month-btn {
    display: none;
}

.container.screenshot-mode #calendar-header {
    justify-content: center; /* タイトルを中央寄せ */
    margin-bottom: 30px;
}

/* スクショモードの時は右上にボタンを配置 */
.container.screenshot-mode #view-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    margin: 0;
}

.container.screenshot-mode #schedule-list {
    height: 100%;
    overflow-y: hidden; /* スクロールバーを非表示に */
    column-count: 2; /* 2カラム表示 */
    column-gap: 40px;
}

#calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#view-controls {
    text-align: right;
    margin-bottom: 15px;
}

#toggle-view-btn, #screenshot-btn {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.9em;
    transition: background-color 0.3s;
    margin-left: 10px;
}

#toggle-view-btn:hover, #screenshot-btn:hover {
    background-color: #e0e0e0;
}

h1#calendar-title {
    text-align: center;
    font-weight: 400;
    color: #2c3e50;
    margin: 0;
    padding: 0;
    border: none;
    font-size: 2em; /* タイトルを大きく */
}

#prev-month-btn, #next-month-btn {
    background-color: #f0f0f0;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

#prev-month-btn:hover, #next-month-btn:hover {
    background-color: #e0e0e0;
}

#schedule-list {
    list-style: none;
    padding: 0;
    margin: 0;
    transition: all 0.3s ease;
}

#schedule-list.two-column-view {
    column-count: 2;
    column-gap: 40px; /* Consistent gap */
}

#schedule-list li {
    display: flex;
    padding: 12px 0; /* Line height */
    border-bottom: 1px solid #f0f0f0;
    break-inside: avoid-column; /* Prevent breaking across columns */
}

#schedule-list li:last-child {
    border-bottom: none; /* No border for the last item */
}

#schedule-list.two-column-view li {
    border-bottom: 1px solid #f0f0f0; /* Ensure border in two-column view */
}

.date-label {
    font-weight: 500;
    width: 120px; /* Fixed width for date/day */
    flex-shrink: 0;
    font-size: 1.05em; /* Date font size */
}

.event-details {
    display: flex;
    flex-direction: column;
}

.event-item {
    margin-bottom: 5px;
    font-size: 1em; /* Event font size */
}

.event-item:last-child {
    margin-bottom: 0;
}

/* Color classes */
.weekday { color: #333; }
.saturday { color: #007bff; }
.sunday, .holiday { color: #dc3545; }

/* Past date style */
.past-date .date-label,
.past-date .event-details {
    color: #bbb !important;
}

/* Fixed image (usiniku.png) */
#fixed-image {
    position: fixed; /* Default fixed position */
    bottom: 20px;
    right: 20px;
    width: 240px; /* Default size */
    height: auto;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.4s ease;
}

/* Hover animation for default mode */
body:not(.screenshot-mode):hover #fixed-image {
    transform: scale(1.1) rotate(5deg);
}

/* Screenshot mode image style */
.container.screenshot-mode #fixed-image {
    position: absolute; /* Position relative to container */
    width: 240px; /* 元のサイズに戻す */
    bottom: 30px;
    right: 30px;
    transform: none; /* Reset animation */
}

/* --- スマートフォン向けレイアウト --- */
@media screen and (max-width: 768px) {
    body {
        font-size: 16px; /* モバイルでの基本フォントサイズ */
        padding: 10px;
    }

    .container {
        max-width: 100%; /* 画面いっぱいに広げる */
        padding: 15px 20px;
        border-radius: 0;
        box-shadow: none;
    }

    #calendar-header {
        flex-direction: column; /* 縦に並べる */
        align-items: center;
        margin-bottom: 15px;
    }

    #prev-month-btn, #next-month-btn {
        margin: 5px 0; /* ボタンの上下に余白 */
        width: 80%;
    }

    h1#calendar-title {
        font-size: 1.8em;
        margin: 10px 0;
    }

    #view-controls {
        text-align: center;
        margin-bottom: 15px;
    }

    #toggle-view-btn, #screenshot-btn {
        margin: 5px; /* ボタン間の余白 */
        width: calc(50% - 10px); /* 2つ並ぶように */
    }

    #schedule-list,
    #schedule-list.two-column-view {
        column-count: 1; /* 常に1列表示 */
        column-gap: 0;
    }

    #schedule-list li {
        padding: 10px 0;
    }

    .date-label {
        width: 90px; /* 日付の幅を調整 */
        font-size: 1em;
    }

    .event-item {
        font-size: 0.95em;
    }

    #fixed-image {
        width: 80px; /* モバイルでの画像サイズ */
        bottom: 10px;
        right: 10px;
    }

    /* スクリーンショットモードはモバイルでは適用しない */
    body.screenshot-mode,
    .container.screenshot-mode {
        width: auto;
        height: auto;
        max-width: 100%;
        padding: 15px;
        flex-direction: column;
    }

    .container.screenshot-mode #schedule-list {
        column-count: 1;
        overflow-y: auto; /* モバイルのスクショモードではスクロール可能に */
    }

    .container.screenshot-mode #fixed-image {
        display: none; /* モバイルのスクショモードでは非表示 */
    }
}
