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

.terep3-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;
}

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

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

.terep3-instance .terep3-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);
}
.terep3-instance .terep3-hud-top .label { font-size: 10px; opacity: 0.65; letter-spacing: 1px; }
.terep3-instance .terep3-hud-top .value { font-size: 17px; font-weight: 500; }

.terep3-instance .terep3-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;
}
.terep3-instance .terep3-speed .num { font-size: 36px; font-weight: 500; line-height: 1; }
.terep3-instance .terep3-speed .unit { font-size: 10px; opacity: 0.65; letter-spacing: 1.5px; margin-top: 3px; }

.terep3-instance .terep3-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;
}

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

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

.terep3-instance .terep3-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);
}
.terep3-instance .terep3-time svg { width: 14px; height: 14px; stroke: white; fill: none; stroke-width: 2; }
.terep3-instance .terep3-time input { width: 80px; }

.terep3-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;
}
.terep3-instance .dpad-btn:active { background: rgba(255,255,255,0.4); }
.terep3-instance .dpad-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2.5; }

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

.terep3-instance .terep3-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;
}
.terep3-instance .terep3-overlay .tag { font-family: ui-monospace, monospace; font-size: 10px; letter-spacing: 4px; opacity: 0.55; margin-bottom: 4px; }
.terep3-instance .terep3-overlay h1 { font-size: 42px; font-weight: 500; margin: 0 0 6px; letter-spacing: -1px; }
.terep3-instance .terep3-overlay h2 { font-size: 26px; font-weight: 500; margin: 0 0 22px; }
.terep3-instance .terep3-overlay .sub { font-size: 13px; opacity: 0.7; margin-bottom: 22px; }
.terep3-instance .terep3-overlay .hint { font-family: ui-monospace, monospace; font-size: 10px; opacity: 0.5; margin-top: 22px; line-height: 1.8; }

.terep3-instance .terep3-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;
}

.terep3-instance .car-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    justify-content: center;
}
.terep3-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;
}
.terep3-instance .car-card:hover { background: rgba(255,255,255,0.14); }
.terep3-instance .car-card.active { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.55); }
.terep3-instance .car-card .swatch { width: 56px; height: 28px; border-radius: 4px; margin: 0 auto 8px; }
.terep3-instance .car-card .name { font-size: 13px; font-weight: 500; }
.terep3-instance .car-card .stat { font-size: 10px; opacity: 0.6; margin-top: 5px; font-family: ui-monospace, monospace; letter-spacing: 0.5px; }

.terep3-instance .terep3-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 */
.terep3-instance .terep3-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;
}
.terep3-instance .mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}
.terep3-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;
}
.terep3-instance .mode-tab.active {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.5);
}
.terep3-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;
}
.terep3-instance .mp-row { margin-bottom: 8px; }
.terep3-instance .mp-row code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-family: ui-monospace, monospace;
}
.terep3-instance .mp-connect {
    display: flex;
    gap: 6px;
}
.terep3-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;
}
.terep3-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;
}
.terep3-instance .mp-info {
    font-size: 10px;
    opacity: 0.65;
    line-height: 1.5;
}
.terep3-instance .dpad-jump {
    background: rgba(255, 180, 70, 0.25) !important;
    border-color: rgba(255, 200, 100, 0.45) !important;
}
.terep3-instance .dpad-jump:active {
    background: rgba(255, 200, 100, 0.5) !important;
}

/* v3.0 — rooms + roster + open world */
.terep3-instance .terep3-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;
}
.terep3-instance .mp-room-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.terep3-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;
}
.terep3-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;
}
.terep3-instance .mp-panel [data-el="btnJoin"]:hover {
    background: rgba(255,255,255,0.28);
}

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

/* v3.2.2 — touch-drag steering visual */
.terep3-instance .terep3-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;
}
.terep3-instance .terep3-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;
}
