/*
 * journey-map-bfriend - Game Stylesheet
 * Prefix: DPPYCO_BF_MAP
 * All class names follow the pattern: .DPPYCO_BF_MAP-{element}
 * No external frameworks. RTL-first (dir="rtl" on root).
 * Version: 1.0.0
 */

/* ── Reset & root ──────────────────────────────────────────────────────────── */
/*
 * Apply box-model/margin reset to the three main plugin containers.
 * Covering #hb and #overlay (siblings of #root) prevents WordPress theme CSS
 * from interfering with the hamburger button and pre-game screen elements.
 */
#DPPYCO-BF-MAP-root *,
#DPPYCO-BF-MAP-hb *,
#DPPYCO-BF-MAP-overlay *,
#DPPYCO-BF-MAP-root *::before,
#DPPYCO-BF-MAP-hb *::before,
#DPPYCO-BF-MAP-overlay *::before,
#DPPYCO-BF-MAP-root *::after,
#DPPYCO-BF-MAP-hb *::after,
#DPPYCO-BF-MAP-overlay *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#DPPYCO-BF-MAP-root {
    font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
    font-size: clamp(11px, 1.4vw, 16px);
    line-height: 1.6;
    direction: rtl;
    text-align: right;
    color: #1a1a2e;
    /*
     * Fit within the wrapper while keeping the 1926:1200 aspect ratio.
     * - width: the smaller of: full available width  OR  height-derived width
     * - height: auto → computed from aspect-ratio
     * cqw / cqh refer to the wrapper (container-name: jmb-wrapper).
     */
    aspect-ratio: 1926 / 1200;
    width: min(100cqw, calc(100cqh * 1926 / 1200));
    height: auto;
    position: relative;
    z-index: 2;          /* above copyright (z-index:1), below overlay (z-index:50) */
    overflow: hidden;   /* clips children AND prevents them contributing to document scroll width */
    border-radius: 12px;
    flex-shrink: 0;
}

/*
 * ── Track-bar mode: root shrinks to keep map-container at 1926:1200 ─────────
 * When the journey track bar is visible (class added by JS), the root loses its
 * fixed aspect-ratio and instead becomes just wide enough so that the remaining
 * height (after subtracting the track bar) is exactly right for the map image.
 *
 * Math: map_width = min(100cqw, (100cqh - track_h) × 1926/1200)
 *       root_height = map_width × 1200/1926 + track_h
 *
 * This ensures background-size:cover never crops the map and pin % positions
 * remain pixel-perfect regardless of whether the track bar is visible.
 */
#DPPYCO-BF-MAP-root.jmb-has-track {
    aspect-ratio: unset;
    --_jmb-map-w: min(100cqw, calc((100cqh - 58px) * 1926 / 1200));
    width: var(--_jmb-map-w);
    height: calc(var(--_jmb-map-w) * 1200 / 1926 + 58px);
}

/*
 * ── Elementor container width fix ──────────────────────────────────────────
 * When Elementor renders the shortcode widget inside a flex container (e-con),
 * the widget collapses to fit-content (0px content + 40px padding = 40px).
 * :has() forces the widget flex-item to grow and the shortcode div to stretch.
 *
 * overflow:hidden on every element in the chain prevents the game from
 * contributing to a page-level horizontal scrollbar.
 */
body:has(.DPPYCO-BF-MAP-wrapper) {
    overflow-x: hidden;  /* suppress horizontal page scroll on game pages */
}

.elementor-section:has(.DPPYCO-BF-MAP-wrapper),
.e-con:has(.DPPYCO-BF-MAP-wrapper),
.elementor-container:has(.DPPYCO-BF-MAP-wrapper) {
    overflow: hidden;
}

.elementor-widget-shortcode:has(.DPPYCO-BF-MAP-wrapper) {
    flex-grow: 1;
    min-width: 0;
    align-self: stretch;
    overflow: hidden;
}
.elementor-shortcode:has(> .DPPYCO-BF-MAP-wrapper) {
    display: block;
    width: 100%;
    height: 100%;  /* pass parent widget height to wrapper so height:100% resolves */
    overflow: hidden;
}

/* ── Main game wrapper ─────────────────────────────────────────────────────── */
/*
 * Configurable via shortcode attrs (set as CSS variables on the element):
 *   --jmb-height  wrapper height           (default: 100vh)
 *   --jmb-width   wrapper width in parent  (default: 100%)
 *   --jmb-pv      vertical padding         (default: 10px)
 *   --jmb-ph      horizontal padding       (default: 5px)
 *
 * The game board (#root) is always centered horizontally + vertically.
 * The board fills available space while maintaining 1926:1200 aspect ratio.
 * container-type: size  - lets the root use cqw/cqh relative to wrapper.
 * transform             - makes wrapper a containing block for fixed descendants.
 */
.DPPYCO-BF-MAP-wrapper {
    position: relative;
    width: var(--jmb-width, 100%);
    height: var(--jmb-height, 100vh);
    box-sizing: border-box;
    padding: var(--jmb-pv, 10px) var(--jmb-ph, 5px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    container-type: size;
    container-name: jmb-wrapper;
    transform: translate(0, 0);
}
/* Alignment: affects wrapper placement in its parent when width < 100% */
.DPPYCO-BF-MAP-wrapper.align-center { margin-left: auto; margin-right: auto; }
.DPPYCO-BF-MAP-wrapper.align-right  { margin-left: auto; margin-right: 0; }
.DPPYCO-BF-MAP-wrapper.align-left   { margin-left: 0; margin-right: auto; }

/* ── Screens ───────────────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-screen {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /*
     * overflow: hidden auto  =  overflow-x:hidden, overflow-y:auto.
     * Writing overflow-y:auto alone forces the browser to compute overflow-x
     * as 'auto' too (CSS cross-axis rule), creating an unwanted horizontal
     * scrollbar whenever a child (e.g. a hovered pin near the map edge) overflows.
     */
    overflow: hidden auto;
    animation: DPPYCO_BF_MAP_fadeIn 0.35s ease;
}

.DPPYCO_BF_MAP-screen.DPPYCO_BF_MAP-active {
    display: flex;
    flex-direction: column;
    align-items: stretch;    /* screen-body stretches to full width */
    justify-content: flex-start;
    overflow: hidden auto;   /* explicit x:hidden — same cross-axis reason */
}

/*
 * Inner centering wrapper for pre-game screens (welcome, mode-select).
 * min-height:100% fills the screen height → content is centered when it fits.
 * When content is taller than screen, screen-body grows and the screen scrolls.
 */
.DPPYCO_BF_MAP-screen-body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
}

@keyframes DPPYCO_BF_MAP_fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Copyright notice ─────────────────────────────────────────────────────── */
/*
 * Sits at the bottom-right of the wrapper, BEHIND the game board (z-index:1).
 * Uses pointer-events:none so it never intercepts clicks.
 */
#DPPYCO-BF-MAP-copyright {
    position: absolute;
    bottom: 6px;
    right: 10px;
    z-index: 1;          /* below root (2) and overlay (50) */
    font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
    font-size: clamp(10px, 0.8cqw, 13px);
    color: rgba(100, 100, 100, 0.82);
    white-space: nowrap;
    direction: rtl;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

/* Pre-game screens render inside #overlay; map screen renders inside #root.
 * Both use position:absolute;inset:0 to fill their container. */

/* ── Overlay host ─────────────────────────────────────────────────────────── */
/*
 * Uses the same size formula as #root + top/left 50% + translate(-50%,-50%).
 * Proof: flex-centering puts root's center at wrapper_w/2, wrapper_h/2 —
 * same as top:50%;left:50% on an absolute child. So overlay ALWAYS mirrors
 * root's position/size, including on resize, with zero JS needed.
 */
#DPPYCO-BF-MAP-overlay {
    position: absolute;
    inset: 0;               /* covers full wrapper so content is never clipped by root */
    z-index: 50;
    pointer-events: none;  /* JS sets pointer-events:auto when a screen is active */
}

/* ── Map background (shared by welcome, map, and summary screens) ──────────── */
.DPPYCO_BF_MAP-map-bg {
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

/* ── Overlay glass panel ───────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-panel {
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 16px;
    padding: 36px 40px !important;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    text-align: center;
    position: relative;
    z-index: 10;
}

/* ── Welcome screen ────────────────────────────────────────────────────────── */

.DPPYCO_BF_MAP-welcome-logo {
    font-size: 56px;
    margin-bottom: 8px;
    display: block;
}

.DPPYCO_BF_MAP-welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a6e;
    margin-bottom: 12px;
}

.DPPYCO_BF_MAP-welcome-desc {
    font-size: 1.05rem;
    color: #444;
    margin-bottom: 28px;
    line-height: 1.7;
}

/* ── Mode selection ────────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 90%;
    max-width: 620px;
    z-index: 10;
}

.DPPYCO_BF_MAP-mode-card {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 28px 22px !important;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    text-align: center;
}

.DPPYCO_BF_MAP-mode-card:hover,
.DPPYCO_BF_MAP-mode-card:focus {
    border-color: #4c6ef5;
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(76,110,245,0.22);
    outline: none;
}

.DPPYCO_BF_MAP-mode-icon {
    font-size: 46px;
    display: block;
    margin-bottom: 12px;
}

.DPPYCO_BF_MAP-mode-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a6e;
    margin-bottom: 8px;
}

.DPPYCO_BF_MAP-mode-desc {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
}

/* ── Map screen container ──────────────────────────────────────────────────── */
/* מסך המפה: column - כותרת למעלה, מפה+פאנל מתחת */
#DPPYCO-BF-MAP-screen-map {
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    overflow: hidden;   /* map never needs scrolling; clip any pin that strays outside */
}

.DPPYCO_BF_MAP-map-container {
    position: relative;
    flex: 1;
    min-height: 0;   /* מאפשר לflex לשלוט בגובה */
    overflow: hidden; /* contain pin hover-scale so it can't contribute to ancestor scroll */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* container query: lets pin images use cqw/cqh units relative to the map */
    container-type: size;
    container-name: jmb-map;
}

.DPPYCO_BF_MAP-map-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,30,0.08);
}

/* ── Station pins ──────────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-station-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s;
}

/* Hovered pin floats above all siblings so its tooltip is never hidden beneath them */
.DPPYCO_BF_MAP-station-pin:hover,
.DPPYCO_BF_MAP-station-pin:focus-visible {
    z-index: 300;
}

.DPPYCO_BF_MAP-station-pin:hover .DPPYCO_BF_MAP-pin-bubble {
    transform: scale(1.12);
    box-shadow: 0 4px 18px rgba(76,110,245,0.45);
}

/* Image-based pins (replaces emoji bubble when destination images exist) */
.DPPYCO_BF_MAP-pin-img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.DPPYCO_BF_MAP-pin-img {
    /* 20% map-width × 25% map-height - smaller dimension limits, preserves aspect ratio */
    width: 20cqw;
    height: 25cqh;
    max-width: 20cqw;
    max-height: 25cqh;
    object-fit: contain;
    filter: drop-shadow(0 3px 10px rgba(0,0,0,0.28));
    transition: transform 0.18s, filter 0.18s;
    display: block;
}

.DPPYCO_BF_MAP-station-pin:hover .DPPYCO_BF_MAP-pin-img {
    filter: drop-shadow(0 5px 14px rgba(76,110,245,0.50));
    transform: scale(1.08);
}

.DPPYCO_BF_MAP-pin-bubble {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4c6ef5, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.25);
    border: 3px solid #fff;
    transition: transform 0.15s, box-shadow 0.15s;
}

.DPPYCO_BF_MAP-station-pin.DPPYCO_BF_MAP-pin-selected .DPPYCO_BF_MAP-pin-bubble {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #bbf7d0;
}

.DPPYCO_BF_MAP-station-pin.DPPYCO_BF_MAP-pin-completed .DPPYCO_BF_MAP-pin-bubble {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #fef3c7;
}

.DPPYCO_BF_MAP-pin-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: #4c6ef5;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #4c6ef5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.22);
    display: none;
}

.DPPYCO_BF_MAP-pin-selected .DPPYCO_BF_MAP-pin-num {
    display: flex;
    border-color: #22c55e;
    color: #22c55e;
}

.DPPYCO_BF_MAP-pin-label {
    margin-top: 4px;
    background: rgba(255,255,255,0.92);
    padding: 2px 7px !important;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #1a1a6e;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    max-width: 90px;
    text-align: center;
    line-height: 1.3;
}

/* ── Pin tooltip (summary on hover) ───────────────────────────────────────── */
.DPPYCO_BF_MAP-pin-tooltip {
    position: absolute;
    bottom: 80%;        /* bottom edge at ~20% from pin top → slightly overlaps the pin image */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 50, 0.88);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 180px;
    text-align: center;
    padding: 6px 10px !important;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.28);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s, visibility 0.18s;
    z-index: 200;
    /* small arrow pointing down */
}
.DPPYCO_BF_MAP-pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(15, 15, 50, 0.88);
}
.DPPYCO_BF_MAP-station-pin:hover .DPPYCO_BF_MAP-pin-tooltip,
.DPPYCO_BF_MAP-station-pin:focus-visible .DPPYCO_BF_MAP-pin-tooltip {
    opacity: 1;
    visibility: visible;
}


.DPPYCO_BF_MAP-route-panel {
    width: 220px;
    min-width: 180px;
    background: rgba(255,255,255,0.97);
    border-right: none;
    border-left: 1px solid #e4e7f0;
    display: flex;
    flex-direction: column;
    padding: 20px 16px !important;
    z-index: 30;
    box-shadow: -4px 0 20px rgba(0,0,0,0.08);
}

.DPPYCO_BF_MAP-route-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a6e;
    margin-bottom: 14px;
    text-align: center;
}

.DPPYCO_BF_MAP-route-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    margin-bottom: 16px;
}

.DPPYCO_BF_MAP-route-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 !important;
    border-bottom: 1px solid #f0f0f8;
    font-size: 0.88rem;
    color: #333;
}

.DPPYCO_BF_MAP-route-list li .DPPYCO_BF_MAP-route-num {
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #4c6ef5;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.DPPYCO_BF_MAP-route-empty {
    color: #999;
    font-size: 0.88rem;
    text-align: center;
    margin-top: 12px;
}

.DPPYCO_BF_MAP-route-hint {
    font-size: 0.8rem;
    color: #888;
    text-align: center;
    margin-bottom: 12px;
}

/* ── Journey track bar (horizontal, above the map) ────────────────────────── */
.DPPYCO_BF_MAP-journey-track {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px !important;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1.5px solid rgba(196, 181, 253, 0.35);
    min-height: 58px;
    flex-shrink: 0;
    position: relative;
    z-index: 25;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.DPPYCO_BF_MAP-track-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #7c3aed;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.DPPYCO_BF_MAP-track-scroll {
    display: flex;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    padding: 6px 0 !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    direction: rtl;
}

.DPPYCO_BF_MAP-track-scroll::-webkit-scrollbar {
    display: none;
}

.DPPYCO_BF_MAP-track-stop {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.DPPYCO_BF_MAP-track-icon {
    /* no border / circle - show image only */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    /* remove border/bg entirely */
    background: none;
    border: none;
    width: auto;
    height: auto;
    border-radius: 0;
    overflow: visible;
}

.DPPYCO_BF_MAP-track-icon img {
    height: 22px !important;
    max-height: 22px !important;
    width: auto !important;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 1;
}

/* emoji fallback stays visible */
.DPPYCO_BF_MAP-track-stop.completed .DPPYCO_BF_MAP-track-icon { opacity: 1; }
.DPPYCO_BF_MAP-track-stop.active .DPPYCO_BF_MAP-track-icon {
    filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.55));
    animation: jmb-pulse-icon 1.4s ease-in-out infinite;
}
.DPPYCO_BF_MAP-track-stop.upcoming .DPPYCO_BF_MAP-track-icon { opacity: 0.55; }

@keyframes jmb-pulse-icon {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(124, 58, 237, 0.45)); }
    50%       { filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.15)); }
}

/* ── Track line - brown/sandy trail colour, z-index behind icons ───────────── */
.DPPYCO_BF_MAP-track-line {
    /* extends slightly into adjacent icon zones so it looks continuous */
    width: 28px;
    flex-shrink: 0;
    height: 4px;
    background: linear-gradient(to left, #b8860b, #d4a028);
    border-radius: 2px;
    margin: 0 -6px;
    position: relative;
    z-index: 0;
    align-self: center;
}

.DPPYCO_BF_MAP-track-empty {
    font-size: 0.78rem;
    color: #9ca3af;
    padding: 4px 8px !important;
    font-style: italic;
}

.DPPYCO_BF_MAP-track-action {
    flex-shrink: 0;
    padding-right: 6px !important;
}

@keyframes jmb-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22); }
    50%       { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.06); }
}

/* ── Hamburger menu button ──────────────────────────────────────────────────── */
/*
 * All selectors prefixed with #DPPYCO-BF-MAP-hb for high specificity.
 * JS (positionHb) resizes #hb to exactly cover #root, so right:8px
 * below is relative to the GAME BOARD right edge — no formula needed.
 */
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn {
    position: absolute !important;
    top: 52px !important;
    right: 8px !important;
    z-index: 200 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1.5px solid rgba(124, 58, 237, 0.25) !important;
    cursor: pointer;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transition: background 0.18s, box-shadow 0.18s;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn:hover {
    background: white !important;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.18);
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn span {
    display: block !important;
    width: 16px !important;
    height: 2px !important;
    background: #7c3aed !important;
    border-radius: 1px;
    transition: transform 0.22s ease, opacity 0.15s ease;
}

/* Spans animate into ✕ when the menu is open */
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn.is-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn.is-open span:nth-child(2) {
    opacity: 0 !important;    /* intentional: hide middle bar for X animation */
    transform: scaleX(0);
}
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn.is-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-menu {
    position: absolute !important;
    top: 94px;
    right: 8px;
    z-index: 210 !important;
    background: white !important;
    border-radius: 12px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.16);
    border: 1.5px solid rgba(196, 181, 253, 0.4) !important;
    padding: 6px !important;
    min-width: 170px;
    display: flex;          /* jQuery .toggle() manages display; no !important here */
    flex-direction: column;
    gap: 2px;
    animation: DPPYCO_BF_MAP_fadeIn 0.18s ease;
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-menu-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 14px !important;
    border-radius: 8px;
    background: none !important;
    border: none !important;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    color: #1a1a6e !important;
    direction: rtl;
    width: 100% !important;
    text-align: right;
    transition: background 0.12s;
    white-space: nowrap;
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-menu-item:hover {
    background: #f5f3ff !important;
}

#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-menu-item.DPPYCO_BF_MAP-menu-danger:hover {
    background: #fff1f2 !important;
    color: #dc2626 !important;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 44px !important;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
    text-decoration: none;
    user-select: none;
}

.DPPYCO_BF_MAP-button:active {
    transform: scale(0.97);
}

.DPPYCO_BF_MAP-button-primary {
    background: linear-gradient(135deg, #4c6ef5, #a855f7);
    color: #fff;
    box-shadow: 0 4px 18px rgba(76,110,245,0.38);
}

.DPPYCO_BF_MAP-button-primary:hover {
    background: linear-gradient(135deg, #3b5bdb, #9333ea);
    box-shadow: 0 6px 24px rgba(76,110,245,0.48);
}

.DPPYCO_BF_MAP-button-secondary {
    background: #f0f2ff;
    color: #4c6ef5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.DPPYCO_BF_MAP-button-secondary:hover {
    background: #e0e4ff;
}

.DPPYCO_BF_MAP-button-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 4px 16px rgba(34,197,94,0.35);
}

.DPPYCO_BF_MAP-button-success:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.DPPYCO_BF_MAP-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.DPPYCO_BF_MAP-button-sm {
    padding: 7px 28px !important;
    font-size: 0.85rem;
}

.DPPYCO_BF_MAP-button-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px !important;
    border-radius: 8px;
    transition: background 0.15s;
    color: #666;
}

.DPPYCO_BF_MAP-button-icon:hover {
    background: #f0f2ff;
    color: #4c6ef5;
}

/* ── Hamburger host - permanent, always above all in-wrapper overlays ──────── */
/*
 * Covers full wrapper (inset:0) at z-index:100 so the button is always reachable.
 * pointer-events:none so it doesn't block game clicks; children restore it.
 * The button and menu use a CSS right-formula to sit inside the game-area edge.
 */
#DPPYCO-BF-MAP-hb {
    position: absolute;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    /* Inherit same base typography as #root so buttons render correctly */
    font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
    font-size: clamp(11px, 1.4vw, 16px);
    line-height: 1.6;
    direction: rtl;
}
#DPPYCO-BF-MAP-hb > * {
    pointer-events: auto;
}

/* ── Fullscreen button ─────────────────────────────────────────────────────── */
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-fullscreen-btn {
    position: absolute !important;
    /* sits directly below the fullscreen button (top:8 + height:36 + gap:8 = 52) */
    top: 8px !important;
    right: 8px !important;
    z-index: 200 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.82) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    transition: background 0.18s, box-shadow 0.18s;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    clip: auto !important;
    clip-path: none !important;
}
#DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-fullscreen-btn:hover {
    background: rgba(30, 30, 30, 0.95) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Fullscreen: stretch wrapper to fill viewport */
.DPPYCO-BF-MAP-wrapper:fullscreen,
.DPPYCO-BF-MAP-wrapper:-webkit-full-screen,
.DPPYCO-BF-MAP-wrapper:-moz-full-screen,
.DPPYCO-BF-MAP-wrapper:-ms-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    background: #000;
}

/* Fake fullscreen (iOS Safari fallback) */
.DPPYCO-BF-MAP-wrapper.jmb-fake-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    z-index: 99999 !important;
    background: #000;
    margin: 0 !important;
}

/* Modal overlay inside fullscreen must be fixed to the fullscreen element */
.DPPYCO-BF-MAP-wrapper:fullscreen .DPPYCO_BF_MAP-modal-overlay,
.DPPYCO-BF-MAP-wrapper:-webkit-full-screen .DPPYCO_BF_MAP-modal-overlay,
.DPPYCO-BF-MAP-wrapper:-moz-full-screen .DPPYCO_BF_MAP-modal-overlay,
.DPPYCO-BF-MAP-wrapper.jmb-fake-fullscreen .DPPYCO_BF_MAP-modal-overlay {
    position: fixed;
}

/* ── Modal overlay ─────────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-modal-overlay {
    position: absolute;   /* within wrapper, not fixed to viewport */
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 60;          /* above root(2)/jmb-overlay(50), below hb(100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px !important;
    animation: DPPYCO_BF_MAP_overlayIn 0.2s ease;
}

@keyframes DPPYCO_BF_MAP_overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.DPPYCO_BF_MAP-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90%;    /* relative to wrapper height, not viewport */
    overflow-y: auto;
    padding: 32px 36px !important;
    position: relative;
    direction: rtl;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: DPPYCO_BF_MAP_modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes DPPYCO_BF_MAP_modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.DPPYCO_BF_MAP-modal-close {
    position: absolute;
    top: 14px;
    left: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 4px 8px !important;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}

.DPPYCO_BF_MAP-modal-close:hover {
    color: #333;
    background: #f5f5f5;
}

.DPPYCO_BF_MAP-station-header {
    display: flex;
    align-items: flex-end;  /* title aligns to bottom of image */
    gap: 14px;
    margin-bottom: 10px;
}

/* Modal station icon - img variant: no crop, height-constrained only */
img.DPPYCO_BF_MAP-station-icon-lg {
    height: 64px;
    width: auto;
    max-height: 64px;
    object-fit: contain;
    border-radius: 0;
    flex-shrink: 0;
    box-shadow: none;
    background: none;
}
/* Modal station icon - div (emoji) fallback: keep circle */
div.DPPYCO_BF_MAP-station-icon-lg {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(135deg, #4c6ef5, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 14px rgba(76,110,245,0.3);
}

.DPPYCO_BF_MAP-station-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a6e;
}

.DPPYCO_BF_MAP-station-desc {
    font-size: 0.92rem;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.6;
}

.DPPYCO_BF_MAP-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e4ff, transparent);
    margin: 14px 0;
}

.DPPYCO_BF_MAP-question-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.DPPYCO_BF_MAP-question-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
}

.DPPYCO_BF_MAP-question-text {
    flex: 1;
    font-size: 1rem;
    color: #1a1a6e;
    font-weight: 600;
    line-height: 1.5;
}

.DPPYCO_BF_MAP-textarea {
    width: 100%;
    min-height: 110px;
    border: 2px solid #e0e4ff;
    border-radius: 12px;
    padding: 12px 14px !important;
    font-size: 0.97rem;
    font-family: inherit;
    color: #1a1a2e;
    resize: vertical;
    direction: rtl;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 16px;
    background: #fafbff;
    line-height: 1.6;
}

.DPPYCO_BF_MAP-textarea:focus {
    outline: none;
    border-color: #4c6ef5;
    box-shadow: 0 0 0 3px rgba(76,110,245,0.12);
    background: #fff;
}

.DPPYCO_BF_MAP-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* ── AI message area ───────────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-ai-message {
    display: none;
    background: linear-gradient(135deg, #f0f4ff, #fdf2ff);
    border: 1.5px solid #c7d2fe;
    border-radius: 14px;
    padding: 18px 20px !important;
    margin-top: 18px !important;
    position: relative;
    animation: DPPYCO_BF_MAP_fadeIn 0.4s ease;
}

.DPPYCO_BF_MAP-ai-message.DPPYCO_BF_MAP-visible {
    display: block;
}

.DPPYCO_BF_MAP-ai-message-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.DPPYCO_BF_MAP-ai-message-text {
    font-size: 0.97rem;
    color: #2d2d5e;
    line-height: 1.75;
}

.DPPYCO_BF_MAP-ai-loader {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.DPPYCO_BF_MAP-ai-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a855f7;
    animation: DPPYCO_BF_MAP_bounce 1.2s infinite;
}

.DPPYCO_BF_MAP-ai-loader span:nth-child(2) { animation-delay: 0.2s; }
.DPPYCO_BF_MAP-ai-loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes DPPYCO_BF_MAP_bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1;   }
}

/* ── AI sub-overlay (result card on top of station modal) ──────────────────── */
.DPPYCO_BF_MAP-sub-overlay {
    position: absolute;   /* within wrapper */
    inset: 0;
    z-index: 70;          /* above modal-overlay(60), below hb(100) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    animation: DPPYCO_BF_MAP_overlayIn 0.2s ease;
}

.DPPYCO_BF_MAP-sub-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 80%;    /* relative to wrapper */
    overflow-y: auto;
    padding: 28px 32px;
    direction: rtl;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
    animation: DPPYCO_BF_MAP_modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.DPPYCO_BF_MAP-sub-msg-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.DPPYCO_BF_MAP-sub-msg-text {
    font-size: 0.97rem;
    color: #2d2d5e;
    line-height: 1.75;
    background: linear-gradient(135deg, #f0f4ff, #fdf2ff);
    border: 1.5px solid #c7d2fe;
    border-radius: 14px;
    padding: 16px 18px !important;
    margin-bottom: 16px;
    min-height: 60px;
}

.DPPYCO_BF_MAP-sub-save-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.DPPYCO_BF_MAP-sub-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-start;
    border-top: 1px solid #e8eaf6;
    padding-top: 14px;
    margin-top: 4px;
}

@media (max-width: 700px) {
    .DPPYCO_BF_MAP-sub-card {
        padding: 20px 18px !important;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    .DPPYCO_BF_MAP-sub-overlay {
        align-items: flex-end;
        padding: 0 !important;
    }
}

/* ── Summary screen ────────────────────────────────────────────────────────── */
#DPPYCO-BF-MAP-screen-summary {
    padding: 0 !important;
}

/* Summary shown as fixed overlay - centered, panel scrolls if tall */
.DPPYCO_BF_MAP-summary-overlay {
    align-items: center;
    padding: 32px 16px !important;
}

.DPPYCO_BF_MAP-summary-panel {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 20px 24px !important;
    max-width: 760px;
    width: 96%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 12px 50px rgba(0,0,0,0.18);
    position: relative;
    z-index: 10;
    text-align: center;
}

.DPPYCO_BF_MAP-summary-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a6e;
    margin-top: -4px;
    margin-bottom: 8px;
}

.DPPYCO_BF_MAP-summary-stations-bar {
    display: flex;
    gap: 0;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 10px 12px !important;
    background: #f4f6ff;
    border-radius: 14px;
}

.DPPYCO_BF_MAP-summary-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.76rem;
    color: #555;
    min-width: 50px;
}

/* Summary badge - img variant */
img.DPPYCO_BF_MAP-summary-badge-icon {
    height: 45px;
    width: auto;
    max-height: 45px;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    background: none;
}
/* Summary badge - div (emoji) fallback */
div.DPPYCO_BF_MAP-summary-badge-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Track line between summary badges */
.DPPYCO_BF_MAP-summary-track-line {
    width: 24px;
    height: 4px;
    background: linear-gradient(to left, #b8860b, #d4a028);
    border-radius: 2px;
    align-self: flex-start;
    margin-top: 24px;
    flex-shrink: 0;
}

.DPPYCO_BF_MAP-summary-wait-label {
    text-align: center;
    font-size: 0.9rem;
    color: #7c3aed;
    font-weight: 600;
    margin-bottom: 8px !important;
    opacity: 0.85;
}

.DPPYCO_BF_MAP-summary-message-box {
    background: linear-gradient(135deg, #f0f4ff, #fdf2ff);
    border: 1.5px solid #c7d2fe;
    border-radius: 16px;
    padding: 14px 18px !important;
    margin-bottom: 14px !important;
    font-size: 1rem;
    color: #2d2d5e;
    line-height: 1.8;
    text-align: right;
    min-height: 60px;
}

.DPPYCO_BF_MAP-summary-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Tooltip notification ──────────────────────────────────────────────────── */
.DPPYCO_BF_MAP-toast {
    position: fixed;
    bottom: 24px;
    right: 50%;
    transform: translateX(50%);
    background: #1a1a6e;
    color: #fff;
    padding: 12px 22px !important;
    border-radius: 50px;
    font-size: 0.9rem;
    z-index: 200;
    box-shadow: 0 6px 24px rgba(0,0,0,0.22);
    animation: DPPYCO_BF_MAP_toastIn 0.3s ease;
    pointer-events: none;
}

@keyframes DPPYCO_BF_MAP_toastIn {
    from { opacity: 0; transform: translateX(50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(50%) translateY(0); }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {

    /* Track-bar mobile: track is 50px tall, not 58px */
    #DPPYCO-BF-MAP-root.jmb-has-track {
        --_jmb-map-w: min(100cqw, calc((100cqh - 50px) * 1926 / 1200));
        height: calc(var(--_jmb-map-w) * 1200 / 1926 + 50px);
    }

    .DPPYCO_BF_MAP-panel {
        padding: 24px 18px;
        border-radius: 12px;
    }

    .DPPYCO_BF_MAP-mode-grid {
        grid-template-columns: 1fr;
        max-width: 360px;
    }

    #DPPYCO-BF-MAP-screen-map {
        flex-direction: column;
    }

    .DPPYCO_BF_MAP-route-panel {
        width: 100%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid #e4e7f0;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 8px;
        align-items: center;
        order: -1;
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    }

    .DPPYCO_BF_MAP-route-panel-title {
        width: 100%;
        margin-bottom: 6px;
        font-size: 0.9rem;
    }

    .DPPYCO_BF_MAP-route-list {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 0;
    }

    .DPPYCO_BF_MAP-route-list li {
        border-bottom: none;
        padding: 4px 10px;
        background: #f0f2ff;
        border-radius: 20px;
        font-size: 0.82rem;
    }

    .DPPYCO_BF_MAP-map-container {
        flex: 1;
        min-height: 0;
    }

    .DPPYCO_BF_MAP-journey-track {
        min-height: 50px;
        padding: 0 46px 0 8px;
        gap: 5px;
    }

    .DPPYCO_BF_MAP-track-label {
        display: none;
    }

    .DPPYCO_BF_MAP-track-icon img {
        height: 22px !important;
        max-height: 22px !important;
    }

    .DPPYCO_BF_MAP-track-line {
        width: 18px;
        margin: 0 -4px;
    }

    #DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-btn {
        top: 47px;
        width: 32px !important;
        height: 32px !important;
    }

    #DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-fullscreen-btn {
        top: 7px !important;
        width: 32px !important;
        height: 32px !important;
    }

    #DPPYCO-BF-MAP-hb .DPPYCO_BF_MAP-hamburger-menu {
        top: 84px;
    }

    .DPPYCO_BF_MAP-modal {
        padding: 22px 18px;
        border-radius: 0;
        max-height: 100vh;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .DPPYCO_BF_MAP-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .DPPYCO_BF_MAP-summary-panel {
        padding: 24px 18px !important;
        border-radius: 12px;
    }

    .DPPYCO_BF_MAP-welcome-title {
        font-size: 1.4rem;
    }

    .DPPYCO_BF_MAP-pin-bubble {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .DPPYCO_BF_MAP-pin-label {
        display: none;
    }

    /* Mode-select screen: reduce padding on portrait mobile so cards fit */
    #DPPYCO-BF-MAP-screen-mode {
        padding: 20px 12px !important;
    }
    .DPPYCO_BF_MAP-mode-card {
        padding: 14px 12px !important;
    }
    .DPPYCO_BF_MAP-mode-grid {
        gap: 12px;
        max-width: 100%;
    }
}
