:root {
    --brand: #6d4aff;
    --brand-dark: #5534dd;
    --brand-soft: #eeeaff;
    --ink: #211d36;
    --muted: #767287;
    --line: #e9e6f1;
    --surface: #ffffff;
    --canvas: #f6f5fa;
    --success: #20a66a;
    --success-soft: #e8f8f0;
    --danger: #e05065;
    --danger-soft: #fff0f2;
    --warning: #e8972c;
    --shadow: 0 16px 45px rgba(43, 34, 86, .12);
    --nav-height: 76px;
    color-scheme: light;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #ebe9f2;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--ink);
    background: #ebe9f2;
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button[aria-busy="true"] {
    position: relative;
    overflow: hidden;
}

button[aria-busy="true"]::after {
    position: absolute;
    z-index: 5;
    display: grid;
    place-items: center;
    inset: 0;
    border-radius: inherit;
    color: white;
    content: "发送中…";
    background: rgba(70, 48, 175, .94);
    font-size: 11px;
    font-weight: 800;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(109, 74, 255, .28);
    outline-offset: 2px;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    position: relative;
    width: min(100%, 480px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    overflow-x: hidden;
    background: var(--canvas);
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    height: calc(76px + env(safe-area-inset-top));
    padding: calc(12px + env(safe-area-inset-top)) 18px 10px;
    color: white;
    background: linear-gradient(135deg, #7557ff 0%, #5f3fe4 60%, #4c31c5 100%);
    box-shadow: 0 8px 24px rgba(78, 52, 190, .2);
}

.pet-avatar,
.profile-avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .52);
    color: white;
    background: linear-gradient(145deg, #ffaf74, #e56e83);
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(42, 26, 105, .2);
}

.pet-avatar {
    width: 42px;
    height: 42px;
    border-radius: 15px;
}

.pet-heading {
    min-width: 0;
    flex: 1;
}

.eyebrow,
.section-kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar .eyebrow {
    margin-bottom: 2px;
    color: rgba(255, 255, 255, .7);
}

.pet-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pet-name-row h1 {
    overflow: hidden;
    margin: 0;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-state {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 999px;
    color: #f5f2ff;
    background: rgba(255, 255, 255, .16);
    font-size: 10px;
    font-weight: 700;
}

.device-state i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #73f0b2;
    box-shadow: 0 0 0 3px rgba(115, 240, 178, .16);
}

.device-state.offline i {
    background: #c8c4d5;
    box-shadow: none;
}

.battery-pill,
.map-badge,
.soft-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
}

.battery-pill {
    gap: 5px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .15);
    font-size: 12px;
    font-weight: 750;
}

.battery-pill svg {
    width: 18px;
    height: 18px;
}

main {
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 18px);
}

.page {
    display: none;
    min-height: calc(100vh - 76px - var(--nav-height));
    padding: 14px 14px 24px;
    animation: page-in .2s ease-out;
}

.page.active {
    display: block;
}

@keyframes page-in {
    from { opacity: .3; transform: translateY(4px); }
}

.map-card,
.chart-card,
.settings-card,
.profile-card,
.info-card,
.daily-card {
    border: 1px solid rgba(229, 226, 239, .9);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(47, 39, 82, .06);
}

.map-card {
    overflow: hidden;
}

.mock-map {
    position: relative;
    height: clamp(280px, 42vh, 385px);
    overflow: hidden;
    background: #edf0eb;
    isolation: isolate;
}

.map-grid {
    position: absolute;
    inset: 0;
    opacity: .55;
    background-image:
        linear-gradient(28deg, transparent 47%, rgba(255, 255, 255, .92) 48%, rgba(255, 255, 255, .92) 53%, transparent 54%),
        linear-gradient(118deg, transparent 47%, rgba(255, 255, 255, .68) 48%, rgba(255, 255, 255, .68) 52%, transparent 53%);
    background-size: 142px 126px, 184px 178px;
}

.road {
    position: absolute;
    z-index: 1;
    height: 19px;
    border: 5px solid white;
    border-right: 0;
    border-left: 0;
    background: #dce0dd;
    box-shadow: 0 0 0 1px rgba(182, 188, 185, .35);
}

.road::after {
    position: absolute;
    top: 4px;
    right: 0;
    left: 0;
    height: 1px;
    content: "";
    background: repeating-linear-gradient(90deg, #f8f8f8 0 12px, transparent 12px 22px);
}

.road-a { top: 29%; left: -8%; width: 118%; transform: rotate(-12deg); }
.road-b { top: 67%; left: -8%; width: 118%; transform: rotate(18deg); }
.road-c { top: 49%; left: 34%; width: 80%; transform: rotate(83deg); }

.park {
    position: absolute;
    z-index: 0;
    display: grid;
    place-items: center;
    border: 1px solid #c9dec7;
    border-radius: 42% 58% 52% 48%;
    color: #6e966d;
    background: #dcebd7;
    font-size: 10px;
    font-weight: 700;
}

.park-a { top: 8%; right: 5%; width: 35%; height: 29%; transform: rotate(6deg); }

.building {
    position: absolute;
    z-index: 0;
    border: 1px solid #dedbd5;
    border-radius: 8px;
    background: #e8e5df;
}

.building-a { bottom: 8%; left: 4%; width: 25%; height: 17%; transform: rotate(8deg); }
.building-b { top: 13%; left: 7%; width: 22%; height: 18%; transform: rotate(-6deg); }

.map-label {
    position: absolute;
    z-index: 2;
    color: #90948d;
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .04em;
}

.label-a { top: 42%; left: 8%; transform: rotate(-12deg); }
.label-b { top: 24%; right: 11%; }

.map-badges {
    position: absolute;
    z-index: 8;
    top: 12px;
    left: 12px;
    display: flex;
    gap: 6px;
}

.map-badge {
    min-height: 30px;
    gap: 6px;
    padding: 6px 10px;
    color: #514b60;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 4px 12px rgba(43, 41, 54, .1);
    backdrop-filter: blur(8px);
    font-size: 10px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.map-badge.live .pulse-dot {
    background: var(--danger);
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    50% { box-shadow: 0 0 0 6px rgba(224, 80, 101, 0); }
    0%, 100% { box-shadow: 0 0 0 0 rgba(224, 80, 101, .3); }
}

.fence-layer {
    position: absolute;
    z-index: 3;
    inset: 0;
    pointer-events: none;
}

.fence-circle {
    position: absolute;
    border: 2px solid rgba(109, 74, 255, .5);
    border-radius: 50%;
    background: rgba(109, 74, 255, .11);
    transform: translate(-50%, -50%);
}

.fence-circle span {
    position: absolute;
    top: -22px;
    left: 50%;
    padding: 3px 7px;
    border-radius: 99px;
    color: var(--brand-dark);
    background: rgba(255, 255, 255, .88);
    font-size: 9px;
    font-weight: 750;
    white-space: nowrap;
    transform: translateX(-50%);
}

.accuracy-ring {
    position: absolute;
    z-index: 4;
    width: 74px;
    height: 74px;
    border: 1px solid rgba(109, 74, 255, .25);
    border-radius: 50%;
    background: rgba(109, 74, 255, .08);
    transform: translate(-50%, -50%);
    transition: left .8s ease, top .8s ease;
}

.pet-marker {
    position: absolute;
    z-index: 6;
    display: grid;
    width: 50px;
    height: 58px;
    padding: 0 0 8px;
    border: 0;
    color: white;
    background: transparent;
    transform: translate(-50%, -82%);
    transition: left .8s ease, top .8s ease;
    cursor: pointer;
}

.pet-marker::before {
    position: absolute;
    z-index: -1;
    inset: 2px 6px 10px;
    border: 4px solid white;
    border-radius: 50% 50% 50% 8px;
    content: "";
    background: linear-gradient(145deg, #7658ff, #5435d8);
    box-shadow: 0 6px 13px rgba(65, 45, 158, .28);
    transform: rotate(-45deg);
}

.pet-marker span {
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 850;
}

.recenter-button,
.icon-button {
    display: grid;
    place-items: center;
    border: 0;
    cursor: pointer;
}

.recenter-button {
    position: absolute;
    z-index: 8;
    right: 12px;
    bottom: 12px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    color: var(--brand);
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 5px 15px rgba(43, 41, 54, .13);
}

.recenter-button svg,
.icon-button svg {
    width: 20px;
    height: 20px;
}

.location-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px 15px;
}

.location-copy {
    min-width: 0;
    flex: 1;
}

.section-kicker {
    margin-bottom: 4px;
    color: #9a95a9;
}

.location-copy strong {
    display: block;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-copy small,
.settings-card small,
.profile-card span,
.hero-metric small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.fence-status {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 750;
}

.fence-status svg {
    width: 14px;
    height: 14px;
}

.fence-status.safe { color: #188556; background: var(--success-soft); }
.fence-status.outside { color: #c64255; background: var(--danger-soft); }
.fence-status.unknown { color: #777280; background: #efedf2; }

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.action-button {
    display: flex;
    min-width: 0;
    min-height: 74px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    text-align: left;
    background: var(--surface);
    box-shadow: 0 6px 18px rgba(47, 39, 82, .045);
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.action-button:active {
    transform: scale(.98);
}

.action-button.primary,
.action-button.running {
    border-color: transparent;
    color: white;
    background: linear-gradient(135deg, #7658ff, #5a38db);
    box-shadow: 0 10px 24px rgba(94, 59, 222, .23);
}

.action-button[disabled] {
    opacity: .58;
    cursor: wait;
}

.action-icon {
    display: grid;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 12px;
    color: var(--brand);
    background: var(--brand-soft);
}

.primary .action-icon,
.running .action-icon {
    color: white;
    background: rgba(255, 255, 255, .16);
}

.action-icon svg {
    width: 21px;
    height: 21px;
}

.action-button > span:last-child {
    min-width: 0;
}

.action-button b,
.action-button small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-button b { font-size: 13px; }
.action-button small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.primary small, .running small { color: rgba(255, 255, 255, .73); }

.daily-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 15px 16px;
}

.daily-card strong {
    font-size: 24px;
    letter-spacing: -.03em;
}

.daily-card strong small {
    color: var(--muted);
    font-size: 11px;
}

.text-button,
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 8px 0;
    border: 0;
    color: var(--brand);
    background: transparent;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}

.text-button svg,
.back-link svg { width: 16px; height: 16px; }

.page-heading {
    padding: 10px 4px 18px;
}

.page-heading .eyebrow { color: var(--brand); }
.page-heading h2 { margin: 5px 0; font-size: 25px; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.hero-metric {
    position: relative;
    display: flex;
    min-height: 142px;
    align-items: center;
    gap: 18px;
    overflow: hidden;
    padding: 22px;
    border-radius: 24px;
    color: white;
    background: linear-gradient(135deg, #7557ff, #5335ca);
    box-shadow: 0 14px 35px rgba(86, 54, 202, .24);
}

.hero-metric::after {
    position: absolute;
    top: -55px;
    right: -55px;
    width: 160px;
    height: 160px;
    border: 24px solid rgba(255, 255, 255, .06);
    border-radius: 50%;
    content: "";
}

.metric-icon {
    display: grid;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, .15);
}

.metric-icon svg { width: 28px; height: 28px; }
.hero-metric span { display: block; color: rgba(255, 255, 255, .72); font-size: 11px; }
.hero-metric strong { display: block; margin: 3px 0; font-size: 34px; letter-spacing: -.04em; }
.hero-metric small { color: rgba(255, 255, 255, .68); }

.chart-card {
    margin-top: 13px;
    padding: 18px 16px 14px;
}

.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-heading h3 { margin: 0; font-size: 17px; }
.soft-pill { padding: 6px 9px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 750; }

.bar-chart {
    display: flex;
    height: 190px;
    align-items: flex-end;
    gap: 7px;
    padding-top: 24px;
}

.bar-column {
    display: flex;
    min-width: 0;
    height: 100%;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.bar-track {
    position: relative;
    width: 100%;
    max-width: 27px;
    height: 135px;
    overflow: hidden;
    border-radius: 9px;
    background: #f0eef5;
}

.bar-value {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 5px;
    border-radius: 9px;
    background: linear-gradient(180deg, #9d89ff, #6545e9);
    transition: height .5s ease;
}

.bar-column.today .bar-value { background: linear-gradient(180deg, #ffad76, #e87986); }
.bar-column small { color: var(--muted); font-size: 10px; }
.bar-column output { color: #7f798d; font-size: 8px; }

.info-card {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 13px;
    padding: 15px;
}

.info-card svg { flex: 0 0 auto; width: 20px; height: 20px; color: var(--brand); }
.info-card strong { font-size: 12px; }
.info-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.profile-avatar { width: 50px; height: 50px; border-radius: 17px; }
.profile-card > div:nth-child(2) { min-width: 0; flex: 1; }
.profile-card strong { display: block; font-size: 15px; }
.icon-button { width: 38px; height: 38px; border-radius: 12px; color: var(--muted); background: #f3f1f7; }
.icon-button[disabled] { opacity: .45; cursor: not-allowed; }

.settings-card { margin-top: 13px; padding: 2px 15px; }
.setting-row { display: flex; min-height: 67px; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.setting-icon svg { width: 18px; height: 18px; }
.setting-row > div { min-width: 0; flex: 1; }
.setting-row strong { display: block; font-size: 12px; }
.setting-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { color: var(--muted); font-size: 11px; }

.switch { position: relative; display: inline-flex; flex: 0 0 auto; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch > span { position: relative; width: 42px; height: 24px; border-radius: 99px; background: #d8d4e0; transition: background .2s; cursor: pointer; }
.switch > span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; content: ""; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: transform .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

.server-card { padding: 15px; }
.server-card > label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 750; }
.inline-form { display: flex; gap: 8px; }
.inline-form input,
.field-input {
    min-width: 0;
    height: 43px;
    flex: 1;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: #faf9fc;
    font-size: 12px;
}
.inline-form button { padding: 0 15px; border: 0; border-radius: 12px; color: white; background: var(--brand); font-size: 11px; font-weight: 750; cursor: pointer; }
.server-card > small { margin-top: 9px; }

.danger-button {
    width: 100%;
    height: 45px;
    margin-top: 13px;
    border: 1px solid #f0ccd2;
    border-radius: 15px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.version-note { margin: 16px 0; color: #aaa5b3; text-align: center; font-size: 10px; }

.bottom-nav {
    position: fixed;
    z-index: 30;
    right: max(0px, calc((100vw - 480px) / 2));
    bottom: 0;
    left: max(0px, calc((100vw - 480px) / 2));
    display: grid;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 1fr);
    padding: 8px 20px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(229, 226, 239, .9);
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 -8px 30px rgba(46, 38, 76, .08);
    backdrop-filter: blur(14px);
}

.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
    border: 0;
    color: #9893a3;
    background: transparent;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.nav-button svg { width: 22px; height: 22px; }
.nav-button.active { color: var(--brand); }
.nav-button.active svg { stroke-width: 2.2; }

.scrim {
    position: fixed;
    z-index: 50;
    inset: 0;
    background: rgba(24, 19, 43, .45);
    backdrop-filter: blur(2px);
    animation: fade-in .2s ease;
}

.drawer {
    position: fixed;
    z-index: 60;
    right: max(0px, calc((100vw - 480px) / 2));
    bottom: 0;
    left: max(0px, calc((100vw - 480px) / 2));
    max-height: min(86vh, 760px);
    overflow-y: auto;
    padding: 9px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    background: white;
    box-shadow: 0 -18px 50px rgba(35, 28, 61, .23);
    animation: drawer-in .25s ease-out;
}

@keyframes drawer-in { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

.drawer-handle { width: 38px; height: 4px; margin: 0 auto 13px; border-radius: 99px; background: #ddd9e5; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; }
.drawer-header h2 { margin: 0; font-size: 21px; }
.drawer-description { margin: 12px 0 14px; color: var(--muted); font-size: 11px; line-height: 1.55; }

.fence-list,
.audio-list { display: grid; gap: 9px; }

.fence-item,
.audio-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfafd;
}

.fence-symbol,
.audio-symbol {
    display: grid;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 13px;
    color: var(--brand);
    background: var(--brand-soft);
}

.fence-symbol svg,
.audio-symbol svg { width: 20px; height: 20px; }
.fence-copy, .audio-copy { min-width: 0; flex: 1; }
.fence-copy strong, .audio-copy strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fence-copy small, .audio-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.item-actions { display: flex; align-items: center; gap: 4px; }
.small-icon-button { display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 10px; color: var(--muted); background: #f0edf5; cursor: pointer; }
.small-icon-button.danger { color: var(--danger); background: var(--danger-soft); }
.small-icon-button svg { width: 16px; height: 16px; }

.wide-primary-button,
.wide-secondary-button {
    display: flex;
    width: 100%;
    height: 47px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 13px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.wide-primary-button { border: 0; color: white; background: linear-gradient(135deg, #7658ff, #5938da); box-shadow: 0 9px 20px rgba(91, 57, 218, .2); }
.wide-secondary-button { border: 1px solid var(--line); color: var(--brand); background: var(--brand-soft); }
.wide-primary-button svg { width: 17px; height: 17px; }
.wide-primary-button[disabled], .wide-secondary-button[disabled] { opacity: .48; cursor: wait; }

.fence-editor { margin-top: 5px; }
.field-label,
.field-label-row { margin-top: 13px; color: #625d6d; font-size: 11px; font-weight: 750; }
.field-label { display: block; margin-bottom: 7px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.field-label-row output { color: var(--brand); font-size: 10px; font-weight: 750; }
.field-input { width: 100%; }

.fence-picker {
    position: relative;
    height: 146px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #edf0eb;
    cursor: crosshair;
}

.mini-road { position: absolute; width: 120%; height: 14px; border: 4px solid white; border-right: 0; border-left: 0; background: #dce0dd; }
.mini-road-a { top: 38%; left: -10%; transform: rotate(-10deg); }
.mini-road-b { top: 67%; left: -10%; transform: rotate(17deg); }
.picker-circle { position: absolute; z-index: 2; border: 2px solid rgba(109, 74, 255, .5); border-radius: 50%; background: rgba(109, 74, 255, .12); transform: translate(-50%, -50%); pointer-events: none; }
.picker-pin { position: absolute; z-index: 3; width: 15px; height: 15px; border: 3px solid white; border-radius: 50%; background: var(--brand); box-shadow: 0 3px 8px rgba(63, 40, 153, .3); transform: translate(-50%, -50%); pointer-events: none; }

.range-input { width: 100%; height: 24px; accent-color: var(--brand); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 15px; background: #f8f7fb; }
.toggle-row strong { display: block; font-size: 11px; }
.toggle-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

.audio-item { cursor: pointer; }
.audio-item.selected { border-color: rgba(109, 74, 255, .45); background: #f5f2ff; box-shadow: inset 0 0 0 1px rgba(109, 74, 255, .12); }
.audio-item.playing .audio-symbol { color: white; background: var(--brand); }
.audio-item button { flex: 0 0 auto; min-width: 52px; height: 32px; border: 0; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 800; cursor: pointer; }
.audio-item.playing button { color: white; background: var(--brand); }
.audio-item button[disabled] { opacity: .5; cursor: wait; }
.volume-control { margin-top: 17px; }

.toast-region {
    position: fixed;
    z-index: 90;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    display: grid;
    width: min(calc(100% - 32px), 420px);
    gap: 8px;
    pointer-events: none;
    transform: translateX(-50%);
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 14px;
    color: white;
    background: rgba(38, 31, 64, .94);
    box-shadow: var(--shadow);
    font-size: 11px;
    font-weight: 700;
    animation: toast-in .25s ease-out;
}

.toast.success { background: rgba(25, 130, 84, .96); }
.toast.error { background: rgba(186, 55, 74, .96); }
.toast::before { width: 7px; height: 7px; border-radius: 50%; content: ""; background: currentColor; opacity: .8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }

body.drawer-open { overflow: hidden; }

.report-summary { padding: 0 18px 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.led-control { padding: 14px 0 6px; margin-top: 14px; border-top: 1px solid var(--line); }
.led-control-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.led-control-heading h3 { margin: 0; font-size: 14px; }
.led-control-heading span { color: var(--muted); font-size: 12px; }
.led-mode-switch { display: flex; gap: 1px; padding: 3px; margin-top: 10px; border-radius: 8px; background: #e6ebe9; }
.led-mode-switch button { flex: 1; min-width: 0; height: 40px; border: 0; border-radius: 6px; color: #52605b; background: transparent; cursor: pointer; font-size: 13px; }
.led-mode-switch button[aria-pressed="true"] { background: white; color: #157454; font-weight: 700; }
.led-mode-switch button:disabled { opacity: .5; cursor: not-allowed; }
.led-command-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.location-empty { display: none; }
.mock-map.no-location { height: 210px; background: #eef2f1; }
.mock-map.no-location > * { display: none; }
.mock-map.no-location > .location-empty { display: grid; height: 100%; place-items: center; color: #60716c; }
.action-button:disabled { opacity: .5; cursor: not-allowed; }
.telemetry-details { padding-top: 10px; }
.telemetry-details > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.telemetry-details > div:last-child { border-bottom: 0; }
.telemetry-details span { flex-shrink: 0; color: var(--muted); }
.telemetry-details strong { min-width: 0; overflow-wrap: anywhere; text-align: right; font-size: 12px; }
.setting-row small { display: block; white-space: normal; overflow-wrap: anywhere; }
.row-value { max-width: 46%; overflow-wrap: anywhere; text-align: right; }
.reconnect-button { width: 100%; min-height: 44px; margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--text); cursor: pointer; }
[hidden] { display: none !important; }

@media (min-width: 481px) {
    .app-shell { box-shadow: 0 0 55px rgba(42, 35, 70, .13); }
}

@media (max-width: 359px) {
    .page { padding-right: 10px; padding-left: 10px; }
    .topbar { padding-right: 13px; padding-left: 13px; }
    .action-button { gap: 7px; padding: 10px 8px; }
    .action-icon { width: 32px; height: 32px; }
    .battery-pill { padding-right: 7px; padding-left: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
