:root {
    --bg-dark: #0a0b14;
    --bg-panel: rgba(22, 24, 38, 0.7);
    --primary: #00f2ea;
    --secondary: #ff0055;
    --accent: #7000ff;
    --text-main: #ffffff;
    --text-muted: #8b9bb4;
    --success: #00ff9d;
    --danger: #ff2a5d;
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --font-head: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(112, 0, 255, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 234, 0.08) 0%, transparent 40%);
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 18px;
    /* Adjusted to 18px */
}

/* Glass Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 2rem;
    /* Reduced from 1.0rem */
    background: rgba(10, 11, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: var(--glass-border);
    border-radius: 16px;
    margin-bottom: 8px;
    /* Reduced from 10px */
    gap: 20px;
}

/* ... (omitting unchanged header indicators) ... */

h1 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

/* ... (omitting highlight and market status) ... */

/* Dashboard Grid Refactor */
.dashboard-grid.full-width {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Reduced from 24px */
    height: auto;
}

.winrate-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    /* Reduced from 24px */
}

.winrate-card {
    padding: 25px;
    /* Adjusted to 25px */
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Confirmed 15px */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ... (omitting hover effects) ... */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.3rem;
    /* Reduced from 1.5rem */
    font-weight: 700;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-indicators {
    display: flex;
    gap: 40px;
    background: rgba(0, 0, 0, 0.45);
    padding: 10px 30px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.ind-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ind-label {
    font-size: 0.7rem;
    color: #ffcc00;
    /* Labels Yellow */
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.ind-value {
    font-size: 1.4rem;
    font-weight: 900;
    font-family: var(--font-head);
    color: var(--primary);
    /* Value defaults to primary, overridden by JS */
    text-shadow: 0 0 10px rgba(0, 242, 234, 0.3);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-head);
    box-shadow: 0 0 15px rgba(0, 242, 234, 0.3);
}

h1 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

.highlight {
    color: var(--primary);
}

.market-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Dashboard Grid Refactor */
.dashboard-grid.full-width {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Reduced from 24px */
    height: auto;
}

.winrate-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    /* Reduced from 24px */
}

.winrate-card {
    padding: 20px;
    /* Reduced from 30px */
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Reduced from 20px */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.winrate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 242, 234, 0.1);
}

.highlight-card {
    border: 1px solid rgba(0, 242, 234, 0.4);
    box-shadow: 0 0 20px rgba(0, 242, 234, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.3rem;
    /* Reduced from 1.5rem */
    font-weight: 700;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.winrate-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rate-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid transparent;
}

.rate-box.long {
    border-color: rgba(0, 255, 157, 0.3);
}

.rate-box.short {
    border-color: rgba(255, 42, 93, 0.3);
}

.rate-box .label {
    display: block;
    font-size: 1.0rem;
    /* Increased from 0.75rem */
    color: #ffffff;
    /* Changed to White */
    font-weight: 700;
    /* Bold */
    margin-bottom: 8px;
}

.rate-box .value {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-head);
}

.rate-box.long .value {
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
}

.rate-box.short .value {
    color: var(--danger);
    text-shadow: 0 0 10px rgba(255, 42, 93, 0.3);
}

.signal-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    font-weight: 700;
    font-size: 1.1rem;
}

/* Info Section */
.info-section {
    display: grid;
    grid-template-columns: 1fr;
}

.price-big {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-head);
    color: var(--primary);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

@media (max-width: 992px) {
    .app-container {
        padding: 10px !important;
    }

    .glass-header {
        flex-direction: column;
        gap: 8px;
        padding: 1rem !important;
        align-items: center;
        text-align: center;
    }

    .market-status {
        width: 100%;
        justify-content: center;
        margin-top: 5px;
        padding-top: 5px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 0.75rem;
    }

    .master-panel {
        padding: 0 10px !important;
        margin-bottom: 10px !important;
    }

    .signal-box {
        max-width: 95%;
        min-width: unset;
        padding: 15px 25px;
        box-sizing: border-box;
        margin: 0 auto;
    }

    #master-signal-text {
        font-size: 2.2rem;
        letter-spacing: 1px;
    }

    .winrate-section {
        grid-template-columns: 1fr;
        gap: 10px !important;
    }

    .winrate-card {
        max-width: 500px;
        margin: 0 auto;
        padding: 15px !important;
        gap: 8px !important;
    }

    .bottom-panels-desktop {
        display: none !important;
    }

    .ai-chat-box {
        height: 180px;
        max-width: 500px;
        margin: 0 auto;
    }

    #current-price-mobile {
        font-size: 2.8rem !important;
    }

    .glass-panel {
        align-items: center !important;
        text-align: center !important;
    }

    .ai-log-mobile {
        padding: 0 10px !important;
    }
}

@media (min-width: 993px) {
    .app-container {
        padding: 5px 18px !important;
    }

    .price-display-mobile,
    .ai-log-mobile {
        display: none !important;
    }

    .glass-header {
        max-width: 1600px;
        margin: 0 auto 5px auto;
        padding: 0.5rem 2rem !important;
    }

    .master-panel {
        margin-bottom: 4px !important;
        padding: 0 20px 5px 20px !important;
    }

    .dashboard-grid.full-width {
        gap: 6px !important;
    }

    .winrate-section {
        gap: 6px !important;
    }

    .winrate-card {
        padding: 15px 20px !important;
        gap: 10px !important;
    }

    .bottom-panels {
        gap: 6px !important;
    }

    .ai-chat-box {
        padding: 10px 15px !important;
        height: 240px !important;
    }
}

/* RISK INFO STYLES */
.risk-info {
    display: none;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
    color: #aaa;
}

.risk-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    align-items: center;
}

.risk-info strong {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 700;
    margin-left: 5px;
}

/* MASTER SIGNAL UI */
.master-panel {
    text-align: center;
    margin-bottom: 15px;
    padding: 0 20px 10px 20px;
}

.master-header {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.signal-box {
    display: inline-block;
    padding: 30px 60px;
    border: 3px solid #444;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    min-width: 400px;
}

#master-signal-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 10px;
    letter-spacing: 5px;
}

#master-signal-sub {
    color: var(--text-muted);
    font-size: 1rem;
}

/* STATES */
.signal-box.buy {
    border-color: #39ff14;
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.3), inset 0 0 20px rgba(57, 255, 20, 0.1);
}

.signal-box.buy #master-signal-text {
    color: #39ff14;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.6);
}

.signal-box.sell {
    border-color: #ff003c;
    box-shadow: 0 0 30px rgba(255, 0, 60, 0.3), inset 0 0 20px rgba(255, 0, 60, 0.1);
}

.signal-box.sell #master-signal-text {
    color: #ff003c;
    text-shadow: 0 0 20px rgba(255, 0, 60, 0.6);
}

.signal-box.wait {
    border-color: #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3), inset 0 0 20px rgba(255, 215, 0, 0.1);
}

.signal-box.wait #master-signal-text {
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* BLINKING EFFECT FOR SIGNALS */
@keyframes signal-blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
}

.signal-box.buy #master-signal-text,
.signal-box.sell #master-signal-text {
    animation: signal-blink 1s ease-in-out infinite;
}

/* FINAL FONT OVERRIDE */
.price-big {
    font-size: 5rem !important;
    text-shadow: 0 0 30px rgba(0, 242, 234, 0.5) !important;
}

/* NUCLEAR EXPLOSION CSS ICON */
.logo-icon.nuclear {
    position: relative;
    width: 40px;
    height: 40px;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.logo-icon.nuclear .cloud {
    position: absolute;
    top: 5px;
    width: 30px;
    height: 18px;
    background: #ffaa00;
    border-radius: 50% 50% 50% 50% / 100% 100% 0% 0%;
    box-shadow: 0 0 15px #ff5500, 0 0 30px #ff0000;
    animation: pulse-cloud 2s infinite ease-in-out;
}

.logo-icon.nuclear .stem {
    position: absolute;
    bottom: 5px;
    width: 8px;
    height: 20px;
    background: linear-gradient(to top, #ff0000, #ffaa00);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.logo-icon.nuclear .blast-ring {
    position: absolute;
    bottom: 0px;
    width: 40px;
    height: 10px;
    border: 2px solid #ffaa00;
    border-radius: 50%;
    opacity: 0.6;
    animation: blast-expand 2s infinite ease-out;
}

@keyframes pulse-cloud {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
}

@keyframes blast-expand {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* AI LOG / BOTTOM LAYOUT REFACTOR */
.bottom-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: flex-end;
}

.ai-chat-box {
    height: 220px;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 12px;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}

.chat-header h3 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-log-content {
    flex: 1;
    overflow-y: hidden;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}

.log-entry {
    color: #aaa;
    line-height: 1.4;
    padding: 2px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.log-entry.bullish {
    color: var(--success);
}

.log-entry.bearish {
    color: var(--danger);
}

.log-entry.neutral {
    color: #fff;
}

.log-entry.system {
    color: var(--accent);
    font-style: italic;
}

.log-timestamp {
    color: #666;
    margin-right: 8px;
    font-size: 0.7rem;
}

.blink {
    animation: blinker 1.5s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

/* FINAL MOBILE OVERRIDES - HIGHEST PRIORITY FIX */
@media (max-width: 992px) {
    .app-container {
        padding: 8px !important;
        overflow-x: hidden !important;
    }

    .master-panel {
        padding: 0 5px !important;
        margin: 0 auto 15px auto !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    .signal-box {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: calc(100% - 14px) !important;
        max-width: calc(100% - 14px) !important;
        min-width: unset !important;
        padding: 20px 10px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        border-width: 2px !important;
    }

    #master-signal-text {
        font-size: 1.8rem !important;
        letter-spacing: 1px !important;
        width: 100% !important;
        line-height: 1.1 !important;
        text-align: center !important;
        display: block !important;
        word-break: break-all !important;
        margin-bottom: 5px !important;
    }

    #master-signal-sub {
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
        margin-top: 5px !important;
        padding: 0 5px !important;
        opacity: 0.8 !important;
    }

    .winrate-card {
        width: calc(100% - 10px) !important;
        max-width: 100% !important;
        margin: 0 auto 10px auto !important;
    }

    .ai-log-mobile {
        width: 100% !important;
        padding: 0 5px !important;
        margin: 10px auto !important;
    }

    .ai-chat-box {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}