:root {
    --asphalt: #10161d;
    --panel: #1b242e;
    --panel-light: #232e3a;
    --amber: #ffb020;
    --amber-dim: #7a5215;
    --signal-green: #35d07f;
    --alert-red: #ff4d4d;
    --text: #f5f2ec;
    --text-muted: #8fa0ab;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #10161d;
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.app {
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

/* ---------- Header ---------- */
.topbar {
    text-align: center;
    margin-bottom: 18px;
}

h1 {
    font-weight: 800;
    letter-spacing: 2px;
    font-size: clamp(28px, 9vw, 40px);
    margin: 0;
    text-transform: uppercase;
}

h1 span {
    color: var(--amber);
}

.subtitle {
    color: var(--text-muted);
    font-size: clamp(13px, 3.6vw, 15px);
    margin: 6px 0 0;
}

/* ---------- Server address box ---------- */
.server-box {
    background: var(--panel);
    border: 1px solid var(--panel-light);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
}

.server-box label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.server-box input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--panel-light);
    background: #0d1319;
    color: var(--text);
    font-size: 15px;
}

.server-hint {
    font-size: 11px;
    color: #5c6b75;
    margin: 6px 0 0;
    line-height: 1.4;
}

/* ---------- Channel select ---------- */
.channel-select {
    display: flex;
    gap: 10px;
}

.channel-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    border-radius: 14px;
    border: 2px solid var(--panel-light);
    background: var(--panel);
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.channel-btn .flag {
    font-size: 26px;
    line-height: 1;
}

.channel-btn:active {
    transform: scale(0.97);
}

.channel-btn.active {
    border-color: var(--amber);
    background: var(--panel-light);
    box-shadow: 0 0 0 1px var(--amber-dim);
}

.channel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pick-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin: 14px 0 0;
}

/* ---------- Room ---------- */
.room {
    margin-top: 18px;
    background: var(--panel);
    border: 1px solid var(--panel-light);
    padding: 16px;
    border-radius: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.room.hidden {
    display: none;
}

.room-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.channel-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.channel-dot.live {
    background: var(--signal-green);
    box-shadow: 0 0 10px 2px var(--signal-green);
}

#roomTitle {
    font-size: clamp(17px, 4.6vw, 20px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    flex: 1;
}

.status {
    font-size: 12px;
    color: var(--text-muted);
}

.status.error { color: var(--alert-red); }
.status.live { color: var(--signal-green); }

/* ---------- Participants ---------- */
.participants {
    flex: 1;
    min-height: 120px;
    background: #000;
    margin: 0 0 16px;
    border-radius: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-hint {
    margin: auto;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 0 10px;
}

.participant {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel-light);
    border-radius: 10px;
    padding: 10px 12px;
}

.participant .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--amber-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.participant .name {
    flex: 1;
    font-size: 14px;
}

.participant .speak-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #354049;
    transition: background 0.1s ease, box-shadow 0.1s ease;
}

.participant .speak-dot.active {
    background: var(--signal-green);
    box-shadow: 0 0 8px 1px var(--signal-green);
}

/* ---------- Push to talk ---------- */
.ptt-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.mic {
    width: clamp(96px, 30vw, 128px);
    height: clamp(96px, 30vw, 128px);
    border-radius: 50%;
    border: none;
    background: #2c3944;
    color: white;
    font-size: clamp(34px, 10vw, 46px);
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 0 #16202a, 0 8px 16px rgba(0,0,0,0.4);
    touch-action: none;
    user-select: none;
    cursor: pointer;
}

.mic.on-air {
    background: var(--alert-red);
    transform: translateY(4px) scale(0.98);
    box-shadow: 0 2px 0 #a12020, 0 4px 12px rgba(0,0,0,0.4), 0 0 0 10px rgba(255,77,77,0.15);
}

.mic:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hint {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0;
    text-align: center;
}

.leave-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: 2px solid var(--panel-light);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
}
