/* --- Base and Reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5; /* Light background */
    color: #333;
    line-height: 1.6;
    font-size: 16px; /* Base font size */
    padding-top: 95px; /* Increased padding to account for header + nav height */
}

.page-wrapper {
    max-width: 1200px; /* Max width */
    margin: 0 auto;
    padding: 0 15px;
}

h1, h2, h3, h4 {
    color: #1d3557; /* Dark blue heading */
    margin-bottom: 0.75em;
    line-height: 1.3;
}

h1 { font-size: 1.8em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.3em; }
h4 { font-size: 1.1em; margin-bottom: 0.5em;}

.centered-headline { text-align: center; }
.text-center { text-align: center; }

a {
    color: #457b9d;
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: #1d3557;
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Header --- */
.main-header {
    background: linear-gradient(90deg, #d90429, #ef233c);
    color: #fff;
    padding: 10px 20px;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    /* Position relative removed, handled by body padding + sticky nav */
    /* position: relative; */
    /* z-index: 1001; */
    /* Make header part of the sticky container */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001; /* Above nav */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Add shadow to header */
}

.main-header h1 {
    margin: 0; font-size: 1.6em; color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    display: flex; align-items: center; gap: 10px;
    flex-grow: 1;
}
.header-link {
    color: inherit; text-decoration: none !important;
    display: inline-flex; align-items: center;
}
.header-link:hover { color: inherit; text-decoration: none !important; opacity: 0.9; }
.logo-link { line-height: 0; }
.header-logo { height: 75px; width: auto; max-width: none; display: inline-block; vertical-align: middle; }
.date-display { font-size: 0.9em; color: #f1faee; white-space: nowrap; }

/* --- Sticky Navigation --- */
.sticky-nav {
    /* position: sticky; */ /* No longer sticky itself, part of fixed header */
    /* top: 0; */
    background-color: #1d3557; /* Dark blue background */
    padding: 8px 0;
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.2); */ /* Shadow handled by header now */
    /* z-index: 1000; */
    width: 100%; /* Take full width */
    /* margin-bottom: 20px; */ /* Removed margin */
    /* Added to the header container */
    order: 2; /* Ensure it comes after H1/Date in flex order if wrapped */
    flex-basis: 100%; /* Take full width if header wraps */
}
.sticky-nav ul {
    list-style: none; padding: 0; margin: 0; display: flex;
    justify-content: center; align-items: center; flex-wrap: wrap;
    gap: 10px; /* Space between items */
    /* Add max-width to center content within full-width bar */
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 15px; /* Match page-wrapper padding */
    padding-right: 15px;
}
.sticky-nav li { display: inline-block; }
.sticky-nav a {
    color: #fff; text-decoration: none; padding: 8px 15px;
    border-radius: 4px; transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500; font-size: 0.95em; white-space: nowrap;
}
.sticky-nav a:hover { background-color: rgba(255, 255, 255, 0.15); color: #fff; text-decoration: none; }
.sticky-nav a.active { background-color: #d90429; color: #fff; font-weight: bold; }


/* --- Intro Text Section --- */
.intro-text { background-color: #fff; padding: 20px 25px; margin-bottom: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.intro-text p { text-align: justify; font-size: 1.05em; color: #444; }


/* --- Main Content Area Layout (Flexbox) --- */
.main-content-area { display: flex; gap: 25px; margin-bottom: 30px; margin-top: 20px; /* Add margin to clear fixed header */ }
.generator-section, .products-section, .content-page { flex: 3; background-color: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.generator-core { border-top: 1px solid #eee; margin-top: 25px; padding-top: 25px; }
.ads-section { flex: 1; min-width: 300px; }
.ad-placeholder { background-color: #e9ecef; padding: 20px; border-radius: 8px; text-align: center; color: #6c757d; min-height: 250px; display: flex; flex-direction: column; align-items: center; justify-content: space-around; height: 100%; }
.ad-placeholder img { max-width: 100%; height: auto; margin-top: 10px; border: 1px dashed #ccc; }

/* --- Game Selection --- */
.game-selection-container { padding-bottom: 20px; margin-bottom: 25px; border-bottom: 1px solid #eee; text-align: center; /* Center button */ }
.game-selection-container h3 { margin-bottom: 20px; }
.game-options { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; /* Add space before clear button */ }
.game-option { border: 3px solid transparent; padding: 10px 15px; border-radius: 10px; background-color: #fff; cursor: pointer; transition: all 0.2s ease-in-out; box-shadow: 0 3px 6px rgba(0,0,0,0.1); outline: none; text-align: center; width: 150px; }
.game-option:hover, .game-option:focus { border-color: #aadaff; box-shadow: 0 5px 10px rgba(0,0,0,0.15); transform: translateY(-2px); }
.game-option img { width: 100px; height: 100px; object-fit: contain; margin: 0 auto 8px auto; }
.game-option span { display: block; font-weight: bold; color: #1d3557; }
.game-option.active { border-color: #d90429; background-color: #fff0f2; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); transform: scale(0.98); }

/* Clear Button Style */
.clear-button {
    display: inline-block; /* Allow centering via text-align on container */
    margin-top: 15px;
    padding: 6px 15px; font-size: 0.9em; color: #fff;
    background-color: #6c757d; border: none; border-radius: 4px;
    cursor: pointer; transition: background-color 0.2s ease;
}
.clear-button:hover { background-color: #5a6268; }


/* --- Lucky Symbols --- */
.luck-instructions { color: #444; margin-bottom: 20px; padding: 0 10%; font-size: 1.05em; }
.lucky-symbols-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-bottom: 30px; padding: 15px 0; border-bottom: 1px solid #eee; padding-bottom: 30px; }
.lucky-symbol { border: 2px solid transparent; padding: 8px; border-radius: 10px; background-color: #f8f9fa; cursor: pointer; transition: all 0.2s ease-in-out; box-shadow: 0 2px 4px rgba(0,0,0,0.1); outline: none; }
.lucky-symbol:hover, .lucky-symbol:focus { border-color: #aadaff; box-shadow: 0 4px 8px rgba(0,0,0,0.15); transform: translateY(-2px); }
.lucky-symbol img { width: 52px; height: 52px; object-fit: contain; }
.lucky-symbol.active { border-color: #2a9d8f; background-color: #e0f2f1; box-shadow: inset 0 1px 3px rgba(0,0,0,0.2); transform: scale(0.95); }


/* --- Generator Controls --- */
.generator-controls {
    display: flex; flex-direction: column; align-items: center; gap: 20px; margin-bottom: 25px;
    opacity: 0; max-height: 0; overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease-in-out, margin-top 0.4s ease, padding-top 0.4s ease, border-top 0.4s ease;
    margin-top: 0; padding-top: 0; border-top: none;
}
.generator-controls.visible { opacity: 1; max-height: 500px; margin-top: 25px; padding-top: 25px; border-top: 1px solid #eee; }

.num-sets-label { font-weight: bold; margin-bottom: -10px; }
.number-set-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.number-set-options label { display: inline-block; padding: 8px 15px; border: 1px solid #ccc; border-radius: 20px; cursor: pointer; transition: all 0.2s ease; background-color: #fff; user-select: none; }
.number-set-options input[type="radio"] { display: none; }
.number-set-options label:hover { background-color: #f0f0f0; border-color: #aaa; }
.number-set-options label:has(input[type="radio"]:checked) { background-color: #1d3557; color: #fff; border-color: #1d3557; font-weight: bold; }


.generate-button { background-color: #2a9d8f; color: white; border: none; padding: 12px 25px; font-size: 1.2em; font-weight: bold; border-radius: 5px; cursor: pointer; transition: background-color 0.2s ease, transform 0.1s ease; text-transform: uppercase; box-shadow: 0 3px 6px rgba(0,0,0,0.2); width: auto; max-width: 350px; }
.generate-button:hover:not(:disabled) { background-color: #268a7e; box-shadow: 0 4px 8px rgba(0,0,0,0.25); transform: translateY(-1px); }
.generate-button:active:not(:disabled) { background-color: #21786f; transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.generate-button:disabled { background-color: #aaa; cursor: not-allowed; opacity: 0.7; }


/* --- Good Luck Banner Blinking --- */
@keyframes blinker { 50% { opacity: 0.3; } }
.good-luck { background-color: #e9ffea; border: 1px solid #a3d9a5; color: #2a9d8f; padding: 10px; text-align: center; font-weight: bold; margin: 0 auto 25px auto; border-radius: 5px; font-size: 1.2em; max-width: 400px; }
.good-luck.blinking { animation: blinker 0.8s linear infinite; }


/* --- Generated Results Area --- */
.results-container-wrapper { border-top: 2px solid #eee; padding-top: 20px; margin-top: 20px; }
#results-timestamp { font-size: 0.9em; color: #666; margin-bottom: 15px; text-align: center; }
.game-results-section { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px dashed #ddd; }
.game-results-section:last-child { border-bottom: none; margin-bottom: 0; }
.game-title { font-size: 1.2em; color: #d90429; margin-bottom: 15px; padding-bottom: 5px; border-bottom: 1px solid #f0f0f0; }

.generated-columns { display: grid; grid-template-columns: 1fr; gap: 10px 15px; margin-bottom: 10px; }
@media (min-width: 768px) { .generated-columns { grid-template-columns: repeat(2, 1fr); } }

.generated-line { display: flex; align-items: center; gap: 5px; padding: 8px; background-color: #f8f9fa; border-radius: 6px; border: 1px solid #e9ecef; justify-content: center; flex-wrap: wrap; }
.generated-line .line-number { font-weight: bold; color: #555; font-size: 0.9em; min-width: 25px; margin-right: 5px; text-align: right; }

/* Ball Styles */
.generated-line .ball-unit { position: relative; width: 40px; height: 55px; display: flex; flex-direction: column; align-items: center; margin: 2px 0; opacity: 1; transform: scale(1); transition: none; }
.generated-line .ball { width: 40px; height: 40px; border-radius: 50%; position: relative; display: flex; justify-content: center; align-items: center; font-weight: bold; z-index: 1; box-shadow: inset -3px -3px 8px rgba(0,0,0,0.15), 0px 2px 4px rgba(0,0,0,0.2); }
.generated-line .ball::before { content: ''; position: absolute; top: 3px; left: 5px; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 8px 8px, rgba(255,255,255,0.7), rgba(255,255,255,0) 60%); z-index: 2; pointer-events: none; }
.generated-line .ball .number { font-size: 1.2em; line-height: 40px; z-index: 3; position: relative; }
.generated-line .ball.white-ball { background: radial-gradient(circle at 15px 15px, #ffffff, #e0e0e0 90%); border: 1px solid #ccc; color: #222; text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5); }
.generated-line .ball.power-ball { background: radial-gradient(circle at 15px 15px, #ff6b6b, #d90429 90%); border: 1px solid #a00000; color: #fff; text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.4); }
.generated-line .ball.power-ball::before { background: radial-gradient(circle at 8px 8px, rgba(255,200,200,0.6), rgba(255,255,255,0) 60%); }
.generated-line .ball.mega-ball { background: radial-gradient(circle at 15px 15px, #ffe168, #f7b731 90%); border: 1px solid #c78f0a; color: #111; text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.6); }
.generated-line .ball.mega-ball::before { background: radial-gradient(circle at 8px 8px, rgba(255,240,180,0.7), rgba(255,255,255,0) 60%); }
.generated-line .shadow { width: 35px; height: 8px; background-color: rgba(0, 0, 0, 0.25); border-radius: 50%; margin-top: 3px; filter: blur(3px); z-index: 0; }


/* --- Print Button --- */
.print-button { display: block; margin: 20px auto 0; background-color: #457b9d; color: white; border: none; padding: 10px 25px; font-size: 1em; border-radius: 5px; cursor: pointer; transition: background-color 0.2s ease; }
.print-button:hover { background-color: #3b6986; }


/* --- Footer --- */
.main-footer { text-align: center; margin-top: 40px; padding: 20px 15px; border-top: 1px solid #eee; }
.main-footer p { margin-bottom: 10px; }
.main-footer .disclaimer { font-size: 0.7em; color: #999; }
.main-footer .copyright { font-size: 0.85em; color: #555; }
.main-footer .copyright a { color: inherit; text-decoration: underline; }
.main-footer .copyright a:hover { color: #1d3557; }
.print-footer { display: none; }


/* --- Content Page Specific Styles (Winner/Resources) --- */
.content-page {}
.content-page article { margin-top: 20px; }
.content-page section { margin-bottom: 30px; padding-bottom: 15px; border-bottom: 1px dashed #eee; }
.content-page section:last-of-type { border-bottom: none; }
.content-page h3 { font-size: 1.25em; color: #457b9d; margin-bottom: 10px; }
.content-page p { margin-bottom: 15px; }
.content-page ul { list-style: disc; margin-left: 25px; margin-bottom: 15px; }
.content-page li { margin-bottom: 8px; }
.content-page strong { color: #d90429; }
.content-page .intro-paragraph { font-size: 1.1em; font-style: italic; color: #555; }
.content-page .disclaimer { font-size: 0.85em; color: #777; border-top: 1px solid #eee; padding-top: 15px; margin-top: 20px; }
.page-nav { background-color: #f8f9fa; padding: 15px; border-radius: 5px; margin-bottom: 25px; border: 1px solid #eee; }
.page-nav h3 { margin-bottom: 10px; font-size: 1.1em; }
.page-nav ul { list-style: none; margin-left: 0; padding-left: 0; }
.page-nav li { margin-bottom: 5px; }
.page-nav a { text-decoration: underline; font-size: 0.95em; }
.resource-section ul a { font-weight: 500;} /* Make resource links slightly bolder */


/* --- Products Page Specific Styles --- */
.products-intro { text-align: center; margin-bottom: 30px; font-size: 1.05em; color: #444; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 25px; }
.product-item { background-color: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 15px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); transition: transform 0.2s ease, box-shadow 0.2s ease; display: flex; flex-direction: column; justify-content: space-between; }
.product-item:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.product-item img { max-width: 100%; height: 120px; object-fit: contain; margin: 0 auto 10px auto; }
.product-title { color: #333; font-weight: bold; margin-bottom: 10px; flex-grow: 1; font-size: 1em; }
.buy-button { display: inline-block; background-color: #2a9d8f; color: #fff; padding: 8px 15px; border-radius: 5px; text-decoration: none; font-size: 0.95em; font-weight: bold; transition: background-color 0.2s ease; margin-top: auto; border: none; }
.buy-button:hover { background-color: #21786f; color: #fff; text-decoration: none; }


/* --- Responsiveness --- */
@media (max-width: 992px) {
    body { padding-top: 0; } /* Remove body padding */
    .main-header { position: static; } /* Unstick header */
    .sticky-nav { position: static; margin-bottom: 20px; } /* Unstick nav */
    .main-content-area { flex-direction: column; margin-top: 0; } /* Adjust top margin */
    .ads-section { min-width: unset; margin-top: 20px; order: 3; }
    .ad-placeholder { flex-direction: row; flex-wrap: wrap; justify-content: space-around; }
    .ad-placeholder img { margin: 10px; max-height: 250px; }
}

@media (max-width: 767px) {
    h1 { font-size: 1.6em; } h2 { font-size: 1.4em; } h3 { font-size: 1.2em; }
    .main-header { flex-direction: column; text-align: center; }
    .main-header h1 { font-size: 1.5em; margin-bottom: 5px; justify-content: center;}
    .sticky-nav ul { justify-content: space-around; }
    .sticky-nav a { padding: 8px 10px; font-size: 0.9em; }

    .generator-section, .products-section, .content-page { padding: 20px; }
    .generator-controls { gap: 15px; }
    .generate-button { font-size: 1.1em; padding: 10px 20px; }
    .game-option { width: 120px; }
    .game-option img { width: 85px; height: 85px; } 
    .lucky-symbol img { width: 40px; height: 40px; }
    .lucky-symbols-container { gap: 15px; }
    .product-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; }
    .product-item img { height: 100px; }
    .generated-line .line-number { min-width: 0; margin-right: 10px; text-align: left; }
}

@media (max-width: 480px) {
     .main-header h1 { font-size: 1.3em; }
     .header-logo { height: 75px; }
     .sticky-nav a { padding: 6px 8px; font-size: 0.85em; }
     .generator-section, .products-section, .content-page { padding: 15px; }
     .intro-text p, .luck-instructions, .products-intro { font-size: 1em; text-align: center;}
     .luck-instructions { padding: 0 5%; }
     .game-option { width: 135px; padding: 8px 10px;}
     .game-option img { width: 50px; height: 50px; } 
     .game-options { gap: 15px; }

     .lucky-symbol img { width: 36px; height: 36px; }
     .lucky-symbols-container { gap: 10px; padding-bottom: 20px; margin-bottom: 20px;}
     .lucky-symbol { padding: 6px; }

     .number-set-options label { padding: 6px 12px; font-size: 0.9em; }
     .generate-button { font-size: 1em; padding: 10px 18px; }
     .generated-line .ball-unit { width: 32px; height: 45px; }
     .generated-line .ball { width: 32px; height: 32px; }
     .generated-line .ball::before { width: 24px; height: 24px; top:2px; left: 4px;}
     .generated-line .ball .number { font-size: 1em; line-height: 32px; }
     .generated-line .shadow { width: 28px; height: 6px; }
     .generated-line { gap: 3px; padding: 5px;}
     .generated-columns { gap: 10px; }
     .product-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
     .product-item { padding: 10px; }
     .product-item img { height: 80px; }
     .buy-button { font-size: 0.9em; padding: 6px 10px; }
}


/* --- Print Styles --- */
#print-header-icons { display: none; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #ccc; text-align: center; }
#print-header-icons h4 { width: 100%; text-align: center; font-size: 11pt; font-weight: bold; color: #000; margin-bottom: 10px; }
.print-footer { display: none; text-align: center; margin-top: 25px; padding-top: 15px; border-top: 1px solid #ccc; font-size: 9pt; color: #555; }

@media print {
    @page { margin: 1.5cm; }
    body { background: #fff !important; color: #000 !important; font-size: 10pt; padding-top: 0 !important; }

    /* Hide screen elements */
    .main-header, .sticky-nav, .intro-text, .generator-core > *:not(#good-luck-banner),
    .ads-section, #print-button, .main-footer,
    .generator-core .game-selection-container,
    .generator-core .lucky-symbols-container,
    .generator-core .generator-controls,
    .luck-instructions, .generator-core h2,
    .products-section, .content-page /* Hide other full pages */
     { display: none !important; visibility: hidden !important; }

    .page-wrapper, .main-content-area, .generator-section,
    #generated-results-container { display: block !important; }

    .page-wrapper, .main-content-area, .generator-section,
    #generated-results-container { margin: 0 !important; padding: 0 !important; box-shadow: none !important; border: none !important; width: 100% !important; max-width: 100% !important; background: none !important; }
     #generated-results-container { border-top: none !important; margin-top: 0 !important; padding-top: 0 !important; }

    /* Show and style print header icons */
    #print-header-icons { display: block !important; }
    #print-header-icons img { height: 75px !important; width: 75px !important; object-fit: contain; border: 1px solid #eee; padding: 3px; border-radius: 4px; display: inline-block !important; vertical-align: middle; margin: 0 5px 8px 5px; }

    #generated-results-area { display: block !important; }
     /* Style game sections for print */
     .game-results-section { margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px dashed #aaa; page-break-inside: avoid; }
     .game-results-section:last-child { border-bottom: none; }
     .game-title { font-size: 12pt; color: #000; margin-bottom: 10px; padding-bottom: 3px; border-bottom: 1px solid #ccc; text-align: center; font-weight: bold; }

     /* Force 2 columns for generated results */
     .generated-columns { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 8px 15px !important; margin-bottom: 10px; align-items: start; }
     .generated-line { display: flex !important; align-items: center; page-break-inside: avoid !important; border: none !important; padding: 2px 0 !important; margin-bottom: 5px; background: none !important; justify-content: center; flex-wrap: nowrap; width: 100%; }
     .generated-line .line-number { font-size: 9pt; min-width: 20px; margin-right: 6px; text-align: right; flex-shrink: 0; }

     .generated-line .ball-unit { display: inline-flex !important; margin: 0 1px !important; width: 24px; height: 34px; }
     .generated-line .ball { width: 24px; height: 24px; border: 1px solid #000 !important; background: #fff !important; color: #000 !important; box-shadow: none !important; text-shadow: none !important; font-size: 9pt; }
     .generated-line .ball .number { line-height: 24px; font-size: 9pt; }
     .generated-line .power-ball, .generated-line .mega-ball { border: 2px solid #000 !important; font-weight: bold; }
     .generated-line .ball::before, .generated-line .shadow { display: none !important; }

     #results-timestamp { text-align: center; margin-bottom: 15px; font-size: 9pt; color: #333; width: 100%; }
     #generated-results-container h3 { font-size: 14pt; margin-bottom: 15px; color: #000; text-align: center; }
     #good-luck-banner { display: none !important; }

     /* Show print footer */
     .print-footer { display: block !important; }
}