@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Fredoka:wght@500;600;700&display=swap');

:root {
    --ink: #171021;
    --plum: #6f569b;
    --deep-plum: #3a2b57;
    --violet: #a881d5;
    --pink: #ff83be;
    --soft-pink: #ffeaf6;
    --cream: #fffaf1;
    --paper: rgba(255, 253, 249, 0.92);
    --line: #ead8f2;
    --line-strong: #d7b8ea;
    --gold: #ffd36e;
    --shadow: 0 18px 40px rgba(122, 82, 141, 0.18);
    --soft-shadow: 0 8px 24px rgba(152, 105, 171, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: 'Fredoka', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 205, 232, 0.55), transparent 28%),
        radial-gradient(circle at 86% 5%, rgba(255, 230, 184, 0.52), transparent 24%),
        linear-gradient(135deg, #fff8ee 0%, #fff1fb 52%, #f7ecff 100%);
    overflow-x: hidden;
}

.page-pattern {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.52;
    background-image:
        radial-gradient(circle at 6px 6px, rgba(169, 129, 213, 0.2) 1.4px, transparent 1.6px),
        radial-gradient(circle at 36px 28px, rgba(255, 131, 190, 0.18) 1.5px, transparent 1.7px);
    background-size: 68px 64px, 86px 78px;
}

.page-pattern::before,
.page-pattern::after {
    content: "♡  ✦  🎀  ☆  ♡  ✧  🎀  ✦";
    position: fixed;
    left: 3vw;
    right: 3vw;
    color: rgba(143, 94, 178, 0.18);
    font-size: clamp(1rem, 2vw, 1.8rem);
    letter-spacing: 26px;
    white-space: nowrap;
}

.page-pattern::before {
    top: 26px;
}

.page-pattern::after {
    bottom: 28px;
}

.app-shell {
    width: min(1380px, calc(100% - 48px));
    margin: 0 auto;
    padding: 30px 0 34px;
    position: relative;
    z-index: 1;
}

.hero {
    min-height: 276px;
    display: grid;
    grid-template-columns: minmax(520px, 1fr) 330px;
    align-items: center;
    gap: 24px;
    margin-bottom: 18px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-copy {
    align-self: center;
}

.title-art {
    display: block;
    width: min(660px, 100%);
    height: auto;
    filter: drop-shadow(0 18px 20px rgba(128, 81, 148, 0.12));
}

.personal-title-art {
    width: min(720px, 100%);
    max-height: 300px;
    object-fit: contain;
    object-position: left center;
    margin-left: -8px;
}

.sparkle-row {
    color: var(--deep-plum);
    font-size: 1.2rem;
    margin-bottom: 4px;
    opacity: 0.9;
}

.eyebrow,
.week-label,
.summary-label {
    margin: 0;
    color: var(--plum);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    color: #171021;
    font-family: 'Baloo 2', 'Fredoka', sans-serif;
    font-size: clamp(3.6rem, 7.2vw, 6.4rem);
    line-height: 0.82;
    font-weight: 800;
    text-shadow:
        0 5px 0 #ffffff,
        5px 0 0 #ffffff,
        -5px 0 0 #ffffff,
        0 -5px 0 #ffffff,
        8px 8px 0 rgba(174, 139, 215, 0.42);
}

h1::first-line {
    color: #171021;
}

.ribbon {
    width: min(460px, 92%);
    margin: 8px 0 0 154px;
    padding: 8px 22px;
    color: var(--deep-plum);
    background: linear-gradient(180deg, #fff3fb, #f4e2ff);
    border: 3px solid #ceb4e5;
    box-shadow: 0 6px 0 rgba(174, 139, 215, 0.22);
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    position: relative;
}

.ribbon::before,
.ribbon::after {
    content: "";
    position: absolute;
    top: 7px;
    width: 36px;
    height: 32px;
    background: #ead7ff;
    border: 3px solid #ceb4e5;
    z-index: -1;
}

.ribbon::before {
    left: -24px;
    transform: skewY(-15deg);
}

.ribbon::after {
    right: -24px;
    transform: skewY(15deg);
}

.week-card,
.summary-strip,
.tracker-panel,
.access-gate {
    background: var(--paper);
    border: 2px solid rgba(218, 190, 229, 0.88);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.week-card {
    justify-self: end;
    width: 302px;
    min-height: 134px;
    border-radius: 28px;
    padding: 22px 28px;
    position: relative;
    transform: rotate(1deg);
}

.calendar-icon {
    position: absolute;
    left: 24px;
    top: 18px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    color: var(--plum);
    border: 3px dashed #c8a6e2;
    border-radius: 10px;
    font-size: 1.3rem;
}

.week-card .week-label {
    display: block;
    margin-left: 56px;
}

.week-card strong {
    display: block;
    margin: 8px 0 0 56px;
    color: var(--ink);
    font-family: 'Baloo 2', sans-serif;
    font-size: 2rem;
    line-height: 1;
}

.mini-mascot {
    position: absolute;
    right: 18px;
    bottom: 10px;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #211b27;
    border: 5px solid #fff;
    border-radius: 50%;
    box-shadow: 0 8px 16px rgba(57, 32, 72, 0.18);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    min-height: 138px;
    border-radius: 34px;
    margin-bottom: 22px;
    overflow: hidden;
}

.summary-card {
    display: grid;
    grid-template-columns: 76px 1fr;
    grid-template-rows: auto auto;
    align-content: center;
    gap: 2px 16px;
    padding: 20px 34px;
    position: relative;
}

.summary-card + .summary-card {
    border-left: 2px dashed rgba(197, 166, 219, 0.72);
}

.summary-icon {
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: center;
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    background: transparent;
    border-radius: 0;
    transform: rotate(-9deg);
    box-shadow: none;
}

.summary-icon img {
    max-width: 76px;
    max-height: 76px;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(116, 76, 138, 0.16));
}

.summary-card strong {
    color: var(--pink);
    font-family: 'Baloo 2', sans-serif;
    font-size: 3.6rem;
    line-height: 0.9;
    text-shadow: 0 4px 0 #ffe2f2;
}

.access-gate,
.tracker-panel {
    border-radius: 28px;
    padding: 22px;
}

.access-gate {
    margin-bottom: 20px;
}

.access-gate h2,
.tracker-panel h2 {
    color: #16111d;
    font-family: 'Baloo 2', sans-serif;
    font-size: 2rem;
    font-weight: 800;
}

.access-form {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.access-form input {
    flex: 1;
    min-width: 0;
    height: 46px;
    border: 2px solid var(--line-strong);
    border-radius: 999px;
    padding: 0 18px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.access-form input:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 4px rgba(168, 129, 213, 0.18);
}

.access-form button,
.sync-btn {
    height: 38px;
    border: 2px solid #d7b8ea;
    border-radius: 999px;
    padding: 0 15px;
    background: #fff6fc;
    color: var(--deep-plum);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    box-shadow: 0 5px 0 rgba(177, 136, 205, 0.16);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.access-form button,
.sync-btn.primary {
    color: #fff;
    border-color: #9b6fd0;
    background: linear-gradient(135deg, #b98ee8, #ff86c0);
}

.sync-btn:hover,
.access-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 rgba(177, 136, 205, 0.18);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.save-status {
    min-width: 132px;
    border-radius: 999px;
    padding: 9px 13px;
    background: #f5eaff;
    color: var(--deep-plum);
    border: 2px solid #dec8ef;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
}

.save-status.saving {
    background: #fff2be;
    color: #7a5a00;
    border-color: #f5d35f;
}

.save-status.saved {
    background: #e9f7e5;
    color: #3d7b42;
    border-color: #b6ddb1;
}

.save-status.error {
    background: #ffe4ee;
    color: #a33b68;
    border-color: #ffadc9;
}

.error-message {
    margin: 0 0 14px;
    border: 2px solid #ffadc9;
    border-radius: 18px;
    padding: 10px 14px;
    background: #fff0f6;
    color: #943b63;
    font-size: 0.95rem;
    font-weight: 700;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 22px;
}

.tracker-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    table-layout: fixed;
    overflow: hidden;
    border: 2px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
}

.tracker-table th,
.tracker-table td {
    height: 108px;
    padding: 10px;
    text-align: center;
    vertical-align: middle;
    border: 2px solid var(--line);
}

.tracker-table thead th {
    height: 86px;
    color: var(--deep-plum);
    background: linear-gradient(180deg, #fff1fb, #f7ecff);
    font-family: 'Baloo 2', sans-serif;
    font-size: 1.08rem;
    font-weight: 800;
}

.item-col {
    width: 250px;
}

.item-cell {
    text-align: left !important;
    background: rgba(255, 252, 247, 0.84);
}

.item-content {
    display: grid;
    grid-template-columns: 58px 1fr 18px;
    align-items: center;
    gap: 14px;
}

.item-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    transform: rotate(-8deg);
}

.item-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 5px 5px rgba(96, 64, 114, 0.15));
}

.item-name {
    display: block;
    color: #171021;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.08;
}

.item-sparkle {
    color: #ff9cca;
    font-size: 1.4rem;
}

.day-name {
    display: block;
}

.day-date {
    display: block;
    margin-top: 2px;
    color: var(--deep-plum);
    font-family: 'Fredoka', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
}

.today {
    position: relative;
    background: linear-gradient(180deg, rgba(246, 232, 255, 0.9), rgba(255, 246, 252, 0.92));
    box-shadow: inset 0 0 0 4px rgba(194, 153, 236, 0.28), 0 0 24px rgba(173, 132, 224, 0.26);
}

.check-cell {
    background: rgba(255, 250, 253, 0.72);
}

.check-cell.disabled {
    background: rgba(250, 244, 250, 0.76);
}

.not-scheduled {
    display: inline-grid;
    place-items: center;
    width: 70px;
    height: 70px;
}

.not-scheduled img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    opacity: 0.76;
    filter: drop-shadow(0 5px 5px rgba(125, 82, 153, 0.16));
}

.check-button {
    width: 82px;
    height: 82px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.check-button::before {
    content: "";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: url("assets/checked.png") center / contain no-repeat;
    opacity: 0.27;
    filter: grayscale(1);
}

.check-button::after {
    content: "♡";
    position: absolute;
    right: -2px;
    top: 0;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #ff8fc4;
    border: 3px solid #fff;
    border-radius: 50%;
    font-size: 0.82rem;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.check-button:hover {
    transform: translateY(-3px) rotate(-3deg);
}

.check-button.checked::before {
    opacity: 1;
    filter: none;
}

.check-button.checked::after {
    opacity: 1;
    transform: scale(1);
}

.check-button.checked {
    animation: stickerPop 0.26s ease;
}

@keyframes stickerPop {
    0% { transform: scale(0.82) rotate(-9deg); }
    60% { transform: scale(1.12) rotate(4deg); }
    100% { transform: scale(1) rotate(0); }
}

.empty-row {
    height: 148px;
    color: var(--plum);
    background: #fff9fd;
    font-weight: 800;
}

.sticker-floor {
    height: 86px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    color: var(--deep-plum);
    font-family: 'Baloo 2', sans-serif;
    font-size: 1.8rem;
}

.book-sticker,
.potion-sticker {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
}

.book-sticker {
    transform: rotate(-13deg);
}

.potion-sticker {
    transform: rotate(12deg);
}

.book-sticker img,
.potion-sticker img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(77, 45, 96, 0.16));
}

.bat-ribbon {
    color: var(--deep-plum);
    font-size: 2rem;
}

.footer {
    text-align: center;
    padding: 8px 0 18px;
    color: rgba(58, 43, 87, 0.62);
    font-size: 0.9rem;
    font-weight: 700;
}

@media (max-width: 980px) {
    .app-shell {
        width: min(100% - 24px, 900px);
        padding-top: 20px;
    }

    .hero {
        grid-template-columns: 1fr;
        min-height: 0;
        text-align: center;
    }

    .ribbon {
        margin-left: auto;
        margin-right: auto;
    }

    .week-card {
        justify-self: center;
    }

    .summary-strip {
        grid-template-columns: 1fr;
        border-radius: 26px;
    }

    .summary-card + .summary-card {
        border-left: 0;
        border-top: 2px dashed rgba(197, 166, 219, 0.72);
    }

    .panel-header {
        display: block;
    }

    .panel-actions {
        justify-content: flex-start;
        margin-top: 10px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 16px, 640px);
    }

    .title-art {
        width: min(100%, 520px);
    }

    .personal-title-art {
        width: min(100%, 680px);
    }

    .week-card {
        width: min(100%, 330px);
    }

    .summary-card {
        grid-template-columns: 62px 1fr;
        padding: 18px;
    }

    .summary-card strong {
        font-size: 3rem;
    }

    .tracker-panel,
    .access-gate {
        padding: 14px;
        border-radius: 22px;
    }

    .panel-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .sync-btn,
    .save-status {
        width: 100%;
    }

    .access-form {
        display: block;
    }

    .access-form button {
        width: 100%;
        margin-top: 10px;
    }

    .tracker-table {
        min-width: 920px;
    }
}

.hero-copy {
    position: relative;
    min-height: 248px;
    padding-left: 190px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-copy.has-title-art {
    min-height: 286px;
    padding-left: 0;
    align-items: flex-start;
}

.hero-sticker {
    position: absolute;
    left: 0;
    top: 42px;
    width: 156px;
    display: grid;
    place-items: center;
    transform: rotate(-7deg);
}

.hero-sticker img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 16px 18px rgba(128, 81, 148, 0.16));
}

.hero-copy h1 {
    max-width: 720px;
}

.hero-copy.has-title-art .ribbon {
    width: min(460px, calc(100% - 280px));
    margin-top: -26px;
    margin-left: 270px;
}

.home-button {
    width: fit-content;
    margin: 14px 0 0 154px;
    border: 2px solid #d7b8ea;
    border-radius: 999px;
    padding: 8px 18px;
    background: #fff6fc;
    color: var(--deep-plum);
    box-shadow: 0 5px 0 rgba(177, 136, 205, 0.16);
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 rgba(177, 136, 205, 0.18);
}

.hero-copy.has-title-art .home-button {
    margin-left: 270px;
}

.secondary-button {
    color: var(--deep-plum) !important;
    border-color: #d7b8ea !important;
    background: #fff6fc !important;
}

.ranking-table th,
.ranking-table td {
    height: 86px;
}

.ranking-table a {
    color: #171021;
    text-decoration-color: var(--pink);
    text-underline-offset: 4px;
}

.ranking-progress {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 54px;
    gap: 12px;
    align-items: center;
}

.progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: #f1e2f6;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--violet), var(--pink));
}

.sort-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--deep-plum);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.sort-button.active {
    color: var(--pink);
    text-decoration: underline;
    text-underline-offset: 4px;
}

@media (max-width: 980px) {
    .hero-copy {
        padding-left: 0;
        align-items: center;
    }

    .hero-sticker {
        position: relative;
        top: auto;
        margin: 0 auto;
    }

    .home-button {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-copy.has-title-art {
        align-items: center;
    }

    .hero-copy.has-title-art .ribbon,
    .hero-copy.has-title-art .home-button {
        width: min(460px, 92%);
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 640px) {
    .ribbon,
    .hero-copy.has-title-art .ribbon {
        width: min(300px, 80%);
        padding-left: 16px;
        padding-right: 16px;
        font-size: 1rem;
    }

    .ribbon::before,
    .ribbon::after {
        width: 22px;
        height: 28px;
    }

    .ribbon::before {
        left: -15px;
    }

    .ribbon::after {
        right: -15px;
    }
}
