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

body {
    background-color: #f5f7fa;
    /* Checkered/diamond background pattern for desktop viewports */
    background-image: 
        linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%),
        linear-gradient(45deg, #ffffff 25%, #e2e8f0 25%, #e2e8f0 75%, #ffffff 75%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* Mobile viewport container */
.app-container {
    width: 100%;
    max-width: 480px;
    background-color: #f8fafc;
    min-height: 100vh;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    padding-bottom: 20px;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

/* Header bar */
.top-bar {
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px 4px 16px;
}

.download-badge-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.download-badge-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

/* Lottery Header Card */
.lottery-card {
    background: #ffffff;
    margin: 10px 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.lottery-title-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.lottery-title {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}

.lottery-period {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.countdown-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #10b981;
    background: #f0fdf4;
    padding: 8px 16px;
    border-radius: 8px;
    color: #047857;
    font-size: 13px;
    font-weight: 600;
    width: fit-content;
    margin: 0 auto 16px auto;
}

.countdown-box svg {
    color: #10b981;
}

.countdown-time {
    color: #10b981;
    font-weight: 800;
    margin-left: 2px;
}

.lottery-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.num-box {
    width: 48px;
    height: 48px;
    background-color: #cbd5e1;
    color: #334155;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    font-weight: 700;
}

.operator {
    font-size: 20px;
    font-weight: 600;
    color: #64748b;
}

.num-box.result {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* App Store Download Button Hero */
.app-store-hero {
    margin: 8px 16px;
}

.app-store-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1.5px solid #1e293b;
    border-radius: 12px;
    padding: 12px 24px;
    text-decoration: none;
    color: #1e293b;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.app-store-btn:active {
    transform: scale(0.98);
    background-color: #f1f5f9;
}

.app-store-btn svg {
    width: 28px;
    height: 28px;
    fill: #1e293b;
}

.app-store-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-store-text .small-text {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    color: #64748b;
}

.app-store-text .bold-text {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

/* Cards Section */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 16px;
}

.formula-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.01);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.card-id {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
}

.card-collect {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 1px 6px;
    font-size: 9px;
    color: #64748b;
    background-color: #f8fafc;
}

.card-collect svg {
    width: 8px;
    height: 8px;
    fill: #94a3b8;
}

.card-date-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
    margin-bottom: 6px;
}

.card-date {
    font-size: 9px;
    color: #94a3b8;
}

.card-title-container {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.card-title-pill {
    background-color: #f3e8ff;
    color: #7e22ce;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
}

.card-title-plain {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.card-tag {
    background-color: #d1fae5;
    color: #065f46;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
}

/* Stats Block layout */
.card-stats {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.stat-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-val-percent {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
}

.stat-label-period {
    font-size: 9px;
    color: #94a3b8;
}

.stat-fraction-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fraction-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.fraction-lbl {
    font-size: 9px;
    color: #94a3b8;
    min-width: 32px;
}

.fraction-val {
    font-size: 10px;
    font-weight: 700;
    color: #334155;
}

/* Consec status grid */
.card-consec {
    display: grid;
    grid-template-columns: 1fr 1fr;
    row-gap: 8px;
    column-gap: 4px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 8px;
}

.consec-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.consec-num {
    font-size: 14px;
    font-weight: 700;
    color: #334155; /* default */
}

.consec-num.win {
    color: #10b981;
}

.consec-num.loss {
    color: #ef4444;
}

.consec-label {
    font-size: 9px;
    color: #94a3b8;
}

/* Max Consec display */
.card-max-consec {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}

.max-item {
    font-size: 9px;
    color: #64748b;
}

.max-item span.win {
    color: #10b981;
    font-weight: 700;
}

.max-item span.loss {
    color: #ef4444;
    font-weight: 700;
}

/* Card bottom author / views / check */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.author-name {
    font-size: 10px;
    color: #64748b;
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.view-count-box {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: #94a3b8;
}

.view-count-box svg {
    width: 10px;
    height: 10px;
    fill: #94a3b8;
}

.btn-check {
    background-color: #3b82f6;
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: background-color 0.2s;
}

.btn-check svg {
    width: 10px;
    height: 10px;
    fill: #ffffff;
}

.btn-check:active {
    background-color: #1d4ed8;
}

/* Pagination container */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 20px 16px 10px 16px;
}

.p-arrow {
    font-size: 14px;
    font-weight: bold;
    color: #3b82f6;
    text-decoration: none;
    padding: 6px;
}

.p-pill {
    background-color: #3b82f6;
    color: #ffffff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    text-decoration: none;
}

/* Stats summary at bottom */
.stats-summary {
    text-align: center;
    font-size: 11px;
    color: #64748b;
    margin: 8px 16px;
    font-weight: 500;
}

.stats-summary .highlight {
    color: #b45309;
    font-weight: 600;
}

/* Footer links */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
    padding: 0 16px;
}

.footer-link {
    font-size: 12px;
    color: #64748b;
    text-decoration: none;
    font-weight: 500;
}

.footer-link:hover {
    color: #3b82f6;
}

/* Modal Popup styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #ffffff;
    width: 85%;
    max-width: 360px;
    border-radius: 24px;
    position: relative;
    padding: 30px 20px 24px 20px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Modal close button */
.modal-close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    background-color: #475569;
    border: 2px solid #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.modal-close-btn:hover {
    background-color: #334155;
}

/* Modal Logo shape */
.modal-logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.modal-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #ff4b82;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(255, 75, 130, 0.2);
}

.modal-logo .logo-top {
    font-size: 20px;
    font-weight: 900;
    color: #ff4b82;
    line-height: 1.1;
    font-style: italic;
}

.modal-logo .logo-bottom {
    font-size: 16px;
    font-weight: 900;
    color: #7c3aed;
    line-height: 1;
    margin-top: 2px;
}

/* Modal Text list */
.modal-marketing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin: 16px 0 24px 0;
    padding: 0 8px;
}

.modal-marketing-item {
    font-size: 13px;
    line-height: 1.4;
    color: #1e293b;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.modal-marketing-item .emoji {
    font-size: 15px;
    flex-shrink: 0;
}

/* Modal Button App Store styled */
.modal-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1.5px solid #1e293b;
    border-radius: 12px;
    padding: 10px 20px;
    text-decoration: none;
    color: #1e293b;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s;
    width: 100%;
}

.modal-download-btn:active {
    background-color: #f1f5f9;
}

.modal-download-btn svg {
    width: 24px;
    height: 24px;
    fill: #1e293b;
}

.modal-download-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.modal-download-text .small-text {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    color: #64748b;
}

.modal-download-text .bold-text {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
}
