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

body {
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: #fff5e8;
    background:
        radial-gradient(circle at top, rgba(255, 213, 157, 0.44), transparent 30%),
        radial-gradient(circle at bottom left, rgba(124, 191, 255, 0.16), transparent 28%),
        linear-gradient(180deg, #4a2f1d 0%, #20150f 48%, #0d0906 100%);
}

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

.controlCard {
    width: min(32rem, 100%);
    padding: 1.35rem;
    border-radius: 1.5rem;
    background: rgba(19, 12, 9, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px);
}

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

.controlTitle {
    margin: 0.35rem 0 0.55rem;
    font-size: clamp(1.8rem, 7vw, 2.7rem);
    line-height: 1;
}

.statusText,
.hintPanel,
.commsInfo,
.orientationNotice,
.viewerStateCard {
    line-height: 1.45;
}

.statusText {
    margin: 0;
    color: rgba(255, 245, 232, 0.86);
}

.buttonStack {
    display: grid;
    gap: 0.7rem;
    margin-top: 1.15rem;
}

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

.primaryButton {
    background: linear-gradient(135deg, #f0be7a 0%, #da8b43 100%);
    color: #29170a;
}

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

.previewCard,
.sensorCard,
.viewerStateCard,
.manualControls,
.hintPanel,
.commsInfo,
.orientationNotice {
    margin-top: 1.15rem;
    padding: 0.95rem 1rem;
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.panelTitle {
    margin: 0;
    font-size: 1rem;
}

.panelCopy {
    margin: 0.35rem 0 0.85rem;
    color: rgba(255, 245, 232, 0.78);
}

.previewHeader {
    display: flex;
    gap: 0.8rem;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
}

.previewReadout {
    color: #f1bb73;
    font-size: 0.84rem;
    font-weight: 700;
}

.rawReadout {
    margin-top: 0.55rem;
    color: #a9d6ff;
    font-size: 0.84rem;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.5;
}

.tiltPad {
    position: relative;
    width: min(16rem, 100%);
    aspect-ratio: 1;
    margin: 1rem auto 0;
    border-radius: 1.35rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04)),
        radial-gradient(circle at center, rgba(240, 190, 122, 0.2), transparent 52%);
    overflow: hidden;
}

.tiltGrid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 25% 25%;
}

.tiltDot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f0be7a 38%, #d46d2f 100%);
    box-shadow: 0 0 0 0.22rem rgba(240, 190, 122, 0.16);
    transition: transform 90ms ease;
}

.viewerStateCard {
    color: #aee8bd;
}

.viewerStateCard.viewerStateWarn {
    color: #ffd0a6;
}

.viewerStateCard.viewerStateSuccess {
    color: #b6ffca;
}

.orientationNotice {
    background: rgba(240, 190, 122, 0.14);
    border-color: rgba(240, 190, 122, 0.25);
    color: #ffe7c7;
}

.manualControls {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

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

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

.manualButtonWide {
    grid-column: 1 / -1;
}

.manualButtonActive {
    background: #f0be7a;
    transform: scale(0.985);
}

.hidden {
    display: none;
}

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

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

    .manualButtonWide {
        grid-column: auto;
    }
}
