:root {
    --bg: #0b0d12;
    --panel: #141822;
    --panel-border: #272f42;
    --gold: #f5c85c;
    --gold-dim: #b58d35;
    --text: #eef1f7;
    --muted: #93a0b8;
    --good: #4cd98a;
    --bad: #ff6b6b;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: #0f131c;
    border-bottom: 1px solid var(--panel-border);
    z-index: 20;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--gold);
}

.brand span.badge {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(245, 200, 92, 0.14);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

button, select, input[type="text"] {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
}

button {
    cursor: pointer;
    font-weight: 600;
    transition: border-color 0.15s, background 0.15s;
}

button:hover:not(:disabled) {
    border-color: var(--gold);
}

button.primary {
    background: var(--gold);
    color: #111318;
    border-color: var(--gold);
}

button.primary:hover:not(:disabled) {
    background: #ffd778;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#stage {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
}

#overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, rgba(25, 31, 46, 0.95), rgba(8, 10, 15, 0.98));
    z-index: 10;
    overflow-y: auto;
}

#overlay.hidden { display: none; }

.card {
    width: 100%;
    max-width: 780px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.card h1 {
    margin: 0 0 6px;
    font-size: 24px;
    color: var(--gold);
    letter-spacing: 0.04em;
}

.subtitle {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
}

.rom-drop {
    border: 2px dashed var(--panel-border);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color 0.15s, background 0.15s;
}

.rom-drop.dragover {
    border-color: var(--gold);
    background: rgba(245, 200, 92, 0.08);
}

.rom-drop.ready {
    border-color: var(--good);
    border-style: solid;
    background: rgba(76, 217, 138, 0.07);
}

.rom-status {
    font-size: 14px;
    margin-bottom: 10px;
}

.rom-status.ok { color: var(--good); }
.rom-status.err { color: var(--bad); }

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 18px;
}

.action-row input[type="text"] {
    width: 140px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.lobbies-box {
    border-top: 1px solid var(--panel-border);
    padding-top: 14px;
}

.lobbies-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.lobbies-head h2 {
    margin: 0;
    font-size: 15px;
    color: var(--gold);
}

.lobby-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.lobby-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #0e121b;
    border: 1px solid var(--panel-border);
    font-size: 13px;
}

.lobby-meta { color: var(--muted); font-size: 12px; }

.tag-vr {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 107, 107, 0.14);
    color: var(--bad);
    border: 1px solid rgba(255, 107, 107, 0.35);
}

#log-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 180px;
    background: rgba(8, 10, 14, 0.92);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: #cdd6f4;
    overflow-y: auto;
    z-index: 30;
    display: none;
    white-space: pre-wrap;
}

#log-panel.open { display: block; }

.warn-banner {
    background: rgba(255, 107, 107, 0.14);
    border: 1px solid var(--bad);
    color: #ffd0d0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
}
