:root {
    --primary-color: #2196f3;
    --secondary-color: #64B5F6;
    --dark-color: #333;
    --light-color: #F8F9FA;
    --card-color: #ffffff;
    --text-color: #2c3e50;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 16px;
    --surface-color: #F8F9FA;
}

* {
    box-sizing: border-box;
}

.main-content {
    padding: 30px 0;
}

.result-section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 35px;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--primary-color);
    text-align: center;
    letter-spacing: -0.3px;
}

/* Sticky Header Animation */
.sticky-wrapper {
    position: sticky;
    top: 90px;
    /* Aligned with new header height */
    z-index: 990;
    transition: all 0.3s ease;
    background: var(--surface-color);
    padding: 15px 0;
}

.sticky-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sticky-active .sticky-header-content {
    flex-direction: row;
    justify-content: center;
    /* Centered horizontally */
    align-items: center;
    /* Centered vertically */
    padding: 10px 20px;
    background: #fff;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.2);
    gap: 22px;
    /* Gap between title and date */
    height: 60px;
    /* Force consistent height for vertical centering */
}

.sticky-active .section-title {
    margin: 0;
    /* Remove default margins for perfect centering */
    font-size: 27px;
    /* Adjusted to 27px */
    display: flex;
    align-items: center;
    line-height: 1;
    /* Help with vertical centering */
}

.sticky-active .date-pill {
    margin: 0;
}



@media (max-width: 991px) {
    .section-title {
        font-size: 25px;
    }

    .date-pill {
        font-size: 14px;
    }

    .sticky-active .section-title {
        font-size: 19px;
        /* Mobile: 1px smaller than app sticky (20px) */
    }

    .sticky-active .date-pill {
        font-size: 12px;
        /* Mobile: -2px from base 14px */
        padding: 2px 8px;
    }

    .sticky-active .sticky-header-content {
        gap: 13px;
        height: 50px;
        /* Slightly smaller for mobile sticky */
    }
}

/* TOTO Table Title with Date */
.toto-title-row {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    /* Centered for date */
    align-items: center;
}

.toto-title-row h2 {
    display: none;
    /* Removed from inside card header */
}

.toto-title-row .toto-date {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.0px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* App Styled Cards */
.lottery-card {
    background: var(--card-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 8px 0px 24px 0px;
    border: 1.5px solid rgba(33, 150, 243, 0.1);
}

.card-header {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 12px 20px;
    text-align: center;
}

.card-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-body {
    padding: 12px;
    text-align: center;
}

/* 4D Style Table */
.prize-number {
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-color);
    padding: 0;
}

.small-prize-card .prize-number {
    font-size: 28px;
    padding: 0;
}

.small-prize-card .card-header {
    padding: 10px 20px;
}

.small-prize-card .card-header h2 {
    font-size: 14px;
}

/* Grid for Starter/Consolation */
.grid-container {
    padding: 16px;
}

.grid-title-box {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 12px;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 16px;
}

.grid-number {
    background: rgba(33, 150, 243, 0.05);
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 18px;
    border: 1px solid rgba(33, 150, 243, 0.1);
}

/* TOTO Circles */
.toto-numbers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: clamp(2px, 1vw, 8px);
    padding: 16px 0;
}

@media (max-width: 400px) {
    .number-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }

    .toto-numbers {
        gap: 4px;
        /* Reduced gap to fit single row on mobile */
    }
}

.toto-ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: #fff;
    background: linear-gradient(135deg, #424242, #212121);
    box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.5), inset -1px -1px 2px rgba(255, 255, 255, 0.1);
}

.toto-ball.additional {
    background: linear-gradient(135deg, #E53935, #B71C1C);
}

.toto-plus {
    color: #9e9e9e;
    font-size: 18px;
    font-weight: bold;
    margin-right: 4px;
}

/* Date Pill Decoration */
.date-pill {
    display: inline-block;
    padding: 4px 12px;
    border: 0.5px solid var(--primary-color);
    border-radius: 15px;
    background: #fff;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 19px;
    margin-bottom: 16px;
}

/* Utils */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -4px;
}

.col-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 4px;
}

/* History Page Sticky Headers */
.history-title-bar {
    position: sticky;
    top: 100px;
    z-index: 995;
    background: var(--surface-color);
    padding: 5px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.history-title-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.history-title-content .section-title {
    margin: 0;
    font-size: 35px;
    /* Matches default desktop title size from previous task */
}

.history-search-btn {
    position: absolute;
    right: 20px;
    color: var(--primary-color);
    font-size: 20px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
}

.history-date-bar {
    position: sticky;
    top: 163px;
    /* Aligned with title bar height */
    z-index: 990;
    background: var(--surface-color);
    padding: 3px 0;
    text-align: center;
}

.history-item-container {
    margin-bottom: 40px;
}

@media (max-width: 991px) {
    .history-title-bar {
        top: 100px;
        padding: 3px 0;
    }

    .history-date-bar {
        top: 145px;
        padding: 3px 0;
    }

    .history-search-input-wrapper {
        padding: 3px 15px;
        /* Mobile padding */
    }
}

/* App-Style Search Result Card */
.search-result-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.15);
    margin: 10px 16px 30px 16px;
    overflow: hidden;
    border: 1px solid rgba(33, 150, 243, 0.1);
}

.search-result-header {
    background: linear-gradient(to right, #2196F3, #64B5F6);
    color: #fff;
    padding: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 18px;
    text-transform: capitalize;
}

.search-result-body {
    padding: 30px 20px;
    text-align: center;
}

.search-result-number {
    font-size: 48px;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: 2px;
}

/* History Search UI */
.history-search-container {
    display: none;
    width: 100%;
    max-width: 500px;
    padding: 0 10px;
}

.history-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 10px 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.history-search-input-wrapper input {
    border: none;
    outline: none;
    width: 100%;
    padding: 8px 0;
    font-size: 16px;
    background: transparent;
}

.history-search-close {
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding-left: 10px;
}

.searching .history-title-content .section-title,
.searching .history-search-btn {
    display: none;
}

.searching .history-search-container {
    display: block;
}

/* ==========================================
   MOBILE OVERRIDES - FLUTTER APP MATCH
   Match single_result_page.dart & grid_item.dart
   ========================================== */
@media (max-width: 600px) {
    .lottery-card {
        margin: 8px 0px 16px 0px;
    }

    /* Prize Cards */
    .prize-number {
        font-size: 28px;
        /* Flutter: 28 for small, 32 normal. Mobile screen needs smaller */
        padding: 12px 0;
    }

    .small-prize-card .prize-number {
        font-size: 24px;
    }

    .card-header {
        padding: 10px 12px;
    }

    .card-header h2 {
        font-size: 14px;
        letter-spacing: 0.8px;
    }

    /* Grid Items (Starter, Consolation, Jackpot) */
    .number-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 3px;
        /* Flutter: margin horizontal 1.5 --> gap 3px */
        padding: 8px;
        /* Flutter: padding all(8) */
    }

    .grid-number {
        height: 35px;
        /* Flutter: height 35 */
        font-size: 13px !important;
        /* Flutter: 3.5vw on 375px width ~= 13.1px */
        border-radius: 8px;
    }

    .grid-title-box {
        font-size: 14px;
        padding: 10px;
    }

    /* TOTO Balls */
    .toto-ball {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .toto-numbers {
        gap: 6px;
    }

    /* General Layout */
    .col-6 {
        padding: 0 4px;
        /* Tighter columns */
    }

    .row {
        margin: 0 -4px;
    }
}

/* ==========================================
   SEO CONTENT BOXES - MATCHING APP DESIGN
   ========================================== */
.seo-text-box {
    background: var(--card-color);
    border: 1.5px solid rgba(33, 150, 243, 0.1);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 10px 24px;
    /* Further reduced vertical padding from 15px */
    margin: 15px 0;
    text-align: left;
}

.seo-text-box h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
    /* Reduced from 12px */
    display: flex;
    align-items: center;
    gap: 10px;
}

.seo-text-box h2::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
}

.seo-text-box h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-color);
    margin-top: 12px;
    /* Reduced from 15px */
    margin-bottom: 6px;
    /* Reduced from 8px */
}

.seo-text-box p {
    font-size: 15px;
    color: #555;
    line-height: 1.5;
    /* Reduced from 1.6 */
    margin-bottom: 8px;
    /* Reduced from 12px */
}

.seo-text-box ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 8px;
    /* Reduced from 12px */
}

.seo-text-box li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 6px;
    /* Reduced from 8px */
    font-size: 15px;
    color: #555;
    line-height: 1.4;
    /* Reduced from 1.5 */
}

.seo-text-box li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232196f3' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.seo-text-box a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.seo-text-box a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .seo-text-box {
        padding: 10px 16px;
        /* Further reduced padding for mobile */
        margin: 12px 4px;
    }

    .seo-text-box h2 {
        font-size: 18px;
    }

    .seo-text-box p,
    .seo-text-box li {
        font-size: 14px;
    }
}