.quests-fab {
    /* Anchored inside .client-app (max-width: 480px on desktop) so the FAB
       stays inside the mobile-style column instead of sticking to the viewport edge. */
    position: absolute;
    right: 16px;
    bottom: 88px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    font-size: 28px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms ease;
}
.quests-fab:hover { transform: scale(1.05); }
.quests-fab:active { transform: scale(0.95); }

.quests-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #fff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: quest-badge-pulse 1.5s infinite;
}
@keyframes quest-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.quests-drawer {
    /* Anchored inside .client-app — fills the mobile column on desktop,
       full screen on actual mobile (the column is 100vw there). */
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(8px);
    color: #fff;
    transform: translateX(100%) rotateY(15deg);
    transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: right center;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.3);
}
.quests-drawer[aria-hidden="false"] {
    transform: translateX(0) rotateY(0);
}

.quests-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.quests-drawer-head h2 { margin: 0; font-size: 20px; }
.quests-drawer-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.quests-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}
.quests-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
    transition: all 200ms;
    white-space: nowrap;
}
.quests-tab.active {
    color: #4ade80;
    border-bottom-color: #4ade80;
}

.quests-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 22px; /* air between the «обязательные» and «по желанию» groups */
}

/* Each slot group is a labelled column: a section caption (set per-id below) +
   evenly-spaced cards. Mandatory = green, optional = amber. */
.quests-region {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.quests-region::before {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    padding: 2px 2px 0;
}
#quests-mandatory::before { content: "Обязательные"; color: rgba(74, 222, 128, 0.78); }
#quests-optional::before { content: "По желанию  ·  смахни, чтобы пропустить"; color: rgba(250, 204, 21, 0.78); }

.quest-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    transition: border-color 200ms;
}
/* Colour-coded left accent: green for mandatory, amber for optional. */
#quests-mandatory > .quest-card:not(.quest-card--placeholder)::before,
#quests-optional > .quest-card:not(.quest-card--placeholder)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
}
#quests-mandatory > .quest-card:not(.quest-card--placeholder)::before { background: rgba(74, 222, 128, 0.55); }
#quests-optional > .quest-card:not(.quest-card--placeholder)::before { background: rgba(250, 204, 21, 0.65); }
/* touch-action: pan-y lets the browser keep vertical scroll while the JS owns the
   horizontal swipe-to-dismiss — without it, mobile browsers eat the horizontal drag. */
.quest-card--swipeable { touch-action: pan-y; }
.quest-card[data-completed="true"][data-claimed="false"] {
    border-color: #4ade80;
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.25);
}
.quest-card-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 8px;
    margin-bottom: 8px;
}
.quest-card-head h3 { margin: 0; font-size: 16px; }
.quest-reward {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.quest-desc {
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}
.quest-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}
.quest-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 400ms ease;
}
.quest-progress-text {
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}
.quest-claim-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 150ms;
}
.quest-claim-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}
.quest-claim-btn:not(:disabled):hover { transform: translateY(-1px); }

.quests-empty {
    text-align: center;
    padding: 40px 16px;
    color: rgba(255, 255, 255, 0.5);
}

.direction-chooser[aria-hidden="true"] { display: none; }
/* height: 100dvh (dynamic viewport) so the bottom-anchored sheet sits above the
   mobile browser toolbar instead of behind it; falls back to 100vh. */
.direction-chooser { position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 6000; display: flex; align-items: flex-end; }
.direction-chooser__backdrop { position: absolute; inset: 0; background: rgba(8,6,20,0.6); }
/* padding-bottom clears the iOS home-indicator safe area so the last row of
   directions isn't cut off; box-sizing keeps the padding inside max-height. */
.direction-chooser__sheet { position: relative; z-index: 1; width: 100%; box-sizing: border-box; max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; background: #1b1530; color: #fff; border-radius: 16px 16px 0 0; padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.direction-chooser__head { display: flex; justify-content: space-between; align-items: center; }
.direction-chooser__close { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; }
.direction-chooser__hint { opacity: 0.8; font-size: 14px; margin: 4px 0 16px; }
.direction-chooser__list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.direction-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 8px; border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; background: rgba(255,255,255,0.04); color: #fff; cursor: pointer; }
.direction-card__icon { font-size: 32px; }
.direction-card__img { width: 40px; height: 40px; object-fit: contain; }
.direction-card__name { font-size: 14px; font-weight: 600; }
.quest-card--direction { cursor: pointer; }

/* Multi-select states: a card toggles selected; a check badge + green accent show it. */
.direction-card { position: relative; transition: border-color .15s, background .15s; }
.direction-card__check { position: absolute; top: 8px; right: 8px; font-size: 16px; color: #22c55e; opacity: 0; transform: scale(0.6); transition: opacity .15s, transform .15s; }
.direction-card.is-selected { border-color: #22c55e; background: rgba(34,197,94,0.14); }
.direction-card.is-selected .direction-card__check { opacity: 1; transform: scale(1); }
.direction-chooser__foot { position: sticky; bottom: 0; padding-top: 16px; margin-top: 4px; background: linear-gradient(to top, #1b1530 70%, rgba(27,21,48,0)); }
.direction-chooser__confirm {
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 15px;
    font-weight: 700;
    color: #06210f;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    cursor: pointer;
}
.direction-chooser__confirm:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.3); }

/* «Выбрать направление» CTA — a green-accent pill that reads as the first action.
   The whole card is tappable, but the pill is the obvious affordance. */
.quest-direction-btn {
    margin-top: 4px;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #06210f;
    border: 0;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.35);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.quest-direction-btn::after {
    content: "→";
    font-size: 15px;
    line-height: 1;
    transition: transform 140ms ease;
}
.quest-direction-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(34, 197, 94, 0.5);
    filter: brightness(1.06);
}
.quest-direction-btn:hover::after { transform: translateX(4px); }
.quest-direction-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}
/* Gentle pulse so the CTA draws the eye while the tour points at it. */
@keyframes onbDirectionPulse {
    0%, 100% { box-shadow: 0 6px 18px rgba(34, 197, 94, 0.35); }
    50%      { box-shadow: 0 6px 22px rgba(34, 197, 94, 0.6); }
}
.quest-card--direction .quest-direction-btn {
    animation: onbDirectionPulse 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .quest-card--direction .quest-direction-btn { animation: none; }
}
