/* ========================================
   営業日カレンダー (Google Calendar Integration)
   70% Scaled Version (Based on 1200x1500 target)
   Version: 1.2.0
   ======================================== */

:root {
    --calendar-primary: #d35400;
    --calendar-secondary: #e67e22;
    --calendar-accent: #3498db;
    --calendar-open: #95a5a6;
    --calendar-closed: #27ae60;
    --calendar-event: #e74c3c;
}

/* Calendar Display Card - Scaled to 70% (Height: 1050px) */

.calendar-display-card {
    background: #a0dad0;
    /* 外側からテーマカラーを敷く */
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 7px 28px rgba(0, 0, 0, 0.08);
    border: 2px solid #86c7bd;
    /* 外枠の色を統一 */
    position: relative;
    min-height: 1050px;
    height: 1050px;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
}



/* Calendar Logo */
.calendar-logo {
    position: absolute;
    bottom: 25px;
    left: 20px;
    width: 75px;
    height: auto;
    z-index: 10;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Header - Scaled */
.calendar-header {
    display: flex;
    align-items: flex-end;
    /* 基本を下揃えに */
    justify-content: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    position: relative;
    padding-left: 8px;
    padding-right: 8px;
    height: 115px;
    /* 高さを固定して絶対配置の基準を安定させる */
    border-bottom: 2.5px solid #333333;
    /* パキッとさせるために太く・濃く */
}

.header-center-nav {
    display: flex;
    align-items: flex-end;
    /* 月を下に揃える */
    justify-content: center;
    gap: 15px;
    z-index: 1;
    margin-bottom: 0px;
    /* 10px上に移動 */
    /* 月の数字の余白を調整して下線に近づける */
}

.calendar-header h2 {
    font-family: 'Outfit', 'Zen Kaku Gothic New', sans-serif;
    color: var(--calendar-primary);
    margin: 0;
    min-width: 154px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.9;
    /* 行高を詰めて下側に寄せる */
}

.year-label {
    font-size: 24px;
    font-weight: 400;
    color: #000000;
    opacity: 1;
    position: absolute;
    bottom: 25px;
    /* ロゴ・月と揃える */
    /* 更新日と同じ高さ */
    left: 105px;
    /* ロゴの右側 */
    z-index: 10;
}

.month-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    width: 100%;
}

.month-number {
    font-size: 100px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #000000;
    /* 直接指定して確実に適用 */
    min-width: 1.2em;
    text-align: center;
    display: inline-block;
    margin-top: 0;
    /* マージンをクリア */
}

.month-nav-btn {
    width: 34px;
    height: 34px;
    margin-top: 0;
    margin-bottom: 25px;
    /* ボタンも下側に揃える */
    border: 1.5px solid #000000;
    background: #ffffff;
    color: #000000;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-nav-btn:hover {
    transform: scale(1.1);
    background: #000000;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.header-right-action {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
}

.save-btn {
    margin-left: 12px;
    color: #2980b9;
    background: #eaf6ff;
}


.calendar-last-updated {
    position: absolute;
    bottom: 18px;
    /* 8pxから18pxへ10px引き上げ */
    /* 他の要素との視覚的な下揃えのため、さらに2px調整 */
    right: 15px;
    font-size: 20px;
    color: #1a1a1a;
    font-family: 'Noto Sans JP', sans-serif;
    z-index: 10;
}

/* Grid - Scaled */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 0px;
    flex: 1;
    min-height: 0;
    transition: opacity 0.3s ease;
    /* 内側の背景・パディング・ボーダーを削除して外枠と一体化 */
}

.calendar-day-header {
    text-align: center;
    font-weight: 800;
    color: #2d3436;
    font-size: 20px;
    padding: 6px 0;
    margin-bottom: 6px;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    letter-spacing: 0.1em;
    line-height: 1.2;
}

.calendar-day-header.saturday {
    color: #3498db;
}

.calendar-day-header.sunday {
    color: #e74c3c;
}

.calendar-day {
    border-radius: 8px;
    cursor: default;
    /* デフォルトはポインターなし */
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #ffffff;
    border: 1px solid transparent;
    overflow: hidden;
    padding: 4px;
    height: 100%;
    min-height: 0;
}

/* クリック可能な要素のみホバーエフェクト */
.calendar-day.clickable-day:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.calendar-day.other-month {
    opacity: 0.3;
    pointer-events: none;
}

.calendar-day.today {
    border: 1px solid var(--calendar-primary);
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.1);
}

.day-header-top {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 4px;
    min-height: 17px;
    flex-shrink: 0;
}

.day-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 25px;
    z-index: 2;
    position: relative;
    line-height: 1;
}

.day-badge {
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 3px;
    color: white;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
    z-index: 2;
}

.day-main-icon {
    flex: 1;
    width: 100%;
    margin: 3px 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    font-size: 35px;
    color: var(--calendar-primary);
    gap: 6px;
    opacity: 0.8;
}

.day-main-icon i {
    filter: drop-shadow(0 3px 4px rgba(39, 174, 96, 0.3));
}

.day-center-content {
    flex: 1;
    width: 100%;
    margin: 3px 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.day-bottom-info {
    font-size: 15px;
    font-weight: 700;
    color: #636e72;
    text-align: center;
    width: 100%;
    margin-top: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 10px;
}

/* Status Highlighting - Scaled */
.calendar-day.open-limited .day-bottom-info {
    color: #e67e22;
    font-weight: 900;
}

.calendar-day.open-special .day-bottom-info {
    color: #2980b9;
    font-weight: 900;
}

.calendar-day.closed-temp .day-bottom-info,
.calendar-day.closed-private .day-bottom-info {
    color: #e74c3c;
    font-weight: 900;
}

.calendar-day.open {
    background: #ffffff;
    /* 真っ白 */
}

.calendar-day.closed .day-main-icon {
    color: #7f8c8d;
    /* 落ち着いたグレー */
}

.calendar-day.closed {
    background: #e0ebe8;
    /* くすんだミントグレー */
}

/* 未定のマスをより薄く、控えめにする */
.calendar-day.pending {
    background: #fafafa;
}

.calendar-day.pending .day-main-icon,
.calendar-day.pending .day-bottom-info {
    opacity: 0.5;
}

.calendar-day.closed-trip {
    background: #e0ebe8;
    /* 休業日と同じ */
}

.calendar-day.closed-trip .day-main-icon {
    color: #7f8c8d;
}

.calendar-day.event {
    background: #ffe0d1;
    /* 薄いアプリコット（温かみのある差し色） */
}

/* 詳細未定（画像なし）のアイコンを同系色にする */
.calendar-day.event-live .day-main-icon i.fa-question-circle {
    color: #cc4444;
    /* LIVE背景に合わせた濃い赤 */
}

.calendar-day.event-gen .day-main-icon i.fa-question-circle {
    color: #7b1fa2;
    /* EVENT背景に合わせた濃い紫 */
}

.calendar-day.event .day-main-icon i {
    opacity: 0.7;
    /* 少し馴染ませる */
}

/* Badge Colors - Unified */
.badge-event-live {
    background: linear-gradient(135deg, #e91e63, #c2185b);
}

.badge-event-gen {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    font-weight: 900;
    transform: translateY(-50%) scaleX(0.8);
    transform-origin: right center;
}

.badge-closed-trip {
    background: linear-gradient(135deg, #f1c40f, #d4ac0d);
    font-weight: 900;
    transform: translateY(-50%) scaleX(0.8);
    /* EVENTと同じ0.8に */
    transform-origin: right center;
}

.badge-open-limited {
    background: linear-gradient(135deg, #e67e22, #d35400);
}

.badge-open-special {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.badge-closed-private {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.badge-closed-temp {
    background: linear-gradient(135deg, #7f8c8d, #34495e);
}

.badge-closed-regular {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
}

.badge-open {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.event-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none !important;
    border-radius: 4px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    display: block;
}

.calendar-day.clickable-day:hover .event-thumbnail {
    transform: scale(1.02);
}

/* Locked Month - Scaled */
.calendar-grid.locked-grid {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    background: linear-gradient(135deg, #f8fafb 0%, #e8f0f5 100%);
    border-radius: 14px;
}

.locked-message {
    text-align: center;
    padding: 28px;
}

.locked-icon {
    font-size: 45px;
    color: var(--calendar-closed);
    margin-bottom: 17px;
    opacity: 0.5;
}

.locked-text {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--calendar-primary);
    margin-bottom: 8px;
    letter-spacing: 0.1em;
}

.locked-subtext {
    font-size: 11px;
    color: #636e72;
    line-height: 1.8;
}

/* Events List Section (Kept Original Size as requested) */
.events-list-card {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 2px solid #e8f0f5;
}

.upcoming-events-box {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    margin-top: 60px;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-family: inherit;
    text-decoration: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-secondary {
    background: #f1f2f6;
    color: #2d3436;
    border: 1px solid #dfe6e9;
}

.btn-secondary:hover {
    background: #dfe6e9;
    transform: translateY(-2px);
}

.events-container {
    display: flex;
    overflow-x: auto;
    gap: 24px;
    padding: 20px 0 30px 0;
    scroll-snap-type: x mandatory;
}

.event-card {
    flex: 0 0 300px;
    scroll-snap-align: start;
    background: linear-gradient(135deg, #fff 0%, #f8fafb 100%);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #e8f0f5;
}

.event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    border-color: var(--calendar-primary);
}

.event-card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border: none !important;
}

.event-card-body {
    padding: 16px;
    text-align: left;
}

.card-content-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-top: 0;
    /* PC版でも上端を揃えるためにpaddingを削除 */
}

.card-date-box {
    box-sizing: border-box;
    /* ボーダーを含めたサイズ計算を強制 */
    flex-shrink: 0;
    width: 48px;
    height: 56px;
    background: white;
    border: 1.5px solid var(--calendar-closed);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* 曜日別カラー設定 (カード用) */
.card-date-box.sat {
    border-color: #3498db;
}

.card-date-box.sat .date-box-month {
    background: #3498db;
}

.card-date-box.sat .date-box-day {
    color: #2980b9;
}

.card-date-box.sun {
    border-color: #e74c3c;
}

.card-date-box.sun .date-box-month {
    background: #e74c3c;
}

.card-date-box.sun .date-box-day {
    color: #c0392b;
}

.card-date-box .date-box-month {
    background: var(--calendar-closed);
    color: white;
    font-size: 9px;
    font-weight: 800;
    text-align: center;
    padding: 1px 0;
    font-family: 'Noto Sans JP', sans-serif;
}

.card-date-box .date-box-day {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #2d3436;
    line-height: 1;
}

.card-date-box .date-box-weekday {
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    padding-bottom: 2px;
    color: #636e72;
}

.card-info-main {
    flex: 1;
    min-width: 0;
}

.card-badge-row {
    display: flex;
    /* Flexbox化してインライン要素の隙間を排除 */
    margin-bottom: 4px;
    margin-top: 0;
    line-height: 1;
}

.event-card-title {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: #2d3436;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.category-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    transform: none !important;
    /* グリッド表示用の位置調整・縮小を解除 */
}

.modal-category-badge-wrap .category-badge {
    padding: 4px 10px;
    font-size: 11px;
}

/* Modal (Kept Original Size) */
.event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.event-modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    border: 3px solid #333333;
    /* 太い境界線でパキッと */
    animation: modalSlideIn 0.3s ease;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 2px solid #333333;
    background: #ffffff;
    color: #333333;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-close:hover {
    background: #333333;
    color: #ffffff;
    transform: rotate(90deg) scale(1.1);
}

.modal-body {
    padding: 32px;
}

.modal-event-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: none !important;
}

.modal-event-header-dynamic {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.modal-date-box {
    flex-shrink: 0;
    width: 65px;
    height: 75px;
    background: white;
    border: 2px solid var(--calendar-closed);
    /* デフォルト */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* 土曜日：青 */
.modal-date-box.sat {
    border-color: #3498db;
}

.modal-date-box.sat .date-box-month {
    background: #3498db;
}

.modal-date-box.sat .date-box-day {
    color: #2980b9;
}

/* 日曜日・祝日：赤 */
.modal-date-box.sun {
    border-color: #e74c3c;
}

.modal-date-box.sun .date-box-month {
    background: #e74c3c;
}

.modal-date-box.sun .date-box-day {
    color: #c0392b;
}

.date-box-month {
    background: var(--calendar-closed);
    color: white;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    padding: 2px 0;
    font-family: 'Noto Sans JP', sans-serif;
}

.date-box-day {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #2d3436;
    line-height: 1;
}

.date-box-weekday {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    padding-bottom: 4px;
    color: #636e72;
}

.modal-event-title-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    position: relative;
}

/* タイトルとコピーボタンを横並びにするためのラップ */
.modal-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.modal-event-title {
    font-family: 'Outfit', 'Noto Sans JP', sans-serif;
    font-weight: 800;
    font-size: 28px;
    color: var(--calendar-primary);
    line-height: 1.3;
    margin: 0 !important;
    flex: 1;
}

@media (max-width: 768px) {
    .modal-event-header-dynamic {
        gap: 15px;
    }

    .modal-date-box {
        width: 55px;
        height: 65px;
    }

    .date-box-day {
        font-size: 22px;
    }

    .modal-event-title-area {
        margin-top: 10px;
    }

    .modal-event-title {
        font-size: 26px !important;
        /* スマホでもタイトルは大きく */
        color: #000000;
        font-weight: 800;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        width: 38px;
        height: 38px;
    }
}

.modal-event-description {
    font-size: 16px;
    color: #2d3436;
    line-height: 1.8;
    margin-bottom: 24px;
}

/* Modal Navigation & Swipe Styles */
.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    /* JSで制御 */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10001;
    /* modal-content(z-indexは親の9999内)より上、かつoverlayより上 */
    transition: all 0.3s ease;
    color: var(--calendar-primary);
    backdrop-filter: blur(4px);
}

.modal-nav-btn:hover {
    background: var(--calendar-primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-btn.prev {
    left: 20px;
}

.modal-nav-btn.next {
    right: 20px;
}

.modal-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.pagination-dots {
    display: flex;
    gap: 6px;
}

.pagination-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dfe6e9;
    transition: all 0.3s ease;
}

.pagination-dots .dot.active {
    background: var(--calendar-primary);
    transform: scale(1.2);
}

.pagination-count {
    font-size: 12px;
    font-weight: 700;
    color: #b2bec3;
    font-family: 'Outfit', sans-serif;
}

/* Animations */
.modal-body {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* 消えていくとき */
.modal-body.slide-next {
    transform: translateX(-50px);
    opacity: 0;
}

.modal-body.slide-prev {
    transform: translateX(50px);
    opacity: 0;
}

/* 入ってくるとき */
.modal-body.slide-in-right {
    animation: modalSlideInRight 0.3s ease forwards;
}

.modal-body.slide-in-left {
    animation: modalSlideInLeft 0.3s ease forwards;
}

@keyframes modalSlideInRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes modalSlideInLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Action Buttons */
.modal-image-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 24px;
    border-radius: 16px;
    overflow: hidden;
    line-height: 0;
    /* 画像下の隙間防止 */
}

.modal-image-glass-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.modal-image-glass-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.modal-image-glass-btn i {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.modal-event-title-area,
.modal-event-description-area {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-event-title {
    flex: 1;
    margin-bottom: 0 !important;
}

.modal-event-description {
    flex: 1;
    margin-bottom: 0 !important;
}

.modal-copy-tag-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #333333;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    margin-top: 0;
}

.modal-copy-tag-btn span {
    display: none;
    /* テキストは非表示 */
}

.modal-copy-tag-btn i {
    font-size: 12px;
}

.modal-copy-tag-btn:hover {
    background: #edf2f7;
    color: var(--calendar-primary);
    border-color: var(--calendar-primary);
    transform: translateY(-1px);
}



@media (max-width: 768px) {

    .modal-event-title-area,
    .modal-event-description-area {
        gap: 8px;
    }

    .modal-copy-tag-btn {
        padding: 4px 10px;
        font-size: 10px;
    }
}

/* Loading & Error */
.loading-state,
.error-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #636e72;
    background: white;
    padding: 20px;
    z-index: 10;
    width: 80%;
    display: none;
}

.loading-state.is-visible,
.error-state.is-visible {
    display: block;
}

.loading-state i,
.error-state i {
    font-size: 34px;
    margin-bottom: 11px;
    color: var(--calendar-primary);
}

.loading-state p,
.error-state p {
    font-size: 11px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-display-card {
        padding: 15px;
        height: auto;
        min-height: 480px;
        /* 少し高さを抑える */
    }

    .calendar-header h2 {
        font-size: 18px;
        min-width: 100px;
    }

    .calendar-day-header {
        font-size: 10px;
    }

    .day-number {
        font-size: 12px;
    }

    .events-container {
        flex-direction: column;
        overflow-x: hidden;
    }
}

/* Pending State */
.calendar-day.pending {
    justify-content: flex-end;
    /* Show text at bottom */
    padding-bottom: 2px;
}

.pending-icon {
    color: #b2bec3;
    flex-direction: column;
    gap: 8px !important;
}

.pending-label {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* ========================================
   Mobile Optimization (max-width: 550px)
   ======================================== */
@media (max-width: 550px) {

    /* Calendar Container */
    .calendar-display-card {
        padding: 0;
        /* 外側の余白を削除 */
        min-height: auto;
        /* ボーダーと角丸をPC版から維持 */
    }

    /* Header Adjustments */
    .calendar-header {
        padding-bottom: 0;
        /* 下部パディングをリセット */
        margin-bottom: 10px;
        flex-direction: column;
        justify-content: center;
        /* 垂直方向の中央揃え */
        height: 100px;
        /* 少し高さを詰めてバランスを調整 */
    }

    .calendar-logo,
    .calendar-last-updated {
        display: none !important;
    }


    .header-center-nav {
        width: 100%;
        gap: 20px;
        display: flex;
        align-items: center;
        /* 垂直中央揃え */
        justify-content: center;
        margin-bottom: 0;
        /* 下部マージンをリセット */
    }

    .calendar-header h2 {
        min-width: auto;
        /* 幅制限解除 */
    }

    .month-display {
        gap: 4px;
        /* 数字と単位の間隔 */
    }

    .month-number {
        font-size: 56px;
        /* 36pxから拡大 */
        margin-top: 0;
    }

    .year-label {
        font-size: 16px;
        position: absolute;
        left: 12px;
        bottom: 15px;
        transform: none;
        margin-bottom: 0;
    }

    .month-nav-btn {
        width: 36px;
        height: 36px;
        margin-top: 0;
        margin-bottom: 0;
        /* 下部マージンをリセットして垂直中央に */
        font-size: 14px;
    }

    /* Grid & Cells */
    .calendar-grid {
        gap: 2px;
    }

    .calendar-day-header {
        font-size: 12px;
        padding: 6px 0;
        border-bottom: none;
        /* 線の削除 */
    }

    .calendar-day {
        aspect-ratio: 3 / 5;
        /* 縦長比率で高さを自動調整 */
        border-radius: 4px;
        padding: 2px;
    }

    .day-number {
        font-size: 14px;
        /* 11pxから拡大 */
    }

    /* Make badges smaller but readable */
    .day-badge {
        font-size: 10px;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        padding: 1px 2px;
    }



    .day-main-icon {
        font-size: 20px;
        /* 14pxから拡大 */
        /* アイコンも小さく */
        margin: 1px 0;
    }

    .day-bottom-info {
        font-size: 10px;
        /* 8pxから拡大 */
        font-weight: 800;
        color: #1a1a1a;
        min-height: auto;
        /* 高さ強制を解除 */
        white-space: normal;
        /* 改行を許可 */
        overflow: visible;
        /* はみ出しを表示 */
        text-overflow: clip;
        /* 省略記号なし */
        line-height: 1.2;
        /* 行間を詰める */
        max-height: none;
        /* 高さ制限なし */
    }

    /* Events List - Horizontal Swipe */
    .events-container {
        flex-direction: row;
        /* 横並びに戻す */
        overflow-x: auto;
        /* 横スクロール有効化 */
        padding: 10px 20px 30px 20px;
        /* 下にスクロールバー用の余白、左右にパディング */
        gap: 15px;
        scroll-snap-type: x mandatory;
        /* スナップ有効化 */
        -webkit-overflow-scrolling: touch;
        /* iOSでの慣性スクロール */
    }

    .event-card {
        width: 45vw;
        /* 正方形画像が見やすいよう少し幅を広げる */
        min-width: 140px;
        flex: 0 0 auto;
        margin-right: 0;
        scroll-snap-align: start;
        border-radius: 12px;
    }

    .event-card-image {
        aspect-ratio: 1 / 1;
        /* 正方形にする */
        height: auto;
        /* 高さは幅に合わせて自動調整 */
        object-fit: cover;
    }

    /* 内部パーツもカード縮小に合わせてコンパクト化 */
    .event-card-body {
        padding: 10px;
    }

    .event-card-title {
        font-size: 13px !important;
        /* 強制的に小さく */
        line-height: 1.3;
    }

    .card-content-layout {
        gap: 8px;
        /* 隙間調整のみオーバーライドし、他はPC版（padding-top:0, align-items:flex-start）継承 */
    }

    .card-date-box {
        width: 36px;
        height: 44px;
        border-radius: 6px;
    }

    .card-date-box .date-box-month {
        font-size: 8px;
    }

    .card-date-box .date-box-day {
        font-size: 16px;
    }

    .card-date-box .date-box-weekday {
        font-size: 7px;
    }

    .card-badge-row {
        margin-bottom: 0;
    }

    .category-badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    /* スクロールバー装飾（任意：目立たなくするなら消す） */
    .events-container::-webkit-scrollbar {
        height: 4px;
    }

    .events-container::-webkit-scrollbar-thumb {
        background: #ced6e0;
        border-radius: 4px;
    }

    /* Modal - Mobile Friendly (フルスクリーンではなく、余白あり) */
    .modal-content {
        width: 95%;
        max-height: 90vh;
        border-radius: 12px;
        margin: 20px auto;
        overflow: hidden;
        /* 角丸を効かせるため */
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        padding: 0;
        overflow-y: auto;
        /* スクロール可能に */
        flex: 1;
        /* 残りのスペースを使う */
        -webkit-overflow-scrolling: touch;
        /* スマホでスムーズスクロール */
        position: relative;
        /* 疑似要素の基準 */
    }

    /* 画像を画面端まで広げる */
    .modal-image-wrapper {
        width: 100%;
        margin: 0 0 20px 0;
        border-radius: 0;
        background: #f8fafb;
        min-height: 200px;
        /* 余白が出ないようFlex配置等は削除 */
    }

    .modal-event-image {
        width: 100%;
        height: auto;
        /* 画像のアスペクト比通りに高さを確保 */
        max-height: none;
        /* 高さ制限を撤廃 */
        object-fit: cover;
        /* 幅いっぱい */
        border-radius: 0;
        box-shadow: none;
        display: block;
    }

    .modal-image-glass-btn {
        position: absolute;
        bottom: 15px;
        /* 画像の右下に戻す */
        right: 15px;
        top: auto !important;
        left: auto !important;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.3);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        z-index: 100;
    }

    .modal-image-glass-btn i {
        font-size: 18px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    }

    /* 矢印ボタンを画面最下部へ移動 */
    .modal-nav-btn {
        top: auto !important;
        bottom: 12px;
        transform: none !important;
        width: 50px;
        height: 50px;
        background: transparent;
        box-shadow: none;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10011;
        color: var(--calendar-primary);
    }

    .modal-nav-btn i {
        font-size: 24px;
        opacity: 0.8;
    }

    .modal-nav-btn.prev {
        left: 15px;
    }

    .modal-nav-btn.next {
        right: 15px;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.8);
        /* 画像の上でも見えるように白半透明 */
        color: #333;
        width: 36px;
        height: 36px;
        font-size: 18px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    /* コンテンツ部分（画像の下）にパディングを当てるためのラッパー的な扱いが必要だが、
       既存HTML構造を変えずにCSSだけでやるため、各要素にパディング付与 */

    .modal-event-header-dynamic {
        flex-direction: row;
        /* 横並びに戻す */
        align-items: flex-start;
        gap: 12px;
        padding: 0 20px;
        /* ここで横の余白を作る */
    }

    .modal-date-box {
        width: 44px;
        height: 52px;
        border-radius: 8px;
    }

    .date-box-month {
        font-size: 8px;
    }

    .date-box-day {
        font-size: 18px;
    }

    .date-box-weekday {
        font-size: 7px;
    }

    .modal-event-title-container {
        padding-top: 0;
        gap: 4px;
        /* タイトルとバッジの間隔調整 */
    }

    .modal-category-badge-wrap {
        /* line-height 調整と Flex 表示のみ維持 */
        line-height: 1;
        display: flex;
    }

    .modal-category-badge-wrap .category-badge {
        margin-top: 0;
        line-height: 1;
    }

    .modal-event-title {
        font-size: 18px;
        line-height: 1.4;
    }

    .modal-event-description-area {
        padding: 0 20px;
        /* 本文もパディング */
        flex-direction: column;
        /* 本文とコピーボタンを縦積みに */
        align-items: flex-start;
    }

    .modal-event-description {
        font-size: 14px;
        line-height: 1.6;
    }

    /* Hide save button on mobile */
    .header-right-action .save-btn {
        display: none !important;
    }

    /* Hide copy buttons on mobile modals */
    .modal-copy-tag-btn {
        display: none !important;
    }

    /* ページネーションを常に表示（下部固定） */
    .modal-pagination {
        flex-shrink: 0;
        /* 縮まないように */
        background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 80%, rgba(255, 255, 255, 0.8));
        padding: 12px 20px;
        z-index: 10;
        backdrop-filter: blur(8px);
        position: relative;
        /* 疑似要素の基準 */
    }

    /* ページネーションの上にグラデーション */
    .modal-pagination::before {
        content: '';
        position: absolute;
        top: -60px;
        left: 0;
        right: 0;
        height: 60px;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.8) 70%, rgba(255, 255, 255, 0.98));
        pointer-events: none;
        z-index: -1;
    }
}