/* ========== Minecraft Server Guide - Frontend ========== */
@import url('https://fonts.googleapis.com/css2?family=ZCOOL+KuaiLe&display=swap');

@font-face {
    font-family: 'MC Pixel';
    src: url('https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Unifont';
    src: url('https://cdn.jsdelivr.net/npm/unifont@15.1.06/unifont.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121c;
    --bg-card-hover: #1a1a2e;
    --border: #1e2d4a;
    --accent: #4ecca3;
    --accent-glow: rgba(78, 204, 163, .25);
    --text: #e0e0e0;
    --text-dim: #7a7a8e;
    --online: #22c55e;
    --offline: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'ZCOOL KuaiLe', 'Unifont', 'MC Pixel', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 50px;
    image-rendering: pixelated;
}

/* ---- Custom Background ---- */
#customBg {
    position: fixed; top: -40px; left: -40px; right: -40px; bottom: -40px;
    z-index: 0; pointer-events: none;
    overflow: hidden;
    display: none;
}
#customBg::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10, 10, 15, .55);
}

/* ---- Particles Canvas ---- */
#particles {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}

/* ---- Navbar ---- */
.navbar {
    position: relative; z-index: 10;
    display: flex; justify-content: flex-start; align-items: center;
    padding: 16px 32px;
    background: rgba(10, 10, 15, .85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.navbar-brand {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.2rem; font-weight: 700; color: var(--accent);
}
.navbar-brand .logo { font-size: 1.5rem; }

/* ---- Hero ---- */
.hero {
    position: relative; z-index: 1;
    text-align: center; padding: 70px 20px 40px;
    overflow: hidden;
}
.hero-title {
    font-size: 2.8rem; font-weight: 900; color: #fff;
    text-shadow: 0 0 40px var(--accent-glow), 0 2px 4px rgba(0,0,0,.5),
                 2px 2px 0 #1a1a2e, -1px -1px 0 #1a1a2e;
    margin-bottom: 12px;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
}
.hero-subtitle {
    font-size: 1.1rem; color: var(--text-dim);
    position: relative; z-index: 2;
}

/* MC 浮动方块装饰 */
.hero-decoration {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.mc-block {
    position: absolute;
    width: 24px; height: 24px;
    border-radius: 3px;
    opacity: .15;
    image-rendering: pixelated;
    animation: mcFloat 8s ease-in-out infinite;
}
.block-grass { background: #5B8731; top: 15%; left: 8%; animation-delay: 0s; box-shadow: inset 0 -8px 0 #3B5D1E; }
.block-diamond { background: #4AEDD9; top: 25%; right: 12%; animation-delay: 1.5s; width: 20px; height: 20px; box-shadow: 0 0 12px rgba(74, 237, 217, .3); }
.block-gold { background: #DDA520; bottom: 20%; left: 15%; animation-delay: 3s; width: 18px; height: 18px; box-shadow: 0 0 10px rgba(221, 165, 32, .2); }
.block-redstone { background: #FF3030; top: 40%; right: 6%; animation-delay: 4.5s; width: 16px; height: 16px; box-shadow: 0 0 8px rgba(255, 48, 48, .3); }
.block-emerald { background: #17DD62; bottom: 30%; right: 18%; animation-delay: 2s; width: 22px; height: 22px; box-shadow: 0 0 10px rgba(23, 221, 98, .2); }

@keyframes mcFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(5deg); }
    50% { transform: translateY(-8px) rotate(-3deg); }
    75% { transform: translateY(-20px) rotate(3deg); }
}

/* Hero 标签 */
.hero-tags {
    display: flex; justify-content: center; gap: 12px;
    margin-top: 20px; flex-wrap: wrap;
    position: relative; z-index: 2;
}
.mc-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: rgba(78, 204, 163, .08);
    border: 1px solid rgba(78, 204, 163, .2);
    border-radius: 20px;
    font-size: .78rem; color: var(--accent);
    transition: all .3s;
}
.mc-tag:hover {
    background: rgba(78, 204, 163, .15);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ---- Server List ---- */
.server-list {
    position: relative; z-index: 1;
    max-width: 900px; margin: 0 auto; padding: 0 20px 60px;
}

.empty-state {
    text-align: center; padding: 80px 20px; color: var(--text-dim);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; opacity: .4; }

/* ---- Server Card ---- */
.server-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all .25s ease;
    position: relative;
    overflow: hidden;
}
.server-card::before {
    content: '';
    position: absolute; top: 0; left: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, #4ecca3 0%, #4AEDD9 50%, #17DD62 100%);
    opacity: 0;
    transition: opacity .25s;
    image-rendering: pixelated;
}
.server-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(78, 204, 163, .1);
}
.server-card:hover::before { opacity: 1; }

.server-icon {
    width: 64px; height: 64px; flex-shrink: 0;
    border-radius: 8px; overflow: hidden;
    background: #1a1a2e; display: flex; align-items: center; justify-content: center;
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }

.server-info { flex: 1; min-width: 0; }
.server-name { font-size: 1.15rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.server-motd { font-size: .82rem; color: var(--text-dim); margin-bottom: 6px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.server-meta { display: flex; gap: 16px; font-size: .8rem; color: var(--text-dim); flex-wrap: wrap; }
.server-meta i { margin-right: 4px; }

.server-status { flex-shrink: 0; text-align: right; min-width: 100px; }
.status-loading { color: var(--text-dim); font-size: 1.2rem; }
.status-online .status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--online); margin-right: 6px; box-shadow: 0 0 8px var(--online); }
.status-offline .status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--offline); margin-right: 6px; }
.status-text { font-size: .85rem; font-weight: 600; }
.status-online .status-text { color: var(--online); }
.status-offline .status-text { color: var(--offline); }
.status-players { display: block; font-size: .8rem; color: var(--text-dim); margin-top: 4px; }
.status-version { display: block; font-size: .75rem; color: var(--text-dim); margin-top: 2px; opacity: .7; }

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.7); backdrop-filter: blur(6px);
    z-index: 1000; display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: #111827; border: 1px solid var(--border); border-radius: 16px;
    width: 100%; max-width: 680px; max-height: 85vh; overflow: hidden;
    display: flex; flex-direction: column;
    animation: modalIn .3s ease;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-server-info { display: flex; align-items: center; gap: 14px; min-width: 0; }
.modal-favicon { width: 48px; height: 48px; border-radius: 8px; image-rendering: pixelated; background: #1a1a2e; }
.modal-server-info h2 { font-size: 1.15rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-motd { font-size: .8rem; color: var(--text-dim); margin-top: 2px; line-height: 1.5; word-break: break-all; }
.modal-close {
    background: none; border: none; color: var(--text-dim); font-size: 1.2rem;
    cursor: pointer; padding: 8px; border-radius: 8px; transition: all .2s;
}
.modal-close:hover { background: #1e293b; color: #fff; }

.modal-status-bar {
    display: flex; gap: 20px; padding: 12px 24px;
    background: #0d1117; font-size: .85rem; color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
.modal-status-bar span { display: flex; align-items: center; gap: 6px; }
.modal-status-bar .dot-online { width: 8px; height: 8px; border-radius: 50%; background: var(--online); box-shadow: 0 0 6px var(--online); }
.modal-status-bar .dot-offline { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); }

.modal-address-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px; background: #0a0f18; border-bottom: 1px solid var(--border);
}
.address-label { font-size: .8rem; color: var(--text-dim); flex-shrink: 0; }
.modal-address-bar code {
    flex: 1; font-size: .95rem; color: var(--accent); font-family: 'Consolas', monospace;
    background: #111827; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
    user-select: all;
}
.btn-copy {
    background: #1e293b; border: 1px solid var(--border); color: var(--text-dim);
    padding: 6px 10px; border-radius: 6px; cursor: pointer; transition: all .2s;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); }

/* Tabs */
.modal-tabs {
    display: flex; gap: 0; overflow-x: auto; background: #0d1117;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-tabs .tab-btn {
    padding: 12px 20px; background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--text-dim); cursor: pointer; font-size: .9rem; white-space: nowrap;
    transition: all .2s; display: flex; align-items: center; gap: 6px;
}
.modal-tabs .tab-btn:hover { color: #fff; background: rgba(255,255,255,.03); }
.modal-tabs .tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.modal-body {
    padding: 24px; overflow-y: auto; flex: 1;
    font-size: .95rem; line-height: 1.7;
}
.modal-body h1, .modal-body h2, .modal-body h3 { color: #fff; margin: 16px 0 8px; }
.modal-body h1:first-child, .modal-body h2:first-child, .modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 12px; }
.modal-body ul, .modal-body ol { margin-left: 20px; margin-bottom: 12px; }
.modal-body code { background: #1e293b; padding: 2px 6px; border-radius: 4px; font-size: .9em; }
.modal-body pre { background: #0d1117; padding: 16px; border-radius: 8px; overflow-x: auto; margin-bottom: 12px; }
.modal-body img { max-width: 100%; border-radius: 8px; }
.modal-body a { color: var(--accent); }

.loading-text { text-align: center; padding: 40px; color: var(--text-dim); }

/* ---- Footer ---- */
.footer {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    text-align: center; padding: 6px 16px;
    color: var(--text-dim); font-size: 10px;
    background: rgba(10, 10, 15, .92);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    font-family: 'MC Pixel', 'ZCOOL KuaiLe', 'Unifont', monospace;
    letter-spacing: 1px;
    line-height: 1.8;
}
.footer strong { color: var(--accent); font-weight: normal; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .hero-title { font-size: 1.8rem; }
    .hero { padding: 40px 16px 24px; }
    .hero-tags { gap: 8px; }
    .mc-tag { font-size: .7rem; padding: 4px 10px; }
    .mc-block { display: none; }
    .server-card { flex-wrap: wrap; padding: 16px; gap: 12px; }
    .server-icon { width: 48px; height: 48px; }
    .server-status { width: 100%; text-align: left; display: flex; gap: 12px; align-items: center; }
    .modal { max-height: 90vh; border-radius: 12px; }
    .modal-header { padding: 16px; }
    .modal-status-bar, .modal-address-bar { padding: 10px 16px; flex-wrap: wrap; }
    .modal-body { padding: 16px; }
}
