/* Smartphone-first motorsport stunt-arena controller styles for Poly Road Block XR Control (circa-2015 CSS 3, flexbox only). */
*,
*:before,
*:after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
    background: #0b1020;
    background-image: -webkit-linear-gradient(top, #0c1224 0%, #121b33 48%, #0a0f1d 100%);
    background-image: linear-gradient(180deg, #0c1224 0%, #121b33 48%, #0a0f1d 100%);
    background-attachment: fixed;
    color: #f8fafc;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.ctrl-shell {
    max-width: 540px;
    margin: 0 auto;
    padding: 8px 10px 28px 10px;
}

body.is-driver .ctrl-shell {
    min-height: 100vh;
    padding-bottom: 14px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
}

.driver-deck {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
}

/* Top utility bar */
.top-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 7px;
}

.back-link {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 9px;
    background: #17213a;
    background-image: -webkit-linear-gradient(top, #1e2b4a 0%, #141d34 100%);
    background-image: linear-gradient(180deg, #1e2b4a 0%, #141d34 100%);
    border: 1px solid #324368;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.30);
}

.back-link:active {
    -webkit-transform: translateY(1px);
    transform: translateY(1px);
    background: #131b30;
}

.brand-title {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
}

.comms-badge {
    position: relative;
    font-family: Consolas, Monaco, monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px 5px 18px;
    border-radius: 999px;
    background: #131d33;
    color: #93c5fd;
    border: 1px solid #2b3f66;
    white-space: nowrap;
}

.comms-badge:before {
    content: "";
    position: absolute;
    left: 7px;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

/* Unified Compact Cockpit Header */
.status-strip {
    position: relative;
    overflow: hidden;
    background: #151e34;
    background-image: -webkit-linear-gradient(top, #1c2845 0%, #121a2e 100%);
    background-image: linear-gradient(180deg, #1c2845 0%, #121a2e 100%);
    border: 1px solid #2d3e62;
    border-radius: 14px;
    padding: 11px 10px 9px 10px;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.36);
}

.strip-accent {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: #7c3aed;
    background-image: -webkit-linear-gradient(left, #7c3aed 0%, #c026d3 50%, #f59e0b 100%);
    background-image: linear-gradient(90deg, #7c3aed 0%, #c026d3 50%, #f59e0b 100%);
}

body.is-driver .strip-accent {
    background: #ea580c;
    background-image: -webkit-linear-gradient(left, #ef4444 0%, #f97316 55%, #facc15 100%);
    background-image: linear-gradient(90deg, #ef4444 0%, #f97316 55%, #facc15 100%);
}

.role-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 7px;
}

.role-info {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-width: 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    margin-right: 8px;
}

.role-badge {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 6px;
    background: #ea580c;
    background-image: -webkit-linear-gradient(top, #f97316 0%, #c2410c 100%);
    background-image: linear-gradient(180deg, #f97316 0%, #c2410c 100%);
    border: 1px solid #fdba74;
    color: #ffffff;
    margin-right: 7px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}

.role-badge.is-blocker {
    background: #7c3aed;
    background-image: -webkit-linear-gradient(top, #8b5cf6 0%, #6d28d9 100%);
    background-image: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
    border-color: #c4b5fd;
}

.race-sub {
    font-size: 11px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.mini-btn {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    padding: 5px 9px;
    border-radius: 7px;
    border: 1px solid #41557e;
    background: #10182b;
    background-image: -webkit-linear-gradient(top, #1b2847 0%, #10182b 100%);
    background-image: linear-gradient(180deg, #1b2847 0%, #10182b 100%);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.mini-btn:disabled {
    opacity: 0.65;
    color: #94a3b8;
    cursor: default;
}

.name-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 8px;
}

.name-field {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 9px;
    border: 1px solid #33456b;
    background: #0c1324;
    padding: 2px 3px 2px 9px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
}

.name-label {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-right: 7px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.name-input {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-width: 60px;
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

.start-btn {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    margin-left: 8px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid #fdba74;
    background: #ea580c;
    background-image: -webkit-linear-gradient(top, #fb923c 0%, #ea580c 55%, #c2410c 100%);
    background-image: linear-gradient(180deg, #fb923c 0%, #ea580c 55%, #c2410c 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    box-shadow: 0 3px 0 #7c2d12, 0 4px 10px rgba(234, 88, 12, 0.35);
}

.storage-notice {
    font-size: 10px;
    color: #fde047;
    margin-bottom: 6px;
}

/* Recessed Digital Telemetry HUD Bar */
.telemetry-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.tel-pill {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    padding: 5px 8px;
    margin-right: 6px;
    border-radius: 9px;
    background: #0c1324;
    border: 1px solid #263656;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.38);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.tel-pill:last-child {
    margin-right: 0;
}

.tel-top {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: baseline;
    -webkit-align-items: baseline;
    align-items: baseline;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.tel-lbl {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    color: #8296b8;
    margin-right: 5px;
}

.tel-pill strong {
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.1;
}

.tel-bar {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: #1e2c49;
    margin-top: 3px;
    overflow: hidden;
}

.tel-bar-fill {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background: #22c55e;
    -webkit-transition: width 0.18s ease, background-color 0.2s ease;
    transition: width 0.18s ease, background-color 0.2s ease;
}

.coin-pill {
    border-color: #ca8a04;
    background: #221b08;
    background-image: -webkit-linear-gradient(top, #33270a 0%, #1d1605 100%);
    background-image: linear-gradient(180deg, #33270a 0%, #1d1605 100%);
    box-shadow: inset 0 1px 0 rgba(250, 204, 21, 0.22), 0 0 10px rgba(234, 179, 8, 0.14);
}

.coin-pill .tel-lbl {
    color: #eab308;
}

.coin-pill strong {
    color: #fef08a;
}

.coin-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #facc15;
    border: 1px solid #fef08a;
    margin-right: 4px;
    -webkit-align-self: center;
    align-self: center;
    box-shadow: 0 0 5px rgba(250, 204, 21, 0.7);
}

/* Floating Overlay Toast ONLY for error/system notices — NEVER shifts page layout! */
.ctrl-notice {
    position: fixed;
    left: 50%;
    bottom: 16px;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    z-index: 120;
    max-width: 90%;
    padding: 9px 16px;
    border-radius: 999px;
    background: #2a1808;
    background-image: -webkit-linear-gradient(top, #45260a 0%, #261405 100%);
    background-image: linear-gradient(180deg, #45260a 0%, #261405 100%);
    border: 1px solid #f59e0b;
    color: #fef08a;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
}

/* Persistent Final Scores Card */
.final-card {
    position: relative;
    overflow: hidden;
    background: #172038;
    background-image: -webkit-linear-gradient(top, #222e4f 0%, #131b30 100%);
    background-image: linear-gradient(180deg, #222e4f 0%, #131b30 100%);
    border: 2px solid #facc15;
    border-radius: 16px;
    padding: 18px 14px 14px 14px;
    margin-bottom: 10px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.final-stripe {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background-image: -webkit-linear-gradient(left, #f97316 0%, #facc15 50%, #22c55e 100%);
    background-image: linear-gradient(90deg, #f97316 0%, #facc15 50%, #22c55e 100%);
}

.final-eyebrow {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.16em;
    color: #fb923c;
    margin-bottom: 4px;
}

.final-title {
    font-size: 22px;
    font-weight: 900;
    color: #fef08a;
    margin-bottom: 12px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.final-score-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin-bottom: 10px;
}

.final-box {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    margin: 0 5px;
    padding: 10px 8px;
    border-radius: 11px;
    background: #0d1426;
    border: 1px solid #35476d;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

.final-box-best {
    border-color: #ca8a04;
}

.final-box span {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 2px;
}

.final-box strong {
    display: block;
    font-size: 26px;
    font-weight: 900;
    color: #fde047;
    line-height: 1.1;
}

.final-meta {
    font-size: 12px;
    font-weight: 700;
    color: #fed7aa;
    background: #0f172a;
    border: 1px solid #293858;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 10px;
}

.final-blockers {
    text-align: left;
    background: #0c1324;
    border: 1px solid #2b3c5f;
    border-radius: 10px;
    padding: 9px 10px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #e2e8f0;
}

.final-blocker-row {
    padding: 4px 0;
    border-bottom: 1px solid #1c2944;
    font-weight: 700;
}

.final-blocker-row:last-child {
    border-bottom: 0;
}

.play-again-btn {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #86efac;
    background: #16a34a;
    background-image: -webkit-linear-gradient(top, #22c55e 0%, #15803d 100%);
    background-image: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.04em;
    cursor: pointer;
    box-shadow: 0 4px 0 #14532d, 0 6px 16px rgba(22, 163, 74, 0.35);
}

.final-wait-hint {
    padding: 10px 12px;
    border-radius: 10px;
    background: #0d1426;
    border: 1px solid #2b3c60;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* =========================================================
   MODE A: PLAYER 1 DRIVER DECK (Controls anchored lower in thumb zone)
   ========================================================= */
.drive-console {
    margin-top: auto;
    margin-bottom: 0;
    background: #151e34;
    background-image: -webkit-linear-gradient(top, #1b2744 0%, #11182c 100%);
    background-image: linear-gradient(180deg, #1b2744 0%, #11182c 100%);
    border: 1px solid #2d3f64;
    border-radius: 16px;
    padding: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.38);
}

/* Segmented Buttons / Joystick Control Mode Bar */
.ctrl-mode-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    padding: 3px;
    border-radius: 11px;
    background: #0c1324;
    border: 1px solid #253554;
    margin-bottom: 9px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
}

.ctrl-mode-tab {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    padding: 7px 8px;
    margin-right: 4px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    touch-action: manipulation;
}

.ctrl-mode-tab:last-child {
    margin-right: 0;
}

.ctrl-mode-tab.is-active {
    background: #ea580c;
    background-image: -webkit-linear-gradient(top, #fb923c 0%, #ea580c 100%);
    background-image: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
    border-color: #fdba74;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.40);
}

.ctrl-panel {
    margin-bottom: 10px;
}

/* Touch & Drag Directional Joystick Arena */
.joy-pad {
    position: relative;
    width: 100%;
    height: 236px;
    border-radius: 14px;
    background: #0b1222;
    background-image: -webkit-radial-gradient(center, ellipse cover, #182644 0%, #0b1222 76%);
    background-image: radial-gradient(ellipse at center, #182644 0%, #0b1222 76%);
    border: 1px solid #2c4068;
    box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.58);
    overflow: hidden;
    touch-action: none;
    cursor: pointer;
}

.joy-status {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 10px;
    text-align: center;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #93c5fd;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.joy-pad.is-gas .joy-status {
    color: #86efac;
}

.joy-pad.is-brake .joy-status {
    color: #fca5a5;
}

.joy-ring {
    position: absolute;
    left: 50%;
    top: 54%;
    width: 158px;
    height: 158px;
    margin-left: -79px;
    margin-top: -79px;
    border-radius: 50%;
    border: 2px solid rgba(251, 146, 60, 0.62);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.55), 0 0 16px rgba(249, 115, 22, 0.16);
    pointer-events: none;
}

.joy-pad.is-gas .joy-ring {
    border-color: rgba(74, 222, 128, 0.85);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.50), 0 0 18px rgba(34, 197, 94, 0.30);
}

.joy-pad.is-brake .joy-ring {
    border-color: rgba(248, 113, 113, 0.88);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.50), 0 0 18px rgba(239, 68, 68, 0.32);
}

.joy-axis-h,
.joy-axis-v {
    position: absolute;
    background: rgba(148, 163, 184, 0.18);
    pointer-events: none;
}

.joy-axis-h {
    left: 16px;
    right: 16px;
    top: 50%;
    height: 1px;
}

.joy-axis-v {
    top: 16px;
    bottom: 16px;
    left: 50%;
    width: 1px;
}

.joy-dir {
    position: absolute;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.06em;
    color: rgba(203, 213, 225, 0.72);
    pointer-events: none;
}

.joy-dir-up {
    top: 7px;
    left: 0;
    right: 0;
    text-align: center;
    color: #86efac;
}

.joy-dir-down {
    bottom: 7px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fca5a5;
}

.joy-dir-left {
    left: 9px;
    top: 50%;
    margin-top: -7px;
    font-size: 11px;
}

.joy-dir-right {
    right: 9px;
    top: 50%;
    margin-top: -7px;
    font-size: 11px;
}

.joy-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    margin-left: -28px;
    margin-top: -28px;
    border-radius: 50%;
    border: 2px solid #fed7aa;
    background: #ea580c;
    background-image: -webkit-radial-gradient(35% 30%, circle, #fdba74 0%, #ea580c 58%, #9a3412 100%);
    background-image: radial-gradient(circle at 35% 30%, #fdba74 0%, #ea580c 58%, #9a3412 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.60), 0 0 14px rgba(249, 115, 22, 0.35);
    pointer-events: none;
}

.joy-pad.is-gas .joy-knob {
    border-color: #bbf7d0;
    background: #16a34a;
    background-image: -webkit-radial-gradient(35% 30%, circle, #86efac 0%, #22c55e 55%, #15803d 100%);
    background-image: radial-gradient(circle at 35% 30%, #86efac 0%, #22c55e 55%, #15803d 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.60), 0 0 18px rgba(34, 197, 94, 0.50);
}

.joy-pad.is-brake .joy-knob {
    border-color: #fecaca;
    background: #dc2626;
    background-image: -webkit-radial-gradient(35% 30%, circle, #fca5a5 0%, #ef4444 55%, #991b1b 100%);
    background-image: radial-gradient(circle at 35% 30%, #fca5a5 0%, #ef4444 55%, #991b1b 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.60), 0 0 18px rgba(239, 68, 68, 0.50);
}

.console-labels {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin-bottom: 7px;
}

.console-lbl {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: #8296b8;
}

.console-lbl-steer {
    -webkit-box-flex: 1.3;
    -webkit-flex: 1.3 1 0;
    flex: 1.3 1 0;
    margin-right: 10px;
}

.console-lbl-pedal {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    text-align: center;
}

.drive-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin-bottom: 0;
}

.steer-pad {
    -webkit-box-flex: 1.3;
    -webkit-flex: 1.3 1 0;
    flex: 1.3 1 0;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin-right: 10px;
    padding: 5px;
    border-radius: 14px;
    background: #0c1222;
    border: 1px solid #253554;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.55);
    touch-action: none;
}

.pedal-col {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    touch-action: none;
}

.touch-btn {
    border-radius: 12px;
    border: 1px solid #495f89;
    background: #223052;
    background-image: -webkit-linear-gradient(top, #2e406b 0%, #1d2947 100%);
    background-image: linear-gradient(180deg, #2e406b 0%, #1d2947 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    touch-action: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 5px 0 #0c1222;
    -webkit-transition: -webkit-transform 0.06s ease, box-shadow 0.06s ease;
    transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.steer-btn {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    min-height: 152px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
}

.steer-btn:first-child {
    margin-right: 6px;
}

.btn-glyph {
    display: block;
    font-size: 26px;
    line-height: 1;
    margin-bottom: 6px;
    color: #cbd5e1;
}

.btn-cap {
    display: block;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.btn-cap-lg {
    display: block;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.1;
}

.btn-sub {
    display: block;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #bbf7d0;
    margin-top: 3px;
}

.gas-btn {
    min-height: 98px;
    margin-bottom: 10px;
    border-color: #4ade80;
    background: #16a34a;
    background-image: -webkit-linear-gradient(top, #22c55e 0%, #15803d 100%);
    background-image: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 5px 0 #14532d, 0 7px 14px rgba(22, 163, 74, 0.28);
}

.rev-btn {
    min-height: 54px;
    border-color: #f87171;
    background: #b91c1c;
    background-image: -webkit-linear-gradient(top, #dc2626 0%, #991b1b 100%);
    background-image: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
    font-size: 13px;
    letter-spacing: 0.05em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 0 #5b1010;
}

.touch-btn.is-active {
    background: #f59e0b;
    background-image: -webkit-linear-gradient(top, #fde047 0%, #f59e0b 100%);
    background-image: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
    border-color: #fef9c3;
    color: #111827;
    text-shadow: none;
    -webkit-transform: translateY(3px);
    transform: translateY(3px);
    box-shadow: 0 2px 0 #92400e, 0 0 14px rgba(250, 204, 21, 0.45);
}

.touch-btn.is-active .btn-glyph,
.touch-btn.is-active .btn-sub {
    color: #111827;
}

.drive-aux {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
}

.aux-btn {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    padding: 10px 10px;
    border-radius: 10px;
    border: 1px solid #3a4f78;
    background: #141f38;
    background-image: -webkit-linear-gradient(top, #1e2d4f 0%, #121b31 100%);
    background-image: linear-gradient(180deg, #1e2d4f 0%, #121b31 100%);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 3px 0 #0a0f1d;
}

.aux-horn {
    border-color: #b45309;
    color: #fde68a;
}

/* Monster Truck Chassis Damage Panel (positioned above driving controls so thumbs rest lower) */
.damage-panel {
    background: #151e34;
    background-image: -webkit-linear-gradient(top, #1b2744 0%, #11182c 100%);
    background-image: linear-gradient(180deg, #1b2744 0%, #11182c 100%);
    border: 1px solid #2d3f64;
    border-radius: 14px;
    padding: 9px 10px 6px 10px;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.damage-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 6px;
}

.damage-title {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: #94a3b8;
}

.damage-summary {
    font-size: 12px;
    font-weight: 900;
    color: #4ade80;
}

.dmg-overall-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: #0b1120;
    border: 1px solid #243452;
    overflow: hidden;
    margin-bottom: 10px;
}

.dmg-overall-fill {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: #22c55e;
    -webkit-transition: width 0.2s ease, background-color 0.2s ease;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.damage-grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

.dmg-cell {
    width: 32%;
    margin: 0 2% 6px 0;
    padding: 7px 7px 6px 7px;
    border-radius: 9px;
    background: #0c1324;
    border: 1px solid #243454;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.38);
}

.dmg-cell:nth-child(3n) {
    margin-right: 0;
}

.dmg-cell-top {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: baseline;
    -webkit-align-items: baseline;
    align-items: baseline;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 4px;
}

.dmg-cell-top span {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: #8296b8;
}

.dmg-cell-top strong {
    font-size: 13px;
    font-weight: 900;
    color: #4ade80;
}

.dmg-mini-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #1a2742;
    overflow: hidden;
}

.dmg-mini-fill {
    width: 0%;
    height: 100%;
    border-radius: 2px;
    background: #4ade80;
    -webkit-transition: width 0.18s ease, background-color 0.2s ease;
    transition: width 0.18s ease, background-color 0.2s ease;
}

/* =========================================================
   MODE B: ROAD BLOCKER COMMAND DECK
   ========================================================= */
.map-card {
    background: #141d33;
    background-image: -webkit-radial-gradient(center, ellipse cover, #1d2b4c 0%, #11192d 76%);
    background-image: radial-gradient(ellipse at center, #1d2b4c 0%, #11192d 76%);
    border: 1px solid #2d4066;
    border-radius: 16px;
    padding: 8px 10px 7px 10px;
    margin-bottom: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.36);
}

.map-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 4px;
}

.map-title {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: #fde047;
}

.map-hint {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    color: #cbd5e1;
    background: #0d1527;
    border: 1px solid #2a3b5f;
    border-radius: 999px;
    padding: 2px 8px;
}

.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    margin-right: 5px;
    box-shadow: 0 0 6px #ef4444;
}

.svg-wrap {
    width: 100%;
    max-width: 222px;
    margin: 0 auto;
}

#trackMapSvg {
    display: block;
    width: 100%;
    height: auto;
}

.seg-hit {
    cursor: pointer;
}

/* Selected Target Segment Dock — fixed single-line slots so height NEVER shifts! */
.seg-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    background: #17223b;
    background-image: -webkit-linear-gradient(left, #212e4e 0%, #151e34 100%);
    background-image: linear-gradient(90deg, #212e4e 0%, #151e34 100%);
    border: 1px solid #f97316;
    border-left: 4px solid #f97316;
    border-radius: 12px;
    padding: 8px 9px;
    margin-bottom: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
}

.seg-left {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-width: 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    margin-right: 8px;
}

.seg-code-badge {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    line-height: 32px;
    text-align: center;
    border-radius: 9px;
    background: #f97316;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    margin-right: 9px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.seg-info {
    min-width: 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
}

.seg-title-row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.seg-title {
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seg-lock-pill {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #dc2626;
    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.seg-obs {
    font-size: 11px;
    font-weight: 600;
    color: #fed7aa;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sell-btn {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    padding: 8px 11px;
    border-radius: 9px;
    border: 1px solid #4ade80;
    background: #15803d;
    background-image: -webkit-linear-gradient(top, #16a34a 0%, #15803d 100%);
    background-image: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 0 #14532d;
}

.sell-btn:disabled {
    opacity: 0.42;
    cursor: default;
    background: #1e2a45;
    background-image: none;
    border-color: #33456b;
    color: #94a3b8;
    box-shadow: none;
}

/* Segmented Tier Filter Bar */
.tier-tabs {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    padding: 3px;
    border-radius: 11px;
    background: #0d1426;
    border: 1px solid #243454;
    margin-bottom: 9px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
}

.tier-tab {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    padding: 7px 3px;
    margin-right: 3px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}

.tier-tab:last-child {
    margin-right: 0;
}

.tier-tab.is-active {
    background: #ea580c;
    background-image: -webkit-linear-gradient(top, #fb923c 0%, #ea580c 100%);
    background-image: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
    border-color: #fdba74;
    color: #ffffff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.40);
}

/* 20-Obstacle Arcade Shop Cards (2-column flexbox, zero Grid / zero gap) */
.shop-list {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

.obs-card {
    width: 48.8%;
    margin: 0 2.4% 9px 0;
    padding: 9px 9px 9px 9px;
    border-radius: 12px;
    background: #162038;
    background-image: -webkit-linear-gradient(top, #1e2b4b 0%, #131c31 100%);
    background-image: linear-gradient(180deg, #1e2b4b 0%, #131c31 100%);
    border: 1px solid #2b3c60;
    border-top-width: 3px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.32);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.obs-card:nth-child(2n) {
    margin-right: 0;
}

.obs-card.is-current {
    border-color: #4ade80;
    background: #122c24;
    background-image: -webkit-linear-gradient(top, #173c30 0%, #0f261e 100%);
    background-image: linear-gradient(180deg, #173c30 0%, #0f261e 100%);
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.25), 0 5px 16px rgba(22, 163, 74, 0.22);
}

.obs-card.is-unaffordable {
    opacity: 0.70;
}

.obs-top {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 5px;
}

.obs-name-wrap {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-width: 0;
    margin-right: 5px;
}

.obs-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.obs-name {
    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    color: #ffffff;
}

.obs-cost {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 900;
    color: #fef08a;
    background: #2b2108;
    border: 1px solid #ca8a04;
    border-radius: 999px;
    padding: 2px 7px;
    white-space: nowrap;
}

.obs-meta {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.obs-tier-pill {
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.05em;
    padding: 1px 5px;
    border-radius: 4px;
    margin-right: 5px;
    color: #ffffff;
}

.obs-tier-1 { background: #0f766e; }
.obs-tier-2 { background: #0284c7; }
.obs-tier-3 { background: #d97706; }
.obs-tier-4 { background: #be123c; }

.obs-tag {
    font-size: 10px;
    font-weight: 700;
    color: #93c5fd;
    margin-right: 5px;
}

.obs-stars {
    font-size: 10px;
    letter-spacing: 0.04em;
    color: #facc15;
}

.obs-desc {
    font-size: 11px;
    line-height: 1.32;
    color: #cbd5e1;
    margin-bottom: 9px;
}

.obs-place-btn {
    width: 100%;
    padding: 8px 6px;
    border-radius: 8px;
    border: 1px solid #fdba74;
    background: #ea580c;
    background-image: -webkit-linear-gradient(top, #fb923c 0%, #ea580c 100%);
    background-image: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    touch-action: manipulation;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.30);
    box-shadow: 0 3px 0 #9a3412;
}

.obs-place-btn.is-installed {
    border-color: #4ade80;
    background: #15803d;
    background-image: -webkit-linear-gradient(top, #16a34a 0%, #15803d 100%);
    background-image: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    color: #dcfce7;
    box-shadow: none;
    cursor: default;
}

.obs-place-btn:disabled:not(.is-installed) {
    background: #1f2b47;
    background-image: none;
    border-color: #32446a;
    color: #8296b8;
    text-shadow: none;
    box-shadow: none;
    cursor: default;
}

.obs-place-btn:active:not(:disabled),
.sell-btn:active:not(:disabled),
.start-btn:active,
.play-again-btn:active,
.mini-btn:active:not(:disabled),
.tier-tab:active,
.aux-btn:active {
    -webkit-transform: translateY(2px);
    transform: translateY(2px);
    opacity: 0.94;
}

.sell-btn,
.start-btn,
.play-again-btn,
.mini-btn,
.tier-tab,
.aux-btn,
.seg-hit {
    touch-action: manipulation;
}

/* Wider phones / tablets */
@media (min-width: 440px) {
    .svg-wrap {
        max-width: 248px;
    }
}

/* Shorter smartphone viewports (e.g. 360x640): keep damage readout + lower thumb controls on one screen */
@media (max-height: 700px) {
    .damage-panel {
        padding: 7px 9px 4px 9px;
        margin-bottom: 7px;
    }
    .dmg-overall-track {
        margin-bottom: 7px;
    }
    .dmg-cell {
        padding: 5px 6px 4px 6px;
        margin-bottom: 5px;
    }
    .steer-btn {
        min-height: 126px;
    }
    .gas-btn {
        min-height: 78px;
        margin-bottom: 8px;
    }
    .rev-btn {
        min-height: 44px;
    }
    .joy-pad {
        height: 184px;
    }
}

/* Very narrow phones */
@media (max-width: 359px) {
    .brand-title {
        display: none;
    }
    .svg-wrap {
        max-width: 204px;
    }
    .tier-tab {
        font-size: 10px;
    }
}
