:root {
    --bg: #f4f7fb;
    --primary: #2563eb;
    --text: #0f172a;
    --white: #ffffff;
    --muted: #475569;
    --border: #dbe3ef;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--bg);
    background-image: url("../img/Background.png?v=2");
    background-repeat: no-repeat;
    background-position: top center;
    background-size: 100% auto;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: min(960px, 92%);
    margin: 0 auto;
}

.top-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
}

.top-bar .container {
    width: 100%;
    max-width: none;
    padding: 0 20px;
    margin: 0;
}

.logo {
    display: inline-flex;
    align-items: center;
}

.logo img {
    width: min(180px, 60vw);
    height: auto;
    display: block;
}

.page {
    padding: 30px 0 56px;
}

.hero {
    text-align: center;
    margin-bottom: 30px;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(1.65rem, 3.5vw, 2.15rem);
}

.hero p,
.section-subtext {
    margin: 0 0 20px;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.hero-actions .btn {
    padding: 13px 22px;
}

.landing-page .hero-actions .btn-secondary {
    background: #facc15;
    color: #1f2937;
    border: 1px solid #eab308;
}

.landing-page .hero-actions .btn-secondary:hover {
    background: #fbbf24;
}

.check-card,
.result-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.check-card h1,
.check-card h2,
.result-card h1 {
    margin-top: 0;
}

.field-group {
    margin-bottom: 16px;
}

.recent-checks {
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fbff;
}

.recent-checks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.recent-checks h3 {
    margin: 0;
    font-size: 0.95rem;
}

.recent-checks-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-check-item {
    border: 1px solid #c7d8f4;
    background: #eef4ff;
    color: #1e293b;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.recent-check-item:hover {
    background: #e0ecff;
}

.recent-clear-btn {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 0.76rem;
    padding: 4px 8px;
    cursor: pointer;
}

label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

input,
select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 1rem;
    background: var(--white);
}

input:focus-visible,
select:focus-visible,
.recent-check-item:focus-visible,
.recent-clear-btn:focus-visible,
.home-btn-inline:focus-visible,
.back-btn:focus-visible {
    outline: 2px solid #ca8a04;
    outline-offset: 2px;
}

input[type="date"] {
    accent-color: #facc15;
}

.numbers {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.numbers input {
    min-width: 60px;
    text-align: center;
}

.number-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.number-input-label {
    margin-bottom: 4px;
}

.field-help {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: #64748b;
}

.lottery-rules-help {
    margin-top: 8px;
}

.date-feedback {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: #64748b;
}

.date-feedback.is-valid {
    color: #0f766e;
}

.date-feedback.is-invalid {
    color: #b91c1c;
}

.number-feedback {
    margin: 2px 0 0;
    min-height: 16px;
    font-size: 0.75rem;
    color: #b91c1c;
}

.submit-feedback {
    min-height: 16px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.numbers input.input-invalid {
    border-color: #b91c1c;
    box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.12);
}

.megaplier-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.megaplier-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text);
}

.megaplier-toggle input {
    width: auto;
    margin: 0;
}

.megaplier-controls select {
    width: auto;
    min-width: 120px;
}

.back-btn {
    display: inline-block;
    margin-bottom: 15px;
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.back-btn:hover {
    text-decoration: underline;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.page-actions .back-btn {
    margin-bottom: 0;
}

.home-btn-inline {
    display: inline-block;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.86rem;
    color: #1f2937;
    background: #facc15;
    border: 1px solid #eab308;
    border-radius: 999px;
    padding: 6px 12px;
}

.home-btn-inline:hover {
    background: #fbbf24;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 11px 18px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    touch-action: manipulation;
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 1;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18) inset;
}

.btn:focus-visible {
    outline: 2px solid #ca8a04;
    outline-offset: 2px;
}

.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.85;
}

.btn-primary {
    background: #facc15;
    color: #1f2937;
    border: 1px solid #eab308;
}

.btn-secondary {
    background: #facc15;
    color: #1f2937;
    border: 1px solid #eab308;
}

.btn-primary:hover,
.btn-secondary:hover {
    background: #fbbf24;
}

.trust {
    margin-top: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.landing-section {
    margin-top: 20px;
}

.landing-page {
    padding-top: 18px;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.info-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    background: #f8fbff;
}

.info-card h3 {
    margin: 0 0 6px;
    font-size: 1rem;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
}

.lottery-rule-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.lottery-rule-card {
    border: 1px solid #c4d5f1;
    border-radius: 10px;
    padding: 14px;
    background: #f8fbff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.06);
}

.lottery-rule-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.result-list {
    margin: 0 0 20px;
    padding-left: 20px;
}

.result-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.result-overview-item {
    background: #f8fbff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
}

.result-overview-label {
    margin: 0;
    font-size: 0.78rem;
    color: #64748b;
}

.result-overview-value {
    margin: 4px 0 0;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 600;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-pill.is-win {
    background: #dcfce7;
    color: #166534;
}

.status-pill.is-lose {
    background: #fee2e2;
    color: #991b1b;
}

.result-block {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.result-block h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.result-highlight {
    background: #fffdf2;
    border-color: #f5e4a3;
}

.result-summary-text {
    margin: 0;
    color: #854d0e;
    font-weight: 700;
}

.number-group {
    margin-bottom: 10px;
}

.number-group:last-child {
    margin-bottom: 0;
}

.number-group-title {
    margin: 0 0 6px;
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 600;
}

.number-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.number-chip {
    min-width: 32px;
    height: 32px;
    border-radius: 999px;
    padding: 0 10px;
    border: 1px solid #d6e2f5;
    background: #eef4ff;
    color: #1e293b;
    font-size: 0.86rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.number-chip.is-matched {
    background: #fef08a;
    border-color: #f59e0b;
    color: #854d0e;
    animation: matchedPulse 0.7s ease-out;
}

@keyframes matchedPulse {
    0% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

.nearby-dates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.nearby-date-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #c7d8f4;
    background: #eef4ff;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.nearby-date-chip:hover {
    background: #e0ecff;
}

.result-note {
    margin-bottom: 16px;
}

.payout-list li {
    margin-bottom: 6px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.copy-toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 90;
    background: #1f2937;
    color: #ffffff;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--white);
    padding: 14px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.install-banner {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    max-width: min(420px, 92vw);
}

.install-banner p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.install-btn {
    white-space: nowrap;
}

.install-banner .btn,
#installAppBtn {
    background: #facc15 !important;
    color: #1f2937 !important;
    border: 1px solid #eab308 !important;
}

.install-banner .btn:hover,
#installAppBtn:hover {
    background: #fbbf24 !important;
}

@media (max-width: 480px) {
    .check-card,
    .result-card {
        padding: 18px;
    }

    .page {
        padding: 16px 0 40px;
    }

    .hero {
        margin-bottom: 18px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions .btn {
        width: 100%;
        text-align: center;
    }

    .btn {
        min-height: 44px;
    }

    .back-btn {
        margin-bottom: 10px;
    }

    .home-btn-inline {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .logo img {
        width: min(150px, 65vw);
    }

    .install-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: space-between;
    }

    .install-banner p {
        font-size: 0.82rem;
    }

    .result-actions .btn {
        width: 100%;
        text-align: center;
    }

    .copy-toast {
        right: 12px;
        bottom: 12px;
    }
}

@media (max-width: 900px) {
    .steps-grid {
        grid-template-columns: 1fr;
    }

    .lottery-rule-grid {
        grid-template-columns: 1fr;
    }
}
