:root {
    --bg-color: #0c0c14;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent-neon: #7aa2f7;
    --accent-glow: rgba(122, 162, 247, 0.15);
    --text-main: #c0caf5;
    --text-muted: #9aa5ce;
    --online: #9ece6a;
    --offline: #f7768e;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-outfit: 'Outfit', sans-serif;
}

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

body {
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

.background-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vh;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
}

.main-header {
    background: rgba(12, 12, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    padding: 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative; /* Fixed to relative to unfix */
    z-index: 100;
}

.logo-area h1 {
    font-family: var(--font-outfit);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-area .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #7aa2f7 0%, #bb9af7 100%);
    color: #0c0c14;
    padding: 0 10px;
    height: 24px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 12px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(122, 162, 247, 0.2);
    text-transform: uppercase;
    position: relative;
    top: -2px; /* Slightly lift to align with baseline of Outfit font */
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 12px;
}

.btn-icon, .btn-toggle {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-img {
    width: 32px; /* Increased from 24px */
    height: 32px; /* Increased from 24px */
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(0, 255, 64, 0.4)); /* Green glow */
}

.icon-img-small {
    width: 18px; /* Increased from 12px */
    height: 18px; /* Increased from 12px */
    object-fit: contain;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.3)); /* Gold glow */
}

.btn-icon:hover, .btn-toggle:hover {
    border-color: var(--accent-neon);
    background: rgba(122, 162, 247, 0.05);
    transform: translateY(-2px);
}

.btn-primary .icon-img {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6)) brightness(1.2);
}

.btn-toggle.active {
    background: var(--accent-neon);
    color: var(--bg-color);
    border-color: var(--accent-neon);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Grid Layout */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

/* Server Card */
.server-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.server-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(122, 162, 247, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.card-header {
    display: flex;
    gap: 16px;
    align-items: center;
}

.server-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: #1a1b26;
    object-fit: cover;
    border: 1px solid var(--card-border);
}

.server-info h3 {
    font-family: var(--font-outfit);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.status-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 8px;
    width: fit-content;
}

.status-tag.online {
    background: rgba(158, 206, 106, 0.1);
    color: var(--online);
    border: 1px solid rgba(158, 206, 106, 0.2);
}

.status-tag.offline {
    background: rgba(247, 118, 142, 0.1);
    color: var(--offline);
    border: 1px solid rgba(247, 118, 142, 0.2);
}

.address-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    margin-top: 4px;
}

.address-text {
    font-family: var(--font-outfit);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-neon);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.btn-copy:hover {
    color: var(--accent-neon);
}

.motd {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    min-height: 2.7em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
}

.player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 24px;
}

.player-tag {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    font-family: var(--font-outfit);
    font-weight: 600;
}

.btn-player-toggle {
    background: transparent;
    border: none;
    color: var(--accent-neon);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 4px;
    transition: opacity 0.2s;
    font-family: inherit;
}

.btn-player-toggle:hover {
    opacity: 0.8;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.stat-value {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 0.95rem;
}

.progress-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-neon), #41a1f0);
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-footer {
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* History Chart Section */
.history-chart {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 40px;
    animation: fadeIn 0.8s ease-out;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.chart-controls {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.btn-range {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-range:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-range.active {
    background: var(--accent-neon);
    color: var(--bg-color);
}

.chart-container {
    width: 100%;
    height: 300px;
    margin-top: 20px;
    position: relative;
}

/* Custom Search Section */
.custom-search {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 24px;
    text-align: center;
}

.section-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.search-box {
    max-width: 620px;
    margin: 40px auto;
    display: flex;
    gap: 12px;
    background: rgba(12, 12, 20, 0.6);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 24px;
    border: 1px solid var(--card-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.search-box:focus-within {
    border-color: rgba(122, 162, 247, 0.5);
    box-shadow: 0 15px 40px rgba(122, 162, 247, 0.15);
    transform: translateY(-2px);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 500;
    outline: none;
}

.search-box input::placeholder {
    color: #565f89;
}

.btn-primary {
    background: linear-gradient(135deg, #7aa2f7 0%, #bb9af7 100%);
    color: #0c0c14;
    border: none;
    padding: 12px 28px;
    border-radius: 16px;
    font-weight: 800;
    font-family: var(--font-outfit);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(122, 162, 247, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: all 0.6s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(122, 162, 247, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-primary:disabled {
    background: #24283b;
    color: #565f89;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal h2 {
    font-family: var(--font-outfit);
    margin-bottom: 16px;
}

.modal input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 12px;
    border-radius: 10px;
    color: white;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.masked-address {
    cursor: pointer;
    text-decoration: underline dotted;
}

.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--card-border);
    z-index: 100;
}

.spinning {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes scanning {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 8px var(--accent-neon)); }
    100% { transform: scale(1); opacity: 0.8; }
}

@keyframes radar-sweep {
    0% { transform: translateY(-7px); opacity: 0.4; }
    50% { transform: translateY(7px); opacity: 1; }
    100% { transform: translateY(-7px); opacity: 0.4; }
}

@keyframes dot-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.radar-icon {
    width: 24px;
    height: 24px;
    stroke: #7aa2f7; /* Matching Site Neon Blue */
    fill: none;
    stroke-width: 1.5;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.radar-icon .radar-dot {
    fill: #7aa2f7;
    stroke: none;
    opacity: 0.5;
}

.radar-icon .scan-line {
    stroke-width: 2;
    stroke: #7aa2f7;
    filter: drop-shadow(0 0 3px #7aa2f7);
}

.scanning .scan-line {
    animation: radar-sweep 1.5s infinite ease-in-out;
}

.scanning .radar-dot {
    animation: dot-pulse 2s infinite ease-in-out;
}

.scanning .radar-dot:nth-child(2) { animation-delay: 0.4s; }
.scanning .radar-dot:nth-child(3) { animation-delay: 0.8s; }

.status-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon .status-icon, .btn-icon .radar-icon {
    width: 24px;
    height: 24px;
}

.btn-primary .status-icon, .btn-primary .radar-icon {
    width: 22px;
    height: 22px;
}

/* Custom High-Tech Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    padding: 5px 10px;
    background: rgba(15, 15, 25, 0.95);
    color: #7aa2f7;
    font-size: 0.7rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: 1.5px;
    border: 1px solid rgba(122, 162, 247, 0.5);
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1.5);
    pointer-events: none;
    box-shadow: 0 0 15px rgba(122, 162, 247, 0.2), inset 0 0 5px rgba(122, 162, 247, 0.1);
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    text-shadow: 0 0 8px #7aa2f7;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgba(122, 162, 247, 0.5) transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.btn-icon.small {
    padding: 2px 6px;
    font-size: 0.7rem;
    height: 24px;
    min-width: 24px;
    border-radius: 6px;
}

.lang-toggle {
    margin-right: 10px;
}

.lang-btn {
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.3s;
}

.lang-btn.active {
    opacity: 1;
    font-weight: 800;
    color: var(--accent-neon);
}

@media (min-width: 768px) {
    .server-card.full-width {
        flex-direction: row;
        align-items: center;
        padding: 12px 24px;
        gap: 30px;
    }
    .server-card.full-width .card-header {
        flex: 1;
        border-bottom: none;
        padding-bottom: 0;
    }
    .server-card.full-width .address-bar {
        flex: 1.5;
        margin-top: 0;
    }
    .server-card.full-width .stats-grid {
        flex: 1.5;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    .server-card.full-width .stat-box {
        padding: 6px 12px;
    }
    .server-card.full-width .motd {
        display: none; /* 슬림함을 위해 PC 가로형에선 MOTD 제외 또는 툴팁 처리 */
    }
    .server-card.full-width .card-footer {
        display: flex;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .search-box {
        flex-direction: column;
        padding: 12px;
    }
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
    .server-card.full-width {
        max-width: 100%;
    }
}
