:root {
    color-scheme: light;
    --page: #ffffff;
    --panel: #444444;
    --panel-muted: #5e5e5e;
    --panel-light: #707070;
    --panel-text: #f6f6f6;
    --panel-hint: #d4d4d4;
    --white: #ffffff;
    --accent: #b01820;
    --line: #b01820;
}

@property --found-fill {
    syntax: "<color>";
    inherits: true;
    initial-value: #b01820;
}

* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    color: var(--panel-text);
    background: var(--page);
}

button, input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

input {
    user-select: text;
    -webkit-user-select: text;
}

.hidden {
    display: none !important;
}

#app {
    height: 100%;
    min-height: 100%;
}

#map {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: auto;
    height: calc(100% - 12.2rem);
    overflow: hidden;
    background: var(--white);
    border-bottom: 4px solid #f6e7a2;
}

#map.map-locked {
    height: var(--map-locked-height);
}

#wr {
    width: 100%;
    height: 100%;
    overflow: auto;
    scrollbar-width: none;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    background: var(--white);
}

#wr::-webkit-scrollbar {
    display: none;
}

#wr > svg {
    display: block;
    width: auto;
    min-width: 100%;
    height: 100%;
    background: var(--white);
}

#controls {
    position: absolute;
    z-index: 5;
    top: .65rem;
    left: .65rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
}

.floor-current, .floor-select {
    color: var(--panel-text);
    background: rgba(68, 68, 68, .94);
    border-radius: .75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .16);
}

.floor-current {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .55rem .35rem .75rem;
    font-size: 1.05rem;
    white-space: nowrap;
}

.floor-current svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: currentColor;
    transition: transform .16s ease;
}

.floor-current[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.floor-select {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    padding: .32rem;
}

.floor-select button {
    min-width: 4.8rem;
    padding: .28rem .45rem;
    color: var(--panel-text);
    background: transparent;
    border-radius: .48rem;
    font-size: .98rem;
}

.floor-select button.active,
.floor-select button:active {
    background: var(--panel-light);
}

.highlight > *,
.highlight > * > * {
    fill: var(--found-fill) !important;
    stroke: #171717 !important;
}

.highlight {
    --found-fill: var(--accent);
    animation: found-fill 2s ease-in-out infinite;
}

#Линия {
    --found-fill: var(--line);
    animation: found-fill 2s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

#Линия line {
    stroke: var(--found-fill) !important;
}

#Линия rect {
    fill: var(--found-fill) !important;
}

@keyframes found-fill {
    0%, 100% { --found-fill: var(--accent); }
    50% { --found-fill: #7f1118; }
}

#map-message {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: calc(100% - 2rem);
    padding: .75rem 1rem;
    color: #fff;
    background: rgba(68, 68, 68, .94);
    border-radius: .85rem;
    text-align: center;
}

#bottom-panel {
    position: fixed;
    z-index: 10;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: .38rem;
    min-height: 12.2rem;
    padding: .42rem .62rem calc(.65rem + env(safe-area-inset-bottom));
    background: transparent;
}

#mode-switch {
    display: flex;
    align-self: flex-start;
    overflow: hidden;
    border-radius: 1.2rem;
    background: var(--panel);
}

#mode-switch button {
    min-width: 5.4rem;
    padding: .28rem .8rem;
    color: #eee;
    background: var(--panel);
    font-size: 1rem;
}

#mode-switch button.active {
    color: #fff;
    background: #8d8d8d;
}

#mode-switch,
.panel-card,
.route-card {
    box-shadow: 0 .7rem 2.2rem rgba(0, 0, 0, .16), 0 .12rem .45rem rgba(0, 0, 0, .12);
}

.panel-card, .route-card {
    position: relative;
    width: 100%;
    padding: .62rem .68rem .68rem;
    color: var(--panel-text);
    background: var(--panel);
    border-radius: 1rem;
}

.panel-title {
    margin: 0 0 .48rem;
    font-size: 1.02rem;
    line-height: 1.2;
}

.field-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.35rem;
    padding: .1rem .58rem;
    color: var(--panel-hint);
    background: var(--panel-muted);
    border-radius: .72rem;
}

.field-row svg {
    flex: 0 0 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
    fill: currentColor;
}

.field-row input {
    min-width: 0;
    width: 100%;
    padding: .36rem 0;
    color: #fff;
    background: transparent;
    border: 0;
    outline: none;
    font-size: 1rem;
}

.field-row input::placeholder {
    color: #c6c6c6;
    opacity: .8;
}

.hints {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    max-height: 4.5rem;
    padding-top: .35rem;
    overflow: auto;
    scrollbar-width: none;
}

.hints:empty {
    display: none;
}

.hints::-webkit-scrollbar {
    display: none;
}

.hints button, .hint-empty {
    padding: .28rem .68rem;
    color: #333;
    background: #f8f8f8;
    border-radius: 1rem;
    font-size: .91rem;
    white-space: nowrap;
}

.hint-empty {
    color: var(--panel-hint);
    background: var(--panel-light);
}

.navigator-fields {
    display: grid;
    gap: .28rem;
}

.navigator-fields .hints {
    padding: 0 0 .08rem 1.7rem;
}

.primary-button, .secondary-button {
    min-height: 2.3rem;
    padding: .34rem 1.1rem;
    border-radius: .78rem;
    font-size: 1rem;
}

.primary-button {
    display: block;
    margin: .5rem 0 0 auto;
    color: #333;
    background: #fff;
}

.primary-button:disabled {
    color: #aaa;
    background: #777;
    cursor: not-allowed;
}

.secondary-button {
    color: #fff;
    background: var(--panel-light);
}

.feedback {
    min-height: 0;
    margin: .3rem 0 0;
    color: #ffd1d1;
    font-size: .85rem;
}

.route-card {
    max-height: min(62vh, 26rem);
    overflow: auto;
}

.route-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
}

.route-card-head strong {
    font-size: 1.05rem;
}

.route-card-head button {
    padding: .3rem .8rem;
    color: #fff;
    background: var(--panel-light);
    border-radius: .7rem;
}

#route-summary {
    margin: .45rem 0 .6rem;
    color: var(--panel-hint);
}

.route-steps {
    display: grid;
    gap: .42rem;
    margin-bottom: .65rem;
}

.route-step {
    padding: .48rem .58rem;
    background: var(--panel-muted);
    border-radius: .68rem;
}

.route-step strong {
    display: block;
    margin-bottom: .12rem;
}

.route-step span {
    color: var(--panel-hint);
    font-size: .9rem;
}

#block {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #333;
    background: var(--page);
}

#block h3 {
    margin: 1rem 0 .1rem;
    font-weight: 500;
}

#block p {
    margin: 0;
    color: #555;
}

#loader {
    width: 2rem;
    height: 2rem;
    border: 3px solid #444;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 600px) {
    #bottom-panel {
        right: 50%;
        width: min(34rem, 100%);
        transform: translateX(50%);
    }
}
