* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

body.loaded {
    opacity: 1;
}

/* 通知動畫 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.header-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.header h1 {
    font-size: 3.2em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    line-height: 1.2;
    animation: fadeInUp 0.8s ease;
}

.header-subtitle {
    font-size: 1.4em;
    opacity: 0.95;
    margin-bottom: 30px;
    font-weight: 300;
    animation: fadeInUp 0.8s ease 0.2s both;
}


.header-cta {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    animation: fadeInUp 0.8s ease 0.6s both;
}

.cta-button {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.cta-button.primary {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cta-button.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #ff7979);
}

.cta-button.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.cta-button.secondary:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 跑馬燈樣式 ==================== */

/* 圖片跑碼燈樣式 */
.image-marquee-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 15px 0;
    border-bottom: 1px solid #e1e8ed;
    overflow: hidden;
    position: relative;
}

.marquee-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 電腦版：懸停時顯示滾輪提示 */
.marquee-wrapper:hover {
    cursor: default;
}

/* 手機版：觸控滑動時顯示抓取游標 */
@media (hover: none) and (pointer: coarse) {
    .marquee-wrapper:hover {
        cursor: grab;
    }
    
    .marquee-wrapper:active,
    .marquee-wrapper.dragging {
        cursor: grabbing;
    }
}

.marquee-track {
    display: flex;
    animation: marquee 30s linear infinite;
    gap: 20px;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
    transition: transform 0.3s ease-out;
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-track.dragging {
    animation-play-state: paused;
    transition: none;
}

.marquee-track.user-controlled {
    animation: none;
    transform: translateX(var(--user-offset, 0px));
}

/* 互動提示樣式已移除 - 不再顯示控制提示 */

/* 拖拽時的視覺反饋 */
.marquee-wrapper.dragging .marquee-item {
    opacity: 0.8;
    transform: scale(0.98);
    transition: all 0.1s ease;
}

/* 手機版滑動時的視覺反饋 */
@media (hover: none) and (pointer: coarse) {
    .marquee-wrapper.dragging {
        background: rgba(0, 123, 255, 0.05);
        border-radius: 8px;
    }
    
    .marquee-wrapper.dragging .marquee-item {
        opacity: 0.9;
        transform: scale(0.95);
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
    }
}

/* 使用者控制時的邊框提示 */
.marquee-wrapper.user-controlled {
    box-shadow: inset 0 0 0 2px #007bff;
}

/* 鍵盤焦點樣式 */
.marquee-wrapper:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* 觸控設備優化 - 手機版 */
@media (hover: none) and (pointer: coarse) {
    /* 手機版優化滾動 */
    body {
        height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .content {
        flex: 1;
        overflow-y: visible;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 移除水平滑動提示 */
    .marquee-wrapper::after {
        display: none;
    }
    
    /* 改善觸控響應 - 移除水平滑動 */
    .marquee-wrapper {
        touch-action: none; /* 禁用所有觸控手勢 */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .marquee-item {
        touch-action: none; /* 禁用觸控手勢 */
    }
    
    /* 確保圖片在手機版正常顯示 */
    .marquee-item img {
        width: 60px;
        height: 45px;
        object-fit: cover;
        border-radius: 8px;
        display: block;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
    }
    
    /* 圖片載入失敗時的樣式 */
    .marquee-item img:not([src]),
    .marquee-item img[src=""],
    .marquee-item img[src*="undefined"],
    .marquee-item img[src*="null"] {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7em;
        color: #6c757d;
    }
    
    .marquee-item img:not([src])::before,
    .marquee-item img[src=""]::before,
    .marquee-item img[src*="undefined"]::before,
    .marquee-item img[src*="null"]::before {
        content: "📷";
        font-size: 1.5em;
    }
}

.marquee-item {
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.marquee-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
}

.marquee-item:hover {
    transform: scale(1.2);
    z-index: 10;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.marquee-item:hover img {
    transform: scale(1.1);
}

.marquee-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.marquee-item:hover::before {
    opacity: 1;
}

/* 跑碼燈動畫 */
@keyframes marquee {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* 圖片放大彈窗 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.image-modal.show {
    display: flex;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalZoomIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.image-modal-content img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

/* 多連結按鈕容器 */
.link-buttons-container {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 0;
    padding: 15px;
    background: white;
    border-top: 2px solid #007bff;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* 單個連結按鈕 */
.link-button {
    flex: 1;
    max-width: 60px;
    background: #007bff;
    color: white;
    padding: 3px 6px;
    border-radius: 2px;
    text-decoration: none;
    display: inline-block;
    font-size: 0.7em;
    text-align: center;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-button:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
}

/* 餐車名稱標籤樣式 */
.title-item {
    display: inline-block;
    background: #ffc107;
    color: #212529;
    padding: 3px 10px;
    margin: 2px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #ffc107;
}

.title-item:hover {
    background: #e0a800;
    border-color: #e0a800;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 圖片超連結標籤樣式 */
.img-link-item {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 4px 10px;
    margin: 2px;
    border-radius: 15px;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid #28a745;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.img-link-item:hover {
    background: #218838;
    border-color: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.img-link-empty {
    background: #6c757d;
    border-color: #6c757d;
    font-weight: bold;
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.img-link-empty:hover {
    background: #545b62;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 空連結按鈕樣式 */
.link-button-empty {
    background: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
    font-weight: bold;
    font-size: 0.9em;
}

.link-button-empty:hover {
    background: #545b62 !important;
    border-color: #545b62 !important;
}

/* 內聯編輯樣式 */
.editable-item {
    position: relative;
}

.editable-item.editing {
    background: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #212529 !important;
}

.edit-input {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid #ffc107;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: inherit;
    background: white;
    z-index: 10;
    outline: none;
    min-height: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.edit-buttons {
    position: absolute;
    top: -40px;
    right: 0;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.edit-btn {
    width: auto;
    min-width: 50px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    padding: 0 8px;
}

.edit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.edit-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.edit-btn.save {
    background: #28a745;
    color: white;
}

.edit-btn.cancel {
    background: #dc3545;
    color: white;
}

/* 移動按鈕樣式 */
.move-buttons {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.move-buttons:hover {
    opacity: 1;
}

.move-buttons .btn {
    min-width: 30px;
    height: 30px;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.move-buttons .btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

.image-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

@keyframes modalZoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 群組邀請連結樣式 */
.group-invite {
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.group-link {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e, #ffa8a8);
    color: white;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

.group-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(255, 107, 107, 0.6);
    background: linear-gradient(45deg, #ff5252, #ff7979, #ff9f9f);
}

.group-link:active {
    transform: translateY(-1px);
}

/* 脈衝動畫 */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.8);
    }
    100% {
        box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    }
}

.week-selector {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 20px 25px;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}

.week-selector-header {
    text-align: center;
    margin-bottom: 15px;
}

.week-selector-header h3 {
    font-size: 1.3em;
    color: #2c3e50;
    margin-bottom: 5px;
    font-weight: 700;
}

.week-selector-desc {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0;
}

.week-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

/* 中等桌面螢幕 (1200px - 1600px) */
@media (min-width: 1200px) and (max-width: 1600px) {
    .week-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* 小型桌面螢幕 (1024px - 1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .week-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
}

/* 大型平板 (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .week-tabs {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* 超大桌面螢幕 (>1600px) */
@media (min-width: 1601px) {
    .week-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
}

/* 小平板/大手機 (600px - 767px) */
@media (min-width: 600px) and (max-width: 767px) {
    .week-tabs {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
}

/* 手機直向 (480px - 599px) */
@media (min-width: 480px) and (max-width: 599px) {
    .week-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* 小手機 (<480px) */
@media (max-width: 479px) {
    .week-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }
    
    .week-tab-content {
        padding: 5px 8px;
    }
    
    .week-tab-title {
        font-size: 0.8em;
    }
    
    .week-tab-dates {
        font-size: 0.7em;
    }
    
    .week-tab-trucks {
        font-size: 0.6em;
    }
}

.week-tab {
    background: white;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 0;
    text-align: left;
}

.week-tab:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.week-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.week-tab-content {
    padding: 6px 10px;
}

.week-tab-title {
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 2px;
    color: #2c3e50;
    transition: color 0.3s ease;
}

.week-tab.active .week-tab-title {
    color: white;
}

.week-tab-dates {
    font-size: 0.75em;
    font-weight: 600;
    margin-bottom: 2px;
    color: #495057;
    transition: color 0.3s ease;
}

.week-tab.active .week-tab-dates {
    color: rgba(255, 255, 255, 0.9);
}

.week-tab-trucks {
    font-size: 0.65em;
    color: #6c757d;
    font-weight: 500;
    transition: color 0.3s ease;
}

.week-tab.active .week-tab-trucks {
    color: rgba(255, 255, 255, 0.8);
}

.week-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.week-tab.active::before {
    opacity: 1;
}

.week-tab:hover::before {
    opacity: 0.7;
}


.content {
    padding: 40px 30px;
}

.week-content {
    display: none;
}

.week-content.active {
    display: block;
}

.week-header {
    text-align: center;
    margin-bottom: 40px;
}

.week-title {
    font-size: 2.4em;
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 700;
    padding: 15px 30px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 25px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: inline-block;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.day-header {
    text-align: center;
    padding: 12px 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 16px;
    padding: 16px;
    min-height: 140px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.day-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.12);
    transform: translateY(-2px);
}

.day-card.has-trucks {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #fff8f8, #ffffff);
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.1);
}

.day-card.has-trucks::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
    border-radius: 16px 16px 0 0;
}

.day-number {
    font-size: 1.4em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    line-height: 1;
    display: inline;
}

.day-name {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-bottom: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline;
    margin-left: 8px;
}

.truck-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.truck-item {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 12px;
    font-size: 0.8em;
    color: #495057;
    border-left: 3px solid #ff6b6b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.truck-item:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.truck-item:last-child {
    margin-bottom: 0;
}

.truck-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.4;
    font-size: 0.85em;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.truck-name:hover {
    color: #667eea;
    transform: translateX(2px);
}

.truck-name::after {
    content: '📍';
    font-size: 0.8em;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.truck-name:hover::after {
    opacity: 1;
    transform: scale(1.1);
}

.truck-name::before {
    content: attr(data-address);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 8px;
}

.truck-name::before::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.truck-name:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

.truck-location {
    display: none;
}

.location-icon {
    display: none;
}

.no-trucks {
    text-align: center;
    color: #bdc3c7;
    font-style: italic;
    padding: 20px 10px;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
}

.summary-stats {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/* 廣告區域樣式 */
.ad-section {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 50px 30px;
    border-top: 1px solid #e1e8ed;
    position: relative;
    overflow: hidden;
}

.ad-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #ff6b6b);
}

.ad-container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.ad-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.ad-title {
    font-size: 2em;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
}

.ad-section-desc {
    color: #6c757d;
    font-size: 1.1em;
    margin: 0;
    font-weight: 400;
}

.ad-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.ad-item {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
    display: flex;
    flex-direction: column;
    min-height: 140px;
    position: relative;
    overflow: hidden;
}

.ad-item.featured {
    border: 2px solid #ff6b6b;
    background: linear-gradient(135deg, #fff8f8, #ffffff);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.15);
}

.ad-item:hover {
    border-color: #667eea;
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.2);
    transform: translateY(-4px);
}

.ad-item.featured:hover {
    border-color: #ff5252;
    box-shadow: 0 12px 40px rgba(255, 107, 107, 0.25);
}

.ad-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.ad-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
    flex: 1;
}

.ad-icon {
    font-size: 1.6em;
    text-align: center;
    flex-shrink: 0;
}

.ad-text {
    text-align: left;
    flex: 1;
}

.ad-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 3px;
}

.ad-desc {
    font-size: 0.75em;
    color: #6c757d;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: normal;
}

.ad-link {
    text-align: center;
    margin-top: auto;
}

.ad-link a {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ad-link a:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.cta-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cta-link.primary {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.cta-link.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    background: linear-gradient(135deg, #ff5252, #ff7979);
}

.cta-link.secondary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.cta-link.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
}

.link-arrow {
    transition: transform 0.3s ease;
}

.cta-link:hover .link-arrow {
    transform: translateX(3px);
}

/* 橫幅廣告 */
.ad-banner {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
    padding: 30px;
    color: white;
    text-align: center;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
}

.banner-text h4 {
    font-size: 1.5em;
    margin-bottom: 8px;
    font-weight: 700;
}

.banner-text p {
    font-size: 1.1em;
    opacity: 0.9;
    margin: 0;
}

.cta-button {
    background: white;
    color: #667eea;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.3);
}

/* 彈窗樣式 */
.sponsor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    overflow-y: auto;
}

.sponsor-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sponsor-modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    position: relative;
    margin: 0;
    flex-shrink: 0;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    font-size: 1.2em;
    color: #2c3e50;
    margin: 0;
    font-weight: 600;
}

.close-btn {
    font-size: 1.8em;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
    background: white;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.modal-body .contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.modal-body .contact-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.contact-icon {
    font-size: 2.5em;
    width: 60px;
    text-align: center;
    flex-shrink: 0;
}

.modal-body .contact-info {
    flex: 1;
}

.contact-name {
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 6px;
}

.contact-phone {
    font-size: 1.1em;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    display: inline-block;
    transition: all 0.3s ease;
}

.contact-phone:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.contact-line {
    font-size: 1em;
    color: #00c300;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    background: linear-gradient(135deg, #00c300, #00a300);
    color: white;
    border-radius: 8px;
    display: inline-block;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 195, 0, 0.3);
}

.contact-line:hover {
    background: linear-gradient(135deg, #00a300, #008500);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 195, 0, 0.4);
}

.footer {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #e1e8ed;
}

.footer-content p {
    color: #6c757d;
    margin-bottom: 8px;
    font-size: 0.9em;
}

.keyboard-hint {
    margin-top: 10px;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    display: inline-block;
}

.keyboard-hint small {
    color: #667eea;
    font-size: 0.8em;
}

/* 醫療資訊彈窗樣式 */
.medical-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.medical-category {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e9ecef;
}

.medical-category h4 {
    color: #2c3e50;
    font-size: 1em;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #667eea;
}

.medical-item {
    background: white;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e1e8ed;
    transition: all 0.3s ease;
}

.medical-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.medical-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95em;
    margin-bottom: 6px;
}

.medical-info {
    font-size: 0.85em;
    color: #6c757d;
}

.medical-address,
.medical-phone,
.medical-hours {
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    font-size: 0.85em;
}

.medical-note {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 15px;
    border-left: 4px solid #2196f3;
}

.medical-note p {
    margin-bottom: 10px;
    color: #1976d2;
    font-weight: 600;
}

.medical-note ul {
    margin: 0;
    padding-left: 20px;
}

.medical-note li {
    margin-bottom: 5px;
    color: #424242;
    font-size: 0.9em;
}

/* 醫療資訊導航連結樣式 */
.medical-navigation {
    margin-top: 8px;
    text-align: center;
}

.nav-link {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.nav-link:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.nav-link:active {
    transform: translateY(0);
}

/* 電話連結樣式 */
.phone-link {
    color: #28a745;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.phone-link:hover {
    color: #218838;
    text-decoration: underline;
}

/* 圖片跑碼燈響應式設計 */
@media (max-width: 768px) {
    .image-marquee-container {
        padding: 10px 0;
    }
    
    .marquee-item img {
        width: 70px;
        height: 52px;
    }
    
    .marquee-track {
        gap: 15px;
    }
    
    .image-modal-content {
        max-width: 95vw;
        max-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .image-modal-content img {
        max-height: 80vh;
        flex-shrink: 0;
    }
    
    .image-modal-close {
        width: 35px;
        height: 35px;
        font-size: 18px;
        top: 10px;
        right: 10px;
    }
    
    /* 手機版連結按鈕優化 */
    .link-buttons-container {
        gap: 8px;
        margin-top: 10px;
        padding: 15px;
        flex-wrap: wrap;
        background: white;
        border-top: 2px solid #007bff;
        position: relative;
        z-index: 20;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        /* 確保在手機版可見 */
        min-height: 60px;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .link-button {
        flex: 1;
        min-width: 80px;
        max-width: 120px;
        padding: 10px 12px;
        font-size: 0.85em;
        border-radius: 8px;
        font-weight: 700;
        background: #007bff !important;
        color: white !important;
        border: 2px solid #0056b3;
        box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
        text-align: center;
        text-decoration: none;
        display: block;
    }
}

@media (max-width: 480px) {
    .marquee-item img {
        width: 60px;
        height: 45px;
    }
    
    .marquee-track {
        gap: 12px;
    }
    
    .image-modal-content {
        max-width: 98vw;
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }
    
    .image-modal-content img {
        max-height: 75vh;
        flex-shrink: 0;
    }
    
    /* 小手機版連結按鈕優化 */
    .link-buttons-container {
        gap: 6px;
        margin-top: 8px;
        padding: 12px;
        background: white;
        border-top: 2px solid #007bff;
        position: relative;
        z-index: 20;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        /* 確保在小手機版可見 */
        min-height: 50px;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .link-button {
        min-width: 70px;
        max-width: 100px;
        padding: 8px 10px;
        font-size: 0.8em;
        border-radius: 6px;
        font-weight: 700;
        background: #007bff !important;
        color: white !important;
        border: 2px solid #0056b3;
        box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
        text-align: center;
        text-decoration: none;
        display: block;
    }
}

/* ==================== 響應式設計 ==================== */

/* 超大螢幕 (1920px+) */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .header h1 {
        font-size: 3.5em;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 20px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 20px;
    }
    
    .day-card {
        min-height: 180px;
        padding: 20px;
    }
    
    .truck-item {
        padding: 16px 18px;
        font-size: 1em;
    }
    
    .truck-name {
        font-size: 1em;
    }
}

/* 大螢幕桌面 (1367px - 1919px) */
@media (min-width: 1367px) and (max-width: 1919px) {
    .container {
        max-width: 1400px;
    }
    
    .header h1 {
        font-size: 3.2em;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 18px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 18px;
    }
    
    .day-card {
        min-height: 170px;
        padding: 19px;
    }
    
    .truck-item {
        padding: 15px 17px;
        font-size: 0.95em;
    }
    
    .truck-name {
        font-size: 0.95em;
    }
}

/* 標準桌面 (1025px - 1366px) */
@media (min-width: 1025px) and (max-width: 1366px) {
    .container {
        max-width: 1200px;
    }
    
    .header h1 {
        font-size: 2.8em;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 16px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
    
    .day-card {
        min-height: 165px;
        padding: 18px;
    }
    
    .truck-item {
        padding: 14px 16px;
        font-size: 0.9em;
    }
    
    .truck-name {
        font-size: 0.9em;
    }
}

/* 大平板/小筆電 (1025px - 1366px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .week-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .week-tab {
        padding: 14px 16px;
        font-size: 15px;
    }
}

/* 平板直向模式 (768px - 1024px 且直向) */
/* 平板直向模式優化 (768px - 1366px, portrait) - 包含 iPad Pro */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: portrait) {
    body {
        padding: 10px;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    }
    
    .container {
        margin: 0 auto;
        border-radius: 20px;
        box-shadow: 0 20px 40px rgba(0,0,0,0.08);
        max-width: 100%;
        display: grid;
        grid-template-rows: auto auto 1fr auto;
        min-height: calc(100vh - 20px);
    }
    
    .header {
        padding: 30px 25px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;
        border-radius: 20px 20px 0 0;
    }
    
    .header h1 {
        font-size: 2.2em;
        line-height: 1.3;
        margin-bottom: 10px;
        font-weight: 700;
    }
    
    .header p {
        font-size: 1.1em;
        opacity: 0.9;
    }
    
    .content {
        padding: 30px 25px;
        display: grid;
        grid-template-rows: auto 1fr auto;
        gap: 25px;
    }
    
    .week-selector {
        padding: 20px 0;
        background: #f8f9fa;
        border-radius: 15px;
        margin-bottom: 0;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 0 20px;
    }
    
    .week-tab {
        padding: 14px 12px;
        font-size: 14px;
        font-weight: 600;
        text-align: center;
        white-space: nowrap;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: white;
        border: 2px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    
    .week-tab:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
        border-color: #667eea;
        color: #667eea;
    }
    
    .week-tab.active {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        border-color: #667eea;
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
        transform: translateY(-1px);
    }
    
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 0;
    }
    
    .day-header {
        display: none;
    }
    
    .day-card {
        padding: 20px;
        min-height: 160px;
        border-radius: 16px;
        background: white;
        border: 1px solid #e9ecef;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }
    
    .day-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(0,0,0,0.1);
        border-color: #667eea;
    }
    
    .day-card.has-trucks {
        border-color: #ff6b6b;
        background: linear-gradient(135deg, #fff8f8, #ffffff);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.1);
    }
    
    .day-card.has-trucks::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
        border-radius: 16px 16px 0 0;
    }
    
    .day-number {
        font-size: 1.6em;
        font-weight: 700;
        color: #2c3e50;
        margin-bottom: 8px;
        line-height: 1;
    }
    
    .day-name {
        font-size: 0.9em;
        color: #6c757d;
        margin-bottom: 12px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .truck-item {
        background: linear-gradient(135deg, #f8f9fa, #ffffff);
        padding: 14px 16px;
        margin-bottom: 8px;
        border-radius: 12px;
        border-left: 4px solid #ff6b6b;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        transition: all 0.2s ease;
        font-size: 0.9em;
    }
    
    .truck-item:hover {
        transform: translateX(4px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        border-left-color: #667eea;
    }
    
    .truck-name {
        font-size: 0.9em;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 6px;
        line-height: 1.4;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .truck-name:hover {
        color: #667eea;
        transform: translateX(2px);
    }
    
    .truck-name::after {
        content: '📍';
        font-size: 0.8em;
        opacity: 0.7;
        transition: all 0.2s ease;
    }
    
    .truck-name:hover::after {
        opacity: 1;
        transform: scale(1.1);
    }
    
    .ad-section {
        padding: 25px 0;
        background: #f8f9fa;
        border-radius: 15px;
        margin-top: 0;
    }
    
    .ad-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 0;
        padding: 0 20px;
    }
    
    .ad-item {
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        padding: 16px;
        min-height: 100px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        display: flex;
        flex-direction: column;
    }
    
    .ad-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        border-color: #667eea;
    }
    
    .ad-content {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-bottom: 12px;
        gap: 12px;
        flex: 1;
    }
    
    .ad-icon {
        font-size: 1.8em;
        text-align: center;
        flex-shrink: 0;
    }
    
    .ad-text {
        text-align: left;
        flex: 1;
    }
    
    .ad-name {
        font-size: 1em;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 4px;
    }
    
    .ad-desc {
        font-size: 0.85em;
        color: #6c757d;
        line-height: 1.3;
    }
    
    .ad-link {
        text-align: center;
        margin-top: auto;
    }
    
    .ad-link a {
        display: inline-block;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        text-decoration: none;
        font-size: 0.9em;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .ad-link a:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    }
    
    /* 圖片跑碼燈平板直向優化 */
    .image-marquee-container {
        padding: 10px 0;
    }
    
    .marquee-item img {
        width: 70px;
        height: 52px;
    }
    
    .marquee-track {
        gap: 15px;
    }
    
    .image-modal-content {
        max-width: 90vw;
        max-height: 80vh;
    }
    
    .image-modal-content img {
        max-height: 60vh;
    }
    
    .link-buttons-container {
        gap: 6px;
        margin-top: 10px;
        padding: 15px;
    }
    
    .link-button {
        padding: 6px 10px;
        font-size: 0.8em;
        border-radius: 6px;
    }
}

/* 平板橫向模式 (769px - 1024px 且橫向) */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .header {
        padding: 30px 25px;
    }
    
    .header h1 {
        font-size: 2.2em;
        line-height: 1.2;
    }
    
    .content {
        padding: 30px 25px;
    }
    
    .week-selector {
        padding: 15px 25px;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        justify-content: center;
    }
    
    .week-tab {
        padding: 12px 15px;
        font-size: 14px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .day-card {
        padding: 18px;
        min-height: 160px;
    }
    
    .day-number {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .day-name {
        font-size: 0.85em;
        margin-bottom: 10px;
        margin-left: 6px;
    }
    
    .truck-item {
        padding: 14px 16px;
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .truck-name {
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .truck-name::after {
        content: '📍';
        font-size: 0.8em;
        opacity: 0.7;
    }
    
    .ad-section {
        padding: 35px 25px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .ad-item {
        padding: 14px;
        min-height: 130px;
    }
    
    .ad-content {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .ad-icon {
        font-size: 1.7em;
    }
    
    .ad-name {
        font-size: 1em;
        font-weight: 600;
    }
    
    .ad-desc {
        font-size: 0.8em;
        line-height: 1.3;
    }
    
    .ad-link a {
        padding: 7px 14px;
        font-size: 0.9em;
    }
    
    .sponsor-modal {
        padding: 30px;
    }
    
    .sponsor-modal-content {
        width: 85%;
        max-width: 600px;
        max-height: 85vh;
    }
    
    .medical-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .modal-body .contact-item {
        padding: 18px;
        gap: 15px;
    }
    
    .contact-icon {
        font-size: 2.2em;
        width: 55px;
    }
    
    .contact-name {
        font-size: 1.05em;
    }
    
    .contact-phone,
    .contact-line {
        font-size: 1em;
        padding: 9px 18px;
    }
    
    /* 圖片跑碼燈平板優化 */
    .image-marquee-container {
        padding: 12px 0;
    }
    
    .marquee-item img {
        width: 75px;
        height: 56px;
    }
    
    .marquee-track {
        gap: 18px;
    }
    
    .image-modal-content {
        max-width: 85vw;
        max-height: 85vh;
    }
    
    .image-modal-content img {
        max-height: 65vh;
    }
    
    .link-buttons-container {
        gap: 6px;
        margin-top: 12px;
        padding: 18px;
    }
    
    .link-button {
        padding: 4px 8px;
        font-size: 0.75em;
        border-radius: 4px;
    }
}

/* 平板通用模式 (769px - 1024px) - 當無法檢測方向時使用 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .header {
        padding: 30px 25px;
    }
    
    .header h1 {
        font-size: 2.2em;
        line-height: 1.2;
    }
    
    .day-header {
        display: none;
    }
    
    .content {
        padding: 30px 25px;
    }
    
    .week-selector {
        padding: 15px 25px;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        justify-content: center;
    }
    
    .week-tab {
        padding: 12px 15px;
        font-size: 14px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .day-card {
        padding: 18px;
        min-height: 160px;
    }
    
    .day-number {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .day-name {
        font-size: 0.85em;
        margin-bottom: 10px;
        margin-left: 6px;
    }
    
    .truck-item {
        padding: 14px 16px;
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .truck-name {
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .truck-name::after {
        content: '📍';
        font-size: 0.8em;
        opacity: 0.7;
    }
    
    .ad-section {
        padding: 35px 25px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .ad-item {
        padding: 14px;
        min-height: 130px;
    }
    
    .ad-content {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .ad-icon {
        font-size: 1.7em;
    }
    
    .ad-name {
        font-size: 1em;
        font-weight: 600;
    }
    
    .ad-desc {
        font-size: 0.8em;
        line-height: 1.3;
    }
    
    .ad-link a {
        padding: 7px 14px;
        font-size: 0.9em;
    }
    
    .sponsor-modal {
        padding: 30px;
    }
    
    .sponsor-modal-content {
        width: 85%;
        max-width: 600px;
        max-height: 85vh;
    }
    
    .medical-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .modal-body .contact-item {
        padding: 18px;
        gap: 15px;
    }
    
    .contact-icon {
        font-size: 2.2em;
        width: 55px;
    }
    
    .contact-name {
        font-size: 1.05em;
    }
    
    .contact-phone,
    .contact-line {
        font-size: 1em;
        padding: 9px 18px;
    }
    
    /* 圖片跑碼燈平板優化 */
    .image-marquee-container {
        padding: 12px 0;
    }
    
    .marquee-item img {
        width: 75px;
        height: 56px;
    }
    
    .marquee-track {
        gap: 18px;
    }
    
    .image-modal-content {
        max-width: 85vw;
        max-height: 85vh;
    }
    
    .image-modal-content img {
        max-height: 65vh;
    }
    
    .link-buttons-container {
        gap: 6px;
        margin-top: 12px;
        padding: 18px;
    }
    
    .link-button {
        padding: 4px 8px;
        font-size: 0.75em;
        border-radius: 4px;
    }
}

@media (max-width: 768px) {
    .group-link {
        font-size: 1.1em;
        padding: 12px 25px;
    }
    
    .calendar-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ad-section {
        padding: 30px 15px;
    }
    
    .ad-title {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 25px;
    }
    
    .ad-item {
        padding: 16px;
    }
    
    .ad-content {
        margin-bottom: 12px;
        gap: 8px;
    }
    
    .ad-icon {
        font-size: 1.6em;
        flex-shrink: 0;
    }
    
    .ad-name {
        font-size: 1.1em;
        font-weight: 600;
    }
    
    .ad-desc {
        font-size: 0.85em;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ad-link a {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    
    .ad-banner {
        padding: 20px;
    }
    
    .banner-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .banner-text h4 {
        font-size: 1.3em;
        margin-bottom: 6px;
    }
    
    .banner-text p {
        font-size: 1em;
    }
    
    .cta-button {
        padding: 10px 25px;
        font-size: 0.95em;
    }
    
    .sponsor-modal {
        padding: 20px;
    }
    
    .sponsor-modal-content {
        width: 95%;
        max-width: 350px;
        max-height: 90vh;
        overflow-y: auto;
        margin: 0 auto;
    }
    
    .contact-grid {
        gap: 15px;
    }
    
    .medical-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .modal-body .contact-item {
        padding: 15px;
        gap: 12px;
    }
    
    .contact-icon {
        font-size: 2em;
        width: 50px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 1em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .contact-icon {
        font-size: 1.8em;
        width: 45px;
    }
    
    .contact-name {
        font-size: 0.95em;
    }
    
    .contact-phone {
        font-size: 0.95em;
    }
    
    .contact-line {
        font-size: 0.9em;
    }
    
    .day-header {
        display: none;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 0 10px;
        justify-content: center;
    }
    
    .week-tab {
        padding: 12px 8px;
        font-size: 13px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header h1 {
        font-size: 1.8em;
        line-height: 1.3;
    }
    
    .content {
        padding: 20px 15px;
    }
    
    .day-card {
        padding: 16px;
        min-height: 130px;
    }
    
    .day-number {
        font-size: 1.4em;
        display: inline;
    }
    
    .day-name {
        font-size: 0.9em;
        margin-bottom: 10px;
        display: inline;
        margin-left: 6px;
    }
    
    .truck-item {
        padding: 12px 14px;
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .truck-name {
        margin-bottom: 8px;
        font-size: 1.05em;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .truck-location {
        display: block;
        font-size: 0.85em;
        margin-top: 3px;
        padding-top: 3px;
        border-top: 1px solid #e9ecef;
        text-align: center;
    }
    
    .truck-name::after {
        content: "📍 " attr(data-address);
        font-size: 0.8em;
        color: #6c757d;
        font-weight: normal;
    }
}

/* 大手機/小平板橫向 (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .week-tab {
        padding: 12px 10px;
        font-size: 13px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .day-card {
        padding: 16px;
        min-height: 140px;
    }
    
    .truck-item {
        padding: 12px 14px;
        font-size: 0.95em;
    }
    
    .truck-name {
        font-size: 1em;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .marquee-item img {
        width: 65px;
        height: 48px;
    }
}

/* 橫向模式優化 */
@media (orientation: landscape) and (max-height: 500px) {
    .header {
        padding: 20px 25px;
    }
    
    .header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .week-selector {
        padding: 10px 25px;
    }
    
    .content {
        padding: 20px 25px;
    }
    
    .calendar-grid {
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .day-card {
        padding: 12px;
        min-height: 100px;
    }
    
    .day-number {
        font-size: 1.2em;
        margin-bottom: 6px;
    }
    
    .day-name {
        font-size: 0.75em;
        margin-bottom: 6px;
    }
    
    .truck-item {
        padding: 8px 10px;
        font-size: 0.8em;
        margin-bottom: 4px;
    }
    
    .truck-name {
        font-size: 0.85em;
        margin-bottom: 4px;
    }
}

/* 高解析度螢幕優化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .marquee-item img,
    .image-modal-content img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .day-card,
    .truck-item,
    .ad-item {
        border-width: 0.5px;
    }
}

/* 可折疊螢幕支援 */
/* 平板橫向模式優化 (768px - 1366px, landscape) - 包含 iPad Pro */
@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
    body {
        padding: 8px;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    }
    
    .container {
        margin: 0 auto;
        border-radius: 16px;
        box-shadow: 0 15px 30px rgba(0,0,0,0.08);
        max-width: 100%;
        display: grid;
        grid-template-rows: auto auto 1fr auto;
        min-height: calc(100vh - 16px);
    }
    
    .day-header {
        display: none;
    }
    
    .header {
        padding: 20px 25px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        text-align: center;
        border-radius: 16px 16px 0 0;
    }
    
    .header h1 {
        font-size: 1.8em;
        line-height: 1.2;
        margin-bottom: 8px;
        font-weight: 700;
    }
    
    .header p {
        font-size: 1em;
        opacity: 0.9;
    }
    
    .content {
        padding: 20px 25px;
        display: grid;
        grid-template-rows: auto 1fr auto;
        gap: 20px;
    }
    
    .week-selector {
        padding: 15px 0;
        background: #f8f9fa;
        border-radius: 12px;
        margin-bottom: 0;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        justify-content: center;
        padding: 0 15px;
    }
    
    .week-tab {
        padding: 10px 8px;
        font-size: 12px;
        font-weight: 600;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 8px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: white;
        border: 1px solid #e9ecef;
        box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    }
    
    .week-tab:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
        border-color: #667eea;
        color: #667eea;
    }
    
    .week-tab.active {
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        border-color: #667eea;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
    }
    
    .calendar-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 12px;
        margin-bottom: 0;
    }
    
    .day-card {
        padding: 14px;
        min-height: 120px;
        border-radius: 12px;
        background: white;
        border: 1px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }
    
    .day-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.08);
        border-color: #667eea;
    }
    
    .day-card.has-trucks {
        border-color: #ff6b6b;
        background: linear-gradient(135deg, #fff8f8, #ffffff);
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.1);
    }
    
    .day-card.has-trucks::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
        border-radius: 12px 12px 0 0;
    }
    
    .day-number {
        font-size: 1.3em;
        font-weight: 700;
        color: #2c3e50;
        margin-bottom: 6px;
        line-height: 1;
        display: inline;
    }
    
    .day-name {
        font-size: 0.8em;
        color: #6c757d;
        margin-bottom: 8px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        display: inline;
        margin-left: 6px;
    }
    
    .truck-item {
        background: linear-gradient(135deg, #f8f9fa, #ffffff);
        padding: 10px 12px;
        margin-bottom: 6px;
        border-radius: 8px;
        border-left: 3px solid #ff6b6b;
        box-shadow: 0 1px 4px rgba(0,0,0,0.04);
        transition: all 0.2s ease;
        font-size: 0.85em;
    }
    
    .truck-item:hover {
        transform: translateX(2px);
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        border-left-color: #667eea;
    }
    
    .truck-name {
        font-size: 0.85em;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 4px;
        line-height: 1.3;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .truck-name:hover {
        color: #667eea;
        transform: translateX(1px);
    }
    
    .truck-name::after {
        content: '📍';
        font-size: 0.7em;
        opacity: 0.7;
        transition: all 0.2s ease;
    }
    
    .truck-name:hover::after {
        opacity: 1;
        transform: scale(1.1);
    }
    
    .ad-section {
        padding: 20px 0;
        background: #f8f9fa;
        border-radius: 12px;
        margin-top: 0;
    }
    
    .ad-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        margin-bottom: 0;
        padding: 0 15px;
    }
    
    .ad-item {
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        padding: 12px;
        min-height: 80px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 4px rgba(0,0,0,0.04);
        display: flex;
        flex-direction: column;
    }
    
    .ad-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        border-color: #667eea;
    }
    
    .ad-content {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-bottom: 8px;
        gap: 8px;
        flex: 1;
    }
    
    .ad-icon {
        font-size: 1.4em;
        text-align: center;
        flex-shrink: 0;
    }
    
    .ad-text {
        text-align: left;
        flex: 1;
    }
    
    .ad-name {
        font-size: 0.9em;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 2px;
    }
    
    .ad-desc {
        font-size: 0.75em;
        color: #6c757d;
        line-height: 1.2;
    }
    
    .ad-link {
        text-align: center;
        margin-top: auto;
    }
    
    .ad-link a {
        display: inline-block;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        padding: 6px 12px;
        border-radius: 15px;
        text-decoration: none;
        font-size: 0.8em;
        font-weight: 600;
        transition: all 0.3s ease;
    }
    
    .ad-link a:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 12px rgba(102, 126, 234, 0.3);
    }
}

/* iPad Pro 專門優化 (834px - 1366px) */
@media (min-width: 834px) and (max-width: 1366px) and (orientation: portrait) {
    .container {
        max-width: 90%;
        margin: 20px auto;
    }
    
    .header h1 {
        font-size: 2.4em;
    }
    
    .calendar-grid {
        gap: 20px;
    }
    
    .day-card {
        padding: 24px;
        min-height: 180px;
    }
    
    .day-number {
        font-size: 1.8em;
    }
    
    .truck-item {
        padding: 16px 18px;
        font-size: 1em;
    }
    
    .truck-name {
        font-size: 1em;
    }
    
    .week-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
        padding: 0 25px;
    }
    
    .week-tab {
        padding: 16px 14px;
        font-size: 15px;
    }
}

@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .container {
        max-width: 95%;
        margin: 15px auto;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .day-header {
        display: none;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
    }
    
    .week-tabs {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    
    .day-card {
        padding: 16px;
        min-height: 140px;
    }
    
    .ad-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

/* 重疊檢測樣式 */
.overlap-warning {
    position: relative;
    z-index: 999 !important;
    box-shadow: 0 0 0 2px #ff6b6b !important;
    /* 動畫已關閉，避免閃爍 */
}

@keyframes overlapPulse {
    0% {
        box-shadow: 0 0 0 2px #ff6b6b;
    }
    100% {
        box-shadow: 0 0 0 3px #ff6b6b, 0 0 5px rgba(255, 107, 107, 0.3);
    }
}

/* 平板重疊檢測優化 */
@media (min-width: 768px) and (max-width: 1366px) {
    .overlap-warning {
        transform: translateY(-2px);
        transition: all 0.3s ease;
    }
    
    .day-card.overlap-warning {
        border-color: #ff6b6b;
        background: linear-gradient(135deg, #fff8f8, #ffffff);
    }
    
    .truck-item.overlap-warning {
        border-left-color: #ff6b6b;
        background: linear-gradient(135deg, #fff8f8, #ffffff);
    }
    
    .ad-item.overlap-warning {
        border-color: #ff6b6b;
        background: linear-gradient(135deg, #fff8f8, #ffffff);
    }
}

/* 對齊檢測樣式 */
.alignment-suggestion {
    position: relative;
    outline: 2px dashed #4CAF50 !important;
    outline-offset: 2px;
    background: linear-gradient(135deg, #f8fff8, #ffffff) !important;
    transition: all 0.3s ease;
}

.alignment-suggestion::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.1;
    /* 動畫已關閉，避免閃爍 */
}

@keyframes alignmentPulse {
    0%, 100% {
        opacity: 0.1;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.01);
    }
}

.alignment-hint {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    animation: hintFadeIn 0.3s ease-out;
}

@keyframes hintFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.hint-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #4CAF50;
}

.hint-text {
    text-align: center;
    line-height: 1.3;
}

.hint-text small {
    opacity: 0.8;
    font-size: 10px;
}

.alignment-applied {
    background: linear-gradient(135deg, #e8f5e8, #ffffff) !important;
    border-color: #4CAF50 !important;
    transition: all 0.5s ease;
}

.alignment-applied::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #4CAF50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: checkmarkFade 2s ease-out;
}

@keyframes checkmarkFade {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    20% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* 平板對齊檢測優化 */
@media (min-width: 768px) and (max-width: 1366px) {
    .alignment-suggestion {
        outline-width: 3px;
        outline-offset: 3px;
    }
    
    .alignment-hint {
        font-size: 14px;
        padding: 10px 16px;
        top: -50px;
    }
    
    .hint-arrow {
        border-left-width: 8px;
        border-right-width: 8px;
        border-top-width: 8px;
    }
}

/* 極小螢幕 (320px - 375px) */
@media (max-width: 375px) {
    .header-cta {
        margin-top: 12px;
    }
    
    .cta-button {
        min-width: 100px;
        padding: 8px 16px;
        font-size: 0.85em;
    }
    
    .container {
        margin: 5px;
        border-radius: 10px;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .header h1 {
        font-size: 1.4em;
        line-height: 1.1;
    }
    
    .content {
        padding: 15px 10px;
    }
    
    .week-selector {
        padding: 10px 15px;
    }
    
    .week-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
        padding: 0 2px;
    }
    
    .week-tab {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .day-card {
        padding: 12px;
        min-height: 100px;
    }
    
    .day-number {
        font-size: 1.2em;
        margin-bottom: 6px;
    }
    
    .day-name {
        font-size: 0.75em;
        margin-bottom: 6px;
        margin-left: 4px;
    }
    
    .truck-item {
        padding: 8px 10px;
        font-size: 0.85em;
        margin-bottom: 4px;
    }
    
    .truck-name {
        font-size: 0.9em;
        margin-bottom: 4px;
    }
    
    .ad-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ad-item {
        padding: 12px;
        min-height: 100px;
    }
    
    .marquee-item img {
        width: 50px;
        height: 37px;
    }
    
    .marquee-track {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-cta {
        margin-top: 15px;
    }
    
    .cta-button {
        min-width: 120px;
        padding: 10px 20px;
        font-size: 0.9em;
    }
    
    .sponsor-modal {
        padding: 15px;
    }
    
    .sponsor-modal-content {
        width: 95%;
        max-width: 320px;
        margin: 0 auto;
    }
    
    .ad-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .ad-item {
        padding: 14px;
    }
    
    .ad-content {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .ad-icon {
        font-size: 1.5em;
        flex-shrink: 0;
    }
    
    .ad-name {
        font-size: 1em;
        font-weight: 600;
        margin-bottom: 3px;
    }
    
    .ad-desc {
        font-size: 0.8em;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .ad-link a {
        padding: 5px 10px;
        font-size: 0.85em;
    }
    
    .group-link {
        font-size: 1em;
        padding: 10px 20px;
        margin-top: 15px;
    }
    
    .header h1 {
        font-size: 1.6em;
        line-height: 1.2;
    }
    
    .week-title {
        font-size: 1.8em;
    }
    
    .week-date-range {
        font-size: 0.9em;
        padding: 8px 16px;
    }
    
    .week-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 0 5px;
    }
    
    .week-tab {
        padding: 10px 6px;
        font-size: 12px;
    }
    
    .day-card {
        padding: 14px;
        min-height: 110px;
    }
    
    .day-number {
        font-size: 1.3em;
        display: inline;
    }
    
    .day-name {
        font-size: 0.85em;
        margin-bottom: 8px;
        display: inline;
        margin-left: 5px;
    }
    
    .truck-item {
        padding: 10px 12px;
        font-size: 0.95em;
        margin-bottom: 6px;
    }
    
    .truck-name {
        margin-bottom: 6px;
        font-size: 1em;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .truck-location {
        display: block;
        font-size: 0.8em;
        margin-top: 2px;
        padding-top: 2px;
        border-top: 1px solid #e9ecef;
        text-align: center;
    }
    
    .truck-name::after {
        content: "📍 " attr(data-address);
        font-size: 0.75em;
        color: #6c757d;
        font-weight: normal;
    }
}

/* 快速使用指南樣式 */
.guide-steps {
    margin-bottom: 30px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.guide-step:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.step-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.step-content h4 {
    color: #2c3e50;
    font-size: 1.1em;
    margin-bottom: 8px;
    font-weight: 600;
}

.step-content p {
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
}

.guide-tips {
    background: linear-gradient(135deg, #e3f2fd, #f8f9fa);
    padding: 20px;
    border-radius: 15px;
    border-left: 4px solid #2196f3;
}

.guide-tips h4 {
    color: #1976d2;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.guide-tips ul {
    margin: 0;
    padding-left: 20px;
}

.guide-tips li {
    color: #424242;
    margin-bottom: 8px;
    line-height: 1.5;
}

/* 響應式設計 - 快速使用指南 */
@media (max-width: 768px) {
    .header-cta {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 20px;
    }
    
    .cta-button {
        width: auto;
        min-width: 140px;
        padding: 12px 24px;
        font-size: 1em;
        border-radius: 25px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .cta-button.secondary {
        background: rgba(255, 255, 255, 0.2);
        color: white;
        border: 2px solid rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(10px);
    }
    
    .cta-button.secondary:hover {
        transform: translateY(-2px);
        background: rgba(255, 255, 255, 0.3);
        box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
    }
    
    .guide-step {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .step-number {
        align-self: center;
    }
    
    /* 週次選擇器手機版優化 */
    .week-selector {
        padding: 20px 15px;
    }
    
    .week-selector-header h3 {
        font-size: 1.3em;
    }
    
    .week-selector-desc {
        font-size: 0.9em;
    }
    
    .week-tabs {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .week-tab-content {
        padding: 6px 10px;
    }
    
    .week-tab-title {
        font-size: 0.85em;
    }
    
    .week-tab-dates {
        font-size: 0.75em;
    }
    
    .week-tab-trucks {
        font-size: 0.65em;
    }
    
}

/* 性能優化樣式 */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
}

/* 減少重繪和重排 */
.week-content {
    will-change: transform, opacity;
}

.day-card {
    will-change: transform;
}

.truck-item {
    will-change: transform;
}

/* 硬體加速 */
.header,
.week-tab,
.cta-button,
.day-card,
.truck-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 優化動畫性能 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 聯絡四維總召懸浮按鈕樣式 */

/* ==================== TikTok 影片響應式設計 ==================== */

/* 電腦版基礎樣式已整合到下方分級設定中 */

/* 平板橫向（834px - 1024px）- 兩欄布局（iPad Pro 等）*/
@media (min-width: 834px) and (max-width: 1024px) and (orientation: landscape) {
    .tiktok-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.2rem !important;
        padding: 0 1rem !important;
    }
    
    .tiktok-container {
        height: 500px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.6rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.85rem !important;
    }
}

/* 平板直向（768px - 1024px）- 兩欄布局 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .tiktok-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        padding: 0 1rem !important;
    }
    
    .tiktok-container {
        height: 480px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.5rem !important;
    }
}

/* 確保影片框架在所有設備上都美觀 */
.tiktok-section {
    position: relative;
}

.tiktok-container {
    position: relative;
    transition: height 0.3s ease;
    width: 100%;
}

.tiktok-item {
    width: 100%;
    min-width: 0; /* 允許項目縮小 */
}

/* 載入狀態優化 */
.tiktok-embed {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* 影片內容自適應 */
.tiktok-embed iframe {
    width: 100% !important;
    max-width: 100% !important;
}

/* 電腦版網格優化 */
@media (min-width: 1025px) {
    /* 確保網格正確顯示 */
    .tiktok-grid {
        padding: 0 1.5rem !important;
    }
}

/* ==================== 結束 TikTok 響應式設計 ====================*/

/* ==================== TikTok 影片輪播（手機版滑軌）==================== */

/* 基礎網格設定 - 電腦版並排（默認四欄）*/
.tiktok-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 0 auto;
    position: relative;
}

/* 超大螢幕（2560px 以上）- 四欄布局，最寬敞 */
@media (min-width: 2560px) {
    .tiktok-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 2rem !important;
        max-width: 95% !important;
        padding: 0 2rem !important;
    }
    
    .tiktok-container {
        height: 650px !important;
    }
    
    .tiktok-title h3 {
        font-size: 2rem !important;
    }
    
    .tiktok-title p {
        font-size: 1rem !important;
    }
}

/* 大螢幕（1920px - 2559px）- 四欄布局 */
@media (min-width: 1920px) and (max-width: 2559px) {
    .tiktok-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.5rem !important;
        max-width: 95% !important;
        padding: 0 1.5rem !important;
    }
    
    .tiktok-container {
        height: 580px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.9rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.95rem !important;
    }
}

/* Full HD（1680px - 1919px）- 四欄布局 */
@media (min-width: 1680px) and (max-width: 1919px) {
    .tiktok-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.3rem !important;
        max-width: 95% !important;
        padding: 0 1.5rem !important;
    }
    
    .tiktok-container {
        height: 520px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.8rem !important;
    }
}

/* 標準 HD（1440px - 1679px）- 四欄布局 */
@media (min-width: 1440px) and (max-width: 1679px) {
    .tiktok-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1.2rem !important;
        max-width: 95% !important;
        padding: 0 1.2rem !important;
    }
    
    .tiktok-container {
        height: 480px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.7rem !important;
    }
}

/* 一般電腦（1280px - 1439px）- 四欄布局 */
@media (min-width: 1280px) and (max-width: 1439px) {
    .tiktok-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 1rem !important;
        max-width: 96% !important;
        padding: 0 1rem !important;
    }
    
    .tiktok-container {
        height: 450px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.6rem !important;
    }
}

/* 小筆電（1025px - 1279px）- 三欄布局 */
@media (min-width: 1025px) and (max-width: 1279px) {
    .tiktok-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
        max-width: 96% !important;
        padding: 0 1rem !important;
    }
    
    .tiktok-container {
        height: 500px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.6rem !important;
    }
}

/* 手機版（767px 以下）：啟用滑軌效果 */
@media (max-width: 767px) {
    .tiktok-grid {
        display: flex !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        gap: 1.2rem !important;
        padding: 0 1rem 1rem 1rem;
        /* 觸控優化 */
        touch-action: pan-x pinch-zoom;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* 隱藏捲軸 */
    .tiktok-grid::-webkit-scrollbar {
        display: none;
    }
    
    /* 影片項目 - 滑動卡片 */
    .tiktok-item {
        flex: 0 0 auto;
        width: calc(100vw - 3rem);
        max-width: 500px;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        /* 觸控優化 */
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        /* 視覺優化 */
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    /* 滑動時減弱陰影（視覺回饋）*/
    .tiktok-grid:active .tiktok-item {
        transform: scale(0.98);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    }
    
    /* 滑動指示器容器 */
    .tiktok-dots {
        display: flex !important;
        justify-content: center;
        align-items: center;
        gap: 12px;
        padding: 1.2rem 0;
        min-height: 44px; /* iOS 建議最小觸控區域 */
    }
    
    /* 滑動指示器點點 - 加大觸控區域 */
    .tiktok-dot {
        width: 44px; /* iOS 建議最小觸控尺寸 */
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        /* 點擊反饋 */
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    }
    
    .tiktok-dot::before {
        content: '';
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #d0d0d0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    /* 點擊時的放大效果 */
    .tiktok-dot:active::before {
        transform: scale(1.2);
    }
    
    .tiktok-dot.active::before {
        width: 32px;
        height: 10px;
        border-radius: 5px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    }
    
    /* 滑動提示 - 加強可見性 */
    .tiktok-swipe-hint {
        display: block !important;
        text-align: center;
        color: #667eea;
        font-size: 0.9rem;
        font-weight: 600;
        padding: 0.8rem 0;
        animation: swipeHintPulse 2s ease-in-out infinite;
        background: linear-gradient(to bottom, transparent, rgba(102, 126, 234, 0.05), transparent);
        margin: 0.5rem 0;
    }
    
    @keyframes swipeHintPulse {
        0%, 100% { 
            opacity: 0.7;
            transform: translateY(0);
        }
        50% { 
            opacity: 1;
            transform: translateY(-2px);
        }
    }
    
    .tiktok-container {
        height: 520px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.5rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.8rem !important;
    }
}

/* 一般手機（480px 以下）*/
@media (max-width: 480px) {
    .tiktok-container {
        height: 500px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.4rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.8rem !important;
    }
    
    .tiktok-item {
        width: calc(100vw - 2.5rem);
    }
    
    .tiktok-grid {
        gap: 1rem !important;
        padding: 0 0.75rem 1rem 0.75rem;
    }
    
    /* 滑動提示文字加大 */
    .tiktok-swipe-hint {
        font-size: 0.95rem !important;
        padding: 1rem 0 !important;
    }
    
    /* 指示器加大間距 */
    .tiktok-dots {
        gap: 10px !important;
        padding: 1.2rem 0 !important;
    }
}

/* 小手機（375px 以下）*/
@media (max-width: 375px) {
    .tiktok-container {
        height: 450px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.3rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.75rem !important;
    }
    
    .tiktok-item {
        width: calc(100vw - 2rem);
    }
    
    .tiktok-grid {
        gap: 1rem !important;
        padding: 0 0.5rem 1rem 0.5rem;
    }
}

/* 超小手機（320px 以下）- iPhone SE 等 */
@media (max-width: 320px) {
    .tiktok-container {
        height: 400px !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.2rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.7rem !important;
    }
    
    .tiktok-item {
        width: calc(100vw - 1.5rem);
    }
    
    .tiktok-swipe-hint {
        font-size: 0.85rem !important;
    }
}

/* 手機橫向模式 */
@media (max-width: 767px) and (orientation: landscape) {
    .tiktok-container {
        height: 380px !important;
    }
    
    .tiktok-section {
        margin: 0.8rem 0 !important;
    }
    
    .tiktok-title {
        margin-bottom: 0.8rem !important;
    }
    
    .tiktok-title h3 {
        font-size: 1.2rem !important;
    }
    
    .tiktok-title p {
        font-size: 0.7rem !important;
    }
    
    .tiktok-item {
        width: 350px;
    }
}

/* 平板/電腦版（768px 以上）：隱藏滑動提示和指示器 */
@media (min-width: 768px) {
    .tiktok-dots,
    .tiktok-swipe-hint {
        display: none !important;
    }
}

/* ==================== 結束 TikTok 輪播設計 ====================*/