/* --- 基礎樣式與動態效果設定 --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: #1a1a1a;
    background-image: 
        radial-gradient(circle, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.75) 100%),
        url('bg.png'); 
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #f0f0f0;
    line-height: 1.6;
    padding: 0 20px 40px 20px;
    padding-top: 90px;
}

.container {
    max-width: 850px;
    margin: 0 auto;
}

/* --- 全局登場動畫 Keyframes --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseOnline {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0);
    }
}

@keyframes pulseOffline {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes modalZoomIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- 伺服器標題全螢幕首屏 (Hero Screen) --- */
.header {
    text-align: center;
    min-height: calc(100vh - 90px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-bottom: 60px;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 向下滑動指示器 */
.scroll-hint {
    position: absolute;
    bottom: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #ffff55;
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 1px;
    animation: bounce 2s infinite;
    user-select: none;
}

.scroll-hint i {
    font-size: 1.2rem;
}

.main-content {
    margin-top: 20px;
}

.server-logo {
    font-family: 'Press Start 2P', cursive;
    font-size: 2rem;
    color: #ffaa00;
    text-shadow: 4px 4px 0px #3f2a00;
    margin-bottom: 10px;
    letter-spacing: 2px;
    word-wrap: break-word;
    transition: transform 0.3s ease;
}

.server-logo:hover {
    transform: scale(1.03);
}

.server-version {
    display: inline-block;
    background-color: #55ff55;
    color: #000;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    margin: 5px 4px 0 4px;
    box-shadow: 2px 2px 0px #00aa00;
}

/* --- 核心資訊卡片（Minecraft 經典風格） --- */
.card {
    background-color: #2e2e2e;
    border: 4px solid #000;
    box-shadow: 
        inset -4px -4px 0px #1a1a1a, 
        inset 4px 4px 0px #5c5c5c,
        0px 8px 16px rgba(0,0,0,0.6);
    padding: 30px;
    margin-bottom: 30px;
    image-rendering: pixelated;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 
        inset -4px -4px 0px #1a1a1a, 
        inset 4px 4px 0px #5c5c5c,
        0px 12px 24px rgba(0,0,0,0.8);
}

/* --- 動態伺服器狀態字卡 --- */
.status-card {
    position: relative;
}

/* 線上狀態字卡（綠色主題） */
.status-card-online {
    background-color: #1e3a20;
    border: 4px solid #55ff55;
    box-shadow: 
        inset -4px -4px 0px #0f2111, 
        inset 4px 4px 0px #38693c,
        0px 8px 24px rgba(85, 255, 85, 0.25);
}

/* 離線狀態字卡（紅色主題） */
.status-card-offline {
    background-color: #3d231d;
    border: 4px solid #ff5555;
    box-shadow: 
        inset -4px -4px 0px #211310, 
        inset 4px 4px 0px #5c342b,
        0px 8px 24px rgba(255, 85, 85, 0.25);
}

.status-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
}

.status-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #000;
}

.status-card-online .status-indicator-dot {
    background-color: #00ff00;
    animation: pulseOnline 2s infinite;
}

.status-card-offline .status-indicator-dot {
    background-color: #ff0000;
    animation: pulseOffline 2s infinite;
}

.status-title-large {
    font-size: 2.2rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 0px #000;
}

.status-meta {
    margin-bottom: 20px;
}

.last-checked {
    font-size: 0.85rem;
    color: #cccccc;
    font-weight: bold;
}

/* 上線與離線提示區塊 */
.online-notice {
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px dashed #55ff55;
    padding: 15px;
    margin-top: 15px;
    border-radius: 4px;
}

.online-desc {
    color: #ddffdd;
    font-size: 0.95rem;
}

.offline-notice {
    background-color: rgba(0, 0, 0, 0.3);
    border: 2px dashed #ff7777;
    padding: 15px;
    margin-top: 15px;
    border-radius: 4px;
}

.offline-desc {
    color: #ffcccc;
    font-size: 0.95rem;
}

/* 狀態字卡底部的按鈕群組 */
.status-actions-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed rgba(255, 255, 255, 0.2);
}

.status-actions-group .mc-btn {
    flex: 1;
    min-width: 220px;
}

/* --- IP 區塊 --- */
.ip-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background-color: #151515;
    border: 3px solid #000;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.ip-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.85rem;
    color: #55ffff;
}

.ip-text {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 1px;
    color: #ffffff;
    word-break: break-all;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    width: 100%;
}

/* --- Minecraft 經典 3D 按鈕 --- */
.mc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Noto Sans TC', sans-serif;
    font-weight: bold;
    font-size: 1rem;
    color: #ffffff;
    background-color: #4a4a4a;
    border: 3px solid #000;
    box-shadow: 
        inset -3px -3px 0px #2e2e2e, 
        inset 3px 3px 0px #8b8b8b;
    padding: 12px 24px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    text-align: center;
    text-decoration: none;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.mc-btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    min-width: auto;
    max-width: auto;
    flex: none;
    border-width: 2px;
    box-shadow: 
        inset -2px -2px 0px #2e2e2e, 
        inset 2px 2px 0px #8b8b8b;
}

.mc-btn-recheck:hover {
    background-color: #5555ff;
    box-shadow: inset -2px -2px 0px #0000aa, inset 2px 2px 0px #aaaaff;
}

.mc-btn-copy:hover {
    background-color: #5b8e22;
    box-shadow: inset -3px -3px 0px #3f6317, inset 3px 3px 0px #8be134;
}

.mc-btn-dc {
    background-color: #5865F2;
}

.mc-btn-dc:hover {
    background-color: #4752C4;
    box-shadow: inset -3px -3px 0px #2b327a, inset 3px 3px 0px #808bfe;
}

.mc-btn-join {
    background-color: #2e8b57;
}

.mc-btn-join:hover {
    background-color: #3cb371;
    box-shadow: inset -3px -3px 0px #1e5937, inset 3px 3px 0px #6ee3a1;
}

.mc-btn-info {
    background-color: #0284c7;
}

.mc-btn-info:hover {
    background-color: #0369a1;
    box-shadow: inset -3px -3px 0px #0c4a6e, inset 3px 3px 0px #38bdf8;
}

.mc-btn:active {
    box-shadow: inset 3px 3px 0px #1a1a1a, inset -3px -3px 0px #5c5c5c;
    transform: translateY(2px);
}

.toast {
    display: none;
    background-color: #55ff55;
    color: #000000;
    font-weight: bold;
    padding: 10px 20px;
    border: 2px solid #000;
    margin-top: 15px;
    box-shadow: 3px 3px 0px #00aa00;
    text-align: center;
    width: 100%;
    max-width: 500px;
    animation: fadeInUp 0.3s ease;
}

/* --- 網格導覽選單 --- */
.nav-grid-section {
    margin-top: 40px;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-title {
    font-size: 1.5rem;
    color: #ffff55;
    margin-bottom: 20px;
    border-bottom: 2px dashed #5c5c5c;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.nav-card {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background-color: #2e2e2e;
    border: 3px solid #000;
    box-shadow: 
        inset -3px -3px 0px #1a1a1a, 
        inset 3px 3px 0px #5c5c5c,
        0px 4px 10px rgba(0,0,0,0.5);
    padding: 20px;
    text-decoration: none;
    color: #ffffff;
    transition: all 0.25s ease;
}

.nav-card:hover {
    transform: translateY(-5px);
    background-color: #383838;
    border-color: #ffaa00;
    box-shadow: 
        inset -3px -3px 0px #1a1a1a, 
        inset 3px 3px 0px #707070,
        0px 8px 20px rgba(255, 170, 0, 0.2);
}

.nav-card-icon {
    font-size: 1.8rem;
    color: #ffaa00;
    min-width: 35px;
    text-align: center;
    margin-top: 2px;
}

.nav-card-content h3 {
    font-size: 1.15rem;
    color: #ffffff;
    margin-bottom: 4px;
}

.nav-card-content p {
    font-size: 0.85rem;
    color: #aaaaaa;
    line-height: 1.4;
}

/* --- 彈窗 (Modal) 樣式 --- */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-dialog {
    position: relative;
    background-color: #2e2e2e;
    border: 4px solid #ffaa00;
    box-shadow: 
        inset -4px -4px 0px #1a1a1a, 
        inset 4px 4px 0px #5c5c5c,
        0px 12px 32px rgba(0,0,0,0.9);
    padding: 30px;
    width: 100%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalZoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #aaaaaa;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: #ff5555;
}

.modal-title {
    font-size: 1.5rem;
    color: #ffff55;
    margin-bottom: 20px;
    border-bottom: 2px dashed #5c5c5c;
    padding-bottom: 10px;
    padding-right: 30px;
}

/* --- 步驟說明 --- */
.steps {
    list-style: none;
}

.steps li {
    position: relative;
    padding-left: 40px;
    margin-bottom: 20px;
}

.steps li::before {
    content: attr(data-step);
    position: absolute;
    left: 0;
    top: 2px;
    width: 26px;
    height: 26px;
    background-color: #ffaa00;
    color: #000;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
    box-shadow: 1px 1px 0px #3f2a00;
}

/* 響應式微調 */
@media (max-width: 650px) {
    body {
        padding-top: 130px;
    }
    .header {
        min-height: calc(100vh - 130px);
    }
    .server-logo {
        font-size: 1.6rem;
    }
    .status-title-large {
        font-size: 1.7rem;
    }
    .ip-text {
        font-size: 1.3rem;
    }
    .card {
        padding: 20px;
    }
    .btn-group {
        flex-direction: column;
        align-items: center;
    }
    .mc-btn {
        width: 100%;
        max-width: 100%;
    }
    .status-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .status-card-header button {
        width: 100%;
    }
    .status-actions-group {
        flex-direction: column;
    }
    .status-actions-group .mc-btn {
        width: 100%;
    }
}