/* =============================================
   PHANTOM PWA — Dual Mode Styles
   Mobile-first + iPhone Preview Frame
   ============================================= */

:root {
    --bg: #111111;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* Real-time Design Variables (Source Accurate) */
    --balance-size: 38px;
    --balance-spacing: -0.76px;
    --balance-top: 111px;
    --balance-left: 17px;
    --balance-weight: 600;
    --balance-font: 'Inter', sans-serif;

    /* iPhone Frame Vars (1:1 mapping with modern iPhones) */
    --radius-outer: 48px;
    --radius-inner: 38px;
    --device-width: 390px;
    --device-height: 844px;

    /* Additional Design Studio Vars */
    --avatar-size: 40px;
    --avatar-offset-x: 0px;
    --avatar-offset-y: -5px;
    --name-size: 22px;
    --name-weight: 500;
    --name-family: 'Inter', sans-serif;
    --name-spacing: -0.4px;
    --name-offset-x: 0px;
    --name-offset-y: -5px;
    --handle-size: 14px;
    --handle-family: 'Inter', sans-serif;
    --handle-spacing: 0.1px;
    --handle-offset-x: 0px;
    --handle-offset-y: -9px;

    --frame-thickness: 3px;
    --bezel-thickness: 5px;
}

/* =============================================
   RESET
   ============================================= */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizespeed;
}

body {
    width: 100%;
    height: 100dvh;
    font-family: 'Inter', 'Roboto', 'Arial', sans-serif;
    background: var(--bg);
    color: #fff;
    overflow: hidden;
    overscroll-behavior: none;
    /* Locks entire window from bouncing */
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Electron drag support */
    -webkit-app-region: drag;
}

/* =============================================
   APP SHELL — Shared between both modes
   ============================================= */

.app-shell {
    display: flex;
    flex-direction: column;
    position: relative;
    /* CRITICAL: Traps absolute elements (bottom-nav, etc) to stay inside the iPhone */
    width: 100%;
    height: 100dvh;
    /* Default to viewport height for Web App consistency */
    min-height: 100dvh;
    background: transparent;
    overflow: hidden;
}

/* Mobile shell - ensures the PWA content starts at the top edge */
.mobile-shell {
    padding-top: 0;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-app-region: no-drag;
    margin-top: 0;
    position: relative;
    /* Space for top piece */
    height: 100%;
    /* Space for the absolute bottom nav */
}

.app-content::-webkit-scrollbar,
.settings-content::-webkit-scrollbar {
    display: none;
}

/* CUSTOM FLEXIBLE SCROLLBAR INDICATOR */
.custom-scrollbar-indicator {
    position: absolute;
    top: 0;
    right: 2px;
    width: 3px;
    background: #888888;
    /* Required Grey */
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.3s ease, height 0.1s ease, transform 0.05s linear;
    z-index: 10000;
    /* Absolute top-most layer */
    pointer-events: none;
}

.custom-scrollbar-indicator.visible {
    opacity: 1;
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    -webkit-touch-callout: none;
    pointer-events: none;
    z-index: 0;
}

.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    flex-shrink: 0;
    min-height: 80px;
    max-height: 120px;
    background: transparent;
    z-index: 100;
    overflow: hidden;
    pointer-events: auto;
    /* Clickable */
    cursor: pointer;
    -webkit-app-region: no-drag;
    touch-action: pan-y;
    /* Allow vertical scrolls to pass through */
}

/* Blur layer behind the top piece — only the opaque portion */
.top-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 55%;
    /* Covers only the solid opaque area of the PNG */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 0;
    pointer-events: none;
}

.top-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: top center;
    -webkit-touch-callout: none;
    pointer-events: none;
    opacity: 0.95;
    /* 5% transparent */
    position: relative;
    z-index: 1;
}

.bottom-nav {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    height: max-content;
    /* Let the image define the height naturally */
    background: transparent !important;
    pointer-events: auto;
    cursor: pointer;
    -webkit-app-region: no-drag;
    margin-bottom: 0 !important;
    touch-action: pan-y;
    /* Allow vertical scrolls to pass through */
    display: flex;
    align-items: flex-end;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Mobile shell bottom nav - FORCE SLAM DOWN */
.mobile-shell .bottom-nav {
    padding-bottom: 0 !important;
    bottom: -43px !important;
    /* Nudged down 3px more from -40px */
    margin-bottom: 0 !important;
    max-height: none !important;
    /* Allow the image to occupy full space */
}

.mobile-shell .nav-image {
    object-position: bottom center !important;
}

.nav-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    object-position: bottom center;
    -webkit-touch-callout: none;
    pointer-events: none;
    opacity: 0.95;
    /* 5% transparent */
}

/* Smooth fade-in */
.app-shell {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Fullscreen mode - ensures the app shell fills the entire phone height exactly */
.mobile-shell {
    height: 100vh;
    height: 100dvh;
}

/* =============================================
   iPHONE PREVIEW FRAME (desktop only)
   ============================================= */

.iphone-frame {
    display: none;
    /* hidden by default, JS toggles */
    position: relative;
    width: calc(var(--device-width) + var(--frame-thickness) * 2);
    height: calc(var(--device-height) + var(--frame-thickness) * 2);
    background: linear-gradient(145deg, #2c2c2f, #1a1a1d 30%, #3b3b3e 55%, #1d1d20 75%, #2c2c2f);
    border-radius: var(--radius-outer);
    padding: var(--frame-thickness);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.12),
        0 30px 60px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(0, 0, 0, 0.4);
    margin: 0 auto;
}

/* Center the frame when preview is active */
body.preview-active {
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    -webkit-app-region: drag;
}

/* Hardware Buttons */
.hardware-buttons {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.hw-btn {
    position: absolute;
    background: linear-gradient(to right, #2a2a2d, #3e3e41, #2a2a2d);
}

.hw-btn.action-button {
    left: -3px;
    top: 155px;
    width: 3px;
    height: 22px;
    border-radius: 2px 0 0 2px;
}

.hw-btn.volume-up {
    left: -3px;
    top: 200px;
    width: 3px;
    height: 50px;
    border-radius: 2px 0 0 2px;
}

.hw-btn.volume-down {
    left: -3px;
    top: 262px;
    width: 3px;
    height: 50px;
    border-radius: 2px 0 0 2px;
}

.hw-btn.power-button {
    right: -3px;
    top: 215px;
    width: 3px;
    height: 78px;
    border-radius: 0 2px 2px 0;
}

/* Screen Bezel */
.screen-bezel {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: calc(var(--radius-outer) - var(--frame-thickness));
    padding: var(--bezel-thickness);
    box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.06);
}

.screen-display {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg);
    border-radius: var(--radius-inner);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Dynamic Island */
.dynamic-island {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 95px;
    height: 28px;
    background: #000;
    border-radius: 16px;
    z-index: 200;
    /* Higher than top-nav */
    display: flex;
    align-items: center;
    justify-content: center;
}



.camera-lens {
    width: 9px;
    height: 9px;
    background: #0a0a12;
    border-radius: 50%;
    box-shadow: inset 0 0 2px rgba(30, 30, 60, 0.9);
}

/* Status Bar */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    padding: 0 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 200;
    /* Higher than top-nav */
    pointer-events: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-5g {
    font-size: 13px;
    font-weight: 700;
}

.status-battery {
    display: flex;
    align-items: center;
    margin-left: 2px;
}

.status-battery-body {
    width: 21px;
    height: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 2.5px;
    padding: 1px;
}

.status-battery-level {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 1px;
}

.status-battery-tip {
    width: 1.5px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 1px 1px 0;
    margin-left: 0.5px;
}

/* Framed app shell - now starts flush for natural image positioning underneath status bar */
#app-framed {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-top: 0;
    /* Removed fixed 48px to let images hit the top wall */
}

/* =============================================
   PREVIEW TOGGLE BUTTON
   ============================================= */

.preview-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    /* Higher than settings modal */
    transition: all 0.2s ease;
    -webkit-app-region: no-drag;
}

.edit-mode-toggle {
    position: fixed;
    bottom: 74px;
    /* Positioned above preview-toggle */
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    /* Higher than settings modal */
    transition: all 0.2s ease;
    -webkit-app-region: no-drag;
}

.preview-toggle:hover,
.edit-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.preview-toggle:active,
.edit-mode-toggle:active {
    transform: scale(0.95);
}

.edit-mode-toggle.active {
    background: #ad9ef8;
    border-color: #ad9ef8;
}

.edit-mode-toggle.active svg {
    stroke: #000;
}

/* =============================================
   SETTINGS MODAL
   ============================================= */

.settings-modal {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 92%;
    /* Leaves the top status bar/nav visible */
    background: #1a1a1a;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px 24px 0 0;
    padding: 10px 24px 12px 24px;
    /* extra bottom padding for home indicator */
    z-index: 20000;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    -webkit-app-region: no-drag;
    /* CRITICAL: disable dragging so buttons are clickable */
    display: flex;
    flex-direction: column;

    /* Hidden state - slide down below screen */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(100%);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

/* Force hide nav when settings are open */
body.settings-open .bottom-nav {
    display: none !important;
}

.settings-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #fff;
    flex: 1;
    overflow-y: auto;
    padding-top: 10px;
    padding-bottom: 20px;
    /* NEW: Extra space to prevent button being cut off */
    -webkit-overflow-scrolling: touch;
}

.settings-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 24px;
    position: relative;
    top: 0;
    background: transparent;
    z-index: 10;
}

.settings-content h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    text-align: center;
}

/* Handle bar removed per user request */

.close-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 12px;
    border-radius: 14px;
    transition: color 0.2s ease;
    z-index: 20;
    margin-top: 0px;
    text-align: center;
}

.close-btn:hover {
    color: #fff;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
    width: 100%;
    /* Default - will be flexed in toggle mode */
}

.input-with-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-with-toggle input {
    flex: 1;
    /* Makes the input field shorter to fit the switch */
}

/* PHANTOM-STYLE TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    -webkit-app-region: no-drag;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:checked+.slider {
    background-color: #ad9ef8;
    /* Phantom Purple */
    border-color: #ad9ef8;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.form-group input:focus {
    border-color: #ad9ef8;
}

.settings-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Small gap for a tighter look */
    margin-top: 16px;
    flex-shrink: 0;
    /* More breathing room before buttons */
}

.save-btn {
    background: #ad9ef8;
    color: #000;
    border: none;
    border-radius: 14px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s ease;
    -webkit-app-region: no-drag;
}

.save-btn:active {
    transform: scale(0.98);
}

.close-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #fff;
}

/* =============================================
   TOKENS DASHBOARD (DYNAMIC)
   ============================================= */

.tokens-container {
    position: relative;
    margin-top: 354px;
    /* Nudged down just a few tiny pixels */
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Kept the good spacing */
    pointer-events: auto;
    /* Clickable tokens! */
    z-index: 10;
    /* Ensure on top of background2.jpg */
    padding-bottom: 180px;
    /* CLEAN: Let user scroll a bit more down */
}

/* =============================================
   DASHBOARD HEADER (Avatar, User, Actions)
   ============================================= */

.dashboard-header {
    position: absolute;
    top: 58px;
    /* Perfectly aligned over TOP Piece area */
    left: 0;
    width: 100%;
    padding: 0 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 500;
    /* Ensure it stays above everything in the shell */
    pointer-events: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-container {
    width: var(--avatar-size, 48px);
    height: var(--avatar-size, 48px);
    margin-bottom: 8px;
    position: relative;
    transform: translate(var(--avatar-offset-x, 0px), var(--avatar-offset-y, 0px));
}

.avatar-circle {
    width: 100%;
    height: 100%;
    background: #c3b9f6;
    /* Phantom light purple */
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Simple CSS face/glasses for avatar placeholder as seen in reference */
.avatar-circle::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 18px;
    background: #1a1a1a;
    border-radius: 20px;
}

.avatar-circle::after {
    content: "︶";
    position: absolute;
    bottom: 8px;
    font-size: 16px;
    color: #1a1a1a;
    font-weight: bold;
}

.user-names {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.user-handle {
    font-family: var(--handle-family, 'Inter', sans-serif);
    font-size: var(--handle-size, 14px);
    font-weight: var(--handle-weight, 500);
    letter-spacing: var(--handle-spacing, -0.2px);
    color: #b4b4b4;
    transform: translate(var(--handle-offset-x, 0px), var(--handle-offset-y, 0px));
}

.account-name {
    font-family: var(--name-family, 'Plus Jakarta Sans', sans-serif);
    font-size: var(--name-size, 19px);
    font-weight: var(--name-weight, 500);
    -webkit-text-stroke: 0.2px white;
    /* Extra subtle boldness */
    letter-spacing: var(--name-spacing, -0.4px);
    color: #ffffff;
    margin-top: -2px;
    transform: translate(var(--name-offset-x, 0px), var(--name-offset-y, 0px));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-icon-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.header-icon-btn:active {
    opacity: 0.6;
}

.header-icon-btn svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff;
}

/* =============================================
   TOTAL BALANCE SECTION (TOP)
   ============================================= */

/* Wrapper that locks bg-image and balance together so they move as one during PTR */
.bg-group {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bg-group {
    position: relative;
    width: 100%;
    min-height: 100%;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* This pushes the entire background (and the locked balance) down during pull to add space under the spin wheel! */
body.has-balance.ptr-active .bg-group {
    transform: translateY(12px);
}

.total-balance-section {
    position: absolute;
    top: var(--balance-top);
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: var(--balance-left);
    pointer-events: none;
    z-index: 2;
}

.total-amount {
    font-family: var(--balance-font);
    font-size: var(--balance-size);
    font-weight: var(--balance-weight);
    line-height: 42px;
    /* Source-accurate line-height */
    color: #edeeee;
    letter-spacing: var(--balance-spacing);
    /* -0.02em = -0.76px */
    -webkit-font-smoothing: antialiased;
}

.balance-dollar {
    margin-right: 1.5px;
    /* Nudged from 1px for barely noticeable breathing room */
}

.percent-symbol {
    margin-left: 1px;
    /* Ultra-thin micro-space for the dashboard pill */
}

.total-amount .balance-comma {
    font-size: 38.6px;
    /* Nudged even smaller to be clearly 1px+ smaller than 40.6px */
    display: inline-block;
    /* Required for transform */
    transform: translateY(-1px);
    /* Nudged down slightly from previous -2px */
}

.total-change-row {
    display: flex;
    align-items: center;
    gap: 8.5px;
    /* Nudged tighter to move pill left */
    margin-top: 7.5px;
    /* Nudged down again from 6.5px as requested */
    margin-left: -1px;
    /* Nudged left as requested */
}

.total-change-usd {
    font-size: 17px;
    font-weight: 600;
    color: #00a766;
    letter-spacing: -0.02px;
    /* Tightened as requested */
}

.total-change-pill {
    padding: 2.2px 8px;
    /* Slightly longer and vertically nudged */
    background: #00a766;
    color: #000;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.5px;
    /* Tightened as requested */
}

.total-change-red .total-change-usd {
    color: #f83b17;
}

.total-change-red .total-change-pill {
    background: #f83b17;
    /* Solid red fill */
    color: #000;
    /* Black text for contrast */
}

.tokens-container {
    position: relative;
    width: 100%;
    z-index: 5;
    pointer-events: auto;
}

.token-row {
    position: relative;
    width: 100%;
    margin-bottom: 0;
    display: none;
    /* Controlled by .visible class */
}

.token-row.visible {
    display: block;
}

.token-item {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: auto;
    cursor: pointer;
}

.token-data-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.token-amount {
    margin-top: 21px;
    /* Nudged up bit to align with the token name in the background */
    margin-left: 72.7px;
    /* Ultra-fine nudge right from 72.5px to 72.7px for final alignment */
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    /* Set to 400 (Normal) to match the green/red change indicators exactly */
    color: rgba(255, 255, 255, 0.5);
    text-align: left;
}

.token-values {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 1px;
    /* Significantly reduced to move values UP */
    margin-right: 18px;
}

.usd-value {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 400;
    /* Standard weight restored */
    color: #edeeee;
    margin-top: -3.5px;
    /* Nudged from -3px to -3.5px for slightly higher vertical balance */
    margin-bottom: 3px;
    /* Added spacing between USD and change */
}

.change-24h {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    /* Standard weight restored */
    color: rgba(255, 255, 255, 0.5);
    margin-top: -0.5px;
    /* Nudged down by 0.5px from -1px as requested */
}

.change-green {
    color: #00a766 !important;
}

.change-red {
    color: #f83b17 !important;
}

/* =============================================
   DESIGN STUDIO PANEL
   ============================================= */

.design-studio {
    display: none;
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    width: 240px;
    background: rgba(20, 20, 22, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    z-index: 10002;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
    color: #fff;
    -webkit-app-region: no-drag;
}

.design-studio h3 {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ad9ef8;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.value-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ad9ef8;
    font-size: 11px;
    font-weight: 700;
    width: 60px;
    text-align: right;
    padding: 2px 5px;
    outline: none;
}

.value-input:focus {
    border-color: #ad9ef8;
    background: rgba(255, 255, 255, 0.1);
}

/* Hide number input arrows */
.value-input::-webkit-inner-spin-button,
.value-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.value-input {
    -moz-appearance: textfield;
}

.design-studio input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

.design-studio input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #ad9ef8;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(173, 158, 248, 0.4);
    transition: transform 0.1s ease;
}

.design-studio input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.design-studio .permanent-hint {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    line-height: 1.4;
    margin-top: 5px;
}

/* Note: Show design studio by default on all screen sizes to ensure visibility during development */

/* =============================================
   PULL TO REFRESH & STUDIO MODE
   ============================================= */

.ptr-container {
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(0);
    /* Start tiny and hidden */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
    /* Bouncy pop-in */
    pointer-events: none;
    z-index: 2000;
}

.ptr-active .ptr-container {
    opacity: 1;
    transform: scale(1);
}

/* Shrink the spinner slightly when there is a balance to create optical spacing without shifting any coordinates */
body.has-balance.ptr-active .ptr-container {
    transform: scale(0.85);
}

.ptr-finished .ptr-container {
    animation: ptr-shrink 0.4s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes ptr-shrink {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.ios-spinner {
    position: relative;
    width: 30px;
    height: 30px;
}

.ios-spinner div {
    position: absolute;
    left: 43%;
    top: 0;
    width: 14%;
    height: 34%;
    background: #696971;
    border-radius: 4px;
    opacity: 0.15;
    transform-origin: 50% 150%;
}

.ios-spinner div:nth-child(1) {
    transform: rotate(0deg);
    animation-delay: -0.7s;
}

.ios-spinner div:nth-child(2) {
    transform: rotate(45deg);
    animation-delay: -0.6125s;
}

.ios-spinner div:nth-child(3) {
    transform: rotate(90deg);
    animation-delay: -0.525s;
}

.ios-spinner div:nth-child(4) {
    transform: rotate(135deg);
    animation-delay: -0.4375s;
}

.ios-spinner div:nth-child(5) {
    transform: rotate(180deg);
    animation-delay: -0.35s;
}

.ios-spinner div:nth-child(6) {
    transform: rotate(225deg);
    animation-delay: -0.2625s;
}

.ios-spinner div:nth-child(7) {
    transform: rotate(270deg);
    animation-delay: -0.175s;
}

.ios-spinner div:nth-child(8) {
    transform: rotate(315deg);
    animation-delay: -0.0875s;
}

.ptr-spinning .ios-spinner div {
    animation: ios-spinner-fade 0.7s linear infinite;
}

@keyframes ios-spinner-fade {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0.15;
    }
}

/* Staggered delays for the ticking effect */
.ptr-spinning .ios-spinner div:nth-child(1) {
    animation-delay: -0.8s;
}

.ptr-spinning .ios-spinner div:nth-child(2) {
    animation-delay: -0.7s;
}

.ptr-spinning .ios-spinner div:nth-child(3) {
    animation-delay: -0.6s;
}

.ptr-spinning .ios-spinner div:nth-child(4) {
    animation-delay: -0.5s;
}

.ptr-spinning .ios-spinner div:nth-child(5) {
    animation-delay: -0.4s;
}

.ptr-spinning .ios-spinner div:nth-child(6) {
    animation-delay: -0.3s;
}

.ptr-spinning .ios-spinner div:nth-child(7) {
    animation-delay: -0.2s;
}

.ptr-spinning .ios-spinner div:nth-child(8) {
    animation-delay: -0.1s;
}

/* One-time 360 startup rotation for the whole container */
.ptr-spinning .ios-spinner {
    animation: ptr-startup-rotate 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes ptr-startup-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Push app content down when pulling */
.app-content {
    transition: transform 0.2s ease;
}