:root {
    --player-hue: 2;
    --accent: hsl(var(--player-hue), 82%, 50%);
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1f3515;
    color: #fff8dc;
    font-family: "Trebuchet MS", Arial, sans-serif;
    user-select: none;
}

body {
    touch-action: none;
}

.controller-shell {
    min-height: 100%;
    box-sizing: border-box;
    padding: 18px;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 14px;
    background:
        linear-gradient(160deg, rgba(255, 214, 76, 0.16), transparent 38%),
        linear-gradient(#2c4f1c, #14240e);
}

.controller-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.eyebrow {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    color: #f6d65b;
}

h1 {
    margin: 2px 0 0;
    font-size: 30px;
    line-height: 1;
    color: #fff;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.icon-button {
    height: 42px;
    min-width: 78px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    color: #fff8dc;
    font-weight: 900;
    cursor: pointer;
}

.icon-button:active {
    transform: translateY(2px);
    background: rgba(255, 255, 255, 0.18);
}

.stats {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr;
    gap: 8px;
}

.stats div {
    min-width: 0;
    padding: 9px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.stats span {
    display: block;
    font-size: 11px;
    color: #b9d8a0;
    text-transform: uppercase;
    font-weight: 800;
}

.stats strong {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 19px;
}

.touch-area {
    position: relative;
    min-height: 320px;
    border: 4px solid rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    overflow: hidden;
    background:
        radial-gradient(circle at 70% 16%, rgba(255, 255, 255, 0.92), transparent 12%),
        linear-gradient(#dffaff 0%, #fff6a7 58%, #8fc85c 59%, #315b20 100%);
    box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.24), 0 12px 24px rgba(0, 0, 0, 0.28);
}

.pad-sky {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 25% 72%, rgba(50, 96, 39, 0.32) 0 10%, transparent 11%),
        radial-gradient(ellipse at 64% 70%, rgba(50, 96, 39, 0.28) 0 12%, transparent 13%);
}

.aim-guide {
    position: absolute;
    left: 18%;
    top: 50%;
    width: 72%;
    height: 2px;
    transform: translateY(-1px);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.85) 40%, transparent 0);
    background-size: 20px 2px;
    opacity: 0.8;
}

.power-arc {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.2);
    border: 7px solid var(--accent);
    opacity: 0;
    box-shadow: 0 0 22px var(--accent);
    pointer-events: none;
}

.touch-area.charging .power-arc {
    opacity: 0.52;
}

.sling-base {
    position: absolute;
    left: calc(50% - 14px);
    top: calc(50% - 36px);
    width: 28px;
    height: 112px;
    border-radius: 16px 16px 6px 6px;
    background: linear-gradient(90deg, #53280c, #ad631d 42%, #5f2d0f);
    box-shadow: 0 4px 0 #2c1608;
}

.sling-base::before,
.sling-base::after {
    content: "";
    position: absolute;
    top: -36px;
    width: 22px;
    height: 82px;
    border-radius: 12px;
    background: linear-gradient(90deg, #4c2309, #a85c1b 48%, #67320d);
    transform-origin: bottom center;
}

.sling-base::before {
    left: -26px;
    transform: rotate(-23deg);
}

.sling-base::after {
    right: -26px;
    transform: rotate(23deg);
}

.sling-band {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 1px;
    background: #3c2416;
    border-radius: 8px;
    transform-origin: left center;
    z-index: 3;
}

.bird-puck {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 64px;
    margin-left: -32px;
    margin-top: -32px;
    border-radius: 50%;
    background: var(--accent);
    border: 4px solid #27120d;
    box-sizing: border-box;
    box-shadow: inset -10px -12px rgba(0, 0, 0, 0.12), 0 5px 8px rgba(0, 0, 0, 0.22);
    z-index: 4;
    overflow: visible;
}

.belly {
    position: absolute;
    left: 16px;
    top: 36px;
    width: 35px;
    height: 20px;
    border-radius: 50%;
    background: #fff4d5;
    z-index: 1;
}

.eye {
    position: absolute;
    top: 19px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #211;
    z-index: 3;
}

.eye::after {
    content: "";
    position: absolute;
    right: 2px;
    top: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #111;
}

.eye-left {
    left: 14px;
}

.eye-right {
    right: 13px;
}

.brow {
    position: absolute;
    top: 13px;
    width: 19px;
    height: 5px;
    border-radius: 5px;
    background: #111;
    z-index: 5;
}

.brow-left {
    left: 9px;
    transform: rotate(11deg);
}

.brow-right {
    right: 7px;
    transform: rotate(-14deg);
}

.beak {
    position: absolute;
    left: 42px;
    top: 31px;
    width: 0;
    height: 0;
    border-left: 24px solid #f4ad16;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    filter: drop-shadow(1px 1px 0 #8e4a0c);
    z-index: 4;
}

footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #d7efc7;
    font-size: 13px;
    font-weight: 800;
}

#networkStatus {
    text-align: right;
    color: #93c977;
}

@media (orientation: landscape) and (max-height: 560px) {
    .controller-shell {
        grid-template-columns: 280px 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .controller-header,
    .stats,
    footer {
        grid-column: 1;
    }

    .touch-area {
        grid-column: 2;
        grid-row: 1 / 4;
        min-height: 0;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}
