:root {
    --theme-primary: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --theme-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --theme-accent: #06b6d4;
    --slider-thumb-color: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    --theme-primary-rgb: 59, 130, 246;
    --theme-secondary-rgb: 6, 182, 212;
    --signal-block-bg: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(6, 182, 212, 0.2) 100%);
    --signal-block-border: rgba(59, 130, 246, 0.4);
    --signal-block-animated-border: linear-gradient(45deg, #3b82f6, #06b6d4, #3b82f6, #06b6d4, #3b82f6, #06b6d4);
    --info-card-border: rgba(59, 130, 246, 0.3);
    /* Arrow colors and glow effects */
    --up-arrow-color: #00ff88;
    --up-arrow-color-intense: #00ffff;
    --up-arrow-glow: rgba(0, 255, 136, 0.4);
    --up-arrow-glow-medium: rgba(0, 255, 136, 0.2);
    --up-arrow-glow-intense: rgba(0, 255, 136, 0.6);
    --up-arrow-glow-medium-intense: rgba(0, 255, 136, 0.3);
    --down-arrow-color: #ff3366;
    --down-arrow-color-intense: #ff66cc;
    --down-arrow-glow: rgba(255, 51, 102, 0.4);
    --down-arrow-glow-medium: rgba(255, 51, 102, 0.2);
    --down-arrow-glow-intense: rgba(255, 51, 102, 0.6);
    --down-arrow-glow-medium-intense: rgba(255, 51, 102, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(900px 500px at 10% 0%, rgba(var(--theme-primary-rgb), 0.18), transparent 60%),
        radial-gradient(700px 500px at 90% 20%, rgba(var(--theme-secondary-rgb), 0.16), transparent 55%),
        radial-gradient(700px 450px at 50% 100%, rgba(16, 185, 129, 0.10), transparent 55%),
        #ffffff;
    color: #1a1a1a;
    min-height: 100vh;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.container {
    max-width: 420px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 4px;
    padding: 20px 0;
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--theme-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
}

.header p {
    color: #666666;
    font-size: 14px;
}

.step {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
    color: #1a1a1a;
}

.options-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.option-button {
    background: var(--theme-primary);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.option-button:active {
    transform: translateY(0);
}

.option-button.secondary {
    background: #f3f4f6;
    color: #1a1a1a;
}

.option-button.back {
    background: #f3f4f6;
    color: #666666;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: block;
}

.timeframe-grid {
    grid-template-columns: repeat(3, 1fr);
}

.timeframe-grid .option-button {
    font-size: 14px;
    padding: 12px 8px;
    min-height: 48px;
}

.pairs-grid {
    grid-template-columns: repeat(2, 1fr);
}

.pairs-grid .option-button {
    font-size: 14px;
    padding: 12px 8px;
    min-height: 48px;
}

.signal-result {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
}

.signal-direction {
    font-size: 48px;
    margin-bottom: 16px;
}

.signal-up {
    color: #00d4aa;
}

.signal-down {
    color: #ff6b6b;
}

.signal-details {
    background: var(--tg-theme-bg-color, #1a1a1a);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.signal-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.signal-detail:last-child {
    margin-bottom: 0;
}

.signal-detail .label {
    color: #666666;
}

.signal-detail .value {
    font-weight: 600;
    color: #1a1a1a;
}

.generate-button {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.generate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--theme-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    margin: 0 4px;
    transition: all 0.3s ease;
}

.step-dot.active {
    background: #0088cc;
    transform: scale(1.2);
}

/* Hide step indicator only on the final signal page */


/* Style step indicator dots with our gradient theme */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.step-indicator .step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e5e7eb; /* Серая (неактивная) */
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.step-indicator .step-dot.active {
    background: #10b981; /* Зеленый фон */
    border: 2px solid #10b981; /* Зеленая обводка */
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
    transform: scale(1.2);
}

.step-indicator .step-dot.completed {
    background: #10b981; /* Зеленый фон */
    border: 2px solid transparent;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
    transform: scale(1.1);
}



/* Analysis Modal Styles */
.analysis-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    animation: fadeIn 0.3s ease-in;
}

.analysis-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    max-width: 90%;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid #0088cc;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* Camera capture UI inside analysis modal */
.analysis-content.camera-mode {
    /* slightly tighter to fit buttons without scrolling */
    padding-top: 18px;
    max-height: 86vh;
}

.analysis-content.camera-mode .analysis-header {
    display: none;
}

.camera-capture {
    margin-top: 16px;
}

.camera-hint {
    font-size: 13px;
    color: #666666;
    text-align: center;
    margin-bottom: 12px;
    line-height: 1.35;
}

.camera-preview {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #0b1220;
    border: 2px solid #e5e7eb;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.camera-video {
    width: 100%;
    height: auto;
    display: block;
    /* keep a stable block height even before metadata loads */
    aspect-ratio: 3 / 4;
    object-fit: cover;
    /* prevent taking too much vertical space on small screens */
    max-height: 44vh;
}

.camera-actions {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    /* keep actions always reachable without scrolling */
    position: sticky;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 20%, rgba(255,255,255,1) 100%);
    padding-top: 10px;
}

@media (max-width: 420px) {
    .camera-video {
        aspect-ratio: 10 / 14;
        max-height: 40vh;
    }
}

.analysis-header {
    text-align: center;
    margin-bottom: 24px;
}

.analysis-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.analysis-header p {
    color: #666666;
    font-size: 14px;
}

.analysis-steps {
    margin-bottom: 24px;
}

.analysis-step {
    display: flex;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    background: #f8fafc;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.analysis-step.active {
    background: linear-gradient(135deg, rgba(var(--theme-primary-rgb), 0.2) 0%, rgba(var(--theme-secondary-rgb), 0.2) 100%);
    border: 1px solid var(--theme-primary);
}

.analysis-step.completed {
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.2) 0%, rgba(0, 212, 170, 0.1) 100%);
    border: 1px solid #00d4aa;
}

.step-icon {
    font-size: 24px;
    margin-right: 16px;
    min-width: 24px;
}

.step-text {
    flex: 1;
}

.step-text h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.step-text p {
    font-size: 12px;
    color: #666666;
    margin: 0;
}

.step-status {
    font-size: 20px;
    transition: all 0.3s ease;
}

.analysis-step.active .step-status {
    animation: pulse 1.5s infinite;
}

.analysis-step.completed .step-status {
    color: #00d4aa;
    transform: scale(1.2);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.analysis-progress {
    text-align: center;
}

.progress-bar-analysis {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

.progress-fill-analysis {
    height: 100%;
    background: var(--theme-primary);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 14px;
    color: #666666;
    font-weight: 500;
}

/* Enhanced Signal Result Styles */
.signal-result-enhanced {
    background: var(--signal-block-bg, linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(6, 182, 212, 0.2) 100%));
    border-radius: 20px;
    padding: 24px;
    margin: 2px 0 20px 0;
    border: 2px solid var(--signal-block-border, rgba(59, 130, 246, 0.4));
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    /* so scrollIntoView/scrollTo doesn't stick to very top edge */
    scroll-margin-top: 12px;
}   

.signal-result-enhanced.dir-up {
    --signal-accent: var(--up-arrow-color, #00ff88);
    --signal-accent-glow: var(--up-arrow-glow, rgba(0, 255, 136, 0.35));
    --signal-accent-rgb: 0, 255, 136;
}

.signal-result-enhanced.dir-down {
    --signal-accent: var(--down-arrow-color, #ff3366);
    --signal-accent-glow: var(--down-arrow-glow, rgba(255, 51, 102, 0.35));
    --signal-accent-rgb: 255, 51, 102;
}

.signal-result-enhanced::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--signal-block-animated-border, linear-gradient(45deg, #3b82f6, #06b6d4, #0891b2, #0ea5e9, #0284c7, #0369a1));
    background-size: 400% 400%;
    border-radius: 20px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.signal-result-enhanced.active::before {
    opacity: 1;
}

/* Main Direction Display */
.signal-direction-main {
    text-align: center;
    margin-bottom: 24px;
    background: transparent;
    border-radius: 24px;
    padding: 32px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.signal-direction-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(320px 220px at 50% 0%, rgba(255, 255, 255, 0.12), transparent 60%),
        radial-gradient(420px 260px at 50% 120%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(300px 220px at 20% 60%, rgba(var(--signal-accent-rgb, 59, 130, 246), 0.22), transparent 65%);
    pointer-events: none;
}

.signal-direction-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.direction-arrow {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.5s ease;
    background: transparent;
    border: 4px solid;
    text-align: center;
    overflow: hidden;
}

/* Premium rotating ring */
.direction-arrow::before {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 999px;
    /* Soft premium aura instead of a spinning ring */
    background:
        radial-gradient(circle at 50% 50%,
            rgba(var(--signal-accent-rgb, 6, 182, 212), 0.24) 0%,
            transparent 62%),
        radial-gradient(circle at 50% 50%,
            rgba(var(--signal-accent-rgb, 6, 182, 212), 0.10) 0%,
            transparent 75%);
    opacity: 0;
    filter: blur(1px);
    transform: scale(0.98);
    animation: haloPulse 2.2s ease-in-out infinite;
    pointer-events: none;
}

.signal-result-enhanced.active .direction-arrow::before {
    opacity: 0.9;
}

@keyframes haloPulse {
    0%, 100% {
        transform: scale(0.98);
        filter: blur(1px);
    }
    50% {
        transform: scale(1.03);
        filter: blur(1.6px);
    }
}

.direction-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
}

.direction-arrow.up {
    border-color: var(--up-arrow-color, #00ff88);
    box-shadow: 
        0 0 15px var(--up-arrow-glow, rgba(0, 255, 136, 0.4)),
        0 0 25px var(--up-arrow-glow-medium, rgba(0, 255, 136, 0.2));
    animation: neonPulseGreen 3s infinite;
}

.direction-arrow.down {
    border-color: var(--down-arrow-color, #ff3366);
    box-shadow: 
        0 0 15px var(--down-arrow-glow, rgba(255, 51, 102, 0.4)),
        0 0 25px var(--down-arrow-glow-medium, rgba(255, 51, 102, 0.2));
    animation: neonPulseRed 3s infinite;
}

@keyframes neonPulseGreen {
    0%, 100% { 
        box-shadow: 
            0 0 15px var(--up-arrow-glow, rgba(0, 255, 136, 0.4)),
            0 0 25px var(--up-arrow-glow-medium, rgba(0, 255, 136, 0.2));
        transform: scale(1);
        border-color: var(--up-arrow-color, #00ff88);
    }
    50% { 
        box-shadow: 
            0 0 20px var(--up-arrow-glow-intense, rgba(0, 255, 136, 0.6)),
            0 0 35px var(--up-arrow-glow-medium-intense, rgba(0, 255, 136, 0.3));
        transform: scale(1.02);
        border-color: var(--up-arrow-color-intense, #00ffff);
    }
}

@keyframes neonPulseRed {
    0%, 100% { 
        box-shadow: 
            0 0 15px var(--down-arrow-glow, rgba(255, 51, 102, 0.4)),
            0 0 25px var(--down-arrow-glow-medium, rgba(255, 51, 102, 0.2));
        transform: scale(1);
        border-color: var(--down-arrow-color, #ff3366);
    }
    50% { 
        box-shadow: 
            0 0 20px var(--down-arrow-glow-intense, rgba(255, 51, 102, 0.6)),
            0 0 35px var(--down-arrow-glow-medium-intense, rgba(255, 51, 102, 0.3));
        transform: scale(1.02);
        border-color: var(--down-arrow-color-intense, #ff66cc);
    }
}

.arrow-icon {
    width: 100%;
    height: 100%;
    transition: all 0.5s ease;
    line-height: 1;
    display: block;
}

.arrow-icon path {
    transition: all 0.3s ease;
}

/* Arrow appearance animations */
.arrow-up, .arrow-down {
    animation: arrowAppear 0.4s ease-out;
}

@keyframes arrowAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Enhanced hover effects */
.direction-arrow:hover .arrow-icon path {
    transform: scale(1.02);
}

.direction-arrow.up .arrow-icon {
    color: var(--up-arrow-color, #00ff88);
    animation: none !important;
}

.direction-arrow.down .arrow-icon {
    color: var(--down-arrow-color, #ff3366);
    animation: none !important;
}



.direction-text {
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 3px;
    transition: all 0.5s ease;
    position: relative;
}

.direction-text.up {
    color: var(--up-arrow-color, #00ff88);
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.direction-text.down {
    color: var(--down-arrow-color, #ff3366);
    text-shadow: 0 0 8px rgba(255, 51, 102, 0.3);
}




.direction-subtitle {
    font-size: 14px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    background: transparent;
    padding: 8px 20px;
    border-radius: 25px;
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* Countdown pill under subtitle */
.signal-timer {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.10);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.signal-timer .timer-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.signal-timer .timer-value {
    font-variant-numeric: tabular-nums;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
}

.signal-timer.expired {
    border-color: rgba(255, 255, 255, 0.18);
    opacity: 0.75;
}



/* Signal Information Grid */
.signal-info-grid {
    display: grid;
    /* minmax(0, 1fr) prevents grid item overflow when content is long */
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.info-card {
    background: transparent;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border: 2px solid var(--info-card-border, rgba(255, 255, 255, 0.2));
    box-shadow: 
        0 0 15px rgba(255, 255, 255, 0.08),
        inset 0 0 15px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    /* allow card to shrink inside grid without pushing outside container */
    min-width: 0;
}

.info-card.copyable::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.12) 45%, transparent 60%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.info-card.copyable:hover::after {
    transform: translateX(120%);
}

.info-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.info-icon {
    font-size: 24px;
    width: 28px;
    height: 28px;
    min-width: 28px; /* keep column width consistent */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* remove extra emoji baseline space */
    margin-right: 12px;
}

.info-content {
    flex: 1;
    /* critical for flex children to allow ellipsis/wrap instead of overflow */
    min-width: 0;
}

.info-label {
    font-size: clamp(10px, 2.8vw, 12px);
    color: #ffffff;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    /* keep label in ONE line (no mid-word wraps like УВЕРЕННОСТЬ -> УВЕРЕННОСТ / Ь) */
    white-space: nowrap;
    overflow: hidden;
}

.info-value {
    font-size: clamp(13px, 3.8vw, 16px);
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    line-height: 1.15;
    /* prevent long tokens from breaking layout */
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Mini confidence meter (inside Confidence card) */
.mini-meter {
    margin-top: 8px;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

.mini-meter-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    /* Avoid `color-mix()` for Android WebView compatibility */
    background: linear-gradient(
        90deg,
        rgba(var(--signal-accent-rgb, 6, 182, 212), 0.75),
        rgba(var(--signal-accent-rgb, 6, 182, 212), 1)
    );
    box-shadow: 0 0 16px var(--signal-accent-glow, rgba(6, 182, 212, 0.25));
    transition: width 500ms cubic-bezier(.2,.9,.2,1);
}

/* Signal Stats */
.signal-stats {
    display: flex;
    flex-wrap: nowrap; /* default: single row on normal screens */
    gap: 12px;
    align-items: stretch;
    background: transparent;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 0 15px rgba(255, 255, 255, 0.1),
        inset 0 0 15px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    overflow: hidden; /* prevent overflow on very small screens */
}

/* Signal page responsiveness (phones) */
@media (max-width: 420px) {
    .signal-result-enhanced {
        padding: 18px;
    }

    .signal-direction-main {
        padding: 24px 16px;
    }

    .direction-arrow {
        width: 120px;
        height: 120px;
    }

    .direction-text {
        font-size: 30px;
        letter-spacing: 2px;
    }

    .info-card {
        padding: 14px;
    }

    .info-icon {
        font-size: 22px;
        width: 26px;
        height: 26px;
        min-width: 26px;
        margin-right: 10px;
    }
}

@media (max-width: 360px) {
    /* On very narrow phones switch to 1 column to avoid squeezed cards */
    .signal-info-grid {
        grid-template-columns: 1fr;
    }

    /* Allow stats to wrap instead of clipping */
    .signal-stats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stat-item {
        flex: 1 1 120px;
    }
}

.stat-item {
    text-align: center;
    padding: clamp(6px, 1.8vw, 8px) clamp(8px, 2.2vw, 12px);
    border-radius: 8px;
    background: transparent;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(3px);
    min-width: 0; /* allow shrinking */
    flex: 1 1 0; /* three equal flex items that can shrink */
    overflow: hidden; /* prevent text from spilling outside */
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.08);
}

.stat-value {
    font-size: clamp(16px, 4.5vw, 22px);
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
    display: block;
    max-width: 100%;
    line-height: 1.15;
}

.stat-label {
    font-size: clamp(9px, 2.8vw, 11px);
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    display: block;
    max-width: 100%;
    line-height: 1.15;
}

/* Copyable card styles */
.info-card.copyable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.info-card.copyable:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.info-card.copyable:active {
    transform: translateY(0);
}

/* Welcome Info Card */
.welcome-info-card {
    background: var(--welcome-card-bg, linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%));
    border: 2px solid var(--welcome-card-border, rgba(59, 130, 246, 0.3));
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--welcome-card-shadow, 0 8px 32px rgba(59, 130, 246, 0.1));
    transition: all 0.3s ease;
}

.welcome-info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--welcome-card-hover-shadow, 0 8px 25px rgba(59, 130, 246, 0.1));
    border-color: var(--welcome-card-hover-border, rgba(59, 130, 246, 0.5));
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.welcome-content h3 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content p {
    font-size: 16px;
    color: #666666;
    line-height: 1.6;
    margin: 0;
}

/* Market Info Cards */
.market-info-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.market-info-card {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--market-card-border, rgba(59, 130, 246, 0.2));
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: var(--market-card-shadow, 0 0 15px rgba(59, 130, 246, 0.08));
}

.market-info-card:hover {
    transform: translateY(-2px);
    border-color: var(--market-card-hover-border, rgba(59, 130, 246, 0.4));
    box-shadow: var(--market-card-hover-shadow, 0 8px 20px rgba(59, 130, 246, 0.1));
}

.market-info-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.market-info-content h4 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.market-info-content p {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
    margin-bottom: 12px;
}

.market-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.market-stats .stat-item {
    background: var(--market-stat-bg, linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--market-stat-shadow, 0 2px 8px rgba(59, 130, 246, 0.3));
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.stat-card {
    background: var(--stat-card-bg, linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%));
    border: 2px solid var(--stat-card-border, rgba(59, 130, 246, 0.2));
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    box-shadow: var(--stat-card-shadow, 0 0 15px rgba(59, 130, 246, 0.08));
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--stat-card-hover-border, rgba(59, 130, 246, 0.4));
    box-shadow: var(--stat-card-hover-shadow, 0 8px 20px rgba(59, 130, 246, 0.1));
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 24px;
    font-weight: 800;
    color: var(--stat-number-color, #3b82f6);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #666666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .welcome-info-card {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .welcome-content h3 {
        font-size: 20px;
    }
    
    .welcome-content p {
        font-size: 14px;
    }
    
    .market-info-cards {
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .market-info-card {
        padding: 16px;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 20px;
    }
    
    .stat-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .welcome-info-card {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .welcome-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    
    .welcome-content h3 {
        font-size: 18px;
    }
    
    .welcome-content p {
        font-size: 13px;
    }
    
    .market-info-card {
        padding: 14px;
    }
    
    .market-info-content h4 {
        font-size: 16px;
    }
    
    .market-info-content p {
        font-size: 13px;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 11px;
    }
}

/* Enhanced Generate Button */
.generate-button-enhanced {
    width: 100%;
    background: var(--theme-primary);
    border: none;
    border-radius: 16px;
    padding: 16px 24px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.generate-button-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.generate-button-enhanced:active {
    transform: translateY(0);
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.button-icon {
    font-size: 20px;
    margin-right: 8px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.button-content span {
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.button-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.generate-button-enhanced:hover .button-glow {
    left: 100%;
}

/* Theme Selector Styles - Fixed Position */
.theme-selector-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-toggle-icon {
    background: var(--theme-primary, linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%));
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.theme-toggle-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .theme-selector-fixed {
        top: 15px;
        right: 15px;
    }
    
    .theme-toggle-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .theme-panel {
        right: -10px;
        min-width: 260px;
    }
}

.theme-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-top: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 2px solid #e5e7eb;
    z-index: 1000;
    min-width: 280px;
    animation: slideDown 0.3s ease;
}

.theme-panel.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.color-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-control label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    min-width: 80px;
}

.color-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.color-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--slider-thumb-color);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--slider-thumb-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-value {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    min-width: 40px;
    text-align: right;
}

.theme-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.preset-btn {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn.classic {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: white;
    border: 1px solid #3b82f6;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.preset-btn.classic:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.preset-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* Animation for signal reveal */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.signal-result-enhanced.reveal {
    animation: slideInUp 0.6s ease-out;
}

.signal-result-enhanced.reveal .info-card {
    animation: slideInUp 0.6s ease-out;
}

.signal-result-enhanced.reveal .info-card:nth-child(1) { animation-delay: 0.1s; }
.signal-result-enhanced.reveal .info-card:nth-child(2) { animation-delay: 0.2s; }
.signal-result-enhanced.reveal .info-card:nth-child(3) { animation-delay: 0.3s; }
.signal-result-enhanced.reveal .info-card:nth-child(4) { animation-delay: 0.4s; }
.signal-result-enhanced.reveal .info-card:nth-child(5) { animation-delay: 0.5s; }
.signal-result-enhanced.reveal .info-card:nth-child(6) { animation-delay: 0.6s; }

/* Copy notification styles */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.copy-notification.show {
    transform: translateX(0);
}

.copy-notification-success {
    background: rgba(16, 185, 129, 0.9);
    border-color: rgba(16, 185, 129, 0.5);
}

.copy-notification-error {
    background: rgba(239, 68, 68, 0.9);
    border-color: rgba(239, 68, 68, 0.5);
}

.copy-notification-warning {
    background: rgba(245, 158, 11, 0.9);
    border-color: rgba(245, 158, 11, 0.5);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-icon {
    font-size: 16px;
}

.notification-text {
    flex: 1;
}
