* {
    box-sizing: border-box;
}


:root {
    color-scheme: light;

    --bg: #cbd2da;
    --surface: #cbd2da;

    --text: #303741;
    --secondary: #697482;
    --muted: #87919d;

    --shadow-dark: #adb3ba;
    --shadow-light: #e9f1fa;

    --accent: #586bd8;
    --green: #398c68;
    --red: #c35f65;

    --radius: 28px;
    --small-radius: 18px;
}


html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #20242b;
    --surface: #20242b;

    --text: #e9edf3;
    --secondary: #969eaa;
    --muted: #6f7680;

    --shadow-dark: #171a20;
    --shadow-light: #292e36;

    --accent: #8294ff;
    --green: #70d9a4;
    --red: #ed8c8c;
}


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


body {
    min-height: 100dvh;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        Inter,
        system-ui,
        sans-serif;

    transition:
        background .35s ease,
        color .35s ease;
}


button,
input {
    -webkit-appearance: none;
    appearance: none;

    font: inherit;
}


button {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}


/* ============================================================
   APP
   ============================================================ */

.app {
    width: min(calc(100% - 32px), 540px);

    min-height: 100dvh;

    margin: auto;

    display: flex;
    flex-direction: column;

    padding:
        max(22px, env(safe-area-inset-top))
        0
        max(22px, env(safe-area-inset-bottom));
}


/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    min-height: 64px;

    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 28px;
}


.brand {
    display: flex;
    align-items: center;

    gap: 13px;

    margin-right: auto;
}


.brand-icon {
    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    border-radius: 15px;

    background: var(--surface);

    box-shadow:
        6px 6px 13px var(--shadow-dark),
        -6px -6px 13px var(--shadow-light);
}


.brand-icon span {
    width: 10px;
    height: 10px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 0 5px
        color-mix(
            in srgb,
            var(--green) 13%,
            transparent
        );
}


.brand strong,
.brand small {
    display: block;
}


.brand strong {
    font-size: 15px;
}


.brand small {
    margin-top: 2px;

    color: var(--secondary);

    font-size: 12px;
}


/* ============================================================
   THEME
   ============================================================ */

.theme-button {
    padding: 0;

    border: 0;

    background: transparent;

    cursor: pointer;
}


.theme-track {
    position: relative;

    width: 88px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: space-around;

    border-radius: 22px;

    background: var(--surface);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.theme-icon {
    z-index: 2;

    width: 32px;
    height: 32px;

    display: grid;
    place-items: center;

    color: var(--secondary);

    transition:
        color .35s ease,
        transform .35s ease;
}


.theme-icon svg {
    width: 17px;
    height: 17px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.theme-thumb {
    position: absolute;

    left: 5px;

    width: 34px;
    height: 34px;

    border-radius: 50%;

    background: var(--surface);

    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);

    transition:
        transform .35s cubic-bezier(.2,.8,.2,1),
        background .35s ease;
}


html[data-theme="dark"] .theme-thumb {
    transform: translateX(44px);
}


html:not([data-theme="dark"]) .sun {
    color: #d89b28;
}


html[data-theme="dark"] .moon {
    color: #aab8ff;
}


/* ============================================================
   HERO
   ============================================================ */

.hero {
    margin:
        10px
        5px
        32px;
}


.eyebrow {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-bottom: 12px;

    color: var(--secondary);

    font-size: 11px;
    font-weight: 650;

    letter-spacing: .08em;
    text-transform: uppercase;
}


.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 0 5px
        color-mix(
            in srgb,
            var(--green) 10%,
            transparent
        );
}


h1 {
    margin: 0;

    color: var(--text);

    font-size: clamp(36px, 9vw, 50px);

    font-weight: 680;

    letter-spacing: -.05em;
    line-height: 1;
}


.hero p {
    margin: 11px 0 0;

    color: var(--secondary);

    font-size: 14px;
}


/* ============================================================
   QUICK LAUNCH
   ============================================================ */

.quick-launch {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 17px;

    margin-bottom: 28px;
}


.quick-button {
    min-width: 0;

    height: 94px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    border: 0;
    border-radius: 23px;

    background: var(--surface);
    color: var(--secondary);

    cursor: pointer;

    box-shadow:
        7px 7px 14px var(--shadow-dark),
        -7px -7px 14px var(--shadow-light);

    transition:
        transform .15s ease,
        box-shadow .15s ease;
}


.quick-button:active {
    transform: scale(.96);

    box-shadow:
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}


.quick-button > span:last-child {
    font-size: 11px;
    font-weight: 650;
}


.quick-icon {
    width: 39px;
    height: 39px;

    display: grid;
    place-items: center;

    border-radius: 13px;

    color: var(--accent);

    background: var(--surface);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.quick-icon svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.quick-icon svg path:first-child:last-child {
    fill: currentColor;
}


.quick-icon.prime {
    font-size: 16px;
    font-weight: 750;
}


/* ============================================================
   REMOTE CARD
   ============================================================ */

.remote-card {
    padding: 25px;

    border-radius: 30px;

    background: var(--surface);

    box-shadow:
        11px 11px 23px var(--shadow-dark),
        -11px -11px 23px var(--shadow-light);
}


.card-heading {
    display: flex;
    align-items: center;

    gap: 15px;

    margin-bottom: 31px;
}


.card-icon {
    width: 50px;
    height: 50px;

    display: grid;
    place-items: center;

    flex: 0 0 50px;

    border-radius: 16px;

    color: var(--accent);

    background: var(--surface);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.card-icon svg {
    width: 23px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.card-heading strong,
.card-heading span {
    display: block;
}


.card-heading strong {
    font-size: 16px;
}


.card-heading span {
    margin-top: 3px;

    color: var(--secondary);

    font-size: 12px;
}


/* ============================================================
   DPAD
   ============================================================ */

.dpad {
    width: 244px;
    height: 244px;

    margin: 0 auto 31px;

    display: grid;

    grid-template-columns:
        repeat(3, 68px);

    grid-template-rows:
        repeat(3, 68px);

    gap: 13px;

    justify-content: center;
    align-content: center;
}


.nav-button {
    width: 68px;
    height: 68px;

    display: grid;
    place-items: center;

    padding: 0;

    border: 0;
    border-radius: 22px;

    background: var(--surface);
    color: var(--secondary);

    cursor: pointer;

    box-shadow:
        7px 7px 14px var(--shadow-dark),
        -7px -7px 14px var(--shadow-light);

    transition:
        transform .12s ease,
        box-shadow .12s ease,
        color .2s ease;
}


.nav-button:active {
    transform: scale(.94);

    box-shadow:
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light);
}


.nav-button svg {
    width: 23px;
    height: 23px;

    fill: none;
    stroke: currentColor;

    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.nav-button.ok {
    color: var(--accent);

    font-size: 13px;
    font-weight: 750;
}


.up {
    grid-column: 2;
    grid-row: 1;
}


.left {
    grid-column: 1;
    grid-row: 2;
}


.ok {
    grid-column: 2;
    grid-row: 2;
}


.right {
    grid-column: 3;
    grid-row: 2;
}


.down {
    grid-column: 2;
    grid-row: 3;
}


/* ============================================================
   MEDIA
   ============================================================ */

.media-controls {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 12px;

    padding-top: 24px;

    border-top:
        1px solid
        color-mix(
            in srgb,
            var(--secondary) 12%,
            transparent
        );
}

.tab-symbol {
    font-size: 22px !important;
    line-height: 19px;
}

.media-button {
    min-width: 0;
    height: 67px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    padding: 0;

    border: 0;
    border-radius: 19px;

    background: var(--surface);
    color: var(--secondary);

    cursor: pointer;

    box-shadow:
        5px 5px 11px var(--shadow-dark),
        -5px -5px 11px var(--shadow-light);

    transition:
        transform .15s ease,
        box-shadow .15s ease;
}


.media-button:active {
    transform: scale(.95);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.media-button svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.media-button span {
    font-size: 10px;
    font-weight: 600;
}


/* ============================================================
   INPUTS
   ============================================================ */

.input-section {
    margin-top: 32px;
}


.section-label {
    margin: 0 4px 11px;

    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 15px;
}


.section-label strong {
    font-size: 13px;
}


.section-label span {
    color: var(--secondary);

    font-size: 11px;
}


.input-shell {
    position: relative;
}


.input-shell input {
    width: 100%;
    height: 58px;

    padding: 0 64px 0 19px;

    border: 0;
    border-radius: var(--small-radius);

    outline: none;

    background: var(--surface);
    color: var(--text);

    font-size: 16px;

    box-shadow:
        inset 5px 5px 10px var(--shadow-dark),
        inset -5px -5px 10px var(--shadow-light);

    transition:
        box-shadow .2s ease,
        color .35s ease,
        background .35s ease;
}


.input-shell input:focus {
    box-shadow:
        inset 5px 5px 10px var(--shadow-dark),
        inset -5px -5px 10px var(--shadow-light),
        0 0 0 3px
        color-mix(
            in srgb,
            var(--accent) 15%,
            transparent
        );
}


.input-shell input::placeholder {
    color: var(--muted);
}


.input-send {
    position: absolute;

    top: 7px;
    right: 8px;

    width: 44px;
    height: 44px;

    display: grid;
    place-items: center;

    padding: 0;

    border: 0;
    border-radius: 14px;

    background: var(--surface);
    color: var(--accent);

    cursor: pointer;

    box-shadow:
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);

    transition:
        transform .15s ease,
        box-shadow .15s ease;
}


.input-send:active {
    transform: scale(.94);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.input-send svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;

    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* ============================================================
   OPERATION STATUS
   ============================================================ */

.operation-status {
    min-height: 48px;

    margin-top: 27px;
    padding: 0 17px;

    display: flex;
    align-items: center;

    gap: 10px;

    border-radius: 16px;

    color: var(--secondary);

    font-size: 12px;

    background: var(--surface);

    box-shadow:
        inset 3px 3px 7px var(--shadow-dark),
        inset -3px -3px 7px var(--shadow-light);
}


.operation-dot {
    width: 7px;
    height: 7px;

    flex: 0 0 7px;

    border-radius: 50%;

    background: var(--muted);
}


.operation-status.loading .operation-dot {
    background: var(--accent);

    animation: pulse .8s infinite alternate;
}


.operation-status.success {
    color: var(--green);
}


.operation-status.success .operation-dot {
    background: var(--green);
}


.operation-status.error {
    color: var(--red);
}


.operation-status.error .operation-dot {
    background: var(--red);
}


@keyframes pulse {
    to {
        opacity: .25;
        transform: scale(.65);
    }
}


/* ============================================================
   FOOTER
   ============================================================ */

footer {
    margin-top: auto;

    padding-top: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    color: var(--muted);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: .1em;
    text-transform: uppercase;
}


.footer-dot {
    width: 3px;
    height: 3px;

    border-radius: 50%;

    background: currentColor;
}


/* ============================================================
   ACCESSIBILITY / MOBILE
   ============================================================ */

button:focus {
    outline: none;
}


button:focus-visible {
    outline: none;

    box-shadow:
        inset 4px 4px 8px var(--shadow-dark),
        inset -4px -4px 8px var(--shadow-light),
        0 0 0 3px
        color-mix(
            in srgb,
            var(--accent) 20%,
            transparent
        );
}


@media (max-width: 480px) {

    .app {
        width: calc(100% - 24px);
    }

    .topbar {
        margin-bottom: 20px;
    }

    .remote-card {
        padding: 20px;
    }

    .quick-launch {
        gap: 12px;
    }
}


@media (max-width: 350px) {

    .theme-track {
        width: 76px;
    }

    html[data-theme="dark"] .theme-thumb {
        transform: translateX(32px);
    }

    .dpad {
        transform: scale(.92);

        margin-top: -10px;
        margin-bottom: 20px;
    }
}