* {
    box-sizing: border-box;
}

html, body {
    padding: 0;
    margin: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at top, #ffe6f7, #f3f7ff 50%, #fdfcfb);
    min-height: 100vh;
}

/* Loader overlay */

.loader-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, #ffe4f3, #f5f7ff);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loader-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-box {
    text-align: center;
    padding: 1.4rem 1.6rem;
    border-radius: 1.5rem;
    background: #ffffffee;
    box-shadow: 0 18px 50px rgba(0,0,0,0.12);
    position: relative;
    overflow: hidden;
    max-width: 320px;
    width: 90%;
}

.loader-box::before {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe0f7, transparent);
    top: -60px;
    right: -40px;
    opacity: 0.7;
}

.loader-robot {
    font-size: 3.2rem;
    animation: robot-wave 1.4s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

.loader-title {
    font-weight: 700;
    margin-top: 0.5rem;
    font-size: 1rem;
    position: relative;
    z-index: 1;
}

.loader-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.2rem;
    position: relative;
    z-index: 1;
}

.loader-bar {
    margin-top: 0.9rem;
    width: 10rem;
    height: 0.35rem;
    border-radius: 999px;
    background: #f3f4ff;
    overflow: hidden;
    position: relative;
    margin-left: auto;
    margin-right: auto;
}

.loader-bar-inner {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff81c9, #ffb347);
    transform-origin: left;
    animation: loader-bar-move 1.8s infinite ease-in-out;
}

/* Main card */

.page-wrap {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 1.4rem 0.75rem;
}

.cute-container {
    background: #ffffffdd;
    backdrop-filter: blur(20px);
    border-radius: 1.5rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
    padding: 1.4rem;
    width: 100%;
    max-width: 480px;
    position: relative;
    overflow: hidden;
}

.cute-container::before {
    content: '★';
    position: absolute;
    font-size: 3rem;
    color: #ffd1f3;
    top: -10px;
    right: 10px;
    animation: float 4s infinite ease-in-out;
    opacity: 0.4;
}

.cute-title {
    font-weight: 700;
    font-size: 1.35rem;
    text-align: center;
    margin-bottom: 0.6rem;
}

.cute-subtitle {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 1rem;
}

.cute-form-group {
    margin-bottom: 0.8rem;
}

.cute-form-group label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.cute-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    border: 1px solid #ddd;
    outline: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.cute-input:focus {
    border-color: #ff81c9;
    box-shadow: 0 0 0 3px #ff81c933;
}

.cute-btn {
    border: none;
    outline: none;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s, opacity 0.2s;
}

.cute-btn-primary {
    background: linear-gradient(135deg, #ff81c9, #ffb347);
    color: white;
    box-shadow: 0 8px 20px rgba(255,129,201,0.4);
}

.cute-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(255,129,201,0.5);
}

.cute-btn-ghost {
    background: #f5f5f7;
    color: #555;
}

.cute-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.cute-link {
    color: #ff81c9;
    text-decoration: none;
    font-weight: 500;
}

.cute-link:hover {
    text-decoration: underline;
}

.cute-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: #fff7fb;
    color: #ff81c9;
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
}

.cute-tasks-wrapper {
    display: grid;
    gap: 0.75rem;
}

.cute-card {
    border-radius: 1.1rem;
    padding: 0.75rem;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03);
    position: relative;
    overflow: hidden;
}

.cute-card::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: radial-gradient(circle, #ffe6f7, transparent 60%);
    right: -40px;
    bottom: -40px;
    opacity: 0.7;
}

.cute-card-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.cute-status {
    font-size: 0.75rem;
    margin-top: 0.35rem;
}

.cute-status.done {
    color: #16a34a;
}

.cute-status.pending {
    color: #f97316;
}

/* Square lottery "board" */

.spin-card-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.spin-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spin-board {
    width: 8.5rem;
    border-radius: 0.9rem;
    background: linear-gradient(145deg, #fef3ff, #ffe4f3);
    padding: 0.35rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    margin-bottom: 0.6rem;
}

.spin-board-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
}

.spin-cell {
    background: #1f2937;
    border-radius: 0.55rem;
    color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3rem;
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}

.spin-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, rgba(255,255,255,0.18), transparent 60%);
    transform: translateX(-100%);
}

.spin-cell.spin-anim::before {
    animation: spin-cell-glow 0.9s ease-out forwards;
}

.spin-cell span {
    position: relative;
    z-index: 1;
}

.spin-btn {
    margin-top: 0.2rem;
}

/* Congrats modal */

.congrats-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9500;
}

.congrats-modal {
    background: #ffffff;
    border-radius: 1.4rem;
    padding: 1.1rem 1.1rem 0.9rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    text-align: center;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35);
}

.congrats-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.congrats-code {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ec4899;
    margin: 0.4rem 0 0.3rem;
}

/* Music toggle */

.music-toggle {
    position: fixed;
    right: 0.8rem;
    bottom: 0.9rem;
    z-index: 9100;
}

/* Welcome modal */

.welcome-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.welcome-modal {
    background: #ffffff;
    border-radius: 1.2rem;
    padding: 0.9rem 0.9rem 0.7rem;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 20px 45px rgba(15,23,42,0.25);
    position: relative;
}

.welcome-modal-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.welcome-modal-body {
    font-size: 0.8rem;
    color: #4b5563;
}

.welcome-list {
    margin: 0.4rem 0 0.2rem;
    padding-left: 1.2rem;
    font-size: 0.8rem;
}

.welcome-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    border: none;
    background: #f3f4f6;
    border-radius: 999px;
    width: 1.6rem;
    height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Admin table */

.table-scroll {
    max-height: 420px;
    overflow: auto;
    border-radius: 1rem;
    border: 1px solid #f3f4f6;
    padding: 0.5rem;
    background: #f9fafb;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

th, td {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

th {
    background: #f3f4f6;
    position: sticky;
    top: 0;
}

.pill {
    display:inline-block;
    padding:2px 8px;
    border-radius:999px;
    font-size:0.7rem;
}
.pill-ok {background:#dcfce7;color:#166534;}
.pill-no {background:#fee2e2;color:#b91c1c;}
.pill-code {background:#eef2ff;color:#4f46e5;}

textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #ddd;
    padding: 4px 6px;
    font-size: 0.75rem;
    resize: vertical;
    min-height: 40px;
}

/* Animations */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

@keyframes robot-wave {
    0% { transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(-10deg) translateY(-2px); }
    50% { transform: rotate(8deg) translateY(0); }
    75% { transform: rotate(-6deg) translateY(-1px); }
    100% { transform: rotate(0deg) translateY(0); }
}

@keyframes loader-bar-move {
    0% { transform: translateX(-60%) scaleX(0.2); }
    50% { transform: translateX(0%) scaleX(1); }
    100% { transform: translateX(60%) scaleX(0.2); }
}

@keyframes spin-cell-glow {
    0% { transform: translateX(0); }
    50% { transform: translateX(10%); }
    100% { transform: translateX(0); }
}

/* Mobile tweaks */

@media (max-width: 480px) {
    html {
        font-size: 17px;
    }
    .cute-container {
        padding: 1.1rem;
        border-radius: 1.2rem;
    }
    .cute-title {
        font-size: 1.25rem;
    }
    .spin-board {
        width: 8rem;
    }
}
