/* ==================================================
   Quest Compass v0.5 Field Companion UI
   ================================================== */

/* Main page foundation */
:root {
    --bottom-nav-height: 112px;
    --page-bottom-buffer: 40px;
    --safe-bottom: env(safe-area-inset-bottom);
    --z-base: 1;
    --z-header: 170;
    --z-scanner-overlay: 180;
    --z-bottom-nav: 300;
    --z-settings: 900;
    --z-modal: 1000;
    --z-toast: 1100;
}

@media (max-width: 720px) {
    .signalGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .confidenceItem {
        grid-column: 1 / -1;
    }

    .locationActions {
        grid-template-columns: 1fr 1fr;
    }

    .deleteButton {
        grid-column: 1 / -1;
    }

    .scannerTop {
        align-items: flex-start;
        flex-direction: column;
    }

    .miniButton {
        width: 100%;
    }
}

html {
    min-height: 100%;
    background: #050814;
}

body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at top, rgba(43, 91, 161, 0.28), transparent 32rem),
        linear-gradient(180deg, #050812 0%, #0b1020 50%, #070711 100%);
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
}

/* Mobile app shell */
.appShell {
    max-width: 920px;
    min-height: 100vh;
    margin: 0 auto;
    padding: calc(24px + env(safe-area-inset-top)) 18px calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--page-bottom-buffer));
    box-sizing: border-box;
}

main {
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--page-bottom-buffer));
}

/* Header */
.appHeader {
    position: relative;
    top: auto;
    z-index: var(--z-header);
    padding-top: 4px;
    padding-bottom: 6px;
    background: transparent;
    backdrop-filter: none;
}

/* Title row */
.titleRow {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* App icon */
.appIcon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 34px;
}

/* Title */
h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.04em;
}

/* Mode subtitle */
.modeSubtitle {
    margin: 8px 0 0;
    color: #6fa7ff;
    font-size: 18px;
    font-weight: 700;
}

/* Settings icon */
.iconButton {
    margin-left: auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: white;
    font-size: 24px;
}

/* Status chip grid */
.statusGrid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.scanActive .statusGrid {
    grid-template-columns: repeat(4, auto);
    overflow-x: auto;
    padding-bottom: 2px;
}

.scanActive .statusChip {
    min-width: max-content;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 999px;
}

.scanActive .chipIcon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 15px;
}

.scanActive .statusChip strong,
.scanActive .statusChip small {
    display: inline;
    font-size: 12px;
}

.scanActive .statusChip strong {
    margin-right: 4px;
}

/* Status chip */
.statusChip {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
    background: rgba(14, 21, 38, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.02);
}

/* Status chip icon */
.chipIcon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 20px;
}

/* Chip text */
.statusChip strong {
    display: block;
    font-size: 15px;
}

.statusChip small {
    display: block;
    margin-top: 2px;
    color: #aeb7c8;
}

/* Active states */
.statusChip.active {
    border-color: rgba(99, 255, 147, 0.45);
    box-shadow: 0 0 20px rgba(68, 255, 133, 0.1);
}

.statusChip.active small {
    color: #74f79b;
}

.statusChip.warning small {
    color: #ffd166;
}

/* Panels */
.modePanel {
    display: none;
}

.modePanel.activePanel {
    display: block;
}

.trailScannerOverlay #scanPanel {
    position: fixed;
    inset: calc(72px + env(safe-area-inset-top)) 10px calc(var(--bottom-nav-height) + 18px + var(--safe-bottom)) 10px;
    z-index: var(--z-scanner-overlay);
    display: block;
    overflow: auto;
    padding: 14px;
    border-radius: 24px;
    background: rgba(5, 8, 20, 0.94);
    border: 1px solid rgba(119, 173, 255, 0.24);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(16px);
}

.trailScannerOverlay .appHeader {
    z-index: 190;
}

/* General cards */
.compassCard,
.targetCard,
.readoutCard,
.scannerCard,
.compactTargetCard,
.createCard,
.libraryHeader,
.locationCard {
    border-radius: 24px;
    background: rgba(17, 24, 44, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 22px 50px rgba(0, 0, 0, 0.25),
        inset 0 0 32px rgba(255, 255, 255, 0.02);
}

/* Compass card */
.compassCard {
    margin-top: 18px;
    padding: 18px;
}

/* Compass dial */
.compassDial {
    position: relative;
    width: min(78vw, 520px);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(46, 84, 137, 0.28), rgba(6, 10, 20, 0.94) 68%),
        repeating-conic-gradient(from 0deg, rgba(98, 156, 255, 0.38) 0deg 1deg, transparent 1deg 6deg);
    border: 12px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 0 45px rgba(72, 135, 255, 0.16),
        inset 0 0 70px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: compassBreath 4.4s ease-in-out infinite;
}

/* Compass inner texture */
.compassDial::before {
    content: "";
    position: absolute;
    inset: 34px;
    border-radius: 50%;
    background:
        linear-gradient(130deg, rgba(255, 255, 255, 0.04), transparent),
        radial-gradient(circle at center, rgba(95, 144, 224, 0.16), transparent 60%);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.compassDial::after {
    content: "";
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background:
        conic-gradient(from 0deg, transparent, rgba(116, 247, 255, 0.14), transparent 18%, transparent 42%, rgba(255, 211, 106, 0.1), transparent 58%);
    filter: blur(10px);
    opacity: 0.5;
    animation: compassWind 9s linear infinite;
}

@keyframes compassBreath {
    0%,
    100% {
        box-shadow:
            0 0 45px rgba(72, 135, 255, 0.16),
            inset 0 0 70px rgba(0, 0, 0, 0.6);
    }

    50% {
        box-shadow:
            0 0 58px rgba(116, 247, 255, 0.24),
            inset 0 0 78px rgba(0, 0, 0, 0.56);
    }
}

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

/* Cardinal letters */
.cardinal {
    position: absolute;
    z-index: 2;
    color: rgba(255, 255, 255, 0.88);
    font-size: 28px;
    font-weight: 800;
}

.north {
    top: 22px;
    left: 50%;
    transform: translateX(-50%);
}

.east {
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
}

.south {
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
}

.west {
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
}

/* Large navigation arrow */
.directionArrow {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 46%;
    width: 0;
    height: 0;
    transform: translate(-50%, -50%) rotate(0deg);
    color: #9fc6ff;
    font-size: 160px;
    line-height: 1;
    text-shadow:
        0 0 18px rgba(83, 151, 255, 0.75),
        0 0 44px rgba(83, 151, 255, 0.45);
    transition: transform 0.25s ease;
}

/* Bearing readout */
.bearingReadout {
    position: absolute;
    z-index: 4;
    bottom: 70px;
    width: 100%;
    text-align: center;
    color: #76aaff;
    font-size: 20px;
    font-weight: 800;
}

/* Target card */
.targetCard {
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 14px;
    align-items: center;
    margin-top: 18px;
    padding: 18px;
}

/* Target icon */
.targetIcon {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(94, 255, 143, 0.28), rgba(94, 255, 143, 0.05));
    border: 1px solid rgba(117, 255, 165, 0.45);
    font-size: 36px;
    box-shadow: 0 0 26px rgba(94, 255, 143, 0.22);
    overflow: hidden;
    cursor: pointer;
}

.glyphProgressCard {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(13, 20, 38, 0.78);
    border: 1px solid rgba(119, 173, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.glyphProgressCard .primaryButton {
    width: auto;
    min-width: 156px;
    margin: 0;
    white-space: normal;
}

.locationImageThumb {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(119, 173, 255, 0.24), rgba(119, 173, 255, 0.05));
    border: 1px solid rgba(119, 173, 255, 0.5);
    color: #bcd4ff;
    font-size: 30px;
    overflow: hidden;
    cursor: pointer;
}

/* Small section label */
.sectionLabel {
    color: #5aa2ff;
    font-size: 12px;
    letter-spacing: 0.14em;
    font-weight: 900;
    text-transform: uppercase;
}

/* Target typography */
.targetMain h2,
.createCard h2,
.libraryHeader h2,
.scannerTop h2,
.compactTargetCard h2 {
    margin: 5px 0;
    font-size: 30px;
}

.targetMain p,
.compactTargetCard p {
    margin: 0;
    color: #aeb7c8;
}

/* Target stats */
.targetStats {
    min-width: 90px;
    text-align: right;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    padding-left: 18px;
}

.targetStats small {
    display: block;
    color: #aeb7c8;
}

.targetStats strong {
    display: block;
    font-size: 34px;
    margin: 4px 0;
}

.proximityLabel,
.exactDistance {
    display: block;
}

.proximityLabel {
    color: #9fd4ff;
    font-size: 15px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.exactDistance {
    color: #ffffff;
    font-size: 30px;
}

/* Action grid */
.actionGrid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

/* Action tile */
.actionTile {
    min-height: 116px;
    padding: 14px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(14, 21, 38, 0.88);
    color: white;
}

.actionTile span {
    display: block;
    font-size: 32px;
}

.actionTile strong {
    display: block;
    margin-top: 8px;
    font-size: 15px;
}

.actionTile small {
    display: block;
    margin-top: 5px;
    color: #aeb7c8;
}

.greenAction span,
.greenAction small {
    color: #74f79b;
}

.blueAction span,
.blueAction small {
    color: #77adff;
}

.purpleAction span,
.purpleAction small {
    color: #c789ff;
}

.goldAction span,
.goldAction small {
    color: #ffd166;
}

/* Readout card */
.readoutCard {
    margin-top: 18px;
    padding: 16px;
    color: #cbd5e1;
    line-height: 1.6;
}

/* Scanner */
.scannerCard {
    margin-top: 18px;
    padding: 16px;
}

.scannerTop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.miniButton {
    width: auto;
    padding: 12px 16px;
    border-radius: 14px;
    background: #233a66;
    color: white;
    border: 1px solid rgba(119, 173, 255, 0.3);
}

.cameraFrame {
    position: relative;
    margin-top: 14px;
    border-radius: 22px;
    overflow: hidden;
    background: black;
    border: 1px solid rgba(255, 255, 255, 0.14);
    min-height: 280px;
    display: grid;
    place-items: center;
}

.confirmFoundButton {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 8;
    width: auto;
    min-width: 170px;
    border-radius: 999px;
    padding: 13px 20px;
    background: rgba(91, 141, 255, 0.92);
    border: 1px solid rgba(194, 221, 255, 0.9);
    color: white;
    font-weight: 900;
    box-shadow: 0 0 24px rgba(91, 141, 255, 0.65);
}

.confirmFoundButton:disabled {
    opacity: 0.72;
    background: rgba(30, 39, 58, 0.92);
    color: #aeb7c8;
    box-shadow: none;
}

.confirmFoundButton[hidden] {
    display: none;
}

.liveBadge {
    position: absolute;
    z-index: 4;
    left: 14px;
    top: 14px;
    color: white;
    font-weight: 800;
    font-size: 13px;
}

.liveBadge::first-letter {
    color: #ff5a4f;
}

#cameraVideo {
    display: none;
}

#cameraCanvas {
    display: none;
    width: 100%;
    min-height: 280px;
    background: black;
}

/* Marker banner */
.markerBanner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(14, 21, 38, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.markerIcon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(100, 255, 145, 0.12);
    font-size: 24px;
}

.markerBanner strong {
    color: #74f79b;
    font-size: 18px;
}

.markerBanner p {
    margin: 4px 0 0;
    color: #cbd5e1;
}

/* Signal grid */
.signalGrid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.signalItem {
    padding: 12px;
    border-radius: 16px;
    background: rgba(9, 14, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.signalItem span {
    display: block;
    color: #cbd5e1;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 900;
}

.signalItem strong {
    display: block;
    margin-top: 6px;
    font-size: 16px;
}

/* Bars */
.barTrack {
    height: 8px;
    margin-top: 10px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.barFill {
    width: 0%;
    height: 100%;
    border-radius: 99px;
    transition: width 0.25s ease;
}

.redFill {
    background: #ff5a4f;
}

.blueFill {
    background: #5aa2ff;
}

.goldFill {
    background: #ffd166;
}

.greenFill {
    background: #74f79b;
}

/* Compact target on scan screen */
.compactTargetCard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding: 18px;
    cursor: pointer;
}

.miniCompass {
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(43, 76, 133, 0.35);
    border: 1px solid rgba(119, 173, 255, 0.25);
    color: #77adff;
    font-size: 42px;
}

/* Create */
.createCard {
    margin-top: 18px;
    padding: 18px;
}

.mapPreview {
    width: 100%;
    min-height: 160px;
    display: grid;
    place-items: center;
    margin: 16px 0;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
        radial-gradient(circle, rgba(99, 255, 147, 0.25), transparent 35%),
        rgba(14, 21, 38, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.mapPin {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(94, 255, 143, 0.12);
    border: 1px solid rgba(94, 255, 143, 0.45);
    font-size: 44px;
    overflow: hidden;
    background-position: center;
    background-size: cover;
    cursor: pointer;
}

.mapPin.hasImage {
    border-color: rgba(119, 173, 255, 0.85);
    box-shadow: 0 0 24px rgba(119, 173, 255, 0.35);
}

.targetIcon.hasImage,
.locationImageThumb.hasImage {
    background-position: center;
    background-size: cover;
}

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-weight: 800;
}

input,
textarea,
select {
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 8, 18, 0.86);
    color: white;
    font-size: 16px;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

.fieldReadout {
    margin-top: 14px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(9, 14, 26, 0.9);
    color: #cbd5e1;
    line-height: 1.5;
}

.primaryButton,
.secondaryButton {
    width: 100%;
    margin-top: 12px;
    padding: 16px;
    border-radius: 16px;
    border: none;
    color: white;
    font-size: 17px;
    font-weight: 900;
}

.primaryButton {
    background: linear-gradient(180deg, #2d8a4f, #176532);
}

.secondaryButton {
    background: linear-gradient(180deg, #6335a4, #3a216d);
}

/* Library */
.libraryHeader {
    margin-top: 18px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dangerMiniButton {
    width: auto;
    padding: 10px 14px;
    border-radius: 14px;
    background: #8d1c16;
    color: white;
    border: none;
}

.savedList {
    margin-top: 12px;
}

.locationCard {
    padding: 18px;
    margin-top: 14px;
}

.compactQuestCard {
    padding: 0;
    overflow: hidden;
}

.questDetails {
    display: block;
}

.questDetails summary {
    list-style: none;
}

.questDetails summary::-webkit-details-marker {
    display: none;
}

.questSummary {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto auto auto 22px;
    gap: 10px;
    align-items: center;
    padding: 12px;
    cursor: pointer;
}

.syncPendingButton {
    width: auto;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 211, 106, 0.45);
    background: rgba(255, 211, 106, 0.12);
    color: #ffd36a;
    font-size: 12px;
    font-weight: 800;
}

.questSummary .locationImageThumb {
    width: 54px;
    height: 54px;
}

.questSummaryText {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.questSummaryText strong,
.questSummaryText small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.questSummaryText strong {
    font-size: 18px;
}

.questSummaryText small {
    color: #aeb7c8;
}

.questSummaryStats {
    display: grid;
    justify-items: end;
    gap: 2px;
    color: #dce8ff;
}

.questSummaryStats small {
    color: #8fb4ff;
}

.questChevron {
    color: #8fb4ff;
    transition: transform 0.18s ease;
}

.questDetails[open] .questChevron {
    transform: rotate(180deg);
}

.questExpandedBody {
    padding: 0 14px 14px;
}

.compactMetaGrid {
    margin-top: 12px;
}

.locationCard h3 {
    margin: 0 0 8px;
    font-size: 24px;
}

.locationCard p {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.5;
}

.locationActions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 14px;
}

.glyphBuilder {
    margin-top: 16px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(9, 14, 26, 0.82);
    border: 1px solid rgba(119, 173, 255, 0.16);
}

.glyphBuilder p {
    margin: 6px 0 12px;
    color: #9fb0cc;
}

.glyphObjectiveRow {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.glyphPickerGrid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    margin-top: 4px;
}

.glyphPickerButton {
    min-height: 58px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 7px 4px;
    border-radius: 12px;
    border: 1px solid rgba(119, 173, 255, 0.16);
    background: rgba(4, 9, 20, 0.74);
    color: #dbeafe;
    font-weight: 800;
}

.glyphPickerButton small {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
}

.glyphPickerButton.selectedGlyph {
    border-color: rgba(116, 247, 255, 0.78);
    background: rgba(48, 92, 161, 0.42);
    box-shadow: 0 0 18px rgba(116, 247, 255, 0.2);
}

.glyphMiniIcon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
}

.cameraFrame::before,
.cameraFrame::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.cameraFrame::before {
    background:
        radial-gradient(circle at 50% 50%, rgba(116, 247, 255, 0.12), transparent 36%),
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.16) 1px, transparent 2px),
        radial-gradient(circle at 72% 34%, rgba(116, 247, 255, 0.16) 1px, transparent 2px),
        radial-gradient(circle at 38% 78%, rgba(255, 211, 106, 0.14) 1px, transparent 2px);
    opacity: 0.82;
    animation: scannerBreath 3.6s ease-in-out infinite;
}

.cameraFrame::after {
    background:
        linear-gradient(90deg, transparent, rgba(116, 247, 255, 0.55), transparent),
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 20%, transparent 80%, rgba(90, 162, 255, 0.08));
    height: 3px;
    top: 0;
    bottom: auto;
    box-shadow: 0 0 22px rgba(116, 247, 255, 0.55);
    animation: scannerSweep 2.8s linear infinite;
}

@keyframes scannerBreath {
    0%,
    100% {
        opacity: 0.42;
    }

    50% {
        opacity: 0.9;
    }
}

@keyframes scannerSweep {
    0% {
        transform: translateY(24px);
    }

    100% {
        transform: translateY(390px);
    }
}

.glyphMiniIcon::before {
    content: "△";
    font-size: 24px;
    line-height: 1;
    color: #ff7f7f;
}

.glyphObjectiveRow label {
    margin: 0;
}

.glyphObjectiveRow input[type="checkbox"] {
    width: auto;
}

.glyphObjectiveRow input[type="file"],
.glyphObjectiveRow label:last-child {
    grid-column: 2 / -1;
    width: 100%;
    min-width: 0;
}

.locationDataTools {
    display: grid;
    gap: 10px;
    margin: 14px 0;
    padding: 12px;
    border-radius: 14px;
    background: rgba(9, 14, 26, 0.78);
    border: 1px solid rgba(119, 173, 255, 0.16);
}

.libraryTabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.libraryTab {
    padding: 10px 8px;
    border-radius: 12px;
    background: rgba(13, 20, 38, 0.78);
    color: #b8c7df;
    border: 1px solid rgba(119, 173, 255, 0.14);
    font-size: 12px;
    font-weight: 800;
}

.activeLibraryTab {
    background: rgba(84, 132, 234, 0.32);
    color: white;
    border-color: rgba(119, 173, 255, 0.5);
}

.glyphObjectiveList {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 12px 0;
    list-style: none;
}

.glyphObjectiveList li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(8, 13, 25, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

.glyphIconBadge,
.glyphIconPhoto {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(119, 173, 255, 0.12);
    border: 1px solid rgba(119, 173, 255, 0.28);
    background-position: center;
    background-size: cover;
}

.glyphIconBadge::before {
    content: "△";
    color: #ff7f7f;
    font-size: 28px;
    font-weight: 900;
}

.glyph-circle::before,
.glyph-circle .glyphMiniIcon::before {
    content: "○";
}

.glyph-square::before,
.glyph-square .glyphMiniIcon::before {
    content: "□";
}

.glyph-green::before,
.glyph-green .glyphMiniIcon::before {
    color: #7dffb1;
}

.glyph-yellow::before,
.glyph-yellow .glyphMiniIcon::before {
    color: #ffd84d;
}

.glyph-blue::before,
.glyph-blue .glyphMiniIcon::before {
    color: #9fd4ff;
}

.glyph-black::before,
.glyph-black .glyphMiniIcon::before {
    color: #111827;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.24);
}

.headerFollowButton {
    width: auto;
    min-width: 118px;
    margin: 0;
}

.glyphObjectiveList .glyphComplete {
    border-color: rgba(94, 255, 143, 0.42);
    background: rgba(31, 91, 60, 0.25);
}

.cloudStatusCard,
.cloudLocationCard {
    border-color: rgba(94, 255, 184, 0.2);
    background:
        linear-gradient(135deg, rgba(94, 255, 184, 0.08), transparent),
        rgba(13, 20, 38, 0.84);
}

.adminTools {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.adminTools[hidden] {
    display: none;
}

.profileMap {
    position: relative;
    min-height: 150px;
    margin-top: 12px;
    padding: 12px;
    border-radius: 16px;
    overflow: hidden;
    background:
        linear-gradient(rgba(119, 173, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(119, 173, 255, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 30% 35%, rgba(94, 255, 143, 0.16), transparent 28%),
        rgba(6, 10, 22, 0.88);
    background-size: 22px 22px, 22px 22px, auto, auto;
    border: 1px solid rgba(119, 173, 255, 0.18);
}

.profileMap strong,
.profileMap small {
    position: relative;
    z-index: 2;
}

.profileMapMarker {
    position: absolute;
    z-index: 3;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: #7dffb1;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 18px rgba(125, 255, 177, 0.65);
}

.followButton {
    padding: 13px;
    border-radius: 14px;
    border: none;
    background: #2d4cff;
    color: white;
    font-weight: 900;
}

.deleteButton {
    padding: 13px;
    border-radius: 14px;
    border: 1px solid rgba(255, 90, 79, 0.35);
    background: rgba(141, 28, 22, 0.16);
    color: #ffb0aa;
    font-weight: 900;
}

.editButton {
    padding: 13px;
    border-radius: 14px;
    border: 1px solid rgba(119, 173, 255, 0.28);
    background: rgba(35, 58, 102, 0.64);
    color: white;
    font-weight: 900;
}

.technicalDetails {
    margin-top: 12px;
    color: #aeb7c8;
}

.technicalDetails summary {
    cursor: pointer;
    color: #77adff;
    font-weight: 800;
}

.technicalDetails p {
    margin-top: 8px;
    font-size: 13px;
}

/* Bottom nav */
.bottomNav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-bottom-nav);
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    transform: none;
    padding: 8px 8px calc(8px + var(--safe-bottom));
    border-radius: 22px 22px 0 0;
    background: rgba(11, 16, 32, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.navButton {
    padding: 10px 4px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: #8f9bb1;
    font-size: 13px;
}

.navButton span {
    display: block;
    font-size: 24px;
    margin-bottom: 4px;
}

.activeNav {
    color: #6fa7ff;
    background: rgba(68, 122, 220, 0.14);
    box-shadow: inset 0 0 28px rgba(68, 122, 220, 0.2);
}

.modalOverlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(10px);
}

.modalOverlay[hidden] {
    display: none;
}

.modalCard {
    width: min(420px, 100%);
    padding: 20px;
    border-radius: 22px;
    background: rgba(17, 24, 44, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.46);
}

.modalCard h2 {
    margin: 0;
    font-size: 26px;
}

.modalCard p {
    margin: 10px 0 0;
    color: #cbd5e1;
    line-height: 1.5;
}

.imagePreviewFull {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.35);
}

.modalActions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 18px;
}

.modalActions button {
    margin-top: 0;
}

.dangerButton {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    color: white;
    font-size: 17px;
    font-weight: 900;
    background: linear-gradient(180deg, #a72b22, #741610);
}

/* Mobile tightening */
@media (max-width: 720px) {
    .statusGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actionGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .signalGrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .targetCard {
        grid-template-columns: 64px 1fr;
    }

    .targetStats {
        grid-column: 1 / -1;
        text-align: left;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        padding-left: 0;
        padding-top: 12px;
    }

    h1 {
        font-size: 34px;
    }

    .directionArrow {
        font-size: 126px;
    }
}

/* Milestone 1.1 compact shell refinements */
.appHeader {
    position: relative;
    top: auto;
    z-index: 1;
    padding-top: 4px;
    padding-bottom: 6px;
    background: transparent;
    backdrop-filter: none;
}

.titleRow {
    gap: 10px;
    align-items: flex-start;
}

.titleText {
    flex: 1;
    min-width: 0;
}

.appIcon {
    width: 42px;
    height: 42px;
    font-size: 24px;
}

h1 {
    font-size: 30px;
    letter-spacing: 0;
}

.modeSubtitle {
    margin-top: 4px;
    font-size: 14px;
}

.headerLocationSelect {
    width: 100%;
    min-height: 36px;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(119, 173, 255, 0.28);
    background: rgba(9, 14, 26, 0.92);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
}

.iconButton {
    width: 42px;
    height: 42px;
    font-size: 16px;
}

.statusGrid,
.scanActive .statusGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
    overflow: visible;
}

.statusChip,
.scanActive .statusChip {
    min-width: 0;
    min-height: 38px;
    padding: 6px 7px;
    gap: 6px;
    border-radius: 12px;
    color: white;
    text-align: left;
    cursor: pointer;
}

.chipIcon,
.scanActive .chipIcon {
    display: none;
}

.statusChip strong,
.scanActive .statusChip strong {
    display: block;
    margin: 0;
    font-size: 10px;
    line-height: 1;
}

.statusChip small,
.scanActive .statusChip small {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    line-height: 1;
}

#trailGpsButton,
#trailCompassButton,
#trailScannerButton {
    display: none;
}

.actionGrid {
    grid-template-columns: 1fr;
    margin-top: 12px;
}

#trailSaveButton {
    min-height: 48px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(35, 58, 102, 0.74);
}

#trailSaveButton span,
#trailSaveButton small {
    display: none;
}

#trailSaveButton strong {
    margin: 0;
    font-size: 16px;
}

.scannerCard {
    position: relative;
    padding: 12px;
}

.scannerTop {
    margin-bottom: 10px;
}

.scannerTop h2 {
    font-size: 22px;
}

.cameraFrame {
    min-height: 420px;
    height: min(64vh, 560px);
    margin-top: 0;
}

#cameraCanvas {
    width: 100%;
    height: 100%;
    min-height: 420px;
    object-fit: cover;
}

.markerBanner {
    position: absolute;
    left: 24px;
    right: 24px;
    top: 46px;
    bottom: auto;
    z-index: 7;
    margin: 0;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(5, 8, 18, 0.76);
    backdrop-filter: blur(12px);
}

.markerIcon {
    display: none;
}

.markerBanner strong {
    font-size: 15px;
}

.markerBanner p {
    font-size: 12px;
    line-height: 1.3;
}

.signalGrid {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 18px;
    z-index: 6;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin: 0;
}

.signalItem {
    padding: 7px;
    border-radius: 10px;
    background: rgba(5, 8, 18, 0.72);
    backdrop-filter: blur(10px);
}

.signalItem span {
    font-size: 9px;
}

.signalItem strong {
    margin-top: 4px;
    font-size: 12px;
}

.barTrack {
    height: 4px;
    margin-top: 5px;
}

.libraryDetail h3 {
    margin-bottom: 4px;
    font-size: 28px;
}

.locationHint {
    margin-top: 10px;
    font-size: 16px;
}

.libraryMetaGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.libraryMetaGrid div {
    min-height: 64px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(9, 14, 26, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.libraryMetaGrid small {
    display: block;
    color: #aeb7c8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.libraryMetaGrid strong {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    line-height: 1.3;
}

.savedMeta {
    margin-top: 12px;
}

@media (max-width: 720px) {
    .appShell {
        padding-left: 14px;
        padding-right: 14px;
    }

    h1 {
        font-size: 28px;
    }

    .statusGrid,
    .scanActive .statusGrid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cameraFrame {
        min-height: 430px;
        height: 58vh;
    }

    .markerBanner {
        left: 20px;
        right: 20px;
        top: 44px;
        bottom: auto;
    }

    .signalGrid {
        left: 20px;
        right: 20px;
        bottom: 18px;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .confidenceItem {
        grid-column: auto;
    }

    .libraryMetaGrid {
        grid-template-columns: 1fr;
    }
}

/* Landing, accounts, settings, and attunement */
.landingGate {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 50% 20%, rgba(90, 162, 255, 0.24), transparent 34rem),
        linear-gradient(180deg, #050814, #090d19);
}

.landingGate[hidden] {
    display: none;
}

.landingPanel {
    width: min(460px, 100%);
    padding: 24px;
    border-radius: 24px;
    background: rgba(17, 24, 44, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.landingPanel h1 {
    margin-top: 10px;
    font-size: 32px;
}

.landingPanel p {
    color: #cbd5e1;
    line-height: 1.5;
}

.landingMark {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #ff5a4f;
    border: 1px solid rgba(255, 90, 79, 0.45);
    background: rgba(255, 90, 79, 0.08);
    font-size: 44px;
    text-shadow: 0 0 20px rgba(255, 90, 79, 0.8);
}

.authForm {
    margin-top: 16px;
}

.authMessage {
    min-height: 20px;
    margin: 10px 0 0;
    color: #74f79b;
}

.authMessage.error {
    color: #ffb0aa;
}

.accountBar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: #aeb7c8;
    font-size: 12px;
}

.accountBar span {
    min-width: 0;
}

.settingsPanel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: calc(88px + env(safe-area-inset-top));
    z-index: var(--z-settings);
    max-height: calc(100dvh - 112px - var(--safe-bottom));
    overflow: auto;
    padding: 16px 16px calc(var(--bottom-nav-height) + var(--safe-bottom) + 24px);
    border-radius: 18px;
    background: rgba(9, 14, 26, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5);
}

.settingsOpen .settingsPanel {
    box-shadow:
        0 0 0 9999px rgba(0, 0, 0, 0.62),
        0 24px 80px rgba(0, 0, 0, 0.56);
}

.settingsOpen .bottomNav,
.settingsOpen main,
.settingsOpen .statusGrid,
.settingsOpen .accountBar,
.settingsOpen .headerLocationSelect,
.settingsOpen .liveBadge,
.settingsOpen .markerBanner,
.settingsOpen .signalGrid,
.settingsOpen .confirmFoundButton,
.settingsOpen .attunePrompt {
    z-index: 1;
    pointer-events: none;
}

.settingsHeader {
    position: sticky;
    top: -16px;
    z-index: 2;
    padding: 0 0 12px;
    background: rgba(9, 14, 26, 0.98);
}

.hiddenControl {
    display: none !important;
}

.settingsPanel[hidden] {
    display: none;
}

.settingsHeader {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.settingsHeader h2 {
    margin: 4px 0 0;
    font-size: 22px;
}

.settingsGrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.settingsGrid label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 10px;
    border-radius: 12px;
    background: rgba(17, 24, 44, 0.86);
    font-size: 13px;
}

.settingsGrid input {
    width: auto;
}

.settingsInputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.settingsInputs label {
    margin-top: 0;
}

.settingsActions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.statsPanel {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.statsText p {
    margin: 8px 0;
    color: #cbd5e1;
    line-height: 1.35;
}

.directionArrow {
    top: 50%;
    width: auto;
    height: auto;
    display: block;
    line-height: 1;
    transform-origin: 50% 52%;
    color: transparent;
    background: linear-gradient(0deg, #5878ba 18%, #a9c5ff 58%, #f4fbff 88%);
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow:
        0 -22px 18px rgba(219, 242, 255, 0.55),
        0 -8px 14px rgba(126, 202, 255, 0.78),
        0 18px 28px rgba(60, 94, 160, 0.32);
}

.clueBlock {
    margin-top: 14px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(9, 14, 26, 0.92);
    border: 1px solid rgba(119, 173, 255, 0.14);
}

.clueBlock strong {
    color: #77adff;
}

.clueBlock p {
    margin: 6px 0;
}

.clueBlock small,
.rewardText {
    color: #cbd5e1;
}

.attunePrompt {
    position: absolute;
    left: 50%;
    bottom: 20px;
    z-index: 8;
    width: min(260px, calc(100% - 52px));
    transform: translateX(-50%);
    text-align: center;
}

.attunePrompt[hidden] {
    display: none;
}

.attuneButton {
    width: 100%;
    min-height: 74px;
    border-radius: 999px;
    border: 1px solid rgba(90, 162, 255, 0.8);
    background:
        radial-gradient(circle at 50% 30%, rgba(116, 247, 255, 0.28), transparent),
        rgba(5, 12, 30, 0.9);
    color: white;
    box-shadow:
        0 0 24px rgba(90, 162, 255, 0.62),
        inset 0 0 24px rgba(90, 162, 255, 0.18);
}

.attuneButton span {
    display: block;
    font-size: 22px;
    font-weight: 900;
}

.attuneButton small {
    display: block;
    margin-top: 4px;
    color: #bfe0ff;
}

.attuneMeter {
    height: 10px;
    margin-top: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 0 18px rgba(90, 162, 255, 0.45);
}

.attuneMeterFill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5aa2ff, #74f7ff);
    box-shadow: 0 0 16px rgba(116, 247, 255, 0.95);
    transition: width 0.06s linear;
}

@media (max-width: 720px) {
    .settingsGrid,
    .settingsInputs,
    .settingsActions {
        grid-template-columns: 1fr;
    }

    .accountBar {
        flex-direction: column;
        gap: 3px;
    }

    .questSummary {
        grid-template-columns: 48px minmax(0, 1fr) auto 18px;
    }

    .questSummary .locationImageThumb {
        width: 48px;
        height: 48px;
    }

    .questSummary .headerFollowButton {
        grid-column: 2 / 5;
        width: 100%;
        min-width: 0;
    }

    .questSummary .syncPendingButton {
        grid-column: 2 / 5;
        width: 100%;
    }

    .questSummaryStats {
        font-size: 12px;
    }

    .glyphPickerGrid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .attunePrompt {
        bottom: 20px;
    }
}
