/*
 * SNDK Mobile UI v3
 * Shared visual system for the ind-03-ui branch.
 * Business hooks remain in the page templates and app.js.
 */

:root {
    --v3-bg: #080d19;
    --v3-bg-elevated: #0d1424;
    --v3-surface: #141c2e;
    --v3-surface-strong: #1a2438;
    --v3-surface-soft: #202b41;
    --v3-line: rgba(148, 163, 184, .16);
    --v3-line-strong: rgba(148, 163, 184, .28);
    --v3-text: #f8fafc;
    --v3-muted: #94a3b8;
    --v3-muted-strong: #cbd5e1;
    --v3-gold: #f6b73c;
    --v3-gold-bright: #ffd66b;
    --v3-gold-soft: rgba(246, 183, 60, .14);
    --v3-green: #38d996;
    --v3-green-soft: rgba(56, 217, 150, .13);
    --v3-purple: #8b5cf6;
    --v3-purple-strong: #6d3ce7;
    --v3-blue: #4f8cff;
    --v3-red: #fb7185;
    --v3-shadow: 0 18px 45px rgba(0, 0, 0, .28);
    --v3-shadow-soft: 0 10px 24px rgba(0, 0, 0, .18);
    --v3-radius-xl: 24px;
    --v3-radius-lg: 18px;
    --v3-radius-md: 14px;
    --v3-radius-sm: 11px;
    --v3-space: clamp(14px, 4vw, 20px);
    --v3-content: 620px;
    --v3-bottom-nav-height: 76px;
}

html {
    min-height: 100%;
    background: var(--v3-bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.ui-v3 {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    color: var(--v3-text);
    background:
        radial-gradient(circle at 92% -8%, rgba(139, 92, 246, .18), transparent 28rem),
        radial-gradient(circle at -8% 22%, rgba(79, 140, 255, .08), transparent 22rem),
        var(--v3-bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.ui-v3::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .25;
    background-image:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

body.ui-v3,
body.ui-v3 * {
    box-sizing: border-box;
}

body.ui-v3 img,
body.ui-v3 svg {
    max-width: 100%;
}

body.ui-v3 a {
    color: inherit;
    text-decoration: none;
}

body.ui-v3 button,
body.ui-v3 input,
body.ui-v3 select,
body.ui-v3 textarea {
    font: inherit;
}

body.ui-v3 button,
body.ui-v3 a,
body.ui-v3 select,
body.ui-v3 input[type="checkbox"],
body.ui-v3 input[type="radio"] {
    -webkit-tap-highlight-color: transparent;
}

body.ui-v3 :focus-visible {
    outline: 3px solid rgba(246, 183, 60, .88);
    outline-offset: 3px;
}

body.ui-v3 main {
    width: min(100%, var(--v3-content));
    margin-inline: auto;
}

body.ui-v3.ui-v2-page {
    padding-bottom: calc(var(--v3-bottom-nav-height) + env(safe-area-inset-bottom) + 22px);
}

/* Shared application header */
body.ui-v3 .nav-gradient {
    position: relative;
    z-index: 20;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 142px;
    align-items: center;
    min-height: calc(76px + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) var(--v3-space) 12px;
    color: var(--v3-text);
    background: rgba(8, 13, 25, .9);
    border-bottom: 1px solid var(--v3-line);
    box-shadow: none;
    backdrop-filter: blur(20px) saturate(135%);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
}

body.ui-v3 .nav-gradient::after {
    content: "";
    position: absolute;
    inset: auto var(--v3-space) 0;
    height: 1px;
    background: linear-gradient(90deg, var(--v3-gold), rgba(139,92,246,.65), transparent);
    opacity: .7;
}

body.ui-v3 .nav-title {
    min-width: 0;
    padding-inline: 10px;
    color: var(--v3-text);
    font-size: clamp(18px, 5vw, 22px);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
}

body.ui-v3 .nav-back {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    color: var(--v3-text);
    font-size: 0;
    border: 1px solid var(--v3-line-strong);
    border-radius: 14px;
    background: var(--v3-surface);
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .nav-back::before {
    content: "";
    width: 10px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(1px, -1px);
}

body.ui-v3 .nav-back:hover,
body.ui-v3 .nav-back:active {
    color: var(--v3-gold-bright);
    border-color: rgba(246, 183, 60, .5);
}

/* Fixed utility buttons remain independent from the page header. */
body.ui-v3 .dark-toggle,
body.ui-v3 .install-app-btn,
body.ui-v3 .cs-float-btn {
    top: calc(16px + env(safe-area-inset-top));
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    color: var(--v3-muted-strong);
    background: rgba(20, 28, 46, .9);
    border: 1px solid var(--v3-line-strong);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

body.ui-v3 .dark-toggle { right: max(14px, env(safe-area-inset-right)); }
body.ui-v3 .install-app-btn { right: max(62px, calc(env(safe-area-inset-right) + 62px)); }
body.ui-v3 .cs-float-btn { right: max(110px, calc(env(safe-area-inset-right) + 110px)); }

/* The install action should read as a light utility, not a heavy dark control. */
body.ui-v3 .install-app-btn {
    color: #2d7b58;
    background: linear-gradient(180deg, rgba(255,255,245,.97), rgba(229,244,207,.97));
    border-color: rgba(174, 151, 72, .48);
    box-shadow: 0 5px 14px rgba(48, 91, 61, .14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

body.ui-v3 .dark-toggle svg,
body.ui-v3 .install-app-btn svg,
body.ui-v3 .cs-float-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

body.ui-v3 .utility-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Shared surfaces */
body.ui-v3 .card,
body.ui-v3 .form-card,
body.ui-v3 .panel,
body.ui-v3 .list-card,
body.ui-v3 .info-card,
body.ui-v3 .empty-state-v2,
body.ui-v3 .loading-state,
body.ui-v3 .error-state {
    color: var(--v3-text);
    background: linear-gradient(145deg, rgba(27, 37, 57, .96), rgba(16, 24, 40, .96));
    border: 1px solid var(--v3-line);
    border-radius: var(--v3-radius-lg);
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}

body.ui-v3 .section-heading h2,
body.ui-v3 .section-heading h3 {
    margin: 0;
    color: var(--v3-text);
    font-size: clamp(18px, 5vw, 22px);
    line-height: 1.18;
    letter-spacing: -.025em;
}

body.ui-v3 .section-heading a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 40px;
    color: var(--v3-gold-bright);
    font-weight: 750;
    font-size: 13px;
}

body.ui-v3 .section-heading a svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

body.ui-v3 .ui-eyebrow,
body.ui-v3 .eyebrow,
body.ui-v3 .section-kicker {
    color: var(--v3-gold-bright);
    font-size: 11px;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: .12em;
    text-transform: uppercase;
}

body.ui-v3 .muted,
body.ui-v3 .text-muted,
body.ui-v3 small {
    color: var(--v3-muted);
}

/* Inputs and action controls */
body.ui-v3 input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.ui-v3 select,
body.ui-v3 textarea {
    width: 100%;
    min-height: 52px;
    padding: 13px 15px;
    color: var(--v3-text);
    caret-color: var(--v3-gold);
    background: rgba(8, 13, 25, .68);
    border: 1px solid var(--v3-line-strong);
    border-radius: var(--v3-radius-md);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
    font-size: max(16px, 1em);
    line-height: 1.35;
}

body.ui-v3 textarea {
    min-height: 108px;
    resize: vertical;
}

body.ui-v3 input::placeholder,
body.ui-v3 textarea::placeholder {
    color: #738098;
    opacity: 1;
}

body.ui-v3 input:focus,
body.ui-v3 select:focus,
body.ui-v3 textarea:focus {
    border-color: rgba(246,183,60,.7);
    box-shadow: 0 0 0 4px rgba(246,183,60,.1);
    outline: 0;
}

body.ui-v3 select option {
    color: var(--v3-text);
    background: var(--v3-surface);
}

body.ui-v3 button,
body.ui-v3 .btn,
body.ui-v3 .primary-btn,
body.ui-v3 .submit-btn {
    min-height: 48px;
    border-radius: var(--v3-radius-md);
}

body.ui-v3 .btn-primary,
body.ui-v3 .primary-btn,
body.ui-v3 .submit-btn {
    color: #1b1303;
    font-weight: 850;
    border: 1px solid rgba(255,214,107,.7);
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    box-shadow: 0 10px 24px rgba(246, 183, 60, .2);
}

body.ui-v3 button:disabled,
body.ui-v3 .is-disabled,
body.ui-v3 [aria-disabled="true"] {
    cursor: not-allowed;
    filter: grayscale(.35);
    opacity: .55;
}

/* Tabs */
body.ui-v3 .tab-nav,
body.ui-v3 .tabs,
body.ui-v3 [role="tablist"] {
    gap: 6px;
    padding: 5px;
    background: rgba(13, 20, 36, .92);
    border: 1px solid var(--v3-line);
    border-radius: 15px;
}

body.ui-v3 .tab-nav a,
body.ui-v3 .tab-nav button,
body.ui-v3 [role="tab"] {
    min-height: 42px;
    padding: 9px 13px;
    color: var(--v3-muted);
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-weight: 750;
}

body.ui-v3 .tab-nav .active,
body.ui-v3 .tab-nav .is-active,
body.ui-v3 [role="tab"][aria-selected="true"] {
    color: #fff;
    background: linear-gradient(135deg, var(--v3-purple), var(--v3-purple-strong));
    box-shadow: 0 8px 18px rgba(109,60,231,.25);
}

/* Loading, empty and errors */
body.ui-v3 .skeleton {
    overflow: hidden;
    background: #182238;
    border-radius: var(--v3-radius-md);
}

body.ui-v3 .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.075), transparent);
}

body.ui-v3 .empty-state-v2,
body.ui-v3 .loading-state,
body.ui-v3 .error-state {
    display: grid;
    place-items: center;
    min-height: 170px;
    padding: 28px 20px;
    text-align: center;
}

body.ui-v3 .empty-state-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    margin-bottom: 12px;
    color: var(--v3-gold);
    border-radius: 18px;
    background: var(--v3-gold-soft);
}

body.ui-v3 .empty-state-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

body.ui-v3 .toast {
    z-index: 10050;
    max-width: min(88vw, 380px);
    color: #fff;
    background: rgba(20, 28, 46, .96);
    border: 1px solid var(--v3-line-strong);
    border-radius: 14px;
    box-shadow: var(--v3-shadow);
    backdrop-filter: blur(18px);
}

/* Customer-service and PWA dialogs follow the same app-shell hierarchy. */
body.ui-v3 .cs-overlay,
body.ui-v3 .install-guide-overlay {
    padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(3, 7, 18, .74);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.ui-v3 .cs-popup,
body.ui-v3 .install-guide-dialog {
    width: min(100%, 480px);
    max-height: min(88vh, 760px);
    max-height: min(88dvh, 760px);
    overflow: auto;
    color: var(--v3-text);
    background: linear-gradient(150deg, var(--v3-surface-strong), var(--v3-bg-elevated));
    border: 1px solid var(--v3-line-strong);
    border-radius: var(--v3-radius-xl);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
}

body.ui-v3 .cs-popup {
    overflow-x: hidden;
}

/* Customer service is opened from the page's own navigation entry. */
body.ui-v3 .cs-float-btn {
    display: none !important;
}

body.ui-v3 .cs-popup-copy h5,
body.ui-v3 .install-guide-header h2 {
    color: var(--v3-text);
}

body.ui-v3 .cs-popup-copy p,
body.ui-v3 .install-guide-header p {
    color: var(--v3-muted);
}

body.ui-v3 .cs-link-item,
body.ui-v3 .install-guide-step {
    color: var(--v3-text);
    background: rgba(8,13,25,.5);
    border-color: var(--v3-line);
}

body.ui-v3 .cs-link-item small { color: var(--v3-muted); }

body.ui-v3 .install-guide-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.ui-v3 .install-guide-close,
body.ui-v3 .cs-close {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    color: var(--v3-muted-strong);
    background: rgba(8,13,25,.5);
    border: 1px solid var(--v3-line);
    border-radius: 13px;
}

body.ui-v3 .install-guide-done {
    color: #1b1303;
    border-color: rgba(255,214,107,.65);
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    font-weight: 850;
}

/* Bottom navigation: four stable primary destinations. */
body.ui-v3 .footer-nav.footer-nav-v2 {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 800;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: min(calc(100% - 24px), 590px);
    min-height: 66px;
    padding: 7px;
    color: var(--v3-muted);
    background: rgba(13, 20, 36, .94);
    border: 1px solid var(--v3-line-strong);
    border-radius: 21px;
    box-shadow: 0 18px 45px rgba(0,0,0,.4);
    transform: translateX(-50%);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
}

body.ui-v3 .footer-nav.footer-nav-v2 a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    color: inherit;
    border-radius: 15px;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.05;
    text-align: center;
}

body.ui-v3 .footer-nav.footer-nav-v2 .nav-icon {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    border-radius: 10px;
}

body.ui-v3 .footer-nav.footer-nav-v2 svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ui-v3 .footer-nav.footer-nav-v2 a.active {
    color: #171006;
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    box-shadow: 0 10px 22px rgba(246,183,60,.22);
}

/* Home dashboard */
body.ui-v3.ui-v2-home {
    padding-bottom: calc(var(--v3-bottom-nav-height) + env(safe-area-inset-bottom) + 28px);
}

body.ui-v3 .home-v3-shell {
    width: min(100%, var(--v3-content));
    margin: 0 auto;
    padding: calc(12px + env(safe-area-inset-top)) var(--v3-space) 28px;
}

body.ui-v3 .home-v3-topbar {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 50px;
    padding-right: 138px;
}

body.ui-v3 .home-v3-avatar {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(246,183,60,.5);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(246,183,60,.16), rgba(139,92,246,.22));
    box-shadow: 0 10px 24px rgba(0,0,0,.2);
}

body.ui-v3 .home-v3-avatar img {
    width: 34px;
    height: 34px;
}

body.ui-v3 .home-v3-identity {
    min-width: 0;
}

body.ui-v3 .home-v3-identity small {
    display: block;
    margin-bottom: 2px;
    color: var(--v3-gold-bright);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .15em;
    text-transform: uppercase;
}

body.ui-v3 .home-v3-identity strong {
    display: block;
    max-width: 160px;
    color: var(--v3-text);
    font-size: 16px;
    font-weight: 850;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.ui-v3 .home-v3-account-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 7px;
    margin-top: 10px;
}

body.ui-v3 .home-v3-account-chip,
body.ui-v3 .home-v3-account-action {
    min-width: 0;
    min-height: 50px;
    border: 1px solid var(--v3-line);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(27,37,57,.94), rgba(15,23,39,.94));
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .home-v3-account-chip {
    display: block;
    padding: 8px 9px;
}

body.ui-v3 .home-v3-account-chip span {
    display: block;
    overflow: hidden;
    color: var(--v3-muted);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.ui-v3 .home-v3-account-chip strong {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--v3-text);
    font-size: clamp(12px, 3.4vw, 15px);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.ui-v3 .home-v3-account-chip.is-earning strong { color: var(--v3-green); }

body.ui-v3 .home-v3-account-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 8px 10px;
    color: #1b1303;
    border-color: rgba(255,214,107,.65);
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    font-size: 11px;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
}

body.ui-v3 .home-v3-account-strip.is-guest {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.ui-v3 .home-v3-account-action.is-primary + .home-v3-account-action {
    color: var(--v3-muted-strong);
    border-color: var(--v3-line-strong);
    background: rgba(27,37,57,.94);
}

body.ui-v3 .home-v3-wallet {
    position: relative;
    overflow: hidden;
    margin-top: 12px;
    padding: 15px 16px;
    border: 1px solid rgba(246,183,60,.26);
    border-radius: var(--v3-radius-xl);
    background:
        radial-gradient(circle at 88% 18%, rgba(246,183,60,.24), transparent 34%),
        linear-gradient(140deg, #202b42, #121a2b 64%);
    box-shadow: var(--v3-shadow);
}

body.ui-v3 .home-v3-wallet::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -56px;
    width: 170px;
    height: 170px;
    border: 26px solid rgba(246,183,60,.055);
    border-radius: 50%;
}

body.ui-v3 .home-v3-wallet-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
}

body.ui-v3 .home-v3-wallet-head h1 {
    max-width: 250px;
    margin: 4px 0 0;
    color: var(--v3-text);
    font-size: clamp(19px, 5.5vw, 24px);
    line-height: 1.12;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

body.ui-v3 .home-v3-level {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 7px 10px;
    color: var(--v3-gold-bright);
    border: 1px solid rgba(246,183,60,.25);
    border-radius: 999px;
    background: var(--v3-gold-soft);
    font-size: 11px;
    font-weight: 800;
}

body.ui-v3 .home-v3-balances {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
}

body.ui-v3 .home-v3-balance {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--v3-line);
    border-radius: 14px;
    background: rgba(8,13,25,.52);
}

body.ui-v3 .home-v3-balance span {
    display: block;
    color: var(--v3-muted);
    font-size: 10px;
    line-height: 1.2;
}

body.ui-v3 .home-v3-balance strong {
    display: block;
    margin-top: 5px;
    color: var(--v3-text);
    font-size: clamp(16px, 5vw, 21px);
    line-height: 1.1;
    overflow-wrap: anywhere;
}

body.ui-v3 .home-v3-balance.is-earning strong { color: var(--v3-green); }

body.ui-v3 .home-v3-wallet-actions {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 10px;
}

body.ui-v3 .home-v3-wallet-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 10px;
    border: 1px solid var(--v3-line-strong);
    border-radius: 13px;
    background: rgba(255,255,255,.045);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

body.ui-v3 .home-v3-wallet-actions a:first-child {
    color: #1b1303;
    border-color: rgba(255,214,107,.65);
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
}

body.ui-v3 .home-v3-shortcuts {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin: 13px 0 0;
    padding: 0;
}

body.ui-v3 .home-v3-shortcuts a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 70px;
    padding: 7px 3px 6px;
    color: var(--v3-muted-strong);
    border: 1px solid var(--v3-line);
    border-radius: 13px;
    background: linear-gradient(145deg, rgba(27,37,57,.94), rgba(15,23,39,.94));
    box-shadow: var(--v3-shadow-soft);
    font-size: 9px;
    font-weight: 750;
    line-height: 1.1;
    text-align: center;
    overflow-wrap: anywhere;
}

body.ui-v3 .home-v3-shortcut-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--shortcut-color, var(--v3-gold-bright));
    border: 1px solid var(--v3-line-strong);
    border: 1px solid color-mix(in srgb, var(--shortcut-color, var(--v3-gold)) 35%, transparent);
    border-radius: 12px;
    background: rgba(139,92,246,.12);
    background: color-mix(in srgb, var(--shortcut-color, var(--v3-gold)) 13%, transparent);
}

body.ui-v3 .home-v3-shortcuts a:first-child {
    color: var(--v3-gold-bright);
    border-color: rgba(246,183,60,.42);
    background: linear-gradient(145deg, rgba(246,183,60,.12), rgba(27,37,57,.96));
}

body.ui-v3 .home-v3-shortcut-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ui-v3 .home-v3-section {
    margin-top: 18px;
}

/* Reference-inspired task cards. They use real product data, never synthetic rewards. */
body.ui-v3 .home-v3-mission-list {
    display: grid;
    gap: 9px;
}

body.ui-v3 .home-v3-mission-card {
    overflow: hidden;
    border: 1px solid var(--v3-line);
    border-radius: var(--v3-radius-lg);
    background: linear-gradient(145deg, rgba(27,37,57,.98), rgba(15,23,39,.98));
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .home-v3-mission-card > a {
    position: relative;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 90px;
    padding: 10px;
}

body.ui-v3 .home-v3-mission-card.is-featured > a {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    min-height: 104px;
}

body.ui-v3 .home-v3-mission-card.is-featured > a::after {
    content: "";
    position: absolute;
    top: -54px;
    right: 18px;
    width: 138px;
    height: 138px;
    border: 20px solid rgba(246,183,60,.06);
    border-radius: 50%;
    pointer-events: none;
}

body.ui-v3 .home-v3-mission-media {
    position: relative;
    z-index: 1;
    display: block;
    width: 62px;
    height: 62px;
    overflow: hidden;
    border: 1px solid var(--v3-line-strong);
    border-radius: 15px;
    background: var(--v3-surface-soft);
}

body.ui-v3 .home-v3-mission-card.is-featured .home-v3-mission-media {
    width: 72px;
    height: 72px;
}

body.ui-v3 .home-v3-mission-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.ui-v3 .home-v3-mission-copy {
    position: relative;
    z-index: 1;
    min-width: 0;
}

body.ui-v3 .home-v3-mission-copy strong {
    display: -webkit-box;
    overflow: hidden;
    color: var(--v3-text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.ui-v3 .home-v3-mission-description {
    display: -webkit-box;
    margin-top: 3px;
    overflow: hidden;
    color: var(--v3-muted);
    font-size: 11px;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

body.ui-v3 .home-v3-mission-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 9px;
    margin-top: 6px;
    color: var(--v3-muted);
    font-size: 9px;
    line-height: 1.2;
}

body.ui-v3 .home-v3-mission-metrics span {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    min-width: 0;
}

body.ui-v3 .home-v3-mission-metrics b {
    color: var(--v3-green);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

body.ui-v3 .home-v3-mission-action {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 62px;
    min-height: 34px;
    padding: 7px 8px;
    color: #1b1303;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    font-size: 10px;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
}

body.ui-v3 .home-v3-mission-action svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

body.ui-v3 .home-v3-opportunities {
    display: grid;
    gap: 9px;
}

body.ui-v3 .home-v3-opportunity {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 76px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--v3-line);
    border-radius: var(--v3-radius-lg);
    background: linear-gradient(145deg, rgba(27,37,57,.97), rgba(15,23,39,.97));
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .home-v3-opportunity::after {
    content: "";
    position: absolute;
    top: -26px;
    right: -20px;
    width: 90px;
    height: 90px;
    border: 16px solid rgba(139,92,246,.06);
    border-radius: 50%;
}

body.ui-v3 .home-v3-opportunity-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--v3-gold-bright);
    border-radius: 15px;
    background: var(--v3-gold-soft);
}

body.ui-v3 .home-v3-opportunity-icon.is-purple {
    color: #c4b5fd;
    background: rgba(139,92,246,.15);
}

body.ui-v3 .home-v3-opportunity-icon.is-green {
    color: var(--v3-green);
    background: var(--v3-green-soft);
}

body.ui-v3 .home-v3-opportunity-icon svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.ui-v3 .home-v3-opportunity-copy {
    min-width: 0;
}

body.ui-v3 .home-v3-opportunity-copy strong {
    display: block;
    color: var(--v3-text);
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

body.ui-v3 .home-v3-opportunity-copy small {
    display: -webkit-box;
    margin-top: 4px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.ui-v3 .home-v3-opportunity-action {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-width: 62px;
    min-height: 34px;
    padding: 7px 9px;
    color: #1b1303;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
    font-size: 10px;
    font-weight: 850;
    text-align: center;
}

body.ui-v3 .home-carousel.home-v3-carousel {
    margin: 22px 0 0;
    overflow: hidden;
    border: 1px solid var(--v3-line-strong);
    border-radius: var(--v3-radius-lg);
    background: var(--v3-surface);
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .home-v3-carousel .carousel-item,
body.ui-v3 .home-v3-carousel .carousel-item a {
    display: block;
    aspect-ratio: 2.4 / 1;
}

body.ui-v3 .home-v3-carousel .carousel-item[hidden] { display: none; }

body.ui-v3 .home-v3-carousel img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.ui-v3 .home-v3-carousel .carousel-dots {
    bottom: 9px;
}

body.ui-v3 .home-v3-carousel .carousel-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,.45);
}

body.ui-v3 .home-v3-carousel .carousel-dots span.active {
    width: 18px;
    background: var(--v3-gold);
}

body.ui-v3 .home-v3-products .product-list-v2 {
    display: grid;
    gap: 10px;
}

body.ui-v3 .home-v3-products .product-card-v2 {
    padding: 12px;
    color: var(--v3-text);
    border: 1px solid var(--v3-line);
    border-radius: var(--v3-radius-lg);
    background: linear-gradient(145deg, rgba(27,37,57,.96), rgba(15,23,39,.96));
    box-shadow: var(--v3-shadow-soft);
}

body.ui-v3 .home-v3-products .product-main-link {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

body.ui-v3 .home-v3-products .product-image-wrap {
    width: 82px;
    height: 82px;
    overflow: hidden;
    border: 1px solid var(--v3-line);
    border-radius: 15px;
    background: var(--v3-surface-soft);
}

body.ui-v3 .home-v3-products .product-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.ui-v3 .home-v3-products .product-info-v2 strong {
    display: -webkit-box;
    color: var(--v3-text);
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.ui-v3 .home-v3-products .product-description {
    display: -webkit-box;
    margin-top: 4px;
    color: var(--v3-muted);
    font-size: 10px;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.ui-v3 .home-v3-products .product-price {
    display: block;
    margin-top: 7px;
    color: var(--v3-green);
    font-size: 18px;
    line-height: 1.1;
}

body.ui-v3 .home-v3-products .return-badge {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 1px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px;
    color: var(--v3-muted-strong);
    border: 1px solid rgba(56,217,150,.16);
    border-radius: 13px;
    background: var(--v3-green-soft);
}

body.ui-v3 .home-v3-products .return-badge-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--v3-green);
    border-radius: 10px;
    background: rgba(56,217,150,.1);
}

body.ui-v3 .home-v3-products .return-badge-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

body.ui-v3 .home-v3-products .return-metric-label {
    display: block;
    color: var(--v3-muted);
    font-size: 9px;
    line-height: 1.15;
}

body.ui-v3 .home-v3-products .return-metric strong {
    display: block;
    margin-top: 3px;
    color: var(--v3-green);
    font-size: 12px;
}

body.ui-v3 .home-v3-products .return-metric-divider {
    width: 1px;
    height: 30px;
    background: var(--v3-line);
}

body.ui-v3 .home-v3-products .product-actions-v2 {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

body.ui-v3 .home-v3-products .product-action,
body.ui-v3 .home-v3-products .secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid var(--v3-line-strong);
    border-radius: 999px;
    background: rgba(255,255,255,.045);
    font-size: 11px;
    font-weight: 800;
}

body.ui-v3 .home-v3-products .product-action {
    color: #1b1303;
    border-color: rgba(255,214,107,.55);
    background: linear-gradient(135deg, var(--v3-gold-bright), var(--v3-gold));
}

body.ui-v3 .home-v3-products .product-action svg {
    width: 14px;
    height: 14px;
    margin-left: 4px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Light theme is intentionally lower contrast but keeps the same hierarchy. */
body.ui-v3:not(.dark) {
    --v3-bg: #f1f4f9;
    --v3-bg-elevated: #e9eef6;
    --v3-surface: #ffffff;
    --v3-surface-strong: #f8fafc;
    --v3-surface-soft: #edf2f8;
    --v3-line: rgba(30, 41, 59, .1);
    --v3-line-strong: rgba(30, 41, 59, .18);
    --v3-text: #172033;
    --v3-muted: #64748b;
    --v3-muted-strong: #334155;
    --v3-shadow: 0 18px 45px rgba(30, 41, 59, .12);
    --v3-shadow-soft: 0 10px 24px rgba(30, 41, 59, .08);
    background:
        radial-gradient(circle at 92% -8%, rgba(139,92,246,.11), transparent 28rem),
        radial-gradient(circle at -8% 22%, rgba(79,140,255,.07), transparent 22rem),
        var(--v3-bg);
}

body.ui-v3:not(.dark) .nav-gradient,
body.ui-v3:not(.dark) .footer-nav.footer-nav-v2,
body.ui-v3:not(.dark) .dark-toggle,
body.ui-v3:not(.dark) .install-app-btn,
body.ui-v3:not(.dark) .cs-float-btn {
    background: rgba(255,255,255,.9);
}

body.ui-v3:not(.dark) .home-v3-wallet {
    background:
        radial-gradient(circle at 88% 18%, rgba(246,183,60,.28), transparent 34%),
        linear-gradient(140deg, #253451, #172238 64%);
}

body.ui-v3:not(.dark) .home-v3-wallet,
body.ui-v3:not(.dark) .home-v3-wallet h1,
body.ui-v3:not(.dark) .home-v3-wallet .home-v3-balance strong,
body.ui-v3:not(.dark) .home-v3-wallet .ui-eyebrow {
    color: #f8fafc;
}

body.ui-v3:not(.dark) .home-v3-wallet .home-v3-balance span { color: #aebbd0; }
body.ui-v3:not(.dark) .home-v3-wallet .home-v3-balance { background: rgba(8,13,25,.44); }

body.ui-v3:not(.dark) .home-v3-account-chip,
body.ui-v3:not(.dark) .home-v3-shortcuts a,
body.ui-v3:not(.dark) .home-v3-mission-card,
body.ui-v3:not(.dark) .home-v3-opportunity {
    background: linear-gradient(145deg, #ffffff, #f7f9fd);
    border-color: rgba(30,41,59,.13);
}

body.ui-v3:not(.dark) .home-v3-account-action.is-primary + .home-v3-account-action {
    color: #f8fafc;
    border-color: rgba(23, 34, 56, .66);
    background: linear-gradient(145deg, #2a3b5c, #172238);
}

body.ui-v3:not(.dark) .home-v3-shortcuts a:first-child {
    color: #9a6200;
    border-color: rgba(246,183,60,.62);
    background: linear-gradient(145deg, #fff8e5, #ffffff);
}

body.ui-v3:not(.dark) .home-v3-mission-card.is-featured > a::after {
    border-color: rgba(246,183,60,.12);
}

body.ui-v3:not(.dark) .home-v3-opportunity::after {
    border-color: rgba(139,92,246,.09);
}

body.ui-v3:not(.dark) input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body.ui-v3:not(.dark) select,
body.ui-v3:not(.dark) textarea {
    color: var(--v3-text);
    background: #fff;
}

body.ui-v3:not(.dark) select option { color: #172033; background: #fff; }

@media (max-width: 390px) {
    body.ui-v3 .nav-gradient {
        grid-template-columns: 46px minmax(0, 1fr) 132px;
        padding-inline: 12px;
    }

    body.ui-v3 .nav-gradient::after { inset-inline: 12px; }
    body.ui-v3 .home-v3-shell { padding-inline: 12px; }
    body.ui-v3 .home-v3-topbar { padding-right: 130px; }
    body.ui-v3 .home-v3-shortcuts { gap: 3px; padding-inline: 5px; }
    body.ui-v3 .home-v3-shortcuts a { font-size: 8.5px; }
    body.ui-v3 .home-v3-shortcut-icon { width: 36px; height: 36px; }
}

@media (max-width: 340px) {
    body.ui-v3 .home-v3-topbar { padding-right: 120px; }
    body.ui-v3 .home-v3-identity strong { max-width: 112px; }
    body.ui-v3 .home-v3-wallet { padding: 15px; }
    body.ui-v3 .home-v3-level { padding-inline: 8px; }
    body.ui-v3 .home-v3-balances,
    body.ui-v3 .home-v3-wallet-actions { gap: 7px; }
    body.ui-v3 .home-v3-shortcuts { grid-template-columns: repeat(5, minmax(48px, 1fr)); overflow-x: auto; }
    body.ui-v3 .home-v3-opportunity { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
    body.ui-v3 .home-v3-opportunity-action { min-width: 54px; padding-inline: 7px; }
}

@media (orientation: landscape) and (max-height: 500px) {
    body.ui-v3 .nav-gradient {
        min-height: calc(62px + env(safe-area-inset-top));
        padding-top: calc(8px + env(safe-area-inset-top));
        padding-bottom: 8px;
    }

    body.ui-v3 .dark-toggle,
    body.ui-v3 .install-app-btn,
    body.ui-v3 .cs-float-btn { top: calc(10px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
    body.ui-v3 *,
    body.ui-v3 *::before,
    body.ui-v3 *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
