:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --green: #22c55e;
    --red: #ef4444;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

header {
    text-align: center;
    padding: 2rem;
    border-bottom: 1px solid #334155;
    margin-bottom: 2rem;
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container {
    max-width: 95%;
    /* Expanded from 1200px to nearly full width */
    margin: 0 auto;
    padding: 0 1rem;
}

.prediction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    text-align: center;
    padding-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
    border-bottom: 1px solid #334155;
    margin-bottom: 1rem;
}

.rise-header {
    color: var(--green);
}

.fall-header {
    color: var(--red);
}

/* --- Table Styles --- */
.prediction-table {
    width: 100%;
    border-collapse: separate;
    /* Changed for border radius on rows */
    border-spacing: 0 4px;
    /* Space between rows */
    margin-top: 1rem;
    table-layout: fixed;
}

.prediction-table th {
    text-align: right;
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #334155;
}

/* --- Correct Column Widths (5 Columns) --- */
/* 1. Rank (#) */
.prediction-table th:nth-child(1),
.prediction-table td:nth-child(1) {
    width: 50px;
    text-align: center;
}

/* 2. Asset Name */
.prediction-table th:nth-child(2),
.prediction-table td:nth-child(2) {
    width: 30%;
    text-align: left;
}

/* 3. Entry Price */
.prediction-table th:nth-child(3),
.prediction-table td:nth-child(3) {
    width: 20%;
    text-align: right;
    /* Explicitly align right */
}

/* 4. Live Price */
.prediction-table th:nth-child(4),
.prediction-table td:nth-child(4) {
    width: 25%;
    text-align: right;
    /* Explicitly align right */
}

/* 5. Confidence */
.prediction-table th:nth-child(5),
.prediction-table td:nth-child(5) {
    width: 15%;
    text-align: right;
    /* Explicitly align right */
}

.prediction-table td {
    padding: 1rem;
    vertical-align: middle;
    background-color: #1e293b;
    /* Default row bg */
    border-top: 1px solid #334155;
    border-bottom: 1px solid #334155;
}

/* Rounded corners for rows */
.prediction-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-left: 1px solid #334155;
}

.prediction-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-right: 1px solid #334155;
}

.prediction-table tr:last-child td {
    border-bottom: none;
}

/* --- Colorful Row Styles --- */
/* Rise Table Rows */
.rise .prediction-table tbody tr td {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.05) 0%, rgba(34, 197, 94, 0.01) 100%);
    border-color: rgba(34, 197, 94, 0.2);
}

.rise .prediction-table tbody tr:hover td {
    background: rgba(34, 197, 94, 0.1);
}

/* Fall Table Rows */
.fall .prediction-table tbody tr td {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.05) 0%, rgba(239, 68, 68, 0.01) 100%);
    border-color: rgba(239, 68, 68, 0.2);
}

.fall .prediction-table tbody tr:hover td {
    background: rgba(239, 68, 68, 0.1);
}

/* Zebra Striping & Hover Effect */
.prediction-table tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.02);
}

.prediction-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
    /* Slightly lighter for contrast */
}

.prediction-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

/* Rank Number Style */
.rank-num {
    font-size: 1rem;
    font-weight: 800;
    width: 30px;
    height: 30px;
    line-height: 30px;
    display: inline-block;
    text-align: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.rise .rank-num {
    color: #86efac;
    background: rgba(34, 197, 94, 0.2);
}

.fall .rank-num {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
}

/* Cell Content Styles */
.coin-col-info {
    display: flex;
    flex-direction: column;
}

.coin-symbol {
    font-weight: bold;
    font-size: 1.2rem;
    display: block;
    color: #fff;
}

.coin-name {
    font-size: 0.85rem;
    color: #64748b;
}

.table-price {
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    color: #e2e8f0;
    display: block;
}

.table-profit {
    font-size: 0.85rem;
    display: block;
    margin-top: 4px;
}

.confidence-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: bold;
}

/* --- Winning Animation --- */
/* --- Winning Animation --- */
@keyframes risePulse {
    0% {
        box-shadow: inset 0 0 0px rgba(34, 197, 94, 0);
        background-color: rgba(34, 197, 94, 0.05);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(34, 197, 94, 0.4);
        background-color: rgba(34, 197, 94, 0.2);
    }

    100% {
        box-shadow: inset 0 0 0px rgba(34, 197, 94, 0);
        background-color: rgba(34, 197, 94, 0.05);
    }
}

@keyframes fallPulse {
    0% {
        box-shadow: inset 0 0 0px rgba(239, 68, 68, 0);
        background-color: rgba(239, 68, 68, 0.05);
    }

    50% {
        box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.4);
        background-color: rgba(239, 68, 68, 0.2);
    }

    100% {
        box-shadow: inset 0 0 0px rgba(239, 68, 68, 0);
        background-color: rgba(239, 68, 68, 0.05);
    }
}

.rise-win td {
    animation: risePulse 2s infinite ease-in-out !important;
    color: #fff !important;
}

.fall-win td {
    animation: fallPulse 2s infinite ease-in-out !important;
    color: #fff !important;
}

/* History Section */
.history-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.history-table th,
.history-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #334155;
}

.history-table td {
    color: #cbd5e1;
}

.result-hit {
    color: var(--green);
    font-weight: bold;
}

.result-miss {
    color: var(--red);
    font-weight: bold;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #475569;
    margin-top: 2rem;
}

a {
    color: #3b82f6;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Responsive */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {

    /* Header Stacking */
    .date-badge-container {
        display: inline-flex;
        flex-direction: column;
        gap: 5px;
        padding: 10px 20px;
    }

    .today-badge {
        margin-right: 0;
        margin-bottom: 5px;
        font-size: 1.3rem;
    }

    .date-text {
        font-size: 1rem;
    }

    /* Grid Layout */
    .prediction-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    /* Table Column Visibility */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: table-cell !important;
    }

    /* Table Adjustments for Mobile */
    .prediction-table th,
    .prediction-table td {
        padding: 0.75rem 0.5rem;
        /* Tighter padding */
        font-size: 0.9rem;
    }

    /* Asset Column Width in Mobile */
    .prediction-table th:nth-child(2),
    .prediction-table td:nth-child(2) {
        width: 40%;
        text-align: left;
    }

    /* Live Price Column Width in Mobile */
    .prediction-table th:nth-child(4),
    .prediction-table td:nth-child(4) {
        width: 35%;
        /* Reduced slightly to give space */
        text-align: right;
    }

    /* Status Column Width in Mobile */
    .prediction-table th:last-child,
    .prediction-table td:last-child {
        width: 25%;
        text-align: center;
    }

    /* Font Sizes Standardization */
    .prediction-table th {
        font-size: 0.85rem !important;
        /* Uniform header size */
        vertical-align: middle;
    }

    .prediction-table td {
        font-size: 0.95rem;
        /* readable data size */
    }

    /* Make the Status ICON large, but not the header */
    .prediction-table td:last-child {
        font-size: 1.3rem;
    }

    /* Fix Left Border Radius on Mobile (Asset Column) */
    /* Since first-child (#) is hidden, we must round the 2nd child */
    .prediction-table td:nth-child(2) {
        border-top-left-radius: 8px;
        border-bottom-left-radius: 8px;
        border-left: 1px solid #334155;
    }

    .stats-dashboard {
        flex-direction: column;
    }
}

/* --- Stats Dashboard --- */
.stats-dashboard {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    max-width: 95%;
    margin: 0 auto 2rem auto;
    padding: 0 1rem;
}

.stat-card {
    flex: 1;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

/* Gradients */
.card-yesterday {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-top: 4px solid #3b82f6;
    /* Blue accent */
}

.card-yesterday::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 70%);
    pointer-events: none;
}

.card-week {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-top: 4px solid #f97316;
    /* Orange accent */
}

.card-week::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(249, 115, 22, 0.15), transparent 70%);
    pointer-events: none;
}

.card-month {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-top: 4px solid #14b8a6;
    /* Teal accent */
}

.card-month::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(20, 184, 166, 0.15), transparent 70%);
    pointer-events: none;
}

.stat-title {
    font-size: 0.9rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-profit {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
    font-family: 'Roboto Mono', monospace;
}

.s-green {
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.2);
}

.s-red {
    color: #f87171;
    text-shadow: 0 0 20px rgba(248, 113, 113, 0.2);
}

.stat-sub {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}
/* --- RESTING MODE (23:55 - 01:15) --- */
.prediction-grid {
    position: relative;
    transition: opacity 0.5s ease;
}

.prediction-grid.resting-mode .card {
    opacity: 0.20;
    pointer-events: none;
    filter: blur(2px);
}

.resting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.resting-message {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    padding: 2rem 3rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeIn 0.5s ease-out;
}

.resting-message h2 {
    color: #eab308;
    margin: 0 0 10px 0;
    font-size: 1.8rem;
}

.resting-message p {
    color: #cbd5e1;
    font-size: 1.1rem;
    margin: 0;
}

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