/* ================= RESET ================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --cyan: #06b6d4;
    --violet: #7c3aed;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --page: #eef4ff;
    --surface: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
    --container: 540px;
    --shadow-sm: 0 7px 20px rgba(30, 64, 175, 0.09);
    --shadow-card: 0 16px 38px rgba(30, 64, 175, 0.14);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: #dce7f8;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

body.checkin-modal-open {
    overflow: hidden;
}

button,
a {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
    cursor: pointer;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 3px;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}


/* ================= APP ================= */

.checkin-app {
    width: 100%;
    max-width: var(--container);
    min-height: 100vh;
    margin: 0 auto;
    overflow: hidden;
    background:
        radial-gradient(circle at 0 5%, rgba(6, 182, 212, 0.11), transparent 28%),
        linear-gradient(180deg, #eff6ff 0%, #f8fafc 68%);
}


/* ================= HEADER ================= */

.checkin-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    min-height: 76px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(12px);
}

.checkin-header h1 {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.4px;
}

.back-button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #f8fafc;
    color: var(--text);
    font-size: 18px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.back-button:hover {
    background: var(--primary-soft);
    transform: translateX(-2px);
}


/* ================= HERO ================= */

.checkin-hero {
    padding: 22px 18px 52px;
    background:
        radial-gradient(circle at 90% 18%, rgba(255, 255, 255, 0.22), transparent 26%),
        linear-gradient(135deg, #1d4ed8 0%, #2563eb 52%, #0891b2 100%);
    color: #ffffff;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 126px;
}

.hero-kicker,
.section-kicker {
    display: block;
    margin-bottom: 7px;
    color: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.hero-content h2 {
    max-width: 310px;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.45px;
}

.hero-content p {
    max-width: 330px;
    margin-top: 9px;
    color: rgba(255, 255, 255, 0.83);
    font-size: 14px;
    line-height: 1.5;
}

.calendar-illustration {
    display: grid;
    flex: 0 0 76px;
    width: 76px;
    height: 76px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
    font-size: 36px;
    transform: rotate(3deg);
}

.checkin-summary-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: -83px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-card);
    color: var(--text);
}

.summary-item {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 94px;
    padding: 17px 8px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.summary-item:not(:last-child)::after {
    position: absolute;
    top: 22%;
    right: 0;
    width: 1px;
    height: 56%;
    background: var(--border);
    content: "";
}

.summary-item span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.summary-item strong {
    display: block;
    max-width: 100%;
    margin-top: 8px;
    overflow: hidden;
    color: var(--primary-dark);
    font-size: 16px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ================= MAIN ================= */

.checkin-main {
    padding: 52px 16px 42px;
}

.checkin-calendar-card,
.checkin-rules {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.checkin-calendar-card {
    padding: 20px 15px 15px;
}

.calendar-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 0 3px 16px;
}

.calendar-title .section-kicker,
.rules-heading .section-kicker,
.wallet-sheet-header .section-kicker {
    color: var(--primary);
}

.calendar-title h2,
.checkin-rules h2,
.wallet-sheet-header h2 {
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -0.3px;
}

.calendar-title p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.calendar-title p strong {
    color: var(--text);
}

.calendar-progress {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.calendar-progress strong {
    font-size: 15px;
}

.weekday-row,
.checkin-days-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
}

.weekday-row {
    margin-bottom: 9px;
    padding: 0 2px;
}

.weekday-row span {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
}

.checkin-grid-wrapper {
    position: relative;
    max-height: 248px;
    overflow: hidden;
    transition: max-height 0.32s ease;
}

.checkin-grid-wrapper::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 60px;
    pointer-events: none;
    background: linear-gradient(transparent, #ffffff 88%);
    content: "";
    transition: opacity 0.2s ease;
}

.checkin-grid-wrapper.is-expanded {
    max-height: 1100px;
}

.checkin-grid-wrapper.is-expanded::after {
    opacity: 0;
}

.checkin-days-grid {
    padding: 2px;
}

.checkin-day {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 51px;
    padding: 6px 2px 5px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.checkin-day-number {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.checkin-day-label {
    display: block;
    max-width: 100%;
    margin-top: 5px;
    overflow: hidden;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkin-day-icon {
    margin-top: 5px;
    font-size: 10px;
}

.checkin-day.is-completed {
    border-color: #86efac;
    background: var(--success-soft);
    color: #15803d;
}

.checkin-day.is-next {
    border: 2px solid var(--primary);
    background: #eff6ff;
    color: var(--primary-dark);
    box-shadow: 0 5px 14px rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
}

.checkin-day.is-milestone {
    border-color: #fbbf24;
    background: var(--warning-soft);
    color: #92400e;
}

.checkin-day.is-milestone.is-completed,
.checkin-day.is-milestone-claimed {
    border-color: #c4b5fd;
    background: #ede9fe;
    color: #6d28d9;
}

.checkin-day.is-milestone-claimed::after {
    position: absolute;
    top: -4px;
    right: -3px;
    display: grid;
    width: 15px;
    height: 15px;
    place-items: center;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--success);
    color: #ffffff;
    content: "✓";
    font-size: 8px;
    font-weight: 900;
}

.calendar-toggle-button {
    display: flex;
    width: 100%;
    min-height: 42px;
    margin-top: 9px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

.calendar-toggle-button i {
    transition: transform 0.25s ease;
}

.calendar-toggle-button[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.checkin-page-message {
    min-height: 22px;
    margin: 17px 4px 9px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    text-align: center;
}

.checkin-page-message.is-error {
    color: var(--danger);
}

.checkin-page-message.is-success {
    color: var(--success);
}

.main-checkin-button {
    display: flex;
    width: 100%;
    min-height: 58px;
    padding: 13px 18px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 17px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.main-checkin-button:not(:disabled):hover {
    transform: translateY(-1px);
}

.main-checkin-button:not(:disabled):active {
    transform: translateY(1px);
}

.main-checkin-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    box-shadow: none;
}

.main-checkin-button.is-complete {
    background: linear-gradient(135deg, #16a34a, #15803d);
    opacity: 1;
}

.main-checkin-button.is-error {
    background: linear-gradient(135deg, #475569, #334155);
    opacity: 1;
}


/* ================= RULES ================= */

.checkin-rules {
    margin-top: 22px;
    padding: 21px 18px;
}

.rules-heading {
    margin-bottom: 16px;
}

.checkin-rules ul {
    display: grid;
    gap: 13px;
    list-style: none;
}

.checkin-rules li {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 10px;
    align-items: flex-start;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.checkin-rules li > i {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 13px;
}

.checkin-rules strong {
    color: var(--text);
}


/* ================= WALLET MODAL ================= */

.checkin-wallet-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    padding: 20px;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.checkin-wallet-sheet {
    width: 100%;
    max-width: 500px;
    padding: 12px 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px 24px 18px 18px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    animation: checkinSheetUp 0.25s ease both;
}

.wallet-sheet-handle {
    width: 42px;
    height: 4px;
    margin: 1px auto 15px;
    border-radius: 999px;
    background: #cbd5e1;
}

.wallet-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.wallet-modal-close {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    font-size: 16px;
}

.wallet-modal-instruction {
    margin-top: 11px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.wallet-reward-day {
    margin: 15px 0 11px;
    padding: 9px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 11px;
    background: #eff6ff;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.wallet-choice-list {
    display: grid;
    gap: 10px;
}

.wallet-choice-button {
    display: grid;
    grid-template-columns: 46px 1fr 18px;
    gap: 12px;
    width: 100%;
    min-height: 68px;
    padding: 10px 13px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #ffffff;
    color: var(--text);
    text-align: left;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.wallet-choice-button:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.wallet-choice-button:disabled,
.wallet-modal-close:disabled,
.wallet-modal-cancel:disabled {
    cursor: wait;
    opacity: 0.58;
}

.wallet-choice-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    color: #ffffff;
    font-size: 23px;
    font-weight: 900;
}

.wallet-choice-icon.inr {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.wallet-choice-icon.usdt {
    background: linear-gradient(135deg, #26a17b, #158765);
}

.wallet-choice-copy {
    min-width: 0;
}

.wallet-choice-copy strong,
.wallet-choice-copy small {
    display: block;
}

.wallet-choice-copy strong {
    font-size: 14px;
}

.wallet-choice-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.wallet-choice-button > i {
    color: #94a3b8;
    font-size: 12px;
}

.conversion-note {
    margin: 13px 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.wallet-modal-cancel {
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
}


/* ================= TOAST ================= */

.checkin-toast {
    position: fixed;
    right: 18px;
    bottom: 24px;
    left: 18px;
    z-index: 1200;
    max-width: 470px;
    margin: 0 auto;
    padding: 13px 15px;
    border-radius: 13px;
    background: #0f172a;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.28);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.checkin-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.checkin-toast.success {
    background: #15803d;
}

.checkin-toast.error {
    background: #b91c1c;
}


/* ================= ANIMATION / RESPONSIVE ================= */

@keyframes checkinSheetUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 600px) {
    body {
        padding: 18px 0;
    }

    .checkin-app {
        border-radius: 24px;
        box-shadow: 0 22px 60px rgba(30, 64, 175, 0.16);
    }
}

@media (max-width: 390px) {
    .checkin-hero {
        padding-right: 14px;
        padding-left: 14px;
    }

    .hero-content h2 {
        font-size: 21px;
    }

    .calendar-illustration {
        flex-basis: 65px;
        width: 65px;
        height: 65px;
        border-radius: 20px;
        font-size: 30px;
    }

    .summary-item {
        min-height: 88px;
        padding-right: 5px;
        padding-left: 5px;
    }

    .summary-item span {
        font-size: 10px;
    }

    .summary-item strong {
        font-size: 14px;
    }

    .weekday-row,
    .checkin-days-grid {
        gap: 5px;
    }

    .checkin-day {
        min-height: 48px;
        border-radius: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
