:root {
    /* Radiance design tokens (Foundation → Design Tokens → Colors). */
    --rad-colors-backgrounds-separators: #d6d5d6;
    --rad-colors-backgrounds-page: #f5f5f5;
    --rad-colors-backgrounds-card-base: #ffffff;
    --rad-colors-backgrounds-core-gradient: radial-gradient(129.7% 129.7% at 38% -17.6%, #6284f8 0%, #5276eb 23%, #5276eb 57%, #d2a1c5 100%);
    --rad-colors-components-controls: #5b575b;
    --rad-colors-components-chips: #e0e0e0;
    --rad-colors-components-focus: #7e8bf3;
    --rad-colors-components-select: #edeffd;
    --rad-colors-ctas-primary: #4e60ee;
    --rad-colors-ctas-interactive-gradient: linear-gradient(8.68deg, #225de6 -4.27%, #a664fd 116.09%);
    --rad-colors-ctas-hover-gradient: linear-gradient(8.62deg, #0045e6 10%, #8a33fd 100%);
    --rad-colors-type-headline: #312d32;
    --rad-colors-type-body: #464247;
    --rad-colors-type-secondary: #5b575b;
    --rad-colors-type-labels: #787679;

    /* Matches the Platform Core header: flat Core blue, easing to lavender at the right edge. */
    --topbar-gradient: linear-gradient(90deg, #5276eb 0%, #5276eb 70%, #8483d3 100%);
    --topbar-height: 40px;
    --shadow: 0 24px 70px rgb(49 45 50 / 14%);
}

/* Inter (SIL OFL 1.1, see fonts/Inter-OFL.txt), self-hosted: Latin subset, variable weight. */
@font-face {
    font-family: Inter;
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format("woff2");
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    color: var(--rad-colors-type-body);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--rad-colors-backgrounds-page);
}

body {
    min-height: 100vh;
    margin: 0;
}

button,
a {
    font: inherit;
}

button {
    color: inherit;
}

a {
    color: var(--rad-colors-ctas-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--rad-colors-components-focus);
    outline-offset: 2px;
}

.topbar {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: var(--topbar-height);
    padding: 0 24px;
    color: white;
    background: var(--topbar-gradient);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
}

.product-avatar {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.topbar .brand {
    justify-self: center;
}

.topbar-actions {
    justify-self: end;
}

.product {
    color: #fff;
    font-weight: 500;
    font-size: 16px;
    text-decoration: none;
}

.brand {
    display: flex;
    align-items: center;
    color: white;
    font-size: 22px;
    font-weight: 300;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 55%);
    border-radius: 50%;
    font-family: Georgia, serif;
    font-size: 18px;
    font-style: italic;
    letter-spacing: 0;
}

.topbar-actions {
    display: flex;
    gap: 22px;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.topbar-actions a {
    color: rgb(255 255 255 / 82%);
}

.avatar {
    width: 32px;
    height: 32px;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 50%;
    color: white;
    background: rgb(255 255 255 / 14%);
    cursor: pointer;
}

.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chooser-page {
    position: relative;
    display: grid;
    min-height: 100vh;
    overflow: hidden;
    padding: calc(var(--topbar-height) + 40px) 24px 54px;
    place-items: center;
    background: var(--rad-colors-backgrounds-page);
}

/* Decorative gradient blobs removed for a plain (radiance) background. */
.ambient {
    display: none;
}

.ambient-one {
    top: 13%;
    left: 8%;
    width: 310px;
    height: 180px;
    background: linear-gradient(135deg, #6580cf, #5d4fa5);
}

.ambient-two {
    right: 4%;
    bottom: 8%;
    width: 420px;
    height: 240px;
    background: rgb(255 255 255 / 75%);
}

.chooser-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(680px, 100%) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
    width: 100%;
}

.dragen-logo-large {
    align-self: start;
    justify-self: end;
    margin-top: 30px;
    width: 100%;
    max-width: 200px;
    height: auto;
}

.chooser-card {
    position: relative;
    z-index: 1;
    width: min(100%, 680px);
    padding: 30px;
    border: 1px solid var(--rad-colors-backgrounds-separators);
    border-radius: 16px;
    background: var(--rad-colors-backgrounds-card-base);
    box-shadow: var(--shadow);
}

.chooser-heading h1 {
    margin: 0;
    color: var(--rad-colors-type-headline);
    font-size: clamp(25px, 4vw, 32px);
    line-height: 1.18;
    letter-spacing: -0.025em;
}

.chooser-heading > div > p:last-child {
    max-width: 570px;
    margin: 10px 0 0;
    color: var(--rad-colors-type-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.setup-options {
    display: grid;
    gap: 12px;
    margin-top: 26px;
}

.setup-option {
    display: grid;
    grid-template-columns: 42px 1fr 24px;
    gap: 14px;
    align-items: start;
    width: 100%;
    padding: 17px;
    border: 1px solid var(--rad-colors-backgrounds-separators);
    border-radius: 11px;
    text-align: left;
    background: var(--rad-colors-backgrounds-card-base);
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.setup-option:hover {
    border-color: var(--rad-colors-ctas-primary);
    box-shadow: 0 7px 20px rgb(78 96 238 / 12%);
    transform: translateY(-1px);
}

.setup-option:focus-visible {
    border-color: var(--rad-colors-ctas-primary);
    outline: 2px solid var(--rad-colors-components-focus);
    outline-offset: 2px;
}

.setup-option.selected {
    border-color: var(--rad-colors-ctas-primary);
    background: var(--rad-colors-components-select);
    box-shadow: inset 0 0 0 1px rgb(78 96 238 / 12%);
}

.option-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 9px;
    color: var(--rad-colors-components-controls);
    background: var(--rad-colors-backgrounds-page);
}

.option-icon svg {
    width: 21px;
    fill: none;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.option-icon.icon-pair {
    display: flex;
    gap: 1px;
    justify-content: center;
    align-items: center;
}

.option-icon.icon-pair svg {
    width: 17px;
}

.option-icon.icon-platform {
    color: white;
    background: var(--rad-colors-ctas-interactive-gradient);
}

.option-icon.icon-platform svg {
    fill: currentcolor;
    stroke: none;
}

.option-copy {
    display: grid;
    gap: 5px;
    color: var(--rad-colors-type-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.option-title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.option-title-row strong {
    color: var(--rad-colors-type-headline);
    font-size: 14px;
}

.badge,
.tag {
    padding: 3px 6px;
    border-radius: 4px;
    color: var(--rad-colors-ctas-primary);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--rad-colors-components-select);
}

.tag {
    color: var(--rad-colors-type-secondary);
    background: var(--rad-colors-components-chips);
}

.notice {
    margin-top: 5px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--rad-colors-type-labels);
    font-size: 10px;
    background: var(--rad-colors-backgrounds-page);
}

.arrow {
    align-self: center;
    color: var(--rad-colors-type-labels);
    font-size: 19px;
    transition: transform 160ms ease;
}

.setup-option:hover .arrow {
    color: var(--rad-colors-ctas-primary);
    transform: translateX(3px);
}

.chooser-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 23px;
    color: var(--rad-colors-type-labels);
    font-size: 11px;
}

.help-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin-top: 16px;
    padding: 12px 16px;
    border: 1px solid rgb(78 96 238 / 20%);
    border-radius: 10px;
    background: var(--rad-colors-components-select);
}

.help-footer strong {
    color: var(--rad-colors-type-headline);
    font-size: 12px;
}

.help-footer span {
    flex: 1 1 220px;
    color: var(--rad-colors-type-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.help-footer a {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* The `hidden` attribute must beat component display rules (e.g. `.chooser-page`'s
   grid, `.auth-gate`'s flex), or toggling `element.hidden` has no visible effect. */
[hidden] {
    display: none !important;
}

/* Auth gate (session check / redirect / no-subscription states). */
.auth-gate {
    display: flex;
    justify-content: center;
    padding: calc(var(--topbar-height) + 4rem) 1.5rem 4rem;
}

.auth-gate-card {
    display: grid;
    gap: 1rem;
    max-width: 28rem;
    text-align: center;
}

.auth-gate-message {
    color: var(--rad-colors-type-body);
    font-size: 1rem;
}

/* "Signing in…" only appears if the session check is slow, so fast checks don't flash it. */
.auth-gate-pending {
    animation: auth-gate-reveal 0s 600ms both;
}

@keyframes auth-gate-reveal {
    from {
        visibility: hidden;
    }
    to {
        visibility: visible;
    }
}

.primary-button {
    width: 100%;
    padding: 12px 20px;
    border: 0;
    border-radius: 7px;
    color: white;
    font-weight: 700;
    background: var(--rad-colors-ctas-interactive-gradient);
    box-shadow: 0 5px 14px rgb(78 96 238 / 24%);
    cursor: pointer;
}

.primary-button:hover {
    background: var(--rad-colors-ctas-hover-gradient);
}

.session-user {
    color: rgb(255 255 255 / 82%);
    font-size: 14px;
    align-self: center;
}

.toast {
    position: fixed;
    z-index: 20;
    right: 24px;
    bottom: 24px;
    max-width: 340px;
    padding: 13px 17px;
    border-radius: 8px;
    color: white;
    font-size: 13px;
    background: var(--rad-colors-type-headline);
    box-shadow: 0 10px 30px rgb(0 0 0 / 20%);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1000px) {
    .chooser-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }

    .dragen-logo-large {
        justify-self: auto;
        margin-top: 0;
        width: 96px;
        height: 96px;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding: 0 18px;
    }

    .chooser-page {
        padding-right: 16px;
        padding-left: 16px;
    }

    .chooser-card {
        padding: 22px 16px;
    }
}

@media (max-width: 480px) {
    .chooser-page {
        padding-top: calc(var(--topbar-height) + 20px);
    }

    .setup-option {
        grid-template-columns: 36px 1fr;
        padding: 14px 12px;
    }

    .option-icon {
        width: 36px;
        height: 36px;
    }

    .option-icon.icon-pair svg {
        width: 15px;
    }

    .arrow {
        display: none;
    }

    .chooser-footer {
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
