html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
}

body {
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top, rgba(255, 225, 183, 0.5), transparent 34%),
        linear-gradient(180deg, #3d2a1b 0%, #1d1612 48%, #0f0b09 100%);
    color: #fff8ef;
}

.controlShell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.controlCard {
    width: min(30rem, 100%);
    padding: 1.4rem;
    border-radius: 1.4rem;
    background: rgba(20, 14, 10, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
}

.cardHeader {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.headerCopy {
    min-width: 0;
}

.eyebrow {
    color: #f4c076;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.72rem;
    font-weight: 700;
}

.controlTitle {
    margin: 0.35rem 0 0.55rem;
    font-size: clamp(1.7rem, 7vw, 2.5rem);
    line-height: 1.05;
}

.backToAppsButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 2.1rem;
    padding: 0 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.08);
    color: #fff8ef;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.backToAppsButton:hover,
.backToAppsButton:focus {
    border-color: rgba(240, 184, 107, 0.5);
    background: rgba(240, 184, 107, 0.16);
}

.backToAppsButton:focus-visible {
    outline: 3px solid rgba(240, 184, 107, 0.55);
    outline-offset: 2px;
}

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

.statusText {
    margin: 0;
    color: rgba(255, 248, 239, 0.84);
    line-height: 1.45;
}

.buttonStack {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.primaryButton,
.secondaryButton,
.manualButton {
    appearance: none;
    border: 0;
    border-radius: 1rem;
    padding: 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.primaryButton {
    background: linear-gradient(135deg, #f0b86b 0%, #db8f3f 100%);
    color: #271507;
}

.secondaryButton {
    background: rgba(255, 255, 255, 0.09);
    color: #fff8ef;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.manualControls {
    margin-top: 1.3rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.manualTitle {
    margin: 0;
    font-size: 1.05rem;
}

.manualCopy {
    margin: 0.45rem 0 0.9rem;
    color: rgba(255, 248, 239, 0.78);
    line-height: 1.4;
}

.manualGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.manualButton {
    background: rgba(255, 248, 239, 0.9);
    color: #2a1909;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 90ms ease, background-color 90ms ease;
}

.manualButtonActive {
    background: #f0b86b;
    transform: scale(0.98);
}

.hintPanel,
.commsInfo,
.orientationNotice {
    margin-top: 1.2rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 248, 239, 0.8);
    line-height: 1.45;
}

.orientationNotice {
    background: rgba(240, 184, 107, 0.16);
    border: 1px solid rgba(240, 184, 107, 0.35);
    color: #ffe8c3;
}

.hidden {
    display: none;
}

@media (max-width: 520px) {
    .controlCard {
        padding: 1.1rem;
    }

    .cardHeader {
        gap: 0.7rem;
    }

    .backToAppsButton {
        min-height: 2rem;
        padding: 0 0.65rem;
        font-size: 0.72rem;
    }

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