/* 12-Column Grid System with Ad Spaces */

:root {
    --primary-blue: #1E3A8A;
    --primary-orange: #F97316;
    --bg: #F8FAFC;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

/* Main Layout with Ad Spaces - EMERGENCY FIX */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    /* 좌광고 / 본문 / 우광고 */
}

/* Ad Spaces */
.ad-space-left,
.ad-space-right {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.ad-space-left::before {
    content: 'Ad Space\A180×600';
    white-space: pre;
}

.ad-space-right::before {
    content: 'Ad Space\A180×600';
    white-space: pre;
}

/* Main Content Area - FORCED CENTER POSITIONING */
.main-content {
    grid-column: 2;
    /* 무조건 중앙에 배치 */
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    /* 내부 중앙 정렬 */
    padding: 0 40px;
    /* 여백 확보 */
}

/* 12-Column Grid Container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    justify-content: center;
    align-items: start;
}

/* Column Utilities */
.col-1 {
    grid-column: span 1;
}

.col-2 {
    grid-column: span 2;
}

.col-3 {
    grid-column: span 3;
}

.col-4 {
    grid-column: span 4;
}

.col-5 {
    grid-column: span 5;
}

.col-6 {
    grid-column: span 6;
}

.col-7 {
    grid-column: span 7;
}

.col-8 {
    grid-column: span 8;
}

.col-9 {
    grid-column: span 9;
}

.col-10 {
    grid-column: span 10;
}

.col-11 {
    grid-column: span 11;
}

.col-12 {
    grid-column: span 12;
}

/* Full-width elements (detail tables, etc.) */
.full-width {
    grid-column: 1 / -1;
    /* Span all columns */
}

/* Detail table full width */
.stats-section,
.analysis-section,
.detail-table {
    grid-column: span 12;
    width: 100%;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-orange) 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    grid-column: 1 / -1;
}

.header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 800;
}

/* Container */
.container {
    padding: 40px 0;
}

/* Lottery Cards - ENLARGED for better presence */
.lottery-card {
    background: white;
    border-radius: 20px;
    padding: 50px;
    /* Increased from 45px */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: default;
    min-height: 500px;
    /* Ensure minimum height */
}

.lottery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Lottery Grid - Better spacing */
.lottery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    /* Increased from 450px */
    gap: 35px;
    /* Increased from 30px */
    margin-bottom: 40px;
    justify-content: center;
}

/* Logo */
.lottery-logo {
    text-align: center;
    margin-bottom: 25px;
    cursor: default;
}

.lottery-logo img {
    height: 90px;
    /* Increased from 80px */
    cursor: default;
}

/* Lottery Info */
.lottery-round {
    text-align: center;
    font-size: 1.4rem;
    /* Increased from 1.3rem */
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.lottery-date {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    /* Increased from 25px */
    font-size: 1.05rem;
    /* Increased from 1rem */
}

/* Lottery Numbers Container */
.lottery-numbers {
    margin: 35px 0;
    /* Increased from 30px */
}

.balls-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    /* Increased from 15px */
    flex-wrap: wrap;
    min-height: 100px;
}

/* Ball - OFFICIAL SIZE 70px */
.ball {
    width: 70px;
    /* 공식 사이트 규격 */
    height: 70px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.8rem;
    color: white;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    cursor: default;
}

.ball[data-n="1"] {
    background: linear-gradient(135deg, #FCD34D 0%, #F59E0B 100%);
}

.ball[data-n="2"] {
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
}

.ball[data-n="3"] {
    background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
}

.ball[data-n="4"] {
    background: linear-gradient(135deg, #A3A3A3 0%, #737373 100%);
}

.ball[data-n="5"] {
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
}

/* Slot machine animations */
.ball.spinning {
    animation: spin 0.3s linear infinite;
}

.ball.stopping {
    animation: bounce 0.5s ease-out;
}

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

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Prize Info */
.lottery-prize {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
    margin: 25px 0;
}

.prize-label {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.prize-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-orange);
}

/* Lottery Actions */
.lottery-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    min-height: 56px;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Pretendard', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-orange) 0%, #EA580C 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
    background: white;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
    background: var(--primary-blue);
    color: white;
}

/* Pension Number Display - OFFICIAL SIZE 60px */
.pension-number {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 25px 0;
}

.pension-group {
    background: var(--primary-orange);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1.4rem;
}

.pension-digit {
    background: var(--primary-blue);
    color: white;
    width: 60px;
    /* 공식 사이트 규격 */
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1.6rem;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

/* Loading Spinner */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Footer */
.footer {
    background: #1E293B;
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    grid-column: 1 / -1;
}

.footer p {
    margin: 10px 0;
    opacity: 0.8;
}

/* Winner Guide Section */
.winner-guide-section {
    background: var(--bg);
    padding: 80px 20px;
    margin-top: 60px;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 50px;
}

.guide-grid {
    margin-bottom: 60px;
}

.guide-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.guide-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.guide-icon {
    font-size: 3.5rem;
    text-align: center;
    margin-bottom: 20px;
}

.guide-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-blue);
    text-align: center;
    margin-bottom: 25px;
}

.guide-list {
    list-style: none;
    padding: 0;
}

.guide-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    color: var(--text);
}

.guide-list li:last-child {
    border-bottom: none;
}

/* Location Info */
.location-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.location-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: var(--bg);
    border-radius: 12px;
}

.prize-tier {
    background: var(--primary-orange);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.location-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.location-name {
    font-weight: 700;
    color: var(--text);
    font-size: 1.05rem;
}

.location-address {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Tax Calculator */
.tax-calculator label {
    display: block;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.tax-calculator input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-family: 'Pretendard', sans-serif;
}

.tax-calculator input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.tax-calculator button {
    width: 100%;
    margin-bottom: 20px;
}

.tax-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}

.tax-row.highlight {
    color: var(--primary-orange);
    font-weight: 700;
}

.tax-row.total {
    background: var(--primary-blue);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1.2rem;
    margin-top: 10px;
    border-bottom: none;
}

/* AI Insights Banner - Optimized for AdSense */
.insights-banner {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-orange) 100%);
    border-radius: 24px;
    padding: 60px 50px;
    /* Increased height for ad space */
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 280px;
    /* Sufficient height for readability */
}

.insights-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 40px;
}

.insights-slider {
    position: relative;
    min-height: 140px;
    /* Increased for better spacing */
}

.insight-item {
    display: none;
    align-items: flex-start;
    gap: 25px;
    animation: fadeIn 0.5s ease-in;
}

.insight-item.active {
    display: flex;
}

.insight-icon {
    font-size: 3.5rem;
    flex-shrink: 0;
}

.insight-content {
    flex: 1;
}

.insight-text {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.7;
    margin-bottom: 15px;
}

.insight-source {
    font-size: 0.95rem;
    opacity: 0.85;
    font-style: italic;
}

.insights-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.insights-disclaimer {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
    margin: 0;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background: white;
    width: 30px;
    border-radius: 6px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .guide-grid {
        grid-template-columns: 1fr !important;
    }

    .guide-card {
        grid-column: span 12 !important;
    }

    .interview-text {
        font-size: 1.1rem;
    }
}

.footer a {
    color: var(--primary-orange);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 1360px) {
    body {
        grid-template-columns: 1fr;
    }

    .ad-space-left,
    .ad-space-right {
        display: none;
    }

    .main-content {
        grid-column: 1;
        max-width: 100%;
        padding: 0 20px;
    }

    .header,
    .footer {
        grid-column: 1;
    }
}

@media (max-width: 1024px) {
    .lottery-grid {
        grid-template-columns: 1fr;
        max-width: 600px;
        margin: 0 auto 40px;
    }

    .grid-container {
        padding: 0 15px;
    }
}

@media (max-width: 768px) {
    .lottery-grid {
        grid-template-columns: 1fr;
    }

    .lottery-card {
        padding: 35px;
        /* Reduced for mobile */
        min-height: auto;
    }

    .ball {
        width: 60px;
        /* Reduced for mobile */
        height: 60px;
        font-size: 1.6rem;
    }

    .lottery-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    /* Ensure centering on mobile */
    .container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .lottery-card {
        padding: 25px;
    }

    .ball {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .lottery-logo img {
        height: 60px;
    }
}