:root {
    --bg: #190f2e;
    --card: #2b1d46;
    --card2: #37245a;
    --text: #fff7ff;
    --muted: #d6c7ef;
    --gold: #ffd166;
    --pink: #ff7ab6;
    --blue: #7bdff2;
    --green: #9ef7ab;
    --danger: #ff6b6b;
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at top, #51307c 0, #190f2e 48%, #10091f 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: #caa7ff;
    text-decoration: none;
}

.wrap {
    max-width: 1050px;
    margin: 0 auto;
    padding: 18px;
}

.footer {
    text-align: center;
    color: var(--muted);
    padding: 24px;
}

/* Topbar / nav */
.topbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    font-size: 1.35rem;
}

.brand img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid var(--gold);
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn,
button,
input[type=submit] {
    border: 0;
    border-radius: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--pink), #8e6cff);
    color: white;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px #0005;
}

.btn.secondary,
button.secondary {
    background: #372b58;
}

.gold {
    background: linear-gradient(135deg, #ffdf93, var(--gold));
    color: #2b1d46;
}

.disabled-button {
    width: 100%;
    opacity: 0.55;
    cursor: not-allowed;
}

/* Cards / layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.card {
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid #ffffff18;
    border-radius: 24px;
    padding: 18px;
    box-shadow: 0 18px 35px #0004;
}

.hero {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 18px;
    align-items: center;
}

.ziggy {
    width: 100%;
    border-radius: 24px;
    border: 2px solid #ffffff24;
}

.big {
    font-size: 2.2rem;
    font-weight: 950;
}

.muted {
    color: var(--muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ffffff16;
    color: #fff;
    margin: 4px 4px 0 0;
    font-weight: 700;
}

/* Progress bars */
.progress {
    height: 18px;
    background: #160d28;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #ffffff25;
}

.bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green), var(--gold));
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px;
    border-bottom: 1px solid #ffffff18;
    text-align: left;
}

/* Forms */
input,
textarea,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #ffffff24;
    background: #140c25;
    color: var(--text);
    font: inherit;
}

label {
    font-weight: 800;
    display: block;
    margin: 12px 0 6px;
}

.success {
    background: #1f7a3a;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 12px;
}

.error {
    background: #7a1f3a;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 12px;
}

/* Status */
.status {
    font-weight: 900;
}

.approved {
    color: var(--green);
}

.rejected {
    color: var(--danger);
}

/* Dashboard layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 24px;
    align-items: start;
    margin-top: 24px;
}

.main-column {
    min-width: 0;
}

.quest-sidebar {
    position: sticky;
    top: 20px;
}

.quest-sidebar h2 {
    margin-top: 0;
}

/* Weekly summary */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 22px 0 26px;
}

.summary-card {
    padding: 16px;
}

.summary-number {
    font-size: 2rem;
    font-weight: 950;
    margin-top: 10px;
}

.summary-card .muted {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* Quests */
.quest-card {
    margin-bottom: 16px;
}

.quest-card h3 {
    margin-bottom: 8px;
}

.quest-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quest-progress-label {
    margin: 12px 0 6px;
    font-weight: 900;
    color: var(--muted);
    font-size: 0.9rem;
}

.quest-progress {
    height: 12px;
    background: #160d28;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #ffffff25;
    margin-bottom: 12px;
}

.quest-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green), var(--gold));
}

.quest-complete {
    border-color: #9ef7ab66;
    box-shadow: 0 0 24px #9ef7ab18, 0 18px 35px #0004;
}

.complete-pill {
    background: #1f7a3a;
}

.ready-pill {
    background: #7b5cff;
}

.ready-text {
    color: var(--gold);
}

.awarded-text {
    color: var(--green);
}

/* Admin current weekly quests */
.current-quests-list-card {
    padding: 16px;
    margin-bottom: 32px;
}

.current-quest-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.35fr) 110px minmax(220px, 1.45fr) 120px 90px;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 16px;
    background: #ffffff0d;
    border: 1px solid #ffffff16;
    margin-bottom: 10px;
}

.current-quest-row:last-child {
    margin-bottom: 0;
}

.current-quest-title {
    font-weight: 900;
    font-size: 1rem;
    margin-bottom: 4px;
}

.current-quest-desc {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.3;
}

.current-quest-child {
    font-weight: 900;
    color: var(--gold);
}

.current-quest-progress-label {
    font-weight: 900;
    font-size: 0.86rem;
    margin-bottom: 6px;
    color: var(--muted);
}

.compact-progress {
    height: 8px;
    margin-bottom: 0;
}

.current-quest-status .pill {
    white-space: nowrap;
}

.current-quest-reward {
    font-weight: 900;
    color: var(--gold);
    font-size: 0.95rem;
    text-align: right;
    white-space: nowrap;
}

.quest-row-complete {
    border-color: #9ef7ab66;
    box-shadow: 0 0 18px #9ef7ab12;
}

/* Submit reading */
.submit-hero {
    margin-bottom: 22px;
}

.reading-form {
    max-width: 780px;
    margin: 0 auto;
}

.reading-form h2 {
    margin-top: 24px;
    margin-bottom: 10px;
}

.reading-form h2:first-child {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.finish-check {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff10;
    border: 1px solid #ffffff18;
    border-radius: 18px;
    padding: 14px;
    margin-top: 18px;
    cursor: pointer;
}

.finish-check input {
    width: auto;
    transform: scale(1.3);
}

.finish-check span {
    font-weight: 900;
}

.finish-check small {
    display: block;
    color: var(--gold);
    font-weight: 800;
    margin-top: 4px;
}

.points-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #140c25;
    border: 1px solid #ffffff18;
    border-radius: 18px;
    padding: 14px 16px;
    margin-top: 18px;
}

.points-preview span {
    color: var(--muted);
}

.points-preview strong {
    color: var(--gold);
    font-size: 1.1rem;
}

.submit-button {
    width: 100%;
    margin-top: 18px;
}

/* Reward shop */
.shop-hero {
    margin-bottom: 22px;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.reward-card {
    display: flex;
    flex-direction: column;
    min-height: 330px;
}

.reward-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.reward-description {
    min-height: 48px;
}

.reward-cost {
    font-size: 2.4rem;
    font-weight: 950;
    letter-spacing: 2px;
    margin-top: auto;
}

.reward-card form {
    margin-top: 10px;
}

.reward-card button {
    width: 100%;
    margin-top: 10px;
}

.affordable {
    background: #1f7a3a;
}

.locked {
    background: #ffffff12;
    color: var(--muted);
}

.save-box {
    background: #140c25;
    border: 1px solid #ffffff18;
    border-radius: 14px;
    padding: 12px;
    margin: 10px 0;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.pending-card {
    border-color: #ffd16666;
}

.legendary-card {
    border-color: #ffd16688;
    box-shadow: 0 0 30px #ffd16618, 0 18px 35px #0004;
}

/* Admin rewards / quests editor */
.rewards-admin-grid {
    align-items: start;
}

.add-reward-card {
    align-self: start;
}

.rewards-list-card {
    max-height: 75vh;
    overflow-y: auto;
}

.reward-edit-card {
    background: #ffffff0d;
    border: 1px solid #ffffff18;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 18px;
}

.reward-edit-card textarea {
    min-height: 90px;
}

.reward-admin-actions {
    margin-top: 12px;
}

.reward-admin-actions button {
    width: 100%;
}

/* Admin tools */
.tool-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.tool-amount {
    width: 180px;
    max-width: 100%;
}

.tool-row button {
    margin-top: 0;
}

/* Approval cards */
.approval-card h2 {
    margin-bottom: 6px;
}

.approval-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.approval-stats div {
    background: #140c25;
    border: 1px solid #ffffff18;
    border-radius: 16px;
    padding: 12px;
    text-align: center;
}

.approval-stats strong {
    display: block;
    font-size: 1.4rem;
    color: var(--gold);
}

.approval-stats span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.summary-box {
    background: #ffffff10;
    border: 1px solid #ffffff18;
    border-radius: 16px;
    padding: 14px;
    margin: 14px 0;
    line-height: 1.4;
}

.approval-actions {
    margin-top: 16px;
}

.approval-actions input {
    margin-bottom: 12px;
}

.approval-actions button {
    width: 100%;
    margin-top: 10px;
}

.approval-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.bonus-input {
    width: 120px;
    max-width: 100%;
}

.approval-row button {
    margin-top: 0;
    width: auto;
}

/* Companion */
.companion-hero {
    margin-bottom: 24px;
}

.companion-preview {
    width: 180px;
    height: 180px;
    object-fit: contain;
    object-position: center bottom;
    background: #ffffff0d;
}

.companion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 18px;
}

.companion-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid #ffffff18;
    border-radius: 22px;
    padding: 14px;
    cursor: pointer;
    box-shadow: 0 14px 30px #0003;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.companion-card:hover {
    transform: translateY(-3px);
    border-color: #ffd16655;
}

.companion-card input {
    display: none;
}

.companion-card img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    object-position: center bottom;
    margin-bottom: 10px;
}

.companion-card span {
    font-weight: 900;
    text-align: center;
}

.selected-companion {
    border-color: var(--gold);
    box-shadow: 0 0 28px #ffd16622, 0 14px 30px #0004;
}

.selected-companion::after {
    content: "Selected";
    margin-top: 10px;
    padding: 7px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffdf93, var(--gold));
    color: #2b1d46;
    font-size: 0.8rem;
    font-weight: 900;
}

.save-companion-bar {
    margin-top: 22px;
    display: flex;
    justify-content: center;
}

.save-companion-bar button {
    min-width: 220px;
}

/* Old companion choices */
.choice {
    display: inline-block;
    margin: 8px;
}

.choice label {
    background: #ffffff12;
    padding: 12px;
    border-radius: 14px;
    display: block;
}

/* Mobile */
@media (max-width: 900px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .quest-sidebar {
        position: static;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .current-quest-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .current-quest-reward {
        text-align: left;
    }
}

@media (max-width: 650px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .big {
        font-size: 2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .points-preview {
        flex-direction: column;
        align-items: flex-start;
    }

    .tool-row {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-amount {
        width: 100%;
    }

    .approval-stats {
        grid-template-columns: 1fr;
    }

    .approval-row {
        flex-direction: column;
        align-items: stretch;
    }

    .bonus-input {
        width: 100%;
    }

    .approval-row button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}