:root {
    --bg: #141616;
    --panel: rgba(24, 26, 26, 0.96);
    --text: #f2eee2;
    --muted: #a8a397;
    --line: rgba(143, 130, 95, 0.45);
    --accent: #4fc3f7;
    --ok: #66bb6a;
    --warn: #ffb74d;
    --bad: #ef5350;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
}

.bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    padding-top: max(6px, env(safe-area-inset-top));
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.bar select,
.bar button,
.join input,
.join button,
.roster button {
    min-height: 36px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: #1f2222;
    color: var(--text);
    font: inherit;
    padding: 0 8px;
}

.bar select {
    min-width: 0;
    flex: 1 1 0;
}

#roster-button {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bad);
    flex-shrink: 0;
}

.status-dot.is-connecting {
    background: var(--warn);
}

.status-dot.is-connected {
    background: var(--ok);
}

main {
    position: relative;
    flex: 1;
    min-height: 0;
}

main .squad-map {
    position: absolute;
    inset: 0;
    border: none;
    border-radius: 0;
}

.phone-tools {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.phone-tools button {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-size: 20px;
}

.phone-tools button[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b0d0d;
}

.toast {
    position: absolute;
    left: 50%;
    top: 12px;
    z-index: 1100;
    transform: translateX(-50%);
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    font-size: 13px;
    white-space: nowrap;
}

.roster {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    max-height: 45%;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.roster-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid rgba(143, 130, 95, 0.18);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.roster-item.is-offline {
    opacity: 0.5;
}

.roster-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    flex-shrink: 0;
}

.roster-item .detail {
    color: var(--muted);
    font-size: 12px;
}

.roster-empty {
    padding: 12px;
    color: var(--muted);
}

.roster-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 12px;
}

.join {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.75);
}

.join-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 420px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.join-card h1 {
    margin: 0;
    font-size: 20px;
}

.join-card p,
.join-card small {
    margin: 0;
    color: var(--muted);
}

.join-card input {
    width: 100%;
    letter-spacing: 0.05em;
}

.join-card .check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.join-card .check input {
    width: auto;
    min-height: 0;
}

.join-card details input {
    margin: 6px 0 4px;
}

.join-card #join-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b0d0d;
    font-weight: 600;
}

.join-error {
    color: var(--bad) !important;
}

[hidden] {
    display: none !important;
}
