/* -- Catppuccin Macchiato -- */
:root {
    --base:      #24273a;
    --mantle:    #1e2030;
    --crust:     #181926;
    --surface0:  #363a4f;
    --surface1:  #494d64;
    --surface2:  #5b6078;
    --overlay0:  #6e738d;
    --overlay1:  #8087a2;
    --overlay2:  #939ab7;
    --subtext0:  #a5adcb;
    --subtext1:  #b8c0e0;
    --text:      #cad3f5;
    --lavender:  #b7bdf8;
    --blue:      #8aadf4;
    --sapphire:  #7dc4e4;
    --sky:       #91d7e3;
    --teal:      #8bd5ca;
    --green:     #a6da95;
    --yellow:    #eed49f;
    --peach:     #f5a97f;
    --maroon:    #ee99a0;
    --red:       #ed8796;
    --mauve:     #c6a0f6;
    --pink:      #f5bde6;
    --flamingo:  #f0c6c6;
    --rosewater: #f4dbd6;
}

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

body {
    background: var(--base);
    color: var(--text);
    font-family: 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* -- Screens -- */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* -- Tabs -- */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* -- Auth Screen -- */
#auth-container {
    max-width: 400px;
    margin: 120px auto;
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

#auth-container h1 {
    font-size: 24px;
    color: var(--sapphire);
    margin-bottom: 8px;
}

#auth-container > p {
    font-size: 13px;
    color: var(--subtext0);
    margin-bottom: 28px;
}

#auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

#auth-tabs button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--subtext1);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#auth-tabs button.active {
    background: var(--sapphire);
    color: var(--crust);
    border-color: var(--sapphire);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    border-color: var(--sapphire);
}

.auth-form button {
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: var(--sapphire);
    color: var(--crust);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-form button:hover {
    opacity: 0.85;
}

.error-msg {
    font-size: 12px;
    color: var(--red);
    min-height: 16px;
}

/* -- Header -- */
#game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--mantle);
    border-bottom: 1px solid var(--surface0);
    position: sticky;
    top: 0;
    z-index: 100;
}

#header-logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--sapphire);
    min-width: 160px;
    flex: 1;
}

nav {
    display: flex;
    gap: 4px;
}

nav button {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--subtext0);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

nav button:hover {
    background: var(--surface0);
    color: var(--text);
}

nav button.active {
    background: var(--surface0);
    color: var(--sapphire);
}

#header-user {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 160px;
    justify-content: flex-end;
    flex: 1;
}

#header-username {
    font-size: 13px;
    color: var(--subtext1);
    font-weight: 600;
}

#header-gems,
#header-superchats {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    background: var(--surface0);
    padding: 4px 10px;
    border-radius: 6px;
}

#logout-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--surface1);
    background: transparent;
    color: var(--subtext0);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#logout-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

/* -- Main Content -- */
#game-content {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* -- Summon Tab -- */
#summon-banner {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
    margin-bottom: 24px;
}

#banner-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sapphire);
    margin-bottom: 8px;
}

#banner-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

#banner-desc {
    font-size: 13px;
    color: var(--subtext0);
}

#banner-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 280px;
}

#pity-container {
    background: var(--surface0);
    border-radius: 8px;
    padding: 12px 16px;
}

#pity-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--subtext1);
    margin-bottom: 8px;
}

#pity-count {
    color: var(--sapphire);
}

#pity-bar-track {
    height: 6px;
    background: var(--surface1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
}

#pity-bar-fill {
    height: 100%;
    background: var(--sapphire);
    border-radius: 6px;
    width: 0%;
    transition: width 0.4s ease;
}

#pity-hint {
    font-size: 11px;
    color: var(--overlay0);
}

#pull-buttons {
    display: flex;
    gap: 10px;
}

#pull-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#pull-buttons button:hover {
    border-color: var(--sapphire);
    background: var(--surface1);
}

#pull-buttons button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pull-cost {
    font-size: 12px;
    color: var(--sapphire);
    font-weight: 700;
}

/* -- Pull Results -- */
#pull-results {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
}

#pull-results h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 24px;
}

#pull-cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* -- Card Flip Animation -- */
.pull-card {
    width: 130px;
    height: 190px;
    perspective: 600px;
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 10px;
    opacity: 0;
    animation: cardSlideIn 0.4s ease forwards;
}

.pull-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
}

.pull-card.flipped .pull-card-inner {
    transform: rotateY(180deg);
}

.pull-card-front,
.pull-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}

/* -- Back face -- */
.pull-card-back {
    background: var(--surface0);
    border: 2px solid var(--surface1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pull-card-back-logo {
    font-size: 36px;
}

.pull-card-back-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--subtext0);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* -- Front face -- */
.pull-card-front {
    background: var(--surface0);
    border: 2px solid var(--surface1);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
}

.pull-card-front .pull-card-art {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.pull-card-front .pull-card-info {
    padding: 10px;
    text-align: center;
}

.pull-card-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.pull-card-rarity {
    font-size: 11px;
    font-weight: 600;
}

.pull-card-value {
    font-size: 11px;
    color: var(--subtext0);
    margin-top: 2px;
}

/* -- Rarity colours -- */
.rarity-Legendary  { color: var(--yellow);   border-color: var(--yellow)   !important; }
.rarity-Ultra-Rare { color: var(--mauve);    border-color: var(--mauve)    !important; }
.rarity-Super-Rare { color: var(--blue);     border-color: var(--blue)     !important; }
.rarity-Rare       { color: var(--teal);     border-color: var(--teal)     !important; }
.rarity-Common     { color: var(--overlay1); border-color: var(--overlay1) !important; }

/* -- Shake and glow -- */
@keyframes cardShake {
    0%,100% { transform: rotate(0deg); }
    20%      { transform: rotate(-3deg); }
    40%      { transform: rotate(3deg); }
    60%      { transform: rotate(-2deg); }
    80%      { transform: rotate(2deg); }
}

@keyframes cardGlow {
    0%,100% { box-shadow: 0 0 6px  rgba(125, 196, 228, 0.3); }
    50%      { box-shadow: 0 0 20px rgba(125, 196, 228, 0.8); }
}

.pull-card.ready .pull-card-inner {
    animation:
        cardShake 0.5s ease 0.1s,
        cardGlow  1.2s ease infinite;
}

.pull-card.flipped .pull-card-inner {
    animation: none;
}

/* -- Slide in -- */
@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#dismiss-btn {
    padding: 10px 32px;
    border-radius: 8px;
    border: none;
    background: var(--sapphire);
    color: var(--crust);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

#dismiss-btn:hover {
    opacity: 0.85;
}

/* -- Collection Tab -- */
#collection-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

#collection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

#collection-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

#collection-count {
    font-size: 12px;
    color: var(--subtext0);
    font-weight: 600;
}

#collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 120px));
    gap: 12px;
}

.collection-card {
    background: var(--surface0);
    border: 2px solid var(--surface1);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.collection-card:hover {
    transform: translateY(-3px);
    border-color: var(--sapphire);
}

.collection-card.selected {
    border-color: var(--sapphire);
    box-shadow: 0 0 0 2px var(--sapphire);
}

.collection-card.staked {
    border-color: var(--green);
}

.collection-card.staked.selected {
    border-color: var(--green);
    box-shadow: 0 0 0 2px var(--green);
}

.collection-card-art {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    position: relative;
}

.staked-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    background: var(--green);
    color: var(--crust);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.upgrade-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--peach);
    animation: upgradeGlow 1.8s ease-in-out infinite;
}

@keyframes upgradeGlow {
    0%, 100% { box-shadow: 0 0 3px 1px rgba(245, 169, 127, 0.5); }
    50%       { box-shadow: 0 0 8px 3px rgba(245, 169, 127, 0.9); }
}

.collection-card-info {
    padding: 8px;
    text-align: center;
}

.collection-card-name {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.collection-card-level {
    font-size: 10px;
    color: var(--subtext0);
    margin-bottom: 4px;
}

.collection-card-stats {
    display: flex;
    justify-content: space-between;
    padding: 5px 6px;
    background: var(--surface1);
    border-top: 1px solid var(--surface2);
    gap: 4px;
}

.collection-card-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.collection-card-stat-val {
    font-size: 10px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
}

.collection-card-stat-lbl {
    font-size: 9px;
    color: var(--subtext0);
    white-space: nowrap;
}

/* -- Detail Panel -- */
#collection-detail {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 24px;
    position: sticky;
    top: 80px;
}

#detail-card-art {
    font-size: 64px;
    text-align: center;
    margin-bottom: 8px;
}

#detail-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: 4px;
}

#detail-card-rarity {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

#detail-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: var(--surface0);
    border-radius: 6px;
    font-size: 13px;
}

.detail-stat-label {
    color: var(--subtext0);
    font-weight: 600;
}

.detail-stat-value {
    color: var(--text);
    font-weight: 700;
}

#detail-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#detail-actions button {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#detail-stake-btn:hover {
    border-color: var(--green);
    color: var(--green);
}

#detail-upgrade-btn:hover {
    border-color: var(--yellow);
    color: var(--yellow);
}

#detail-sell-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

#detail-actions button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.rarity-divider {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 6px;
    border-bottom: 1px solid currentColor;
    margin-top: 20px;
    opacity: 0.7;
}

.rarity-divider.first {
    margin-top: 0;
}

.empty-collection {
    color: var(--subtext0);
    font-size: 14px;
    text-align: center;
    padding: 40px 0;
}

/* -- Claim Tab -- */
#claim-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

#claim-summary {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

#claim-total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--subtext0);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

#claim-total {
    font-size: 32px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 6px;
}

#claim-last-claimed {
    font-size: 12px;
    color: var(--subtext0);
}

#claim-btn {
    padding: 14px 28px;
    border-radius: 10px;
    border: none;
    background: var(--green);
    color: var(--crust);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

#claim-btn:hover:not(:disabled) {
    opacity: 0.85;
    transform: translateY(-1px);
}

#claim-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#claim-cards-wrap h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

#claim-cards-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.claim-card-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 10px;
    padding: 14px 18px;
}

.claim-card-emoji {
    font-size: 28px;
    flex-shrink: 0;
}

.claim-card-info {
    flex: 1;
}

.claim-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.claim-card-meta {
    font-size: 12px;
    color: var(--subtext0);
}

.claim-card-earning {
    font-size: 15px;
    font-weight: 800;
    color: var(--green);
    flex-shrink: 0;
}

.empty-staked {
    font-size: 14px;
    color: var(--subtext0);
    text-align: center;
    padding: 32px 0;
}

/* -- Claim Result -- */
#claim-result {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 24px 28px;
}

#claim-result h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
}

#claim-result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}


#claim-result-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--green);
    text-align: right;
    padding-top: 10px;
    border-top: 1px solid var(--surface1);
}


/* -- Claim main layout -- */
#claim-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    gap: 20px 20px;
    align-items: start;
}

/* -- Chart panel -- */
#claim-chart-panel {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 80px;
}

#claim-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#claim-chart-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

#claim-chart-change {
    font-size: 13px;
    font-weight: 700;
}

#claim-chart-change.up   { color: var(--green); }
#claim-chart-change.down { color: var(--red); }
#claim-chart-change.flat { color: var(--subtext0); }

#claim-chart canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

#claim-chart-meta {
    font-size: 11px;
    color: var(--subtext0);
    text-align: center;
    margin-top: 10px;
}

#claim-chart {
    width: 100%;
    height: auto;
    display: block;
}

#claim-live-heading {
    grid-column: 1 / -1;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* -- Streak Section -- */
#streak-section {
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

#streak-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

#streak-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

#streak-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--yellow);
}

#streak-cards {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.streak-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border-radius: 10px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    text-align: center;
    transition: all 0.2s;
}

.streak-day {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--subtext0);
}

.streak-icon {
    font-size: 22px;
    line-height: 1;
}

.streak-amount {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
}

.streak-claim-btn {
    margin-top: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--yellow);
    background: transparent;
    color: var(--yellow);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.streak-claim-btn:hover {
    background: var(--yellow);
    color: var(--crust);
}

/* Past / claimed — greyed out */
.streak-past,
.streak-claimed {
    opacity: 0.4;
}

.streak-past .streak-icon,
.streak-claimed .streak-icon {
    font-size: 18px;
    color: var(--green);
}


/* Current — glowing */
.streak-current {
    border-color: var(--sapphire);
    animation: cardGlow 1.2s ease infinite;
}

/* -- Quests Tab -- */
#quests-layout {
    max-width: 640px;
    margin: 0 auto;
}

#quests-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

#quests-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

#quests-reset-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--subtext0);
}

#quests-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

#weekly-quests-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

#weekly-quests-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

#weekly-reset-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--subtext0);
}

#weekly-quests-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quest-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--mantle);
    border: 1px solid var(--surface0);
    border-radius: 10px;
    padding: 16px 18px;
    transition: border-color 0.2s;
}

.quest-row.quest-complete {
    border-color: var(--sapphire);
}

.quest-row.quest-weekly.quest-complete {
    border-color: var(--yellow);
}

.quest-row.quest-claimed {
    opacity: 0.5;
    border-color: var(--surface0);
}

.quest-emoji {
    font-size: 28px;
    flex-shrink: 0;
}

.quest-info {
    flex: 1;
    min-width: 0;
}

.quest-description {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.quest-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quest-progress-track {
    flex: 1;
    height: 6px;
    background: var(--surface1);
    border-radius: 6px;
    overflow: hidden;
}

.quest-progress-fill {
    height: 100%;
    background: var(--sapphire);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.quest-progress-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--subtext0);
    white-space: nowrap;
}

.quest-reward {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.quest-reward-amount {
    font-size: 14px;
    font-weight: 800;
    color: var(--yellow);
}

.quest-claim-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--subtext1);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quest-claim-btn:not(:disabled):hover {
    border-color: var(--sapphire);
    color: var(--sapphire);
}

.quest-claim-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quest-row.quest-complete .quest-claim-btn:not(:disabled) {
    border-color: var(--sapphire);
    color: var(--sapphire);
}

.quest-row.quest-weekly.quest-complete .quest-claim-btn:not(:disabled) {
    border-color: var(--yellow);
    color: var(--yellow);
}

.quest-row.quest-weekly .quest-progress-fill {
    background: var(--yellow);
}

/* -- Upgrade Modal -- */
#upgrade-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#upgrade-modal {
    background: var(--mantle);
    border: 1px solid var(--surface1);
    border-radius: 16px;
    padding: 28px;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

#upgrade-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

#upgrade-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

#upgrade-modal-header button {
    background: none;
    border: none;
    color: var(--subtext0);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s;
}

#upgrade-modal-header button:hover {
    color: var(--red);
}

#upgrade-modal-slots {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

#upgrade-arrow {
    font-size: 28px;
    font-weight: 700;
    color: var(--yellow);
    flex-shrink: 0;
}

.upgrade-card-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px;
    background: var(--surface0);
    border-radius: 10px;
    text-align: center;
    width: 100%;
}

.upgrade-card-emoji {
    font-size: 48px;
}

.upgrade-card-name {
    font-size: 13px;
    font-weight: 700;
}

.upgrade-card-level {
    font-size: 12px;
    color: var(--subtext0);
}

.upgrade-card-cost {
    font-size: 12px;
    color: var(--yellow);
    font-weight: 600;
}

#upgrade-target-card {
    flex: 1;
}

#upgrade-drop-slot {
    flex: 1;
    min-height: 148px;
    border: 2px dashed var(--surface2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

#upgrade-drop-slot.drag-over {
    border-color: var(--yellow);
    background: rgba(238, 212, 159, 0.05);
}

#upgrade-drop-placeholder {
    text-align: center;
    color: var(--subtext0);
    font-size: 13px;
    line-height: 2;
}

#upgrade-dupe-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--subtext0);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

#upgrade-dupe-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    max-height: 220px;
    overflow-y: auto;
}

.upgrade-dupe-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 12px;
    background: var(--surface0);
    border: 2px solid var(--surface1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 88px;
}

.upgrade-dupe-card:hover {
    border-color: var(--yellow);
}

.upgrade-dupe-card.selected {
    border-color: var(--yellow);
    background: var(--surface1);
    box-shadow: 0 0 0 2px var(--yellow);
}

.upgrade-dupe-emoji {
    font-size: 28px;
}

.upgrade-dupe-name {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.upgrade-dupe-level {
    font-size: 10px;
    color: var(--subtext0);
}

#upgrade-modal-actions {
    display: flex;
    gap: 10px;
}

#upgrade-modal-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--surface1);
    background: var(--surface0);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#upgrade-confirm-btn:not(:disabled):hover {
    border-color: var(--yellow);
    color: var(--yellow);
}

#upgrade-confirm-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

#upgrade-cancel-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

.upgrade-dupe-card.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* -- Slot cards (materials placed in the drop zone) -- */
#upgrade-drop-slot:has(.upgrade-slot-card) {
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 8px;
    padding: 10px;
}

.upgrade-slot-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 10px;
    background: var(--surface1);
    border: 1px solid var(--surface2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 72px;
    position: relative;
}

.upgrade-slot-card:hover {
    border-color: var(--red);
    background: var(--surface0);
}

.upgrade-slot-card:hover .upgrade-slot-remove {
    opacity: 1;
}

.upgrade-slot-emoji {
    font-size: 24px;
}

.upgrade-slot-level {
    font-size: 10px;
    font-weight: 700;
}

.upgrade-slot-remove {
    font-size: 9px;
    color: var(--red);
    opacity: 0;
    transition: opacity 0.15s;
    font-weight: 700;
}