/* Terep 3 game styles. All scoped under .neonderby-instance to avoid theme conflicts. */

.neonderby-mount {
    width: 100%;
    min-height: 380px;
    background: #1a2530;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.neonderby-instance {
    position: relative;
    width: 100%;
    height: 100%;
}

.neonderby-instance canvas.neonderby-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.neonderby-instance .neonderby-hud-top {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.neonderby-instance .neonderby-hud-top .label { font-size: 10px; opacity: 0.65; letter-spacing: 1px; }
.neonderby-instance .neonderby-hud-top .value { font-size: 17px; font-weight: 500; }

.neonderby-instance .neonderby-speed {
    position: absolute;
    bottom: 14px; right: 16px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    text-align: right;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    pointer-events: none;
}
.neonderby-instance .neonderby-speed .num { font-size: 36px; font-weight: 500; line-height: 1; }
.neonderby-instance .neonderby-speed .unit { font-size: 10px; opacity: 0.65; letter-spacing: 1.5px; margin-top: 3px; }

.neonderby-instance .neonderby-minimap {
    position: absolute;
    bottom: 14px; left: 14px;
    width: 108px; height: 108px;
    border-radius: 8px;
    border: 0.5px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.4);
    pointer-events: none;
}

.neonderby-instance .neonderby-actions {
    position: absolute;
    top: 56px; right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.neonderby-instance .t-btn {
    background: rgba(0,0,0,0.5);
    color: white;
    border: 0.5px solid rgba(255,255,255,0.3);
    width: 44px; height: 44px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.neonderby-instance .t-btn:hover { background: rgba(0,0,0,0.7); }
.neonderby-instance .t-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.neonderby-instance .neonderby-time {
    position: absolute;
    top: 56px; left: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.45);
    padding: 6px 10px;
    border-radius: 6px;
    border: 0.5px solid rgba(255,255,255,0.2);
}
.neonderby-instance .neonderby-time svg { width: 14px; height: 14px; stroke: white; fill: none; stroke-width: 2; }
.neonderby-instance .neonderby-time input { width: 80px; }

.neonderby-instance .dpad-btn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 0.5px solid rgba(255,255,255,0.3);
    width: 44px; height: 44px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.neonderby-instance .dpad-btn:active { background: rgba(255,255,255,0.4); }
.neonderby-instance .dpad-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.neonderby-instance .neonderby-touch-steer {
    position: absolute;
    bottom: 130px; left: 14px;
    display: none;
    gap: 6px;
}
.neonderby-instance .neonderby-touch-pedals {
    position: absolute;
    bottom: 90px; right: 14px;
    display: none;
    flex-direction: column;
    gap: 6px;
}
@media (hover: none) {
    .neonderby-instance .neonderby-touch-steer,
    .neonderby-instance .neonderby-touch-pedals { display: flex !important; }
}

.neonderby-instance .neonderby-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 25, 35, 0.94);
    z-index: 10;
    padding: 20px;
    text-align: center;
}
.neonderby-instance .neonderby-overlay .tag { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 4px; opacity: 0.55; margin-bottom: 4px; }
.neonderby-instance .neonderby-overlay h1 { font-size: 42px; font-weight: 500; margin: 0 0 6px; letter-spacing: -1px; }
.neonderby-instance .neonderby-overlay h2 { font-size: 26px; font-weight: 500; margin: 0 0 22px; }
.neonderby-instance .neonderby-overlay .sub { font-size: 13px; opacity: 0.7; margin-bottom: 22px; }
.neonderby-instance .neonderby-overlay .hint { font-family: ui-monospace, monospace; font-size: 10px; opacity: 0.5; margin-top: 22px; line-height: 1.8; }

.neonderby-instance .neonderby-overlay button {
    background: white;
    color: #1a2530;
    border: none;
    padding: 12px 32px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.neonderby-instance .car-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    justify-content: center;
}
.neonderby-instance .car-card {
    background: rgba(255,255,255,0.08);
    border: 0.5px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: center;
    min-width: 120px;
    transition: background 0.15s;
}
.neonderby-instance .car-card:hover { background: rgba(255,255,255,0.14); }
.neonderby-instance .car-card.active { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.55); }
.neonderby-instance .car-card .swatch { width: 56px; height: 28px; border-radius: 4px; margin: 0 auto 8px; }
.neonderby-instance .car-card .name { font-size: 13px; font-weight: 500; }
.neonderby-instance .car-card .stat { font-size: 10px; opacity: 0.6; margin-top: 5px; font-family: ui-monospace, monospace; letter-spacing: 0.5px; }

.neonderby-instance .neonderby-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a2530;
    z-index: 20;
    font-size: 14px;
}

/* v2.0 — multiplayer + jump */
.neonderby-instance .neonderby-mp-status {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: white;
    background: rgba(0,0,0,0.55);
    padding: 4px 10px;
    border-radius: 4px;
    border: 0.5px solid rgba(255,255,255,0.2);
    z-index: 5;
}
.neonderby-instance .mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}
.neonderby-instance .mode-tab {
    background: rgba(255,255,255,0.08);
    color: white;
    border: 0.5px solid rgba(255,255,255,0.2);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}
.neonderby-instance .mode-tab.active {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.5);
}
.neonderby-instance .mp-panel {
    background: rgba(0,0,0,0.25);
    padding: 12px 14px;
    border-radius: 8px;
    border: 0.5px solid rgba(255,255,255,0.15);
    margin-bottom: 14px;
    max-width: 380px;
    font-size: 12px;
}
.neonderby-instance .mp-row { margin-bottom: 8px; }
.neonderby-instance .mp-row code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-family: ui-monospace, monospace;
}
.neonderby-instance .mp-connect {
    display: flex;
    gap: 6px;
}
.neonderby-instance .mp-connect input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 0.5px solid rgba(255,255,255,0.25);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
}
.neonderby-instance .mp-connect button {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 0.5px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
}
.neonderby-instance .mp-info {
    font-size: 10px;
    opacity: 0.65;
    line-height: 1.5;
}
.neonderby-instance .dpad-jump {
    background: rgba(255, 180, 70, 0.25) !important;
    border-color: rgba(255, 200, 100, 0.45) !important;
}
.neonderby-instance .dpad-jump:active {
    background: rgba(255, 200, 100, 0.5) !important;
}

/* v3.0 — rooms + roster + open world */
.neonderby-instance .neonderby-mp-roster {
    position: absolute;
    top: 60px;
    left: 14px;
    background: rgba(0,0,0,0.45);
    padding: 6px 10px;
    border-radius: 6px;
    border: 0.5px solid rgba(255,255,255,0.2);
    color: white;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    max-width: 200px;
    line-height: 1.5;
    z-index: 5;
}
.neonderby-instance .mp-room-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.neonderby-instance .mp-room-row input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 0.5px solid rgba(255,255,255,0.25);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
}
.neonderby-instance .mp-panel [data-el="btnJoin"] {
    width: 100%;
    background: rgba(255,255,255,0.18);
    color: white;
    border: 0.5px solid rgba(255,255,255,0.3);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}
.neonderby-instance .mp-panel [data-el="btnJoin"]:hover {
    background: rgba(255,255,255,0.28);
}

/* v3.1 — fullscreen + tilt button */
.neonderby-instance .t-btn.active {
    background: rgba(100, 200, 140, 0.45);
    border-color: rgba(150, 255, 180, 0.7);
}
.neonderby-instance:fullscreen,
.neonderby-instance:-webkit-full-screen {
    aspect-ratio: auto !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}
.neonderby-instance:fullscreen .neonderby-canvas,
.neonderby-instance:-webkit-full-screen .neonderby-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* v3.2.2 — touch-drag steering visual */
.neonderby-instance .neonderby-thumb-ind {
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.18);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 4;
}
.neonderby-instance .neonderby-thumb-dot {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.06s linear;
}

/* ── v5.0 — best-lap / delta HUD ──────────────────────────────────────────── */
.neonderby-instance .neonderby-best-lap {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px; opacity: 0.7; color: #ffd54a; margin-top: 2px; letter-spacing: 0.5px;
}
.neonderby-instance .neonderby-delta {
    position: absolute; top: 108px; left: 50%; transform: translateX(-50%);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 18px; font-weight: 700; letter-spacing: 0.05em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9); pointer-events: none; z-index: 6;
}

/* ── v5.0 — countdown ─────────────────────────────────────────────────────── */
.neonderby-instance .neonderby-countdown {
    position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 90px; font-weight: 700; color: #fff;
    text-shadow: 0 0 30px rgba(0,240,255,0.8), 0 4px 10px rgba(0,0,0,0.8);
    pointer-events: none; z-index: 13; animation: neonderbyCount 0.9s ease-out;
}
@keyframes neonderbyCount {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(1.8); }
    25%  { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
    100% { opacity: 0.15; transform: translate(-50%, -50%) scale(0.85); }
}

/* ── v5.0 — mission picker ────────────────────────────────────────────────── */
.neonderby-instance .mission-panel {
    background: rgba(0,0,0,0.25); padding: 12px 14px; border-radius: 8px;
    border: 0.5px solid rgba(255,255,255,0.15); margin-bottom: 14px; max-width: 420px;
}
.neonderby-instance .mission-picker { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 10px; }
.neonderby-instance .mission-card {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.08); border: 0.5px solid rgba(255,255,255,0.2);
    border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 12px;
    transition: background 0.15s;
}
.neonderby-instance .mission-card:hover { background: rgba(255,255,255,0.14); }
.neonderby-instance .mission-card.active { background: rgba(0,240,255,0.18); border-color: rgba(0,240,255,0.55); }
.neonderby-instance .mission-emoji { font-size: 16px; }
.neonderby-instance .mission-name { font-weight: 500; }
.neonderby-instance .mission-desc { font-size: 11px; opacity: 0.7; line-height: 1.5; }

/* ── v5.0 — volume row in pause overlay ───────────────────────────────────── */
.neonderby-instance .neonderby-volrow {
    display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
    font-family: ui-monospace, monospace; font-size: 11px; opacity: 0.8;
}
.neonderby-instance .neonderby-volrow input[type="range"] { width: 160px; accent-color: #00f0ff; }

/* ── Derby start-panel options (difficulty + bot count) ── */
.neonderby-instance .derby-opts { display:flex; flex-direction:column; gap:10px; margin:14px 0 4px; }
.neonderby-instance .derby-opt-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.neonderby-instance .derby-opt-label { font-size:12px; letter-spacing:1px; text-transform:uppercase; opacity:.7; }
.neonderby-instance .derby-seg { display:inline-flex; gap:6px; }
.neonderby-instance .derby-seg button {
  min-width:54px; padding:8px 12px; border-radius:10px; cursor:pointer;
  background:rgba(255,255,255,.06); border:1.5px solid rgba(255,255,255,.14);
  color:#e8e8ee; font:700 13px/1 inherit; transition:all .12s;
}
.neonderby-instance .derby-seg button:hover { border-color:rgba(0,255,204,.5); }
.neonderby-instance .derby-seg button.active { background:rgba(138,43,226,.25); border-color:#8A2BE2; color:#fff; box-shadow:0 0 12px rgba(138,43,226,.45); }
