/* The 3D museum (resources/views/museum/index.blade.php). A full-screen
   canvas with the HUD over it. No backdrop-filter: it makes the compositor
   redraw the WebGL layer every frame, which a low-end phone cannot spare. */

:root {
    --mu-a: #7c3aed;
    --mu-a-text: #c4a8ff;
    --mu-deep: #11082b;
    --mu-surface: #1a1340;
    --mu-panel: rgba(20, 13, 48, 0.94);
    --mu-text: #ffffff;
    --mu-dim: rgba(220, 210, 255, 0.74);
    --mu-dim-2: rgba(220, 210, 255, 0.5);
    --mu-line: rgba(255, 255, 255, 0.12);
    --mu-gold: #e6c97a;
    --mu-ease: cubic-bezier(0.1, 0.9, 0.2, 1);
    --mu-font: system-ui, "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    --mu-safe-top: env(safe-area-inset-top, 0px);
    --mu-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mu-safe-left: env(safe-area-inset-left, 0px);
    --mu-safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
h1, h2, h3 { text-wrap: balance; }
p, li, dt, dd, label, span { text-wrap: pretty; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--mu-deep);
    color: var(--mu-text);
    font-family: var(--mu-font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.mu-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    outline: none;
}

/* ---- Buttons ---- */
.mu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--mu-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--mu-text);
    font: 600 15px/1.2 var(--mu-font);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s var(--mu-ease), transform 0.2s var(--mu-ease);
}
.mu-btn:active { transform: scale(0.98); }
.mu-btn--primary { background: var(--mu-a); border-color: transparent; }
.mu-btn--primary:focus-visible, .mu-btn:focus-visible, .mu-icon-btn:focus-visible { outline: 2px solid var(--mu-gold); outline-offset: 2px; }
.mu-btn--wide { width: 100%; }

.mu-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--mu-text);
    cursor: pointer;
    flex: none;
}

.mu-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

/* ---- Overlays: loader, start, pause, fallback ---- */
.mu-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: calc(24px + var(--mu-safe-top)) 20px calc(24px + var(--mu-safe-bottom));
    background:
        radial-gradient(110% 70% at 50% 0%, rgba(124, 58, 237, 0.32), transparent 60%),
        var(--mu-deep);
}
.mu-overlay--soft { background: rgba(10, 6, 26, 0.72); }

.mu-panel {
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.mu-panel h1 { margin: 14px 0 18px; font-size: 30px; line-height: 1.1; letter-spacing: -0.01em; }
.mu-panel h2 { margin: 0 0 6px; font-size: 24px; }

.mu-progress {
    position: relative;
    height: 4px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}
.mu-progress span {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--mu-a), var(--mu-gold));
    animation: mu-progress 1.3s var(--mu-ease) infinite;
}
@keyframes mu-progress {
    from { left: -36%; }
    to { left: 100%; }
}
.mu-loader__stage { margin: 12px 0 0; color: var(--mu-dim); font-size: 14px; }

/* Key lists: one row per control. Touch screens read the pad list. */
.mu-keys { margin: 0 0 20px; text-align: left; }
.mu-keys > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 2px;
    border-top: 1px solid var(--mu-line);
}
.mu-keys > div:last-child { border-bottom: 1px solid var(--mu-line); }
.mu-keys dt { margin: 0; color: var(--mu-text); font-weight: 600; font-size: 14px; }
.mu-keys dd { margin: 0; color: var(--mu-dim); font-size: 14px; text-align: right; }
.mu-keys--touch { display: none; }
.mu--touch .mu-keys--desk { display: none; }
.mu--touch .mu-keys--touch { display: block; }

/* ---- HUD ---- */
.mu-hud {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.mu-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + var(--mu-safe-top)) calc(12px + var(--mu-safe-right)) 10px calc(12px + var(--mu-safe-left));
    background: linear-gradient(180deg, rgba(10, 6, 26, 0.72), rgba(10, 6, 26, 0));
    pointer-events: none;
}
.mu-bar > * { pointer-events: auto; }
.mu-bar__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--mu-text);
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
}
/* The sound switch shows a struck speaker while the sound is off. */
.mu-sound__off { display: none; }
.mu-sound.is-muted .mu-sound__on { display: none; }
.mu-sound.is-muted .mu-sound__off { display: block; }
/* On a narrow phone the logo alone stands for the brand, so the wing name keeps its room. */
@media (max-width: 420px) {
    .mu-bar__brand span { display: none; }
}
.mu-bar__zone {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--mu-gold);
    font-weight: 600;
    font-size: 14px;
    pointer-events: none;
}

/* The crosshair: a dot that turns into a gold ring over something usable. */
.mu-cross {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
}
.mu-cross__ring {
    position: absolute;
    left: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 1.5px rgba(10, 6, 26, 0.65);
    transition: all 0.18s var(--mu-ease);
}
.mu-cross.is-on .mu-cross__ring {
    left: -14px;
    top: -14px;
    width: 28px;
    height: 28px;
    background: rgba(230, 201, 122, 0.12);
    box-shadow: 0 0 0 2.5px var(--mu-gold), 0 0 14px rgba(230, 201, 122, 0.55);
}
.mu-cross__label {
    position: absolute;
    top: 24px;
    left: 0;
    transform: translateX(-50%);
    max-width: 70vw;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(10, 6, 26, 0.78);
    color: var(--mu-gold);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.18s var(--mu-ease);
}
.mu-cross.is-on .mu-cross__label { opacity: 1; }

/* ---- Touch pads ---- */
.mu-pad { display: none; }
.mu--touch .mu-pad {
    display: block;
    position: absolute;
    bottom: 0;
    height: 62%;
    width: 46%;
    pointer-events: auto;
    touch-action: none;
}
.mu--touch .mu-pad--move { left: 0; }
.mu--touch .mu-pad--look { right: 0; }

.mu-pad__base {
    position: absolute;
    width: 124px;
    height: 124px;
    margin: -62px 0 0 -62px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.28);
    transition: left 0.28s var(--mu-ease), top 0.28s var(--mu-ease), opacity 0.2s;
}
.mu-pad--move .mu-pad__base {
    left: calc(86px + var(--mu-safe-left));
    top: calc(100% - 92px - var(--mu-safe-bottom));
}
.mu-pad--look .mu-pad__base {
    left: calc(100% - 86px - var(--mu-safe-right));
    top: calc(100% - 92px - var(--mu-safe-bottom));
}
.mu-pad.is-held .mu-pad__base { transition: opacity 0.2s; }
.mu-pad__knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.24);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.mu-pad--look .mu-pad__knob { background: rgba(255, 255, 255, 0.1); box-shadow: none; }

/* The middle of the right pad uses what the crosshair points at. */
.mu-pad__use {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(10, 6, 26, 0.55);
    box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.18s var(--mu-ease);
}
.mu-pad--look.is-target .mu-pad__use {
    background: rgba(230, 201, 122, 0.18);
    box-shadow: inset 0 0 0 2.5px var(--mu-gold), 0 0 16px rgba(230, 201, 122, 0.45);
    color: var(--mu-gold);
}
.mu-pad--look.is-pressed .mu-pad__use { transform: scale(0.92); }

/* ---- Speech bubble, toast, stats ---- */
.mu-bubble {
    position: absolute;
    left: 0;
    top: 0;
    max-width: 240px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #fff;
    color: #1a1340;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    transform: translate(-50%, -100%);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.mu-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    background: #fff;
    transform: rotate(45deg);
}

.mu-toast {
    position: absolute;
    left: 50%;
    bottom: calc(150px + var(--mu-safe-bottom));
    transform: translateX(-50%);
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(10, 6, 26, 0.86);
    color: var(--mu-text);
    font-size: 14px;
}

.mu-stats {
    position: absolute;
    left: calc(12px + var(--mu-safe-left));
    top: calc(64px + var(--mu-safe-top));
    margin: 0;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #9fe8b0;
    font: 12px/1.35 ui-monospace, Consolas, monospace;
}

/* The compass while the registrar's directions are on. */
.mu-guide {
    position: absolute;
    left: 50%;
    top: calc(60px + var(--mu-safe-top));
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 24px);
    padding: 4px 4px 4px 12px;
    border-radius: 999px;
    background: rgba(10, 6, 26, 0.82);
    pointer-events: auto;
}
.mu-guide__arrow { flex: none; color: var(--mu-gold); }
.mu-guide__name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 600;
}
.mu-guide__dist {
    flex: none;
    color: var(--mu-gold);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.mu-guide__stop {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--mu-dim);
    cursor: pointer;
}
.mu-guide__stop:focus-visible { outline: 2px solid var(--mu-gold); outline-offset: -2px; }

/* A long guided walk fades out, jumps, and fades back in. */
.mu-fade {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: #06040f;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--mu-ease);
}
.mu-fade.is-on { opacity: 1; }

/* ---- Sheets: settings and the booth cards ----
   A bottom sheet on a phone, a side panel on a wide screen. One surface:
   the rows inside are flat, split by hairlines. */
.mu-sheet {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 78vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px calc(18px + var(--mu-safe-right)) calc(20px + var(--mu-safe-bottom)) calc(18px + var(--mu-safe-left));
    border-radius: 20px 20px 0 0;
    background: var(--mu-panel);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
    animation: mu-sheet-in 0.32s var(--mu-ease);
}
@keyframes mu-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}
@media (min-width: 900px) {
    .mu-sheet {
        left: auto;
        top: 16px;
        right: 16px;
        bottom: 16px;
        width: 400px;
        max-height: none;
        border-radius: 20px;
    }
}
.mu-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.mu-sheet__head h2 { margin: 0; font-size: 20px; line-height: 1.2; }

.mu-field {
    display: block;
    padding: 12px 0;
    border-top: 1px solid var(--mu-line);
}
.mu-field--row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mu-field__label { display: block; margin-bottom: 8px; color: var(--mu-dim); font-size: 13px; font-weight: 600; }
.mu-field--row .mu-field__label { margin: 0; }
.mu-field input[type="range"] { width: 100%; accent-color: var(--mu-a); }
.mu-field input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--mu-a); }
.mu-sheet .mu-keys { margin: 8px 0 0; }

.mu-segment {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
}
.mu-segment button {
    min-height: 38px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--mu-dim);
    font: 600 14px var(--mu-font);
    cursor: pointer;
}
.mu-segment button[aria-checked="true"] { background: var(--mu-a); color: #fff; }

/* Booth cards */
.mu-card__top { display: flex; align-items: center; gap: 14px; }
.mu-card__logo {
    width: 64px;
    height: 64px;
    flex: none;
    border-radius: 14px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}
.mu-card__photo {
    display: block;
    width: 100%;
    max-height: 46vh;
    border-radius: 16px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}
.mu-card__name { margin: 0; font-size: 20px; line-height: 1.2; }
.mu-card__record { margin: 4px 0 0; color: var(--mu-dim); font-size: 13px; }
.mu-card__mark { color: var(--mu-gold); font-weight: 600; }
.mu-card__rows { margin: 14px 0 0; }
.mu-card__rows > div { padding: 10px 0; border-top: 1px solid var(--mu-line); }
.mu-card__rows dt { margin: 0 0 3px; color: var(--mu-dim-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.mu-card__rows dd { margin: 0; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.mu-card__rows a { color: var(--mu-a-text); }
.mu-card__pets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mu-card__pets a { display: block; color: var(--mu-text); text-decoration: none; font-size: 12px; }
.mu-card__pets img,
.mu-card__pets .mu-card__blank {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.06);
}
.mu-card__pets span { display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mu-card__state { margin: 18px 0; color: var(--mu-dim); text-align: center; }
.mu-sheet--card .mu-actions { justify-content: stretch; }
.mu-sheet--card .mu-actions .mu-btn { flex: 1 1 140px; }

/* Registrar dialog: flat rows split by hairlines. */
.mu-dialog__title { flex: 1; min-width: 0; }
.mu-menu > * { border-top: 1px solid var(--mu-line); }
.mu-menu > :last-child { border-bottom: 1px solid var(--mu-line); }
.mu-menu__item,
.mu-dest__main {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 10px 2px;
    border: 0;
    background: none;
    color: var(--mu-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.mu-menu__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mu-menu__title { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.mu-menu__meta { color: var(--mu-dim); font-size: 13px; line-height: 1.35; }
.mu-menu__next { display: inline-grid; flex: none; color: var(--mu-dim-2); }
.mu-menu__item:focus-visible,
.mu-dest__main:focus-visible { outline: 2px solid var(--mu-gold); outline-offset: -2px; }
.mu-dest { display: flex; align-items: center; gap: 12px; }
.mu-dest__main {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
}
.mu-dest__walk { flex: none; min-height: 40px; padding: 0 14px; font-size: 14px; white-space: nowrap; }
.mu-search {
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 0 0 12px;
    padding: 0 14px;
    border: 1px solid var(--mu-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--mu-text);
    font: 16px var(--mu-font);
}
.mu-search::placeholder { color: var(--mu-dim-2); }
.mu-search:focus { outline: 2px solid var(--mu-a); outline-offset: 0; border-color: transparent; }

/* ---- Map: the floor plan over the whole screen ---- */
.mu-map {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: flex;
    flex-direction: column;
    background: var(--mu-deep);
    animation: mu-map-in 0.2s var(--mu-ease);
}
@keyframes mu-map-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.mu-map__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + var(--mu-safe-top)) calc(12px + var(--mu-safe-right)) 10px calc(16px + var(--mu-safe-left));
    border-bottom: 1px solid var(--mu-line);
}
.mu-map__head h2 { margin: 0; font-size: 18px; }
.mu-map__canvas {
    display: block;
    flex: 1;
    min-height: 0;
    width: 100%;
    touch-action: none;
    cursor: grab;
}
.mu-map__pick {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px calc(16px + var(--mu-safe-right)) calc(14px + var(--mu-safe-bottom)) calc(16px + var(--mu-safe-left));
    border-top: 1px solid var(--mu-line);
    background: var(--mu-deep);
}
.mu-map__place { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mu-map__name { font-size: 17px; line-height: 1.25; }
.mu-map__meta { color: var(--mu-dim); font-size: 13px; }
.mu-map__go { display: flex; gap: 10px; flex: 1 1 260px; justify-content: flex-end; }
.mu-map__go .mu-btn { flex: 1 1 0; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    .mu-sheet, .mu-progress span, .mu-map { animation: none; }
    .mu-cross__ring, .mu-pad__base, .mu-pad__use, .mu-btn { transition: none; }
}
