/* 全域設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Serif TC', 'Noto SerifTC', sans-serif;
}

body {
    background-color: #e0f2fe;
    color: #1e293b;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

#particles-js {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, #dbeafe 0%, var(--theme-color, #4a88a7) 100%);
}

/* 擬真鐵灰色電梯介面 */
#elevator-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.92);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#elevator-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.elevator-panel-box {
    background: linear-gradient(145deg, #475569, #334155);
    border: 4px solid #1e293b;
    border-radius: 20px;
    padding: 30px;
    width: 350px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10002;
}

.elevator-display-screen {
    background-color: #0f172a;
    border: 3px solid #1e293b;
    border-radius: 10px;
    width: 100%;
    padding: 15px;
    text-align: center;
    margin-bottom: 25px;
    box-shadow: inset 0 0 15px rgba(56, 189, 248, 0.4);
}

#floor-number {
    font-size: 3.2rem;
    color: #38bdf8;
    font-weight: bold;
    text-shadow: 0 0 12px rgba(56,189,248,0.8);
    font-family: monospace;
}

.floor-unit {
    color: #38bdf8;
    font-size: 1rem;
    font-weight: bold;
}

#elevator-status {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 5px;
    letter-spacing: 1px;
}

.elevator-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.floor-key {
    background: linear-gradient(145deg, #64748b, #475569);
    color: #fff;
    border: 2px solid #1e293b;
    padding: 14px 0;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.2);
    transition: 0.2s;
}

.floor-key:hover {
    background: linear-gradient(145deg, #0284c7, #0369a1);
    box-shadow: 0 0 18px rgba(2, 132, 199, 0.7);
    transform: translateY(-2px);
}

.floor-key:active { transform: translateY(2px); }

@keyframes elevatorVibration {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-3px, 3px); }
    40% { transform: translate(3px, -3px); }
    60% { transform: translate(-2px, -2px); }
    80% { transform: translate(2px, 3px); }
    100% { transform: translate(0, 0); }
}
.vibrating { animation: elevatorVibration 0.12s infinite; }

.elevator-doors {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    z-index: 10000;
    overflow: hidden;
    pointer-events: none;
}

.door {
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, #475569, #334155, #475569);
    border: 2px solid #1e293b;
    transition: transform 1.2s cubic-bezier(0.77, 0, 0.175, 1);
}
.left-door { transform-origin: left; }
.right-door { transform-origin: right; }

#elevator-screen.open .left-door { transform: translateX(-100%); }
#elevator-screen.open .right-door { transform: translateX(100%); }

.hidden { display: none !important; }

header {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    color: #0f172a;
    padding: 35px 20px; /* 縮小上下 padding，使高度降低 */
    border-bottom: 1px solid rgba(2, 132, 199, 0.2);
    box-shadow: 0 2px 10px rgba(2, 132, 199, 0.05);
    overflow: hidden; /* 確保背景圖不會超出 header 範圍 */
    text-align: center;
}

/* LOGO 作為背景浮水印 (透明度 0.3) */
.header-bg-logo {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none; /* 確保滑鼠點擊能穿透背景圖 */
}

.header-bg-logo img {
    height: 130px; /* 控制背景浮水印的大小 */
    width: auto;
    object-fit: contain;
    opacity: 0.3; /* 透明度 0.3 */
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

/* 確保文字層在浮水印上方 */
.header-content {
    position: relative;
    z-index: 2;
}

.header-content h1 {
    font-size: 2rem;
    color: var(--theme-color, #0284c7);
    letter-spacing: 1px;
    font-weight: 700;
}

.header-content h1 span {
    color: #0f172a;
    font-weight: 500;
    margin-left: 8px;
    font-weight: 600;
}

.quick-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 12px 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border-bottom: 1px solid rgba(2, 132, 199, 0.15);
    position: sticky;
    top: 0;
    z-index: 99;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.elevator-trigger-btn {
    background: var(--theme-color, #0284c7);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.elevator-trigger-btn:hover { transform: scale(1.05); }

.nav-divider { width: 1px; height: 25px; background: rgba(0,0,0,0.1); }

.nav-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-btn {
    padding: 6px 12px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.2s;
}

.nav-btn.active, .nav-btn:hover {
    background: var(--theme-color, #0284c7);
    color: white;
    border-color: var(--theme-color, #0284c7);
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

.floor-container {
    max-width: 950px;
    margin: 40px auto;
    padding: 0 20px;
}

.floor-detail-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(2, 132, 199, 0.1);
    padding: 35px;
    animation: cardFloat 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.floor-detail-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--theme-color);
}

@keyframes cardFloat {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.floor-title-banner {
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    padding-bottom: 10px;
}

.floor-title-banner h2 {
    font-size: 2.4rem;
    color: var(--theme-color);
}

.wardens-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 35px;
}

/* 樓長卡片主體 */
.warden-box {
    display: flex;
    gap: 25px;
    background: var(--warden-bg);
    padding: 25px;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 25px var(--warden-shadow);
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s;
}
.warden-box:hover { transform: translateY(-3px); }

/* 去背圖片貼紙樣式 (Sticker Image) */
.sticker-img {
    position: absolute;
    width: 5.5rem; 
    height: auto;
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
    min-width: 40px;
    min-height: 40px;
}
/* 讓不同位置的貼紙有各自的錯落角度與座標 */
.sticker-img:nth-child(1) { top: 185px; left: 22%; transform: rotate(-10deg); }
.sticker-img:nth-child(2) { top: 12px; right: 20px; transform: rotate(6deg);  }

.warden-box img.avatar {
    width: 15rem;
    height: 15rem;
    border-radius: 20%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 1;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
}

.warden-desc {
    z-index: 1;
    flex: 1;
}

.warden-desc h3 { font-size: 1.6rem; color: #0f172a; }
.warden-desc .w-title {
    display: inline-block;
    background: rgba(255, 255, 255, 0.8);
    color: #1e293b;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 6px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 自傳文字折疊效果 */
.bio-container { position: relative; margin: 8px 0; }
.bio-text {
    color: #1e293b;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    transition: max-height 0.3s ease;
}
.bio-text.expanded {
    -webkit-line-clamp: unset;
    display: block;
    max-height: 240px; 
    overflow-y: auto; 
    padding-right: 8px;
    background: rgba(255, 255, 255, 0.4);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(2, 132, 199, 0.1);

    scrollbar-width: thin;
    scrollbar-color: var(--warden-color, #9ea0a1) #ececec;
}

.bio-text.expanded::-webkit-scrollbar {
    width: 6px;
}
.bio-text.expanded::-webkit-scrollbar-track {
    background: rgba(186, 230, 253, 0.3);
    border-radius: 4px;
}
.bio-text.expanded::-webkit-scrollbar-thumb {
    background: var(--warden-color, #0284c7);
    border-radius: 4px;
}
.bio-text.expanded::-webkit-scrollbar-thumb:hover {
    opacity: 0.8;
}
.read-more-btn {
    background: rgba(255,255,255,0);
    border: none;
    color: var(--theme-color, #4d7283);
    font-weight: bold;
    cursor: pointer;
    margin-top: 5px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* 給住宿生的話 手風琴 */
.message-accordion {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    text-align: left;
    font-weight: bold;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.accordion-header i { transition: transform 0.3s; }

.accordion-content {
    max-height: 0;
    overflow-y: auto;
    transition: max-height 0.4s ease-in-out, padding 0.3s ease;
    padding: 0 15px;
    font-style: italic;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.8);
    scrollbar-width: thin;
}
.message-accordion.active .accordion-content {
    max-height: 240px;
    padding: 10px 15px 15px 15px;
}
.message-accordion.active .accordion-header i { transform: rotate(180deg); }

/* 樓層資源與QR Code */
.floor-resources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: rgba(240, 249, 255, 0.7);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(2, 132, 199, 0.1);
}

.qr-box, .notice-box { text-align: center; }
.qr-box h3, .notice-box h3 { color: #0f172a; }

.qr-box img {
    width: 130px;
    height: 130px;
    background: white;
    padding: 6px;
    border-radius: 10px;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.notice-box p {
    font-size: 0.95rem;
    color: #334155;
    margin: 12px 0;
    line-height: 1.6;
    text-align: left;
    background: rgba(255,255,255,0.6);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(2, 132, 199, 0.1);
}

.pdf-btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--theme-color, #0284c7);
    color: white;
    font-weight: bold;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.2s;
    margin-top: 8px;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}
.pdf-btn:hover { opacity: 0.9; transform: scale(1.04); }

footer {
    text-align: center;
    padding: 30px;
    background-color: #5f5f5f;
    color: #cacbcc;
    font-size: 0.9rem;
    margin-top: 60px;
    border-top: 1px solid #94a3b8;
}

.tarot-egg-btn {
    display: inline-block;
    margin-top: 8px;
    margin-right: 8px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
    transition: 0.2s;
}
.tarot-egg-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #6d28d9, #9333ea);
}

#tarot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 5, 20, 0.9);
    backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#tarot-modal.show {
    opacity: 1;
    visibility: visible;
}

.tarot-modal-content {
    background: linear-gradient(145deg, #2e1065, #1e1b4b);
    border: 2px solid #a855f7;
    border-radius: 25px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.6);
    color: #f3e8ff;
    position: relative;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 彈跳視窗內的圖片置中與排版 */
.tarot-modal-img {
    width: 12rem;      /* 圖片大小，可依需求調整 */
    height: 12rem;
    object-fit: contain;
    margin: 0 auto 15px auto; /* 左右自動置中，下方留白 */
    display: block;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.6));
}

.tarot-modal-content h2 {
    font-size: 1.8rem;
    color: #c084fc;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.5);
}

.tarot-modal-content p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e9d5ff;
    margin-bottom: 25px;
}

.close-modal-btn {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    color: white;
    border: none;
    padding: 10px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    transition: 0.2s;
}
.close-modal-btn:hover { transform: scale(1.05); }

@media (max-width: 768px) {
    .quick-nav { flex-direction: column; gap: 12px; padding: 10px; }
    .nav-divider { display: none; }
    .warden-box { padding: 10px; flex-direction: column; text-align: left; align-items: center; }
    .floor-resources { grid-template-columns: 1fr; }
    .notice-box p { text-align: center; }
    .sticker-img:nth-child(2) { top: 15px; right: 1%; transform: rotate(6deg); }
    .sticker-img:nth-child(1) { top: 200px; left: 1%; transform: rotate(-10deg); }
    .nav-buttons { max-width: 320px; margin-bottom: 1rem }
    .dorm-logo { width: 8rem; height:8rem;}
    header h1 { font-size: 1.6rem;}
    .floor-title-banner h2 { font-size: 1.8rem; color: var(--theme-color);}
    .sticker-img {width: 4.5rem;}
    .floor-detail-card {padding: 20px;}
    .warden-desc .w-title {margin: 4px 0px; font-size: 0.8rem;}
    .warden-desc h3 { margin-top: 10px; margin-bottom: 4px; }
    .bio-text {-webkit-line-clamp: 4; font-size: 0.9rem;}
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.3rem;
    }
    .header-bg-logo img {
        height: 90px;
    }
}