/* ═══════════════════════════════════════════════════════════════════════
   Quest System Styles — Polished to match Familiar Tab UI
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Quest card base (replaces db-card on quest page) ── */
.quest-card {
    background: rgba(20, 20, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 1rem 1rem 0.85rem;
    margin: 0 0.25rem 0.75rem;
}

/* ── Quest card header ── */
.quest-card__header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.75rem;
}
.quest-card__header-left {
    display: flex; align-items: center; gap: 0.45rem;
}
.quest-card__header-left img,
.quest-card__header-left svg {
    width: 20px; height: 20px; object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(212, 175, 55, 0.3));
    color: var(--color-gold);
}
.quest-card__label {
    font-family: var(--font-display);
    font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--color-gold);
}

/* ── Streak badge (pill in header) ── */
.quest-streak-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-family: var(--font-display); font-size: 0.65rem;
    color: var(--color-gold); letter-spacing: 0.04em;
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.18);
    padding: 0.2rem 0.6rem; border-radius: 20px;
}
.quest-streak-badge svg {
    width: 14px; height: 14px; color: var(--color-gold);
    filter: none;
}

/* ── Progress track (ritual progress) ── */
.quest-progress-track {
    display: flex; align-items: center; gap: 0.75rem;
}
.quest-progress-track__bar {
    flex: 1; height: 10px; border-radius: 6px;
    background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.quest-progress-track__fill {
    height: 100%; border-radius: 6px;
    background: linear-gradient(90deg, rgba(168, 139, 250, 0.7), var(--color-gold));
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}
.quest-progress-track__pct {
    font-family: var(--font-display); font-size: 0.7rem;
    color: var(--color-gold); min-width: 32px; text-align: right;
}

/* ── Ritual hint text ── */
.quest-ritual-hint {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
    text-align: center;
}

/* ── Discovery count badge ── */
.quest-disc-count {
    font-family: var(--font-display); font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4); letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════════════════════════════
   Quest CTA Area — State-based content
   ═══════════════════════════════════════════════════════════════════════ */
.quest-cta-card {
    overflow: hidden;
    text-align: center;
}

.quest-cta {
    text-align: center;
    padding: 1.5rem 1rem;
}

.quest-cta__icon {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(168, 139, 250, 0.08);
    border: 1.5px solid rgba(168, 139, 250, 0.15);
}
.quest-cta__icon img {
    width: 36px; height: 36px; object-fit: contain;
}

.quest-cta__icon--spin {
    border-color: rgba(168, 139, 250, 0.25);
}
.quest-cta__icon--spin img {
    animation: questIconSpin 4s linear infinite;
}
@keyframes questIconSpin {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.quest-cta__icon--glow {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.25);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15);
    animation: questGlow 2s ease-in-out infinite;
}
@keyframes questGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.15); }
    50% { box-shadow: 0 0 35px rgba(212, 175, 55, 0.3); }
}

.quest-cta__icon--done {
    background: rgba(76, 175, 80, 0.08);
    border-color: rgba(76, 175, 80, 0.2);
}

.quest-cta__title {
    font-family: var(--font-display);
    font-size: 1.1rem; font-weight: 600;
    color: #fff;
    margin: 0 0 0.4rem;
}

.quest-cta__desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 0.85rem;
    line-height: 1.45;
}
.quest-cta__desc--muted {
    color: rgba(255, 255, 255, 0.35);
}

.quest-cta__dest {
    font-size: 0.85rem;
    color: var(--color-gold);
    margin: 0 0 0.75rem;
    font-family: var(--font-display);
}

/* ── Ritual progress bar inside CTA ── */
.quest-cta__bar-wrap {
    display: flex; align-items: center; gap: 0.75rem;
    max-width: 280px; margin: 0 auto;
}
.quest-cta__bar {
    flex: 1; height: 8px; border-radius: 4px;
    background: rgba(255, 255, 255, 0.06); overflow: hidden;
}
.quest-cta__bar-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, rgba(168, 139, 250, 0.6), var(--color-gold));
    transition: width 0.6s ease;
}
.quest-cta__bar-text {
    font-family: var(--font-display); font-size: 0.7rem;
    color: var(--color-gold); min-width: 32px; text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   Destination Picker
   ═══════════════════════════════════════════════════════════════════════ */
.quest-dest-picker {
    display: flex; gap: 0.75rem;
    justify-content: center; margin-bottom: 1.25rem;
}
.quest-dest-btn {
    display: flex; flex-direction: column; align-items: center; gap: 0.45rem;
    padding: 1rem 1.75rem;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.quest-dest-btn:hover {
    border-color: rgba(168, 139, 250, 0.25);
    background: rgba(168, 139, 250, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.quest-dest-btn--selected {
    border-color: var(--color-gold) !important;
    background: rgba(212, 175, 55, 0.06) !important;
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.12);
}
.quest-dest-btn__icon {
    font-size: 2rem; line-height: 1;
}
.quest-dest-btn__name {
    font-family: var(--font-display); font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7); letter-spacing: 0.04em;
}
.quest-dest-btn--selected .quest-dest-btn__name {
    color: var(--color-gold);
}

/* ═══════════════════════════════════════════════════════════════════════
   Action Buttons (Start / Claim / Dismiss)
   ═══════════════════════════════════════════════════════════════════════ */
.quest-action-btn {
    display: block; width: 100%; max-width: 260px;
    margin: 0 auto; padding: 0.75rem 1.5rem;
    font-family: var(--font-display); font-size: 0.8rem;
    font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    border: none; border-radius: 50px; cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.quest-action-btn--primary {
    background: linear-gradient(135deg, rgba(168, 139, 250, 0.8), rgba(120, 100, 200, 0.9));
    color: #fff;
    box-shadow: 0 4px 16px rgba(168, 139, 250, 0.2);
}
.quest-action-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(168, 139, 250, 0.3);
}
.quest-action-btn--primary:active {
    transform: scale(0.97);
}
.quest-action-btn--primary:disabled {
    opacity: 0.35; cursor: not-allowed;
    transform: none; box-shadow: none;
}
.quest-action-btn--gold {
    background: linear-gradient(135deg, var(--color-gold), #c084fc);
    color: #fff;
    animation: questClaimPulse 2s ease-in-out infinite;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
}
.quest-action-btn--gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(212, 175, 55, 0.3);
}
@keyframes questClaimPulse {
    0%, 100% { box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2); }
    50% { box-shadow: 0 4px 24px rgba(212, 175, 55, 0.35); }
}

/* ═══════════════════════════════════════════════════════════════════════
   Quest Timer
   ═══════════════════════════════════════════════════════════════════════ */
.quest-timer {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.2rem; margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2); border-radius: 16px;
    max-width: 220px; margin-left: auto; margin-right: auto;
}
.quest-timer__label {
    font-family: var(--font-display);
    font-size: 0.55rem; letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.35); text-transform: uppercase;
}
.quest-timer__value {
    font-family: var(--font-display);
    font-size: 2rem; font-weight: 700;
    color: var(--color-gold); letter-spacing: 0.06em;
    text-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════
   Reward Reveal Overlay
   ═══════════════════════════════════════════════════════════════════════ */
.quest-reward-reveal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0; transition: opacity 0.3s;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.quest-reward-reveal--visible {
    opacity: 1;
}
.quest-reward-reveal__content {
    text-align: center; padding: 2.5rem 1.5rem;
    max-width: 320px; width: 90%;
    border-radius: 24px;
    background: rgba(25, 18, 45, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    transform: scale(0.8); transition: transform 0.3s;
}
.quest-reward-reveal--visible .quest-reward-reveal__content {
    transform: scale(1);
}
.quest-reward-reveal__sparkle {
    width: 90px; height: 90px;
    margin: 0 auto 1rem; border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.25) 0%, transparent 70%);
    animation: questSparkle 2s ease-in-out infinite;
}
@keyframes questSparkle {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
}
.quest-reward-reveal__img {
    width: 80px; height: 80px; object-fit: contain;
    margin: -65px auto 1rem; position: relative;
    filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.4));
}
.quest-reward-reveal__title {
    font-family: var(--font-display); font-size: 1.15rem;
    color: var(--color-gold); margin: 0 0 0.3rem;
}
.quest-reward-reveal__xp {
    font-family: var(--font-display); font-size: 0.85rem;
    color: rgba(168, 139, 250, 0.8); margin: 0 0 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   Special Quests — Locked Items
   ═══════════════════════════════════════════════════════════════════════ */
.quest-special-list {
    display: flex; flex-direction: column; gap: 0.4rem;
}
.quest-special {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 0.75rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s, border-color 0.15s;
}
.quest-special--locked {
    opacity: 0.45;
}
.quest-special__icon-wrap {
    flex-shrink: 0;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
}
/* Legacy emoji icon fallback */
.quest-special__icon {
    font-size: 1.2rem; flex-shrink: 0; width: 32px; text-align: center;
}
.quest-special__info {
    display: flex; flex-direction: column; gap: 0.15rem;
}
.quest-special__name {
    font-family: var(--font-display); font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}
.quest-special__req {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Legacy button compat — old selectors still in quest JS */
.quest-start-btn { /* mapped to quest-action-btn--primary */ }
.quest-claim-btn { /* mapped to quest-action-btn--gold */ }

/* ═══════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 374px) {
    .quest-card { padding: 0.75rem; border-radius: 16px; }
    .quest-cta { padding: 1rem 0.75rem; }
    .quest-cta__icon { width: 52px; height: 52px; }
    .quest-cta__icon img { width: 30px; height: 30px; }
    .quest-dest-btn { padding: 0.75rem 1rem; }
    .quest-timer__value { font-size: 1.6rem; }
}
@media (min-width: 768px) {
    .quest-card { max-width: 560px; margin-left: auto; margin-right: auto; padding: 1.25rem; }
    .quest-cta { padding: 2rem 1.5rem; }
    .quest-cta__icon { width: 72px; height: 72px; }
    .quest-cta__icon img { width: 44px; height: 44px; }
    .quest-cta__title { font-size: 1.25rem; }
    .quest-dest-btn { padding: 1.25rem 2rem; border-radius: 18px; }
    .quest-timer__value { font-size: 2.2rem; }
    .quest-action-btn { max-width: 300px; padding: 0.85rem 2rem; font-size: 0.85rem; }
}
