/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
    background: #fff;
    color: #333;
    padding: 32px 20px;
    text-align: center;
    border-bottom: 1px solid #e2e6ea;
}

.site-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 6px;
    color: #1a2332;
}

.site-header .subtitle {
    font-size: 1rem;
    color: #777;
    font-weight: 400;
}

.header-cards {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.header-card {
    background: #f0f2f5;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}

/* ===== Container ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ===== How It Works ===== */
.how-it-works {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.how-it-works h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.how-it-works ol {
    padding-left: 20px;
    color: #555;
    line-height: 2;
    font-size: 0.95rem;
}

.how-it-works a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
}

.how-it-works a:hover {
    text-decoration: underline;
}

/* ===== Story ===== */
.story {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.story h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.story p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
}

/* ===== Box Contents ===== */
.box-contents {
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.box-image {
    display: block;
    max-width: 220px;
    width: 100%;
    margin: 16px auto 8px;
    border-radius: 8px;
}

.box-dimensions {
    text-align: left;
    color: #777;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.box-contents h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 14px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: #f0f2f5;
    color: #444;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== Bonus ===== */
.bonus {
    background: #fff8e6;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #f5a623;
}

.bonus h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.bonus p {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

/* ===== Stat Cards ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 22px 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    border-top: 3px solid transparent;
}

.stat-card.sold {
    border-top-color: #dc3545;
}

.stat-card.available {
    border-top-color: #28a745;
}

.stat-card.value {
    border-top-color: #0d6efd;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card.sold .stat-number {
    color: #dc3545;
}

.stat-card.available .stat-number {
    color: #28a745;
}

.stat-card.value .stat-number {
    color: #0d6efd;
}

.stat-label {
    font-size: 0.8rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== Progress Bar ===== */
.progress-section {
    margin-bottom: 28px;
}

.progress-bar {
    height: 28px;
    background: #e2e6ea;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #0d6efd;
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    font-weight: 500;
}

/* ===== Sold Out Banner ===== */
.sold-out-banner {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
    background: #dc3545;
    border-radius: 8px;
}

.sold-out-banner h2 {
    font-size: 1.6rem;
    color: #fff;
    font-weight: 700;
    letter-spacing: 2px;
}

.hidden {
    display: none !important;
}

/* ===== Box Grid ===== */
.grid-section {
    margin-bottom: 40px;
}

.grid-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 12px;
}

.legend {
    display: flex;
    gap: 24px;
    margin-bottom: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #666;
}

.legend-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.legend-box.available {
    background: #28a745;
}

.legend-box.sold {
    background: #dc3545;
}

.box-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    gap: 4px;
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.box {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    cursor: default;
    transition: background-color 0.3s ease;
    user-select: none;
}

.box.available {
    background: #28a745;
    color: rgba(255, 255, 255, 0.85);
}

.box.sold {
    background: #dc3545;
    color: rgba(255, 255, 255, 0.85);
}

.box.winner {
    background: linear-gradient(135deg, #f5a623 50%, #dc3545 50%);
    color: #fff;
}

.legend-box.winner {
    background: #f5a623;
}

.box-grid.clickable .box {
    cursor: pointer;
}

.box-grid.clickable .box:hover {
    opacity: 0.8;
    outline: 2px solid #333;
    outline-offset: -2px;
}

/* ===== Payment Options ===== */
.payment-options {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
}

.payment-options h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.payment-options p {
    font-size: 1rem;
    color: #333;
}

/* ===== Pickup Location ===== */
.pickup-location {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.pickup-location h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.pickup-location p {
    font-size: 1rem;
    color: #333;
    margin-bottom: 10px;
}

.pickup-location a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.pickup-location a:hover {
    text-decoration: underline;
}

/* ===== No Returns ===== */
.no-returns {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    border-left: 4px solid #dc3545;
}

.no-returns h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: 8px;
}

.no-returns p {
    font-size: 0.95rem;
    color: #555;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px 0;
    color: #999;
    font-size: 0.8rem;
}

/* ===== Admin: Login ===== */
.login-section {
    max-width: 380px;
    margin: 100px auto;
    text-align: center;
    background: #fff;
    padding: 36px 30px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.login-section h2 {
    margin-bottom: 22px;
    color: #1a2332;
    font-size: 1.3rem;
    font-weight: 700;
}

.login-section input {
    width: 100%;
    padding: 12px 14px;
    background: #f5f7fa;
    border: 1px solid #d0d5dd;
    color: #333;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.login-section input:focus {
    border-color: #0d6efd;
}

.login-section button {
    width: 100%;
    padding: 12px;
    background: #1a2332;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-section button:hover {
    background: #2c3e50;
}

.login-error {
    color: #dc3545;
    margin-top: 10px;
    min-height: 18px;
    font-size: 0.85rem;
}

/* ===== Admin: Controls ===== */
.admin-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.admin-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.admin-card h3 {
    margin-bottom: 14px;
    color: #444;
    font-size: 0.95rem;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 10px 14px;
    background: #f5f7fa;
    border: 1px solid #d0d5dd;
    color: #333;
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: #0d6efd;
}

.btn-sell {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #dc3545;
    color: #fff;
    transition: background 0.2s;
}

.btn-sell:hover {
    background: #c82333;
}

.btn-unsell {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #28a745;
    color: #fff;
    transition: background 0.2s;
}

.btn-unsell:hover {
    background: #218838;
}

.btn-winner {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: #f5a623;
    color: #fff;
    transition: background 0.2s;
}

.btn-winner:hover {
    background: #e09500;
}

.winner-list {
    margin-top: 12px;
    font-size: 0.85rem;
    color: #666;
}

.admin-message {
    text-align: center;
    padding: 10px 14px;
    margin-bottom: 20px;
    border-radius: 6px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.admin-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .site-header {
        padding: 24px 16px;
    }

    .site-header h1 {
        font-size: 1.5rem;
    }

    .header-cards {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .header-card {
        font-size: 0.85rem;
        padding: 8px 16px;
    }


    .container {
        padding: 16px 12px;
    }

    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stat-number {
        font-size: 1.7rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .progress-bar {
        height: 22px;
    }

    .box-grid {
        grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
        gap: 3px;
        padding: 10px;
    }

    .box {
        font-size: 7px;
    }

    .admin-controls {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-sell,
    .btn-unsell {
        width: 100%;
        padding: 12px;
    }

    .sold-out-banner h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 400px) {
    .site-header h1 {
        font-size: 1.2rem;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .box-grid {
        grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
        gap: 2px;
    }

    .box {
        font-size: 6px;
    }
}
