:root {
    --accent: #c33d2d;
    --gold: #d0af63;
    --text: #f1eadb;
    --muted: #a59c8e;
    --panel: rgba(24, 20, 16, 0.92);
    --border: rgba(208, 175, 99, 0.24);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background-color: #090807;
    color: #f1eadb;
    color: var(--text);
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.shell {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 460px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    padding: 10px;
    overflow: hidden;
}

.topline,
.player-card,
.stat-card,
.controls-shell,
.pulse-banner {
    border: 1px solid rgba(208, 175, 99, 0.24);
    border-color: var(--border);
    background-color: #181410;
    background-color: var(--panel);
}

.topline,
.player-card,
.controls-shell {
    border-radius: 22px;
}

.topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 15px;
}

.eyebrow,
.meta-label {
    color: #d0af63;
    color: var(--gold);
    font-size: 0.68rem;
    font-weight: bold;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.topline h1 {
    margin: 6px 0 0;
    color: #dfcfaa;
    font-family: Impact, "Arial Black", sans-serif;
    font-size: 1.9rem;
    line-height: 0.9;
    letter-spacing: 0.08em;
}

.header-actions {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 6px;
    width: 108px;
}

.header-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid rgba(208, 175, 99, 0.24);
    border-radius: 999px;
    background-color: #2b251e;
    color: #f1eadb;
    font: inherit;
    font-size: 0.72rem;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.reset-pill {
    color: #ffd8d0;
    background-color: #4b1f19;
}

.header-pill:active {
    transform: translateY(1px) scale(0.98);
}

.player-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 15px;
}

.player-badge {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.player-glow {
    width: 38px;
    height: 38px;
    border: 7px solid #2f2922;
    border-radius: 12px;
    background-color: #7a352b;
}

.player-glow.online {
    background-color: #879d4f;
}

.player-name {
    font-size: 1rem;
    font-weight: bold;
}

.status-text,
.meta-value {
    color: #a59c8e;
    color: var(--muted);
    font-size: 0.8rem;
}

.meta-box {
    text-align: right;
}

.stats-grid {
    display: flex;
    gap: 8px;
}

.stat-card {
    flex: 1 1 50%;
    min-width: 0;
    border-radius: 15px;
    padding: 9px 12px;
}

.stat-card strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.controls-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 300px;
    padding: 10px;
    overflow: hidden;
}

.menu-strip {
    flex: 0 0 auto;
    margin-bottom: 9px;
    padding: 8px;
    border: 1px solid #6a5636;
    border-radius: 15px;
    background-color: #271f16;
}

.menu-guide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px 7px;
}

.menu-hint {
    color: #e0d1ae;
    font-size: 0.72rem;
    font-weight: bold;
    text-align: right;
}

.menu-actions {
    display: flex;
    gap: 8px;
}

.action-button.menu-action {
    width: auto;
    flex: 1 1 50%;
    min-height: 54px;
    margin: 0;
    border-color: #94723a;
    background-color: #49371f;
}

.action-button.select-action {
    border-color: #ad4938;
    background-color: #6a2b21;
}

.control-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3px 7px;
}

.control-hint {
    color: #a59c8e;
    color: var(--muted);
    font-size: 0.73rem;
}

.control-deck {
    display: flex;
    flex: 1 1 auto;
    gap: 10px;
    min-height: 0;
}

.joystick-stage {
    position: relative;
    display: flex;
    flex: 1 1 56%;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
}

.joystick-base {
    position: relative;
    flex: 0 0 auto;
    width: 250px;
    height: 250px;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid rgba(208, 175, 99, 0.34);
    border-radius: 50%;
    background-color: #11100e;
    touch-action: none;
}

.joystick-ring {
    position: absolute;
    top: 18%;
    right: 18%;
    bottom: 18%;
    left: 18%;
    border: 1px solid #4b4338;
    border-radius: 50%;
}

.joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32%;
    height: 32%;
    border: 4px solid #6f6250;
    border-radius: 50%;
    background-color: #b99a55;
    transform: translate(-50%, -50%);
    transition: margin 90ms ease-out;
    pointer-events: none;
}

.joystick-base.dragging .joystick-knob {
    transition: none;
}

.knob-grip {
    position: absolute;
    top: 28%;
    right: 28%;
    bottom: 28%;
    left: 28%;
    border: 2px solid #56472b;
    border-radius: 50%;
}

.direction-marker {
    position: absolute;
    z-index: 2;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border-radius: 50%;
    color: #7e7569;
    font-size: 1.35rem;
    line-height: 34px;
    text-align: center;
    pointer-events: none;
}

.direction-marker.active {
    background-color: #d0af63;
    color: #17120d;
}

.marker-up {
    top: 16%;
    left: 50%;
}

.marker-left {
    top: 50%;
    left: 16%;
}

.marker-right {
    top: 50%;
    left: 84%;
}

.marker-down {
    top: 84%;
    left: 50%;
}

.action-grid {
    display: flex;
    flex: 1 1 44%;
    align-content: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-width: 0;
    padding: 1px 0;
}

.action-button {
    width: 48%;
    min-height: 55px;
    margin: 1.2% 0;
    border: 2px solid #5b5041;
    border-radius: 15px;
    background-color: #302a22;
    color: #f1eadb;
    font: inherit;
    font-size: 0.82rem;
    font-weight: bold;
    text-transform: uppercase;
    touch-action: none;
}

.action-button.fire-button {
    border-color: #923a2d;
    background-color: #68251c;
    color: #ffe0d9;
}

.button-title,
.button-subtitle {
    display: block;
}

.button-subtitle {
    margin-top: 3px;
    color: #cfc3ad;
    font-size: 0.62rem;
    font-weight: normal;
    letter-spacing: 0.04em;
}

.action-button.active .button-subtitle,
.action-button:active .button-subtitle {
    color: #382b19;
}

.fire-button.active .button-subtitle,
.fire-button:active .button-subtitle {
    color: #fff;
}

.action-button.compact {
    min-height: 43px;
    font-size: 0.68rem;
}

.strafe-slider {
    position: relative;
    width: 100%;
    height: 58px;
    margin: 1.2% 0;
    overflow: hidden;
    border: 2px solid #5b5041;
    border-radius: 15px;
    background-color: #211d18;
    touch-action: none;
}

.strafe-slider.active {
    border-color: #d0af63;
}

.strafe-title {
    position: absolute;
    top: 5px;
    left: 50%;
    color: #d9c99f;
    font-size: 0.66rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transform: translateX(-50%);
}

.strafe-track {
    position: absolute;
    right: 22px;
    bottom: 11px;
    left: 22px;
    height: 8px;
    border: 1px solid #554a3d;
    border-radius: 999px;
    background-color: #0f0e0c;
}

.strafe-knob {
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 30px;
    height: 20px;
    border: 2px solid #6f6250;
    border-radius: 10px;
    background-color: #b99a55;
    transform: translateX(-50%);
    transition: margin 90ms ease-out;
    pointer-events: none;
}

.strafe-slider.dragging .strafe-knob {
    transition: none;
}

.strafe-side {
    position: absolute;
    bottom: 2px;
    z-index: 2;
    width: 24px;
    color: #8f8577;
    font-size: 1.1rem;
    line-height: 28px;
    text-align: center;
    pointer-events: none;
}

.strafe-side-left {
    left: 2px;
}

.strafe-side-right {
    right: 2px;
}

.strafe-slider.left .strafe-side-left,
.strafe-slider.right .strafe-side-right {
    color: #f2cf76;
}

.action-button.active,
.action-button:active {
    border-color: #e5c36f;
    background-color: #d0af63;
    color: #17120d;
    transform: scale(0.96);
}

.fire-button.active,
.fire-button:active {
    border-color: #ff9a87;
    background-color: #c33d2d;
    color: #fff;
}

.pulse-banner {
    flex: 0 0 auto;
    min-height: 36px;
    border-radius: 15px;
    padding: 9px 12px;
    color: #d9c99f;
    font-size: 0.86rem;
    font-weight: bold;
    text-align: center;
}

.pulse-banner.flash {
    background-color: #3d3326;
}

@media (max-width: 420px) {
    .shell {
        gap: 6px;
        padding: 7px;
    }

    .topline {
        padding: 9px 11px;
    }

    .topline h1 {
        font-size: 1.6rem;
    }

    .header-actions {
        width: 98px;
    }

    .header-pill {
        min-height: 29px;
        font-size: 0.66rem;
    }

    .player-card {
        padding: 8px 11px;
    }

    .player-glow {
        width: 34px;
        height: 34px;
    }

    .stat-card {
        padding: 7px 9px;
    }

    .controls-shell {
        padding: 7px;
    }

    .menu-strip {
        margin-bottom: 6px;
        padding: 6px;
    }

    .action-button.menu-action {
        min-height: 48px;
    }

    .control-deck {
        gap: 6px;
    }

    .action-button {
        min-height: 49px;
        font-size: 0.72rem;
    }

    .action-button.compact {
        min-height: 39px;
        font-size: 0.61rem;
    }

    .strafe-slider {
        height: 52px;
    }
}

@media (max-height: 700px) {
    .player-card,
    .stats-grid {
        display: none;
    }

    .controls-shell {
        min-height: 250px;
    }

    .action-button {
        min-height: 43px;
    }

    .action-button.compact {
        min-height: 36px;
    }

    .strafe-slider {
        height: 46px;
    }

    .strafe-title {
        top: 3px;
    }

    .strafe-track {
        bottom: 8px;
    }

    .strafe-knob {
        bottom: 3px;
    }

    .menu-strip {
        margin-bottom: 5px;
        padding: 5px;
    }

    .menu-guide {
        padding-bottom: 4px;
    }

    .action-button.menu-action {
        min-height: 41px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .shell {
        width: 100%;
    }

    .topline {
        position: absolute;
        top: 7px;
        left: 7px;
        width: 170px;
        height: 74px;
    }

    .header-actions,
    .pulse-banner,
    .control-heading {
        display: none;
    }

    .controls-shell {
        position: absolute;
        top: 7px;
        right: 7px;
        bottom: 7px;
        left: 184px;
        min-height: 0;
    }
}
