html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Trebuchet MS", "Gill Sans", sans-serif;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.32), transparent 40%),
        linear-gradient(180deg, #88dfff 0%, #73d2f6 55%, #f2d973 55%, #d8b050 100%);
    color: #432808;
}

body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    box-sizing: border-box;
}

.controllerShell {
    width: min(100%, 420px);
}

.controllerCard {
    padding: 22px 20px 18px;
    border-radius: 28px;
    background: rgba(255, 249, 232, 0.9);
    box-shadow: 0 20px 40px rgba(72, 45, 8, 0.18);
    backdrop-filter: blur(10px);
}

.birdHeader {
    display: flex;
    align-items: center;
    gap: 16px;
}

.birdBadge {
    width: 92px;
    height: 92px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #ffde59 0%, #ffd23f 100%);
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45);
    border: 3px solid rgba(104, 63, 7, 0.14);
}

.birdIcon {
    position: relative;
    width: 56px;
    height: 42px;
    border-radius: 20px;
    background: currentColor;
    border: 4px solid rgba(104, 63, 7, 0.25);
}

.birdWing {
    position: absolute;
    left: 8px;
    top: 18px;
    width: 22px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    transform: rotate(-22deg);
}

.birdEye {
    position: absolute;
    right: 10px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
}

.birdEye::after {
    content: "";
    position: absolute;
    right: 2px;
    top: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #161616;
}

.birdBeak {
    position: absolute;
    right: -13px;
    top: 18px;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 16px solid #ff9140;
}

.birdName {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.birdStatus {
    margin-top: 4px;
    font-size: 15px;
    color: #7f5a25;
}

.statsGrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 22px;
}

.scorePanel {
    padding: 18px;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 239, 179, 0.94), rgba(250, 227, 135, 0.94));
    text-align: center;
}

.winsPanel {
    background: linear-gradient(180deg, rgba(255, 232, 184, 0.94), rgba(247, 214, 113, 0.94));
}

.scoreLabel {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7e5a10;
}

.scoreValue {
    margin-top: 6px;
    font-size: 44px;
    line-height: 1;
    font-weight: 900;
    color: #5d3908;
}

.flapButton {
    width: 100%;
    margin-top: 22px;
    padding: 22px 20px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffb443 0%, #ff8f2d 100%);
    color: #fff7e4;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    box-shadow: 0 14px 24px rgba(186, 88, 18, 0.28);
    touch-action: manipulation;
}

.flapButton:active {
    transform: translateY(2px) scale(0.985);
}

.flapButton.disabled {
    opacity: 0.45;
}

.statusText {
    margin-top: 18px;
    min-height: 42px;
    color: #6f5228;
    font-size: 15px;
    line-height: 1.4;
}

.commsInfoDiv {
    margin-top: 12px;
    color: #8c6938;
    font-size: 12px;
    text-align: center;
}

.backToAppsButton {
    display: block;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.46);
    color: #6f5228;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    -webkit-tap-highlight-color: transparent;
}

.backToAppsButton:active {
    transform: translateY(1px);
}

body {
    display: block;
    padding: 14px;
    background: #75d3f6;
}

.hidden {
    display: none !important;
}

.controllerShell {
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
}

.controllerCard {
    padding: 20px 18px 16px;
    box-sizing: border-box;
    border: 3px solid rgba(90, 53, 8, 0.18);
    border-radius: 24px;
    background: #fff9e8;
    box-shadow: none;
    backdrop-filter: none;
}

.birdBadge {
    display: block;
    width: 92px;
    height: 92px;
    margin-right: 14px;
    border: 3px solid #d6ba76;
    background: #dff4ff;
    box-shadow: none;
    flex: none;
}

.birdPreview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.birdName {
    max-width: 260px;
    overflow: hidden;
    font-size: 25px;
    letter-spacing: 0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.statsGrid {
    display: flex;
    margin: 18px -6px 0;
}

.scorePanel {
    width: 50%;
    margin: 0 6px;
    padding: 15px;
    box-sizing: border-box;
    background: #ffeaa2;
}

.winsPanel {
    background: #ffdfa0;
}

.flapButton {
    min-height: 84px;
    margin-top: 18px;
    padding: 18px;
    background: #ff932f;
    box-shadow: none;
}

.editBirdButton {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    box-sizing: border-box;
    border: 2px solid #c5a158;
    border-radius: 13px;
    background: #fff3c9;
    color: #674515;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
}

.studioCard h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    text-align: center;
}

.studioIntro {
    margin: 7px 0 15px;
    color: #765424;
    font-size: 14px;
    text-align: center;
}

.nameLabel,
.toolField {
    display: block;
    color: #6d4a1b;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.birdNameInput {
    display: block;
    width: 100%;
    height: 46px;
    margin-top: 6px;
    padding: 8px 12px;
    box-sizing: border-box;
    border: 3px solid #d6ba76;
    border-radius: 12px;
    background: #fff;
    color: #38230b;
    font-size: 18px;
    font-weight: 800;
}

.drawingFrame {
    width: 100%;
    max-width: 360px;
    margin: 14px auto 0;
    padding: 8px;
    box-sizing: border-box;
    border: 3px dashed #bf9441;
    border-radius: 16px;
    background: #dff4ff;
}

#drawingCanvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
}

.drawTools {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: center;
    margin: 10px -4px 0;
}

.toolField,
.toolButton {
    margin: 4px;
}

.toolField input {
    display: block;
    margin-top: 5px;
}

.toolField input[type="color"] {
    width: 52px;
    height: 38px;
    padding: 2px;
    border: 2px solid #a97b32;
    border-radius: 8px;
    background: #fff;
}

.thicknessField {
    width: 125px;
}

.thicknessField input {
    width: 120px;
    height: 34px;
}

.toolButton,
.secondaryButton,
.submitBirdButton {
    min-height: 42px;
    padding: 9px 13px;
    border: 2px solid #a8792c;
    border-radius: 11px;
    background: #fff4ce;
    color: #56350c;
    font-size: 13px;
    font-weight: 900;
}

.toolButton.selected {
    border-color: #432808;
    background: #ffd95e;
}

.studioError {
    min-height: 20px;
    margin-top: 8px;
    color: #b02c20;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
}

.studioActions {
    display: flex;
    justify-content: center;
    margin: 5px -5px 0;
}

.studioActions button {
    margin: 0 5px;
}

.submitBirdButton {
    min-width: 168px;
    border-color: #b45a19;
    background: #ff982e;
    color: #fff;
    font-size: 15px;
    text-transform: uppercase;
}

@media (max-width: 360px) {
    body {
        padding: 8px;
    }

    .controllerCard {
        padding: 15px 12px;
    }

    .birdBadge {
        width: 74px;
        height: 74px;
    }

    .birdName {
        font-size: 21px;
    }
}
