/* ==========================================
   Interactive Map Styles
   ========================================== */

/* The floor selector's column. Two things read it — the sidebar itself and the
   back button in the header above it — and they line up because they read the
   same two numbers rather than each carrying its own copy. Declared here rather
   than in css/styles.css because only this page has a sidebar. */
:root {
    --map-sidebar-width: 260px;
    --map-sidebar-pad: var(--spacing-md);

    /* The route's own gold: the Academy's #FFB800 at lightness 42% instead of
       50%, same hue and same saturation. Derived rather than picked, so it is
       the brand gold and not a second yellow that happens to sit near it.

       It exists because a route is one thing made of parts that are otherwise
       scattered across the plan - the pin you start from, the trail, and the
       one lift or stairwell out of four that this journey actually uses. In the
       plan's own gold they read as three unrelated badges; a shade darker and
       they read as the route.

       Darker also happens to help: the trail carried 1.7:1 against the plan's
       white and now carries 2.5:1, and the black glyph on a route badge still
       has 7.8:1 to sit on. */
    --color-route: #D69B00;
}

/* Height is what the plan is short of, and the page spends it above and below
   the drawing: a 104px logo, a two-line floor heading and the address strip.
   The plan is drawn to fit the *shorter* side of its viewport — at 1920x1080
   that is always the height — so every pixel taken back here is a pixel of
   scale, and scale is what makes a label legible. Together these three give the
   viewport about 145px, roughly a fifth more.

   Scoped to the map page: the logo at full size is right on the pages that are
   mostly logo, and the address belongs on them too.

   And a logo of its own at that height. assets/logo.png is 800x291 with the
   artwork 620x95 in the middle - two thirds of it is clear space - so at 56px
   the wordmark was 18px tall and "imienia Feliksa Nowowiejskiego" about five,
   which nobody reads from a step away. map.html draws assets/logo-compact.png,
   the same artwork with a 12px margin, and the header's own spacing is the
   clear space around it. */
.map-page .logo {
    height: 56px;
}

.map-page .footer {
    display: none;
}

/* Map Layout */
.map-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: var(--color-white);
}

/* Sidebar */
.map-sidebar {
    width: var(--map-sidebar-width);
    background-color: var(--color-white);
    display: flex;
    flex-direction: column;
    padding: var(--map-sidebar-pad);
    gap: var(--spacing-sm);
}

/* The back button squares up with the floor buttons under it: same left edge,
   same right edge, so the header and the sidebar read as one column. The header
   insets its sides by --header-pad-x and the sidebar by --map-sidebar-pad, so
   the button is pulled back the difference and given the sidebar's content
   width outright.

   Both on the button and not on .header-side--left, which keeps its own width:
   the logo is centred by the header's two sides being equal, so widening or
   shifting that container would move the logo and the language toggle with it.
   The button simply overhangs its container, which nothing clips.

   The fixed width is also what makes the language toggle safe here. "Powrót"
   and "Back" are different lengths, and a button sized by its text moved every
   time the language changed; sized by the column, it does not move at all. */
.header-side--left .back-button {
    margin-left: calc(var(--map-sidebar-pad) - var(--header-pad-x));
    width: calc(var(--map-sidebar-width) - var(--map-sidebar-pad) * 2);
    flex-shrink: 0;
}

.floor-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    list-style: none;
}

/* Search and the legend are not in this column: they stand with the zoom
   controls over the plan, where every other control that acts on the drawing
   is. See .map-zoom-btn--apart for the one thing that keeps search from
   reading as a third zoom button. */

.floor-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--color-white);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--color-ink);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 56px;
    text-align: left;
    width: 100%;
}

@media (hover: hover) {
    .web .floor-btn:hover {
        background-color: var(--color-paper);
        border-color: var(--color-ink);
    }
}

.floor-btn.active {
    border-color: var(--color-ink);
    box-shadow: inset 3px 0 0 var(--color-yellow);
}

/* Not-ready floor: dimmed, still tappable to reveal the message */
.floor-btn--unavailable {
    opacity: 0.55;
}

.floor-btn--unavailable .floor-btn__number {
    background-color: var(--color-gray);
}


.floor-btn__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background-color: var(--color-yellow);
    color: var(--color-ink);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.floor-btn__label {
    flex: 1;
    line-height: 1.2;
    white-space: nowrap;
}

/* The legend button lives in .map-zoom-controls and is styled as a
   .map-zoom-btn, so it matches the zoom buttons in size and shape. */

/* Legend Modal */
.legend-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.legend-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Wider than the room modal, and deliberately so: this one is a table. At
   500px the faculty names wrapped to three lines each and the whole key no
   longer fitted on the screen — see .legend-modal__body. */
.legend-modal {
    background-color: var(--color-white);
    border-radius: 8px;
    max-width: 860px;
    width: 90%;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    transform: translateY(8px);
    transition: transform var(--transition-normal);
}

.legend-modal-overlay.active .legend-modal {
    transform: translateY(0);
}

.legend-modal__header {
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-line);
}

.legend-modal__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.625rem;
    color: var(--color-ink);
}

.legend-modal__close {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-gray-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

@media (hover: hover) {
    .web .legend-modal__close:hover {
        background-color: var(--color-black);
        color: var(--color-white);
    }
}

.legend-modal__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}

.legend-modal__body {
    padding: var(--spacing-lg);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
    /* Sixteen colours plus nine symbols, and every one of them has to be on
       screen at once: a kiosk legend that has to be scrolled to be read is a
       legend that opens looking like it explains less than it does. Two
       columns at 500px did fit while there were nine colours; the seven
       faculty categories took it to 1030px against 821px of room, which is
       what the third column and the wider modal above are for. Scrolling is
       still the fallback if the building grows another category. */
    max-height: 76vh;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background-color: var(--color-paper);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
}

.legend-item__color {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-item__label {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-ink);
}

/* Spans both columns of .legend-modal__body so the symbol rows read as their
   own block rather than as one more colour swatch. */
.legend-heading {
    grid-column: 1 / -1;
    margin-top: var(--spacing-sm);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--color-ink);
}

.legend-icons {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
}

/* Tighter and unboxed: a symbol carries itself, and the swatch border that
   makes a colour row read as a sample is noise around an icon. */
.legend-item--icon {
    padding: var(--spacing-xs);
    background: transparent;
    border: none;
}

/* One size wherever a symbol appears in the key — on a colour row beside its
   swatch, or on a row of its own. The colour rows used to take a smaller one so
   the swatch stayed the thing the eye landed on; a badge is its own colour now,
   and a key that drew the same symbol at two sizes would not be a key to it.
   No `fill`: the ink is named in js/icons.js. */
.legend-item__icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* Search Modal
   ------------
   Unlike the legend and room modals this one is *not* centred. It carries a
   text field, so the on-screen keyboard will cover the bottom of the display
   whenever it is open. The modal is pinned to the top and the keyboard's share
   of the screen is reserved below it.

   --kiosk-keyboard-space is the one number to change if Windows 10's touch
   keyboard on the kiosk turns out to be taller. 45% of a 1080px kiosk is
   486px, which covers the usual on-screen keyboards with room to spare. */
.search-modal-overlay {
    --kiosk-keyboard-space: 45vh;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-md) var(--kiosk-keyboard-space);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    /* Only opacity transitions, unlike the legend and room modals. This one
       has to take keyboard focus the moment it opens, and an element inside a
       `visibility: hidden` subtree cannot be focused — with visibility on the
       transition list the flip is not guaranteed to have happened yet when
       focus() runs, and the call fails silently. Switching it outright removes
       the race; the fade still reads, it just does not fade back out. */
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.search-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    background-color: var(--color-white);
    border-radius: 8px;
    max-width: 680px;
    width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    transform: translateY(-8px);
    transition: transform var(--transition-normal);
}

.search-modal-overlay.active .search-modal {
    transform: translateY(0);
}

.search-modal__header {
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-line);
    flex-shrink: 0;
}

.search-modal__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.625rem;
    color: var(--color-ink);
}

.search-modal__close {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-gray-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
}

@media (hover: hover) {
    .web .search-modal__close:hover {
        background-color: var(--color-black);
        color: var(--color-white);
    }
}

.search-modal__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}

.search-modal__field {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--color-line);
    flex-shrink: 0;
}

.search-modal__field-icon {
    display: flex;
    color: var(--color-gray);
    flex-shrink: 0;
}

.search-modal__field-icon svg {
    width: 24px;
    height: 24px;
}

/* body sets user-select: none for the kiosk; a text field has to opt back in
   or the caret cannot be placed and nothing can be selected. */
.search-modal__input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 1.5rem;
    color: var(--color-ink);
    padding: var(--spacing-xs) 0;
    -webkit-user-select: text;
    user-select: text;
}

.search-modal__input::placeholder {
    color: var(--color-gray);
}

.search-modal__clear {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-gray-light);
    border: none;
    border-radius: 50%;
    color: var(--color-gray);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

/* `display: flex` above outranks the browser's own [hidden] rule, so js/map.js
   setting `hidden` on an empty field did nothing and a second "×" stood under
   the modal's close button. Same fix as .route-bar[hidden]. */
.search-modal__clear[hidden] {
    display: none;
}

@media (hover: hover) {
    .web .search-modal__clear:hover {
        background-color: var(--color-black);
        color: var(--color-white);
    }
}

.search-modal__clear svg {
    width: 18px;
    height: 18px;
}

.search-modal__results {
    overflow-y: auto;
    padding: var(--spacing-xs);
    -webkit-overflow-scrolling: touch;
}

.search-result {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    min-height: var(--touch-target-min);
    background: transparent;
    border: none;
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result:focus-visible {
    background-color: var(--color-gray-light);
    outline: none;
}

@media (hover: hover) {
    .web .search-result:hover {
        background-color: var(--color-gray-light);
    }
}

.search-result__number {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.0625rem;
    color: var(--color-ink);
    background-color: var(--color-gray-light);
    border-radius: var(--radius);
    padding: 6px 10px;
    min-width: 64px;
    text-align: center;
    flex-shrink: 0;
}

.search-result__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result__name {
    font-family: var(--font-body);
    font-size: 1.125rem;
    color: var(--color-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Rooms with no write-up yet still turn up by number. Their "name" is a
   placeholder, so it is greyed to read as one. */
.search-result__name--placeholder {
    color: var(--color-gray);
    font-style: italic;
}

/* Why this row matched, when it was not the name or the number — without it a
   result found through an occupant or a description looks like a mistake. */
.search-result__why {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result__floor {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-gray);
    flex-shrink: 0;
    white-space: nowrap;
}

.search-message {
    padding: var(--spacing-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-gray);
    text-align: center;
}

/* Main Map Area */
.map-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-sm) var(--spacing-md);
    overflow: hidden;
}

.map-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--spacing-md);
    padding-bottom: var(--spacing-xs);
}

/* One row, not two. The floor's name and what is on it read as a single line
   the way a chapter heading does, and the two-line stack cost 44px of plan. */
.map-floor-info {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    min-width: 0;
}

.map-floor-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.375rem;
    color: var(--color-ink);
    white-space: nowrap;
}

.map-floor-description {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* What you can do here, in the space the heading leaves. Nothing else was ever
   going to use the right half of this row, and a plan full of tappable rooms
   says nothing about being tappable. */
.map-hint {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-gray);
    white-space: nowrap;
    flex-shrink: 0;
}

/* SVG Container
   padding-right is set from map.js on a search reveal, to stand the plan beside
   the modal rather than under it (dockViewport). It is animated so the plan
   visibly makes room instead of jumping. */
.map-svg-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-white);
    overflow: hidden;
    transition: padding-right var(--transition-normal);
}

.map-svg {
    width: 100%;
    height: 100%;
}

/* Floor Plan Styles */
.floor-outline {
    fill: #FAFAFA;
    stroke: var(--color-black);
    stroke-width: 3;
}

/* Room Styles (data-room-id lives on the shape element directly) */
[data-room-id] {
    cursor: pointer;
    stroke: rgba(0, 0, 0, 0.3);
    stroke-width: 1;
}

/* Only where there is a pointer to react to. On the kiosk the one thing these
   transitions ever animated was applyRoomStyles() painting 70-150 rooms their
   category colour, which repainted a 23,000-path drawing for ten frames after
   every floor switch. The website keeps them for the hover darkening. */
.web [data-room-id] {
    transition: fill var(--transition-fast), stroke var(--transition-fast), stroke-width var(--transition-fast);
}

/* :not(.room-found) so hover does not freeze the search highlight. Both
   declarations are !important, and !important beats a running animation — with
   a plain [data-room-id]:hover the pulse stopped dead the moment the cursor
   rested on the room the search had just found.

   :not(.room-disabled) because a room closed to the public must not react to
   the pointer at all. It used to be a second rule further down the file that
   put the grey stroke back — .room-disabled:hover, same !important, and the
   comment said the two had equal specificity so the later one won.

   They did, until :not(.room-found) was added here. A :not() counts what is
   inside it, so this selector went from (0,2,0) to (0,3,0) and started beating
   (0,2,0) outright, order or no order. Nothing said so: the rules still looked
   like a matched pair, and the regression was a black outline round every grey
   block under the mouse.

   Excluded here instead, so there is no pair to keep in step and no cascade to
   lose — and tools/test-kiosk.js reads this rule back off the stylesheet and
   fails if it stops saying :not(.room-disabled), or if a second rule appears
   undoing it. That is the check that would have caught it, and it is written
   against the selector rather than against the rendered stroke because a
   headless CI runner has no hovering pointer: @media (hover: hover) never
   matches there, so there is nothing to force :hover on. The rendered reading
   is still taken, wherever there is a mouse. */
/* Hover only where a pointer can actually rest on something. On the kiosk's
   touch screen the browser holds :hover until the next tap somewhere else, so a
   tapped control kept its highlight long after the finger had gone. :focus and
   :active are deliberately left outside the query - they are what gives touch
   its feedback. */
@media (hover: hover) {
    .web [data-room-id]:not(.room-found):not(.room-disabled):hover {
        stroke-width: 3 !important;
        stroke: var(--color-black) !important;
    }
}

.room-number,
.room-label,
.room-icon,
.map-marker {
    pointer-events: none;
}

/* SVG labels stay in the UI sans, not the serif display face.

   `paint-order: stroke fill` puts the white halo js/map.js sets as `stroke`
   *under* the glyph instead of over it — without it the outline eats the
   letterforms from the outside in and the text goes bolder and blurrier the
   wider the halo. The width itself is set per element, in viewBox units,
   because it has to scale with whatever font size the zoom settles on.

   The number and the name are one ink and are told apart by weight. The pair of
   greys that used to do it measured 2.0:1 on the library's pink; a halo reads
   on any fill, so the ink stopped having to. */
.room-number,
.room-label {
    font-family: var(--font-body);
    paint-order: stroke fill;
    stroke-linejoin: round;
}

.room-number { font-weight: 700; }
.room-label { font-weight: 500; }

/* Icons carry no styling here at all, deliberately. Every one of them is a
   badge whose disc and ink are named in js/icons.js beside the geometry, so a
   `fill` in this file would either be overridden or, worse, silently repaint
   the symbol on top of its own disc. Size is not here either: map.js writes
   the counter-scaling transform on every zoom to hold each badge at ICON_PX on
   the glass, and a width, height or transform rule would fight it. The only
   thing the two classes need from CSS is the `pointer-events: none` above. */

/* The one label on the plan that is not a room's. Sized from js/map.js in the
   same breath as the badges, because it belongs to one of them. */
/* The word, not the pin. The pin is the brand gold; gold type on the plan's
   white halo measures 1.7:1 against it and is not readable at any size, so the
   label keeps the ink every other label on the plan uses. Gold and black is the
   Academy's own pair, so this is the palette rather than a departure from it. */
.map-here-label {
    font-family: var(--font-body);
    font-weight: 700;
    fill: var(--color-ink);
    stroke: #FFFFFF;
    paint-order: stroke fill;
    stroke-linejoin: round;
    pointer-events: none;
}

/* Rooms closed to the public — gray, non-interactive, no hover highlight.
   Driven by "disabled": true in data/floors/*.json; map.js adds this class.
   Only `cursor` and `stroke` are set here, because both inherit down to the
   room's <path>. `fill` deliberately is not: the class sits on the <g> and the
   path carries its own fill, which beats an inherited value — so map.js paints
   the grey onto the paths directly.

   There is no `.room-disabled:hover` rule any more. There was one, restating
   these two declarations to undo the hover highlight, and it stopped working
   the day that highlight's selector grew a :not() — see the note on it above.
   The highlight now excludes this class, so there is nothing to undo: on hover
   this rule is simply the only one that matches, exactly as it is at rest. */
.room-disabled {
    cursor: default !important;
    stroke: rgba(0, 0, 0, 0.15) !important;
    stroke-width: 1 !important;
}

/* Circulation space — corridors, foyers, passages. Driven by
   "interactive": false on the *category* in data/config.json; map.js adds this
   class. Not a destination, so not a target.

   `pointer-events` rather than the cursor/stroke overrides .room-disabled
   needs: the shape is taken out of hit testing altogether, so [data-room-id]
   :hover can never match it and there is no !important and no dependency on
   rule order. The cursor falls through to .map-svg-wrapper, which is what the
   surrounding plan already uses.

   The stroke is deliberately left alone: corridor walls are part of how the
   floor reads, and only the interaction is being removed, not the drawing. */
.room-passive {
    pointer-events: none;
}

/* The room the search just jumped to. map.js adds the class, then drops it
   after the animation, or holds it for as long as the room's modal is up; see
   revealRoom().

   Stroke only, no fill: the class sits on the <g> and stroke inherits down to
   the room's <path>, while fill does not — the path carries its own, which is
   what map.js paints the category colour onto.

   `stroke-width` is deliberately NOT set here. !important beats a running
   animation, so a `stroke-width: 4 !important` on this rule pinned the width
   and the pulse never showed — the room lit up yellow and then just sat there.
   The keyframes own the width; `forwards` holds the last frame so it does not
   snap back to the 1 on [data-room-id] for the moment before map.js removes
   the class. The colour stays !important because that one has to beat hover. */
.room-found {
    stroke: var(--color-yellow) !important;
    animation: room-found-pulse 0.7s ease-in-out 3 forwards;
}

@keyframes room-found-pulse {
    0%, 100% { stroke-width: 3; stroke-opacity: 1; }
    50%      { stroke-width: 14; stroke-opacity: 0.45; }
}

/* ------------------------------------------------------------------ *
 * Route
 *
 * The layer lives inside the plan's own <svg>, so it shares the viewBox
 * and zoom and pan reach it for free. Nothing here may use pixel units:
 * every length is in viewBox units and scales with the drawing.
 *
 * The trail is footsteps and nothing else. It used to carry a line under the
 * prints and a dot at each end as well; the line said what the prints already
 * say, without saying which way you are walking, and read as a wire laid over
 * the plan.
 * ------------------------------------------------------------------ */

/* The trail is the Academy's gold, like the badges and the pin it starts from -
   the trail and its starting point are one thing, so they are one colour.
   Measured, it is the weaker half of the change: gold carries 1.7:1 against the
   plan's white where the red it replaced carried 4.5:1. The footprints are big
   filled shapes rather than hairlines, which is what makes 1.7 legible at all;
   if the trail ever needs to read on a paler floor, an ink outline on each
   print keeps the gold and puts the contrast back. */
.route-foot {
    fill: var(--color-route);
    opacity: 0.85;
}

/* The disc alone, never the badge. `fill` on `.room-icon` or `.map-marker`
   inherits into the glyph and paints it in the disc's own colour, which is why
   nothing in this file has ever set one on them; `buildIcon()` names the two
   halves so this rule can reach the right one.

   `.route-node` is put on the badges this floor's walk goes through by
   markRouteNodes() in js/map.js, and `route-active` on the plan for as long as
   there is a trail. The pin is keyed off the plan rather than off itself
   because it is not part of the route's chain - it is where the route starts,
   and it is drawn whether or not anyone has asked for one. */
.route-active .map-marker--you-are-here .badge-disc,
.route-node .badge-disc {
    fill: var(--color-route);
}

/* ------------------------------------------------------------------ *
 * Route bar
 *
 * The stage strip sitting above the plan once a route is worked out.
 * ------------------------------------------------------------------ */

.route-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 72px 14px 20px;
    margin-bottom: 12px;
    background: #FFF7E6;
    border: 2px solid var(--color-yellow);
    border-radius: var(--radius);
}

/* map.js hides the bar by setting `hidden` when there is no route, but the
   `display: flex` above is an author rule and beats the browser's own
   `[hidden] { display: none }` — so without this the empty bar, reading "Trasa
   do" and nothing else, sat under the floor heading at all times. Restated
   here rather than dropped from the rule above, which is what lays the bar
   out when it is shown. */
.route-bar[hidden] {
    display: none;
}

/* Dokąd i którędy w jednym wierszu: „Trasa do:", sala, a zaraz za nią kafle
   etapów. Osobny wiersz na etapy był o wiersz za dużo (klient, 10.09). Zawija
   się dopiero wtedy, gdy nazwa sali i etapy naprawdę się nie mieszczą. */
.route-bar__main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.route-bar__heading {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-family: var(--font-body);
}

.route-bar__label {
    font-size: 15px;
    color: #7A6A3F;
}

.route-bar__target {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-black);
}

.route-bar__stages {
    display: flex;
    align-items: center;
    /* Poziomo szerzej niż pionowo: w tym odstępie stoi strzałka. */
    gap: 10px 36px;
    margin: 0;
    padding: 0;
    list-style: none;
    flex-wrap: wrap;
}

.route-bar__stages--dimmed { opacity: 0.45; }

/* Odznaka w belce — ta sama, którą rysuje plan, tylko mniejsza. Bez `fill`:
   kolory siedzą w js/icons.js, a reguła na całej odznace pomalowałaby symbol
   kolorem krążka (patrz .badge-disc niżej). */
.route-bar__glyph {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ *
 * Opcje trasy
 *
 * „Trasa bez schodów" - czyli winda - przy każdej trasie między piętrami,
 * zawsze pierwsza, a po niej klatki schodowe. Winda i klatki C oraz E stoją
 * w jednym miejscu budynku, więc zamiana między nimi to przejście do drzwi
 * obok. Klatki A, B i D leżą gdzie indziej i jako zamiana chipa nie
 * dostają - na piętro 4 winda kosztuje 348 jednostek, C 396, a D 1071 - ale
 * trasa, którą router nimi poprowadził, stoi w tym wierszu obok windy.
 * ------------------------------------------------------------------ */

.route-bar__options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.route-bar__options[hidden] {
    display: none;
}

.route-bar__options-label {
    font-size: 0.9375rem;
    color: #7A6A3F;
}

/* Ciszej niż etapy nad nimi, i celowo.
 *
 * Etapy są odpowiedzią — oto trasa. To jest oferta obok niej, więc nie ma
 * prawa ważyć tyle samo. Chipy były białe, z obwódką 2px i złotym wypełnieniem
 * na wybranym, czyli dokładnie tym samym gestem, którym belka mówi „tędy
 * idziesz" — dwa razy to samo, raz za głośno.
 *
 * Ciszej przez kolor i wagę, nie przez rozmiar: `min-height` zostaje na 48px,
 * bo to jest przycisk na ekranie dotykowym i pole trafienia nie jest miejscem
 * na oszczędności. Mniejszy jest krój, cieńsza obwódka, a tło żadne — chip
 * siedzi wprost na kremie belki zamiast wycinać w nim biały prostokąt.
 *
 * Brąz #7A6A3F: belka ma jeden kolor na to, co jest sterowaniem obok trasy,
 * a nie samą trasą - piszą nim i etykieta wiersza, i chipy. */
.route-bar__option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    min-height: var(--touch-target-min);
    background: transparent;
    border: 1px solid #E4D8B4;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: #7A6A3F;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

/* Wybrany wariant. Biel i grubsza litera, nie złoto: złoto w tej belce znaczy
   „to jest twoja trasa" i mówią to już etapy wyżej. Tu wystarczy powiedzieć,
   który z chipów jest tym rysowanym. */
.route-bar__option[aria-pressed="true"] {
    background: #FFFFFF;
    border-color: #D8C89A;
    color: var(--color-ink);
    font-weight: 600;
}

/* Odznaka w chipie tej samej wielkości co na kafelku etapu — klient,
   17.09.2026: dwa rozmiary jednego znaku w jednej belce wyglądały na błąd. Na
   chipie niewybranym przygaszona: po zdjęciu bieli i pogrubienia to ona
   zostawała najjaśniejszą rzeczą w wierszu, i wiersz nadal wołał.
   Przezroczystością, nie innym kolorem: złoto z białym pierścieniem to jest
   ten znak z planu i ma nim pozostać. */
.route-bar__option .route-bar__glyph {
    opacity: 0.6;
}

.route-bar__option[aria-pressed="true"] .route-bar__glyph {
    opacity: 1;
}

/* O ile dłuższy od najkrótszego. Procent, nie metry: skala rysunku nie
   została zmierzona (patrz navigation.unitsPerMetre), a stosunek dwóch
   długości w tych samych jednostkach żadnej skali nie potrzebuje. */
.route-bar__option-cost {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
}

/* „Trasa bez schodów", której do tej sali nie ma. Chip zostaje, bo kto jej
   potrzebuje, musi się tego dowiedzieć - a naciśnięty mówi pod belką dlaczego. */
.route-bar__option[aria-disabled="true"] {
    opacity: 0.55;
}

@media (hover: hover) {
    .web .route-bar__option:hover {
        background: #FFFDF7;
    }

    .web .route-bar__option[aria-pressed="true"]:hover {
        background: #FFFFFF;
    }
}

.route-bar__stage {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    min-height: var(--touch-target-min);
    background: #FFFFFF;
    border: 2px solid #E4D8B4;
    /* Deliberately not var(--radius) (4px). A stage is a chip you tap, not
       a panel like the rest of the kiosk's UI, and only reads as a stage
       at a full pill - do not "fix" this to match --radius. */
    border-radius: 999px;
    font-size: 17px;
}

.route-bar__stage--active {
    border-color: var(--color-black);
    background: var(--color-yellow);
}

/* Strzałka przed każdym etapem poza pierwszym, w odstępie między kaflami: to
   kolejne punkty jednej drogi, a nie rząd przycisków (klient, 10.09).
   Narysowana obramowaniem pseudoelementów, a nie znakiem: kroje są przycięte
   do latin i latin-ext, U+2192 nie ma w żadnym z nich, więc „→" przyszłoby z
   kroju systemowego. Poza polem trafienia i poza zasięgiem wskaźnika. */
.route-bar__stage + .route-bar__stage::before,
.route-bar__stage + .route-bar__stage::after {
    content: "";
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    pointer-events: none;
}

/* Trzon. */
.route-bar__stage + .route-bar__stage::before {
    width: 16px;
    border-top: 2px solid #CDBB85;
    transform: translateY(-50%);
}

/* Grot: kwadrat z dwiema krawędziami, obrócony o 45 stopni. */
.route-bar__stage + .route-bar__stage::after {
    width: 7px;
    height: 7px;
    border-top: 2px solid #CDBB85;
    border-right: 2px solid #CDBB85;
    transform: translateY(-50%) rotate(45deg);
}

/* Flex, bo od kiedy przycisk niesie odznakę, ma dwoje dzieci. Bez tego <svg>
   układa się jak tekst — siada na linii bazowej — i przy 26 px odznaki przeciwko
   17 px napisu wchodzi na literę. `gap` na .route-bar__stage tego nie łapie:
   działa na dzieci <li>, a odznaka jest o poziom głębiej, w środku przycisku. */
.route-bar__stage button {
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

/* The stairwell between two floor stages. Not a button - there is nothing to
   switch to, since a staircase is not a floor. */
.route-bar__stage--stairs {
    background: transparent;
    border-style: dashed;
    color: #7A6A3F;
}

.route-bar__distance {
    font-size: 14px;
    color: #7A6A3F;
}

.route-bar__note {
    margin: 0;
    font-size: 15px;
    color: #7A6A3F;
}

.route-bar__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--color-black);
    cursor: pointer;
}

/* The gap belongs to the button, not to the wrapper around it. map.html always
   renders .room-modal__actions and only hides the button inside it, so a margin
   on the wrapper is 20px of dead space under every modal that offers no route -
   and it cannot collapse into .room-modal__body's bottom padding. */
.room-modal__route {
    margin-top: 20px;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-yellow);
    color: var(--color-black);
    font-family: var(--font-body);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
}

/* Room Modal */
.room-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.room-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.room-modal {
    background-color: var(--color-white);
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    transform: translateY(8px);
    transition: transform var(--transition-normal);
}

.room-modal-overlay.active .room-modal {
    transform: translateY(0);
}

/* Search reveal: the modal stands against the right edge and the room it
   describes is framed in the plan beside it (frameBox's `aside`). The scrim and
   the blur go, because they would grey out and smear the one thing the visitor
   just asked to be shown — the panel's own shadow is what lifts it off the
   plan. It still fills the screen and still swallows the click that lands
   outside the panel, so tapping the plan dismisses it exactly as before.

   Both selectors carry .room-modal-overlay so this beats the base block on
   specificity rather than on being further down the file. */
.room-modal-overlay.room-modal-overlay--aside {
    justify-content: flex-end;
    padding-right: var(--spacing-lg);
    background-color: transparent;
    backdrop-filter: none;
}

.room-modal-overlay.room-modal-overlay--aside .room-modal {
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.room-modal__header {
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.room-modal__type-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 5px 10px;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(0, 0, 0, 0.75);
}

.room-modal__close {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-gray-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

@media (hover: hover) {
    .web .room-modal__close:hover {
        background-color: var(--color-black);
        color: var(--color-white);
    }
}

.room-modal__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}

.room-modal__body {
    padding: 0 var(--spacing-lg) var(--spacing-lg);
}

.room-modal__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2rem;
    color: var(--color-ink);
    margin-bottom: var(--spacing-xs);
    line-height: 1.2;
}

.room-modal__number {
    font-family: var(--font-body);
    font-size: 1.125rem;
    color: var(--color-gray);
    margin-bottom: var(--spacing-md);
}

.room-modal__details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.room-modal__detail {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.room-modal__detail-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-gray);
}

.room-modal__detail-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.room-modal__detail-content {
    flex: 1;
}

.room-modal__detail-label {
    font-family: var(--font-body);
    /* Uppercase at 12px is the smallest thing on the kiosk; 13 with the same
       tracking keeps the label quiet without making it hard to read. */
    font-size: 0.8125rem;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.room-modal__detail-value {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-ink);
}

/* Error / empty state shown when map data or a floor plan fails to load */
.map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: var(--spacing-lg);
    text-align: center;
    font-family: var(--font-body);
    font-size: 1.25rem;
    color: var(--color-gray);
}

/* "Floor not ready" message (floors flagged ready:false in rooms.json) */
.map-floor-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    width: 100%;
    height: 100%;
    padding: var(--spacing-lg);
    text-align: center;
    font-family: var(--font-body);
}

.map-floor-unavailable__title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-ink);
}

.map-floor-unavailable__text {
    font-size: 1.125rem;
    color: var(--color-gray);
}

/* Floor transition */
.map-svg-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    touch-action: none;
}

.map-svg-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.map-svg-wrapper.dragging {
    cursor: grabbing;
}

.map-zoom-controls {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

/* Search is not zoom. Sitting flush against + / reset / -, a magnifier reads
   as "zoom in"; the extra gap says it belongs to a different job. */
.map-zoom-btn--apart {
    margin-bottom: 12px;
}

.map-zoom-btn {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    border-radius: 50%;
    border: 1px solid var(--color-line);
    background: var(--color-white);
    color: var(--color-ink);
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

@media (hover: hover) {
    .web .map-zoom-btn:hover {
        background: var(--color-paper);
        border-color: var(--color-ink);
    }
}

.map-zoom-btn:active {
    transform: scale(0.95);
}

.map-zoom-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
}

.floor-plan {
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.floor-plan.active {
    opacity: 1;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    .map-sidebar {
        width: 220px;
        padding: var(--spacing-sm);
    }

    .floor-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 1rem;
    }

    .floor-btn__number {
        width: 32px;
        height: 32px;
    }
}

/* ==========================================
   Przeglądarka (html.web, patrz js/mode.js)
   ==========================================

   Na kiosku nic z poniższego nie działa — plan wygląda tam tak samo jak przed
   tą sekcją. Poza kioskiem strona mapy zostaje aplikacją na całe okno (plan się
   przesuwa i przybliża, strona nie przewija), ale okno ma wysokość ekranu
   telefonu, a nie 1080 px kiosku: 100dvh, bo pasek adresu przeglądarki
   mobilnej wjeżdża i wyjeżdża. Zoom, wielkość znaczków i klawiatura są po
   stronie js/map.js (kioskZoom(), iconPx(), zoomMax()). */

.web .map-page .kiosk-container {
    height: 100vh;
    height: 100dvh;
    max-height: none;
}

/* Wyszukiwarka nie rezerwuje miejsca na klawiaturę ekranową: poza kioskiem jej
   nie ma, a klawiatura systemowa sama przesuwa okno. */
.web .search-modal-overlay {
    --kiosk-keyboard-space: var(--spacing-md);
}

/* Okna sali i legendy przewijają treść, zamiast ją ucinać: na niskim ekranie
   opis sali z przyciskiem trasy bywa wyższy niż okno. */
.web .room-modal {
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
}

/* Okno sali obok planu staje przy prawej krawędzi strony, nie okna: na ekranie
   szerszym niż 1920 px strona kończy się wcześniej (max-width kadru) i okno
   wisiało w pustym polu obok niej, a plan się pod nie nie zwężał. Do 1920 px
   wychodzi dokładnie to samo co --spacing-lg. */
.web .room-modal-overlay.room-modal-overlay--aside {
    padding-right: max(var(--spacing-lg), calc((100vw - 1920px) / 2 + var(--spacing-lg)));
}

/* „Udostępnij link do sali" pod przyciskiem trasy, poza kioskiem (js/map.js,
   setupShareButton). Ciszej niż trasa: to dodatek, nie odpowiedź. */
.web .room-modal__share {
    margin-top: var(--spacing-sm);
    width: 100%;
    min-height: var(--touch-target-min);
    padding: var(--spacing-xs) var(--spacing-md);
    border: 1px solid var(--color-line);
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.web .room-modal__share[hidden] {
    display: none;
}

@media (hover: hover) {
    .web .room-modal__share:hover {
        border-color: var(--color-ink);
    }
}

/* Tablet i telefon: piętra w pasku nad planem zamiast kolumny obok niego. */
@media (max-width: 1100px) {
    .web .map-container {
        flex-direction: column;
        min-height: 0;
    }

    .web .map-sidebar {
        width: auto;
        padding: var(--spacing-xs) var(--spacing-md);
        border-bottom: 1px solid var(--color-line);
    }

    .web .floor-list {
        flex-direction: row;
        overflow-x: auto;
        gap: var(--spacing-xs);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .web .floor-list::-webkit-scrollbar {
        display: none;
    }

    .web .floor-list > li {
        flex: none;
    }

    .web .floor-btn {
        width: auto;
        min-height: var(--touch-target-min);
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.9375rem;
        gap: var(--spacing-xs);
    }

    .web .floor-btn.active {
        box-shadow: inset 0 -3px 0 var(--color-yellow);
    }

    .web .floor-btn__number {
        width: 28px;
        height: 28px;
    }

    /* „Powrót" nie wyrównuje się już do kolumny pięter, której nie ma. */
    .web .header-side--left .back-button {
        margin-left: 0;
        width: auto;
    }

    .web .map-main {
        flex: 1;
        min-height: 0;
        padding: var(--spacing-xs) var(--spacing-md) var(--spacing-sm);
    }

    .web .map-header {
        flex-wrap: wrap;
        row-gap: 2px;
    }

    .web .map-svg-container {
        min-height: 0;
    }
}

@media (max-width: 700px) {
    .web .map-page .logo {
        height: 32px;
    }

    .web .map-sidebar {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    /* Sam numer piętra; nazwa („Piętro 2") zostaje dla czytnika ekranu.
       `position: relative`, żeby ukryta nazwa miała blok zawierający w
       przycisku: inaczej liczy się od strony, wystaje poza przewijany pasek
       pięter i rozpycha stronę ponad szerokość telefonu. */
    .web .floor-btn {
        position: relative;
        min-width: var(--touch-target-min);
        justify-content: center;
        padding: var(--spacing-xs);
    }

    .web .floor-btn__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .web .map-main {
        padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-sm);
    }

    .web .map-floor-info {
        flex-wrap: wrap;
        row-gap: 0;
    }

    .web .map-floor-name {
        font-size: 1.125rem;
    }

    .web .map-floor-description,
    .web .map-hint {
        font-size: 0.8125rem;
    }

    .web .map-hint {
        white-space: normal;
        flex-shrink: 1;
    }

    .web .map-zoom-controls {
        right: var(--spacing-xs);
        bottom: var(--spacing-xs);
    }

    /* Belka trasy: to samo, ciaśniej. Krzyżyk zostaje w rogu, więc tekst
       odsuwa się od niego o jego szerokość. */
    .web .route-bar {
        padding: 10px 56px 10px 12px;
        margin-bottom: var(--spacing-xs);
        gap: 6px;
    }

    .web .route-bar__close {
        top: 4px;
        right: 4px;
    }

    .web .route-bar__main {
        gap: 6px 16px;
    }

    .web .route-bar__target {
        font-size: 18px;
    }

    .web .route-bar__stages {
        gap: 6px 28px;
    }

    .web .route-bar__stage {
        font-size: 15px;
        padding: 4px 10px;
    }

    .web .route-bar__stage + .route-bar__stage::before {
        width: 12px;
        right: calc(100% + 8px);
    }

    .web .route-bar__stage + .route-bar__stage::after {
        right: calc(100% + 8px);
    }

    .web .route-bar__options-label,
    .web .route-bar__note {
        font-size: 0.8125rem;
    }

    /* Okna: prawie cała szerokość ekranu, mniejsze marginesy w środku. */
    .web .room-modal,
    .web .legend-modal {
        width: calc(100% - var(--spacing-md));
    }

    .web .room-modal__header,
    .web .legend-modal__header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .web .room-modal__body {
        padding: 0 var(--spacing-md) var(--spacing-md);
    }

    .web .room-modal__title {
        font-size: 1.5rem;
    }

    .web .room-modal__route {
        font-size: 1.0625rem;
        padding: 12px;
    }

    .web .search-modal-overlay {
        padding: var(--spacing-xs);
    }
}

/* Legenda: trzy kolumny są dla 860 px okna na kiosku. */
@media (max-width: 1100px) {
    .web .legend-modal__body,
    .web .legend-icons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    /* minmax(0, 1fr), nie samo 1fr: kolumna 1fr nie schodzi poniżej
       najdłuższej etykiety i wypychała wiersze poza okno. */
    .web .legend-modal__body {
        grid-template-columns: minmax(0, 1fr);
        padding: var(--spacing-md);
    }

    .web .legend-icons {
        grid-template-columns: minmax(0, 1fr);
    }

    .web .legend-item__label {
        white-space: normal;
        min-width: 0;
    }
}

/* Telefon w poziomie: ekran ma ~390 px wysokości i każdy wiersz nad planem
   jest wierszem planu mniej. Nagłówek się ściska, piętra wracają do wąskiej
   kolumny z boku (same numery), a nad planem zostaje tylko nazwa piętra. Bez
   tego na plan zostawał pasek 146 px. */
@media (max-height: 500px) and (orientation: landscape) {
    .web .map-page .subpage-header {
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .web .map-page .logo {
        height: 28px;
    }

    .web .map-page .back-button,
    .web .map-page .lang-toggle__btn {
        min-height: 44px;
    }

    .web .map-container {
        flex-direction: row;
    }

    .web .map-sidebar {
        width: auto;
        padding: var(--spacing-xs);
        border-bottom: 0;
        border-right: 1px solid var(--color-line);
    }

    .web .floor-list {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .web .floor-btn {
        position: relative;
        min-width: var(--touch-target-min);
        min-height: 44px;
        justify-content: center;
        padding: 4px;
    }

    .web .floor-btn.active {
        box-shadow: inset 3px 0 0 var(--color-yellow);
    }

    .web .floor-btn__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .web .map-main {
        padding: 4px var(--spacing-sm) var(--spacing-xs);
    }

    .web .map-floor-name {
        font-size: 1rem;
    }

    .web .map-floor-description,
    .web .map-hint {
        display: none;
    }

    .web .map-zoom-controls {
        right: var(--spacing-xs);
        bottom: var(--spacing-xs);
        gap: 4px;
    }

    .web .map-zoom-btn {
        width: 44px;
        height: 44px;
    }

    .web .map-zoom-btn--apart {
        margin-bottom: 4px;
    }
}
