/* ======================================================== */
/* 🗺️ MYSTERY ROADMAP v3.0 & APPLE-TIER STORY PICKER SHEET   */
/* Ceiling: < 350 lines | Standard: Material Design 3 M3-07   */
/* ======================================================== */

/* --------------------------------------------------------- */
/* 1. NEXT-LEVEL GAME WORLD MAP FX (BRIDGE, GEMS, WISP, LOOT) */
/* --------------------------------------------------------- */

/* #5: Cầu Gỗ Nối Khu Vực Giữa Phần 1 & Phần 2 */
.sq-zone-bridge-wrap {
    display: flex; justify-content: center; margin: -12px auto -6px;
    position: relative; z-index: 1; pointer-events: none; opacity: 0.78;
}
.sq-zone-bridge-wrap.is-unlocked { opacity: 1; filter: drop-shadow(0 0 8px rgba(184, 209, 102, 0.35)); }
.sq-zone-bridge-svg { width: 64px; height: 34px; display: block; }

/* #6: Thanh 5 Viên Tinh Thể Năng Lượng Trên Vách Đảo Nhân Vật */
.sq-island-gem-bar {
    position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); z-index: 6;
    padding: 3px 8px; border-radius: 999px; background: #161B12;
    border: 1px solid rgba(184, 209, 102, 0.36); box-shadow: 0 3px 0 #0A0C08, 0 6px 14px rgba(0, 0, 0, 0.5);
    display: inline-flex; align-items: center; gap: 4px; pointer-events: none;
}
.sq-island-gem {
    width: 8px; height: 8px; transform: rotate(45deg); border-radius: 2px;
    background: #272E20; border: 1px solid rgba(255, 255, 255, 0.14);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.sq-island-gem.is-lit-gem {
    background: linear-gradient(135deg, #FEF08A 0%, #B8D166 55%, #65A30D 100%);
    border-color: #FFFFFF; box-shadow: 0 0 7px rgba(184, 209, 102, 0.85);
}
.sq-island-gem.is-gem-pop { animation: sq-gem-awaken 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes sq-gem-awaken {
    0% { transform: rotate(45deg) scale(0.3); }
    60% { transform: rotate(45deg) scale(1.45); box-shadow: 0 0 14px #FEF08A; }
    100% { transform: rotate(45deg) scale(1); }
}
.sq-gem-count { font-size: 9.5px; font-weight: 800; color: #E4F2B8; margin-left: 3px; font-variant-numeric: tabular-nums; }

/* #7: Linh Hồn Lửa Dẫn Đường Đậu Trên Ô Đang Học (Player Wisp Marker) */
.sq-player-wisp {
    position: absolute; top: -14px; right: -12px; width: 30px; height: 30px; z-index: 8;
    pointer-events: none; filter: drop-shadow(0 4px 10px rgba(184, 209, 102, 0.65));
    animation: sq-wisp-hover 2s ease-in-out infinite;
}
@keyframes sq-wisp-hover {
    0%, 100% { transform: translateY(0) rotate(-4deg) scale(1); }
    50% { transform: translateY(-5px) rotate(5deg) scale(1.08); }
}

/* #8: Đạo Cụ Môi Trường Tương Tác & Hạt Bào Tử Rừng Đêm (Interactive Map Hotspots) */
.sq-prop { pointer-events: auto !important; cursor: pointer; transition: transform 0.2s ease, filter 0.2s ease; }
.sq-prop:hover { filter: brightness(1.25) drop-shadow(0 0 16px rgba(34, 211, 238, 0.45)); }
.sq-prop svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sq-hotspot-pulse { transform-origin: center; animation: sq-aura-breathe 2.6s ease-in-out infinite alternate; }
.sq-hotspot-star { transform-origin: 42px 28px; animation: sq-star-twinkle 2.2s ease-in-out infinite alternate; }
.sq-game-spore { animation: sq-spore-float 3s ease-in-out infinite alternate; }
@keyframes sq-aura-breathe { 0% { transform: scale(0.86); opacity: 0.55; } 100% { transform: scale(1.16); opacity: 1; } }
@keyframes sq-star-twinkle { 0% { transform: scale(0.75) rotate(-12deg); opacity: 0.45; } 100% { transform: scale(1.18) rotate(12deg); opacity: 1; } }
@keyframes sq-spore-float { 0% { transform: translateY(2px); opacity: 0.45; } 100% { transform: translateY(-6px); opacity: 1; } }
.ambient-cyan-spore {
    background: #22D3EE !important;
    box-shadow: 0 0 8px #22D3EE, 0 0 16px rgba(34, 211, 238, 0.75) !important;
}
.sq-prop.is-prop-bouncing { animation: sq-prop-jelly 0.52s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes sq-prop-jelly {
    0% { transform: scale(1); }
    30% { transform: scale(1.22, 0.84) translateY(3px); }
    60% { transform: scale(0.92, 1.16) translateY(-6px); }
    100% { transform: scale(1); }
}
.sq-prop-toast {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    white-space: nowrap; padding: 3px 8px; border-radius: 999px; z-index: 30;
    background: rgba(20, 24, 16, 0.95); border: 1px solid rgba(251, 191, 36, 0.55);
    color: #FEF08A; font-size: 9.5px; font-weight: 800; pointer-events: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
    animation: sq-toast-rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.sq-prop-toast span { margin: 0 3px; color: #B8D166; }
@keyframes sq-toast-rise {
    0% { opacity: 0; transform: translateX(-50%) translateY(6px) scale(0.85); }
    22% { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1.04); }
    80% { opacity: 1; transform: translateX(-50%) translateY(-12px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.92); }
}

/* #9: Huy Hiệu Vương Miện / Chìa Khóa & Tia Sáng Kho Báu Ở Ô 05 / 10 */
.sq-milestone-crest {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%); z-index: 6;
    width: 22px; height: 22px; border-radius: 999px; background: #1B1811;
    border: 1px solid rgba(251, 191, 36, 0.55); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center; font-size: 11px; pointer-events: none;
    animation: sq-crest-bob 2.4s ease-in-out infinite;
}
@keyframes sq-crest-bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-3px); } }
.sq-milestone-glint {
    position: absolute; inset: 0; pointer-events: none; z-index: 3;
    background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.32) 48%, transparent 66%);
    transform: translateX(-140%); animation: sq-loot-glint 4.2s ease-in-out infinite;
}
@keyframes sq-loot-glint { 0%, 62% { transform: translateX(-140%); } 100% { transform: translateX(140%); } }

/* --------------------------------------------------------- */
/* 2. HIỆU ỨNG LẬT THẺ BÀI 3D & BADGE TRÊN TIMELINE          */
/* --------------------------------------------------------- */
.mb-card-flip-reveal {
    animation: cardFlip3D 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-style: preserve-3d;
}

@keyframes cardFlip3D {
    0% { transform: rotateY(0deg) scale(1); filter: brightness(1); }
    45% { transform: rotateY(90deg) scale(1.06); filter: brightness(1.4) drop-shadow(0 0 24px #FBBF24); }
    55% { transform: rotateY(90deg) scale(1.06); filter: brightness(1.4) drop-shadow(0 0 24px #B8D166); }
    100% { transform: rotateY(0deg) scale(1); filter: brightness(1); }
}

.age-badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; border-radius: 9999px;
    font-size: 10px; font-weight: 800; letter-spacing: 0.03em;
    text-transform: uppercase; line-height: 1; border: 1px solid; flex-shrink: 0;
}

.age-badge-3 { background: rgba(82, 102, 0, 0.12); color: #3D4D00; border-color: rgba(82, 102, 0, 0.35); }
html.dark .age-badge-3 { background: rgba(184, 209, 102, 0.16); color: #D4EE7F; border-color: rgba(184, 209, 102, 0.45); }
.age-badge-10 { background: rgba(2, 132, 199, 0.12); color: #0369A1; border-color: rgba(2, 132, 199, 0.35); }
html.dark .age-badge-10 { background: rgba(56, 189, 248, 0.16); color: #7DD3FC; border-color: rgba(56, 189, 248, 0.45); }
.age-badge-15 { background: rgba(217, 119, 6, 0.14); color: #92400E; border-color: rgba(217, 119, 6, 0.4); }
html.dark .age-badge-15 { background: rgba(251, 191, 36, 0.16); color: #FCD34D; border-color: rgba(251, 191, 36, 0.45); }
.age-badge-18 { background: rgba(225, 29, 72, 0.12); color: #9F1239; border-color: rgba(225, 29, 72, 0.35); }
html.dark .age-badge-18 { background: rgba(244, 63, 94, 0.16); color: #FDA4AF; border-color: rgba(244, 63, 94, 0.45); }

/* --------------------------------------------------------- */
/* 3. BESPOKE MOBILE BOTTOM SHEET (#roadmapGenrePickerSheet)  */
/* --------------------------------------------------------- */
#roadmapGenrePickerSheet {
    position: absolute; inset: 0; z-index: 100 !important;
    background: rgba(8, 9, 7, 0.72) !important;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    display: flex; flex-direction: column; justify-content: flex-end;
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    user-select: none; -webkit-tap-highlight-color: transparent;
}

#roadmapGenrePickerSheet.hidden { display: none !important; }

#roadmapGenrePickerSheetContent {
    width: 100%; max-width: 420px; margin: 0 auto;
    background: #F6F5EE; color: #1B1C17;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 32px 32px 0 0;
    box-shadow: 0 -24px 64px rgba(0, 0, 0, 0.6);
    padding: 10px 16px 20px 16px;
    animation: sheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

html.dark #roadmapGenrePickerSheetContent {
    background: #141610; color: #F2F1EA;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
}

@keyframes sheetSlideUp {
    0% { transform: translateY(100%); }
    100% { transform: translateY(0); }
}

.story-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px; padding: 0 2px;
}

.story-sheet-title-col { display: flex; flex-direction: column; gap: 2px; }

.story-sheet-eyebrow {
    font-size: 10px; font-weight: 800; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--m3-primary, #526600);
}
html.dark .story-sheet-eyebrow { color: #B8D166; }

.story-sheet-heading {
    margin: 0; font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
}

.story-sheet-close-btn {
    width: 34px; height: 34px; border-radius: 999px;
    background: rgba(128, 128, 120, 0.14); border: none; color: inherit;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.15s ease, background 0.15s ease;
}
.story-sheet-close-btn:active { transform: scale(0.9); }

/* Segmented Control (Độ khó) & Borderless Pills (Thể loại) */
.story-filter-wrap { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.story-seg-control {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 3px; padding: 3.5px; border-radius: 14px;
    background: rgba(0, 0, 0, 0.06);
}
html.dark .story-seg-control { background: rgba(255, 255, 255, 0.055); }

.story-seg-btn {
    padding: 7px 4px; border-radius: 10.5px; border: none;
    background: transparent; color: rgba(27, 28, 23, 0.65);
    font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.18s ease;
}
html.dark .story-seg-btn { color: rgba(242, 241, 234, 0.62); }

.story-seg-btn.is-active {
    background: #FFFFFF; color: #141610; font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}
html.dark .story-seg-btn.is-active {
    background: #282B21; color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.story-genre-row { display: flex; align-items: center; gap: 6px; overflow-x: auto; }

.story-genre-pill {
    flex-shrink: 0; padding: 6px 13px; border-radius: 999px; border: none;
    background: rgba(0, 0, 0, 0.05); color: rgba(27, 28, 23, 0.72);
    font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.16s ease;
}
html.dark .story-genre-pill { background: rgba(255, 255, 255, 0.05); color: rgba(242, 241, 234, 0.7); }

.story-genre-pill.is-active { background: #526600; color: #FFFFFF; font-weight: 800; }
html.dark .story-genre-pill.is-active { background: #B8D166; color: #182000; }

/* Fluid Inset Tracklist (Apple Music Style) */
.story-pick-list { max-height: 44vh; overflow-y: auto; overscroll-behavior: contain; }

.story-tracklist-card {
    border-radius: 22px; background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.06); overflow: hidden;
}
html.dark .story-tracklist-card { background: #1C1F17; border-color: rgba(255, 255, 255, 0.06); }

.story-track-row {
    display: flex; align-items: center; gap: 13px;
    padding: 11px 14px 11px 11px; cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease; position: relative;
}
.story-track-row + .story-track-row { border-top: 1px solid rgba(0, 0, 0, 0.05); }
html.dark .story-track-row + .story-track-row { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.story-track-row:hover { background: rgba(184, 209, 102, 0.08); }
.story-track-row:active { transform: scale(0.99); background: rgba(184, 209, 102, 0.14); }

.story-track-art {
    width: 56px; height: 56px; min-width: 56px; border-radius: 14px;
    object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.story-track-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.story-track-title {
    margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -0.01em;
    color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.story-track-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: rgba(27, 28, 23, 0.58);
}
html.dark .story-track-meta { color: rgba(242, 241, 234, 0.55); }

.story-diff-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.diff-dot-easy { background: #84CC16; box-shadow: 0 0 6px rgba(132, 204, 22, 0.5); }
.diff-dot-med  { background: #F59E0B; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.diff-dot-hard { background: #F43F5E; box-shadow: 0 0 6px rgba(244, 63, 94, 0.5); }
.diff-dot-all  { background: #38BDF8; }

.story-diff-text { font-weight: 700; color: rgba(27, 28, 23, 0.82); }
html.dark .story-diff-text { color: rgba(242, 241, 234, 0.85); }
.story-meta-sep { opacity: 0.45; }

.story-track-chevron {
    width: 28px; height: 28px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center;
    color: rgba(128, 128, 120, 0.7); flex-shrink: 0;
    transition: transform 0.15s ease, color 0.15s ease;
}
.story-track-row:hover .story-track-chevron { transform: translateX(2px); color: #B8D166; }

/* Sticky Bottom Random CTA */
.story-sheet-footer { margin-top: 12px; }

.story-sheet-random-cta {
    width: 100%; height: 46px; border-radius: 16px;
    border: 1px solid rgba(184, 209, 102, 0.32);
    background: rgba(184, 209, 102, 0.12); color: #3D4D00;
    font-size: 13.5px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: all 0.16s ease;
}
html.dark .story-sheet-random-cta {
    background: rgba(184, 209, 102, 0.12); color: #D4EE7F;
    border-color: rgba(184, 209, 102, 0.28);
}
.story-sheet-random-cta:hover { background: rgba(184, 209, 102, 0.20); }
.story-sheet-random-cta:active { transform: scale(0.98); }

.mb-thumb-slot-locked {
    display: flex; align-items: center; justify-content: center;
    background: var(--rm-surface-variant, rgba(120, 120, 110, 0.14)) !important;
    border: 1.5px dashed var(--rm-outline-variant) !important;
}
.slot-locked-icon { font-size: 17px; opacity: 0.65; }
