.header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0,212,255,0.3);
}

.header .time {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.header-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 10px;
}

.theme-btn, .settings-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.theme-btn:hover, .settings-btn:hover {
    background: var(--bg-card-hover);
}

.logout-btn {
    padding: 10px 20px;
    background: #ef4444;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    opacity: 0.9;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.3s;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

.stat-card:active {
    transform: scale(0.98) translateY(-3px);
}

.stat-card .value {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.2s;
}

.stat-card .value.counting {
    animation: countUp 0.3s ease-out;
}

.stat-card .label {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.main-content > div:first-child {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.main-content > div:last-child {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-tabs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-tab {
    padding: 5px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
}

.time-tab.active {
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    color: #fff;
    border-color: transparent;
}

.group-select {
    padding: 5px 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-size: inherit;
}

.group-select:hover {
    border-color: #00d4ff;
}

.group-select:focus {
    outline: none;
    border-color: #00d4ff;
}

.refresh-countdown {
    padding: 5px 15px;
    background: rgba(0,212,255,0.15);
    border-radius: 20px;
    color: #00d4ff;
    font-size: 0.85rem;
    position: relative;
    overflow: hidden;
}

.refresh-countdown::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    background: #00d4ff;
    width: var(--progress, 100%);
    transition: width 1s linear;
}

#chart {
    width: 100%;
    flex: 1;
    min-height: 0;
}

.server-list {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.server-list .chart-title {
    flex-shrink: 0;
}

.server-list #serverList {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.server-list #serverList::-webkit-scrollbar,
.server-list::-webkit-scrollbar {
    width: 6px;
}

.server-list #serverList::-webkit-scrollbar-track,
.server-list::-webkit-scrollbar-track {
    background: transparent;
}

.server-list #serverList::-webkit-scrollbar-thumb,
.server-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.server-list #serverList::-webkit-scrollbar-thumb:hover,
.server-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.server-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-card-hover);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: transform 0.2s, background 0.2s;
}

.server-item:hover {
    transform: translateX(4px);
    background: rgba(0, 212, 255, 0.05);
}

.server-item:last-child {
    margin-bottom: 0;
}

.server-info h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.server-info .address {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.server-info .address.masked {
    cursor: pointer;
    user-select: none;
}

.server-info .address.visible {
    user-select: text;
}

.server-status {
    text-align: right;
}

.server-status .players {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00d4ff;
}

.server-status .latency {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-online {
    color: #10b981;
    position: relative;
    padding-left: 16px;
}

.status-online::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-offline {
    color: #ef4444;
}

.alert-list {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-top: 20px;
    flex: 0 0 auto;
    max-height: 35%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.alert-list .chart-title {
    flex-shrink: 0;
}

#alertList {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#alertList::-webkit-scrollbar,
.alert-list::-webkit-scrollbar {
    width: 6px;
}

#alertList::-webkit-scrollbar-track,
.alert-list::-webkit-scrollbar-track {
    background: transparent;
}

#alertList::-webkit-scrollbar-thumb,
.alert-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#alertList::-webkit-scrollbar-thumb:hover,
.alert-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.alert-item {
    padding: 10px 15px;
    background: var(--bg-card-hover);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    border-left: 3px solid #ef4444;
    transition: transform 0.2s, background 0.2s, opacity 0.3s;
}

.alert-item.recovered {
    border-left-color: #10b981;
}

.alert-item:hover {
    transform: translateX(4px);
    background: rgba(239, 68, 68, 0.1);
}

.alert-item.recovered:hover {
    background: rgba(16, 185, 129, 0.1);
}

.alert-item.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

.alert-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.disconnected {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    display: none;
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
}

.connection-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #10b981;
    transition: all 0.3s;
}

.connection-indicator.disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.connection-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.connection-indicator.disconnected::before {
    animation: none;
}

.server-edit-list {
    margin-top: 20px;
}

.server-edit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-card-hover);
    border-radius: 8px;
    margin-bottom: 10px;
}

.server-edit-item .info {
    flex: 1;
}

.server-edit-item .info h4 {
    margin-bottom: 5px;
}

.server-edit-item .info .addr {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.server-edit-item .info .addr.masked {
    cursor: pointer;
    user-select: none;
}

.server-edit-item .info .addr.visible {
    user-select: text;
}

.server-edit-item .actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-content {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .main-content > div:last-child {
        overflow: visible;
        min-height: auto;
    }
    .server-list {
        flex: none;
    }
    .server-list #serverList {
        overflow: visible;
    }
    .alert-list {
        max-height: none;
        flex: none;
    }
    #alertList {
        overflow: visible;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 0;
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .header .time {
        font-size: 0.9rem;
        margin-top: 8px;
    }
    .header-actions {
        position: static;
        transform: none;
        margin-top: 15px;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }
    .theme-btn, .settings-btn, .logout-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
        flex: 1;
        min-width: 0;
    }
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-card .value {
        font-size: 2rem;
    }
    .stat-card .label {
        font-size: 0.85rem;
    }
    .chart-container, .server-list, .alert-list {
        padding: 15px;
    }
    .chart-title {
        font-size: 1rem;
        margin-bottom: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .time-tabs {
        flex-wrap: wrap;
        gap: 5px;
        width: 100%;
    }
    .time-tab {
        padding: 6px 12px;
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
        text-align: center;
    }
    .group-select {
        padding: 6px 12px;
        font-size: 0.85rem;
        width: 100%;
    }
    .refresh-countdown {
        font-size: 0.75rem;
        padding: 6px 12px;
        width: 100%;
        text-align: center;
    }
    .connection-indicator {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    #chart {
        height: 250px;
        flex: none;
    }
    .chart-container {
        flex: none;
    }
    .server-item {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .server-status {
        text-align: left;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .alert-list {
        max-height: none;
    }
    .alert-item {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .alert-time {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    .header {
        padding: 12px 0;
    }
    .header h1 {
        font-size: 1.2rem;
    }
    .header .time {
        font-size: 0.8rem;
    }
    .theme-btn, .settings-btn, .logout-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .stat-card {
        padding: 12px;
    }
    .stat-card .value {
        font-size: 1.8rem;
    }
    .stat-card .label {
        font-size: 0.8rem;
    }
    .chart-container, .server-list, .alert-list {
        padding: 12px;
    }
    .chart-title {
        font-size: 0.95rem;
    }
    .time-tab {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    .group-select {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    .refresh-countdown {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    #chart {
        height: 200px;
        flex: none;
    }
    .chart-container {
        flex: none;
    }
    .server-info h3 {
        font-size: 0.95rem;
    }
    .server-info .address {
        font-size: 0.75rem;
    }
    .server-status .players {
        font-size: 1.2rem;
    }
    .server-status .latency {
        font-size: 0.75rem;
    }
    .alert-list {
        max-height: none;
    }
    .alert-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .alert-time {
        font-size: 0.7rem;
    }
    .disconnected {
        top: 10px;
        right: 10px;
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .server-item:active {
        transform: scale(0.98);
    }
    .alert-item:active {
        transform: scale(0.98);
    }
    .time-tab:active {
        transform: scale(0.95);
    }
    .stat-card:active {
        transform: scale(0.98);
    }
    .theme-btn:active, .settings-btn:active, .logout-btn:active {
        transform: scale(0.95);
    }
    .alert-list {
        -webkit-overflow-scrolling: touch;
    }
}

.server-group {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: var(--bg-card-hover);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.group-header:hover {
    background: rgba(0, 212, 255, 0.08);
}

.group-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.group-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    margin-left: 10px;
}

.group-toggle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.server-group.collapsed .group-toggle {
    transform: rotate(-90deg);
}

.group-servers {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.server-group.collapsed .group-servers {
    max-height: 0;
    padding: 0 10px;
}

.group-servers .server-item {
    margin-bottom: 0;
    background: var(--bg-secondary);
}

.main-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    background: linear-gradient(90deg, #00d4ff, #7c3aed);
    color: #fff;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: normal;
    vertical-align: middle;
}
