/* 网页雷达 - 暗色游戏主题 */
:root {
    --brand-red: #E50914;
    --brand-gold: #D89A2B;
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-input: #1c2333;
    --border: #30363d;
    --border-glow: rgba(229, 9, 20, 0.4);
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.3);
}

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

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(229,9,20,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(88,166,255,0.05) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.main-content {
    display: flex;
    flex: 1;
    padding: 20px;
    overflow: hidden;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

/* === 地图容器 === */
.minimap-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.minimap-container {
    position: relative;
    width: 500px;
    height: 500px;
    overflow: hidden;
    border-radius: 16px;
    background: #0a0d13;
    border: 3px solid rgba(255,255,255,0.15);
    box-shadow:
        0 0 30px var(--accent-glow),
        0 0 60px rgba(229,9,20,0.1),
        inset 0 0 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

/* 地图四角金色装饰 */
.minimap-container::before,
.minimap-container::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border: 2px solid var(--brand-gold);
    z-index: 20;
    pointer-events: none;
    opacity: 0.7;
}
.minimap-container::before {
    top: 8px; left: 8px;
    border-right: none; border-bottom: none;
    border-radius: 4px 0 0 0;
}
.minimap-container::after {
    top: 8px; right: 8px;
    border-left: none; border-bottom: none;
    border-radius: 0 4px 0 0;
}

.minimap-background {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 1;
}

canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 10;
}

/* === 雷达扫描动画（无数据时） === */
.radar-scan {
    position: absolute;
    top: 50%; left: 50%;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--brand-gold);
    z-index: 5;
    animation: radarPulse 2s ease-out infinite;
}
@keyframes radarPulse {
    0% { box-shadow: 0 0 0 0 rgba(216,154,43,0.6); }
    100% { box-shadow: 0 0 0 200px rgba(216,154,43,0); }
}

/* === 房间信息栏 === */
.room-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}
.room-info .room-id { color: var(--brand-gold); }
.room-info .viewer-count { color: var(--accent); }
.room-info .dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; animation: dotPulse 2s ease-in-out infinite; }
@keyframes dotPulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* === 开关栏 - 玻璃拟态 === */
.toggle-bar {
    display: flex;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(22,27,34,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.toggle-label:hover { color: var(--text); }

.toggle-label input[type="checkbox"] {
    accent-color: var(--brand-gold);
    cursor: pointer;
}

.toggle-label input[type="range"] {
    accent-color: var(--brand-red);
    cursor: pointer;
}

.toggle-sub { font-size: 11px; opacity: 0.75; }

/* === 换房按钮 === */
#changeRoomBtn {
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 800;
    background: transparent;
    color: var(--brand-red);
    border: 1px solid var(--brand-red);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
#changeRoomBtn:hover {
    background: var(--brand-red);
    color: #fff;
}

/* === 弹窗 === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    width: 90%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
    animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideUp {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header { text-align: left; padding-bottom: 14px; border-bottom: 1px solid var(--border); }

.modal-title {
    margin-bottom: 6px;
    color: var(--brand-gold);
    font-size: 24px;
    font-weight: 900;
}

.modal-subtitle { color: var(--text-muted); font-size: 14px; }

.room-input-section { display: flex; flex-direction: column; gap: 10px; }

.room-input-wrapper { display: flex; gap: 10px; align-items: center; }

.room-input {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}
.room-input::placeholder { color: var(--text-muted); }
.room-input:focus { border-color: var(--brand-gold); }

.btn-primary {
    min-width: 80px;
    height: 42px;
    padding: 0 20px;
    background: var(--brand-gold);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.18s;
}
.btn-primary:hover { background: #e8a820; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-fullscreen {
    width: 48px;
    height: 42px;
    padding: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.btn-fullscreen:hover { border-color: var(--brand-gold); color: var(--brand-gold); }

.room-list-section { display: none; }
.room-list-title, .room-list, .room-item, .empty-room-message { display: none; }

@media (max-width: 768px) {
    .main-content { padding: 12px; }
    .minimap-container { width: min(88vmin, 500px); height: min(88vmin, 500px); }
    .modal-content { width: 94%; padding: 22px; }
    .toggle-bar { gap: 6px; padding: 6px 10px; }
    .toggle-label { font-size: 11px; }
}

@media (max-width: 480px) {
    .modal-content { padding: 18px; }
    .modal-title { font-size: 20px; }
    .room-input-wrapper { flex-wrap: wrap; }
    .room-input { flex: 1 1 100%; }
    .btn-primary { flex: 1; }
}
