#page-quests {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    width: 100%;
    padding-top: 20px;
}

#page-quests > * {
    flex-shrink: 0;
}

#quests-container {
    flex-shrink: 1;
}

#page-quests h1 {
    margin-top: 0;
}
#quests-container {
    width: 90%;
    max-width: 400px;
    margin: 10px auto 20px auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    padding-bottom: 20px;
}

.quest-card {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    text-align: left;
    transition: 0.2s;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
    border: 4px solid transparent;
}

.quest-card.completed {
    border-color: rgba(0, 255, 0, 1);
    background: rgba(0, 80, 0, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.8), inset 0 0 10px rgba(0, 255, 0, 0.3);
}
.quest-emoji {
    font-size: 20px;
    vertical-align: middle;
    line-height: 1;
}
.quest-progress-bar {
    width: 100%;
    height: 10px;
    background: #b46aff;
    overflow: hidden;
}

.quest-progress-fill {
    height: 100%;
    background: #5a2a8a;
    transition: width 0.4s ease;
}

.quest-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    min-height: 60px;
}

.quest-title-text {
    flex: 1;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    text-align: left;
}

.quest-progress-mini {
    font-size: 12px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
}

.quest-arrow {
    font-size: 14px;
    color: #FFD700;
    transition: transform 0.3s ease;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.8);
}

.quest-card.expanded .quest-arrow {
    transform: rotate(90deg);
}

.quest-hint-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.quest-card.expanded .quest-hint-wrap {
    max-height: 120px;
}

.quest-hint {
    padding: 8px 12px 10px 12px;
    font-size: 11px;
    color: #ccc;
    line-height: 1.3;
    text-align: left;
    background: rgba(0, 0, 0, 0.4);
}

.quest-locked {
    text-align: center;
    color: #fff;
    font-size: 16px;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    margin: 0 auto;
    width: 90%;
    max-width: 400px;
}

.quest-action-btn {
    position: relative;
    overflow: hidden;
    padding: 0;
    background-image: url('/zabrat.webp');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    border-radius: 0;
    width: 200px;
    height: 60px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    
    margin: 10px auto;
    z-index: 10;
}

.quest-action-btn::after {
    content: '';
    position: absolute;
    top: 10%;
    left: -75%;
    width: 50%;
    height: 80%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: questShine 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes questShine {
    0%   { left: -75%; }
    60%  { left: 125%; }
    100% { left: 125%; }
}

.quest-action-btn:disabled::after {
    animation: none;
}
.quest-note {
    font-size: 13px;
    color: #aaa;
    text-align: center;
    margin: 8px auto;
    max-width: 350px;
}
/* === Анимация шарика перед наградой === */
.quest-scene {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(120, 200, 255, 0.8), rgba(80, 120, 255, 0.3) 50%, transparent 75%);
    filter: blur(30px);
    animation: questPulse 2.5s ease-in-out infinite;
}

@keyframes questPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50%      { transform: scale(1.25); opacity: 0.85; }
}

.quest-ring {
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 2px solid rgba(150, 220, 255, 0.35);
    box-shadow: 0 0 25px rgba(100, 180, 255, 0.5);
    animation: questSpin 6s linear infinite;
}

.quest-ring2 {
    position: absolute;
    width: 310px;
    height: 310px;
    border-radius: 50%;
    border: 1px dashed rgba(180, 230, 255, 0.25);
    animation: questSpinBack 9s linear infinite;
}

@keyframes questSpin {
    from { transform: rotate(0deg) rotateX(70deg); }
    to   { transform: rotate(360deg) rotateX(70deg); }
}

@keyframes questSpinBack {
    from { transform: rotate(360deg) rotateX(-65deg); }
    to   { transform: rotate(0deg) rotateX(-65deg); }
}

.quest-ball {
    position: relative;
    width: 120px;
    height: 120px;
    object-fit: contain;
    filter:
        drop-shadow(0 0 30px rgba(120, 200, 255, 0.9))
        drop-shadow(0 0 60px rgba(80, 150, 255, 0.5));
    animation: questFloat 2s linear infinite;
}

@keyframes questFloat {
    0%   { transform: translateY(0)     rotateY(0deg); }
    50%  { transform: translateY(-20px) rotateY(180deg); }
    100% { transform: translateY(0)     rotateY(360deg); }
}

.quest-spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #9fe4ff, 0 0 20px #9fe4ff;
    animation: questSparkle 2s ease-in-out infinite;
}

.quest-spark:nth-child(1) { top: 15%; left: 20%; animation-delay: 0s; }
.quest-spark:nth-child(2) { top: 70%; left: 80%; animation-delay: 0.4s; }
.quest-spark:nth-child(3) { top: 25%; left: 85%; animation-delay: 0.8s; }
.quest-spark:nth-child(4) { top: 80%; left: 15%; animation-delay: 1.2s; }
.quest-spark:nth-child(5) { top: 50%; left: 5%;  animation-delay: 1.6s; }
.quest-spark:nth-child(6) { top: 10%; left: 60%; animation-delay: 0.6s; }

@keyframes questSparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50%      { opacity: 1; transform: scale(1.5); }
}
@keyframes questSparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50%      { opacity: 1; transform: scale(1.5); }
}
.quest-action-btn:disabled {
    opacity: 0.5;
}
/* === КОЛЕСО КВЕСТОВ === */
.quest-wheel-scene {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.6s ease-out;
}
.quest-wheel-scene.active {
    opacity: 1;
    pointer-events: all;
}

.quest-wheel-bg {
    position: absolute; inset: 0;
    background: radial-gradient(circle at center, #1a0033 0%, #05000a 75%);
}

.quest-wheel-particles {
    position: absolute; inset: 0;
    overflow: hidden;
}
.quest-wheel-particle {
    position: absolute;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: #d4a4ff;
    box-shadow: 0 0 8px #d4a4ff;
    opacity: 0;
    animation: questWheelParticleFloat linear infinite;
}
@keyframes questWheelParticleFloat {
    0%   { opacity: 0; transform: translateY(0); }
    20%  { opacity: 0.9; }
    80%  { opacity: 0.9; }
    100% { opacity: 0; transform: translateY(-120px); }
}

.quest-wheel-counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 18px;
    border-radius: 18px;
    text-shadow: 0 0 10px rgba(212, 164, 255, 0.8);
    z-index: 10;
}

.quest-wheel-zone {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.quest-wheel-arrow {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-style: solid;
    border-width: 26px 18px 0 18px;
    border-color: #ffd700 transparent transparent transparent;
    filter: drop-shadow(0 0 10px #ffd700);
    z-index: 10;
}

.quest-wheel {
    position: relative;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    box-shadow:
      0 0 40px rgba(180, 106, 255, 0.8),
      inset 0 0 20px rgba(0, 0, 0, 0.8);
    transition: transform 6s cubic-bezier(0.15, 0.85, 0.15, 1);
}

.quest-wheel-sector {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0; height: 0;
}
.quest-wheel-sector-icon {
    position: absolute;
    width: 42px;
    height: 42px;
    object-fit: contain;
    top: -21px;
    left: -21px;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}
.quest-wheel-sector.empty .quest-wheel-sector-icon {
    display: none;
}
.quest-wheel-sector.empty::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    top: -9px;
    left: -9px;
}

.quest-wheel-center {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #ffd700, #7a5000);
    box-shadow:
      0 0 30px rgba(255, 215, 0, 0.9),
      inset 0 0 10px rgba(0, 0, 0, 0.6);
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #2a1a00;
}

.quest-wheel-drop {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
    z-index: 20;
    pointer-events: none;
}
.quest-wheel-drop.show {
    animation: questWheelDropJump 0.8s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
}
@keyframes questWheelDropJump {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    60%  { opacity: 1; transform: translate(-50%, -180%) scale(1.15); }
    100% { opacity: 1; transform: translate(-50%, -160%) scale(1); }
}
.quest-wheel-drop.fade-out {
    animation: questWheelDropFly 0.6s ease-in forwards;
}
@keyframes questWheelDropFly {
    0%   { opacity: 1; transform: translate(-50%, -160%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -280%) scale(0.9); }
}

.quest-wheel-drop-img {
    width: 130px; height: 130px;
    object-fit: contain;
    filter: drop-shadow(0 0 25px rgba(212, 164, 255, 0.9));
}
.quest-wheel-drop-img.cat {
    object-fit: cover;
    border-radius: 40%;
    box-shadow: 0 0 60px #b46aff, 0 0 100px rgba(180, 106, 255, 0.6);
}
.quest-wheel-drop-label {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(212, 164, 255, 0.9);
}
#page-quests::after {
    content: '';
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.85));
    pointer-events: none;
    z-index: 5;
}
#quest-total {
    width: 90%;
    max-width: 400px;
    margin: 10px auto 0 auto;
}

.quest-total-label {
    font-size: 13px;
    color: #fff;
    text-align: center;
    margin-bottom: 6px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.quest-total-label span {
    color: #FFD700;
    font-weight: bold;
}

.quest-total-bar {
    width: 100%;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-total-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: repeating-linear-gradient(
        45deg,
        #5a2a8a 0 10px,
        #b46aff 10px 20px
    );
    background-size: 200% 100%;
    animation: questStripes 1s linear infinite;
    border-radius: 8px;
    transition: width 0.4s ease;
}
@keyframes questStripes {
    to { background-position: -28px 0; }
}

.quest-total-text {
    position: relative;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
    z-index: 2;
}
.quest-pools-line {
    width: 80%;
    max-width: 300px;
    margin: 0 auto 12px auto;
}

.quest-pools-segments {
    display: flex;
    gap: 3px;
    margin-bottom: 6px;
}

.quest-pools-seg {
    flex: 1;
    height: 14px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
}

.quest-pools-seg.on {
    background: #00FF7F;
}

.quest-pools-text {
    font-size: 13px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

#quest-pools-num {
    color: #00FF7F;
}
.quest-wheel-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 5;
    width: 100%;
    max-width: 400px;
}

.quest-wheel-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    max-width: 100%;
    z-index: 10;
}

.quest-wheel-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    color: #fff;
    white-space: nowrap;
}

.quest-wheel-legend-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.quest-wheel-legend-icon.cat {
    object-fit: cover;
    border-radius: 40%;
}