.mw-app {
    --mw-bg: #0e141b;
    --mw-card: #17202b;
    --mw-text: #e8eef5;
    --mw-muted: #b7c4d2;
    --mw-line: #314255;
    --mw-accent: #8ec5ff;
    --mw-warn: #e7c27a;
    color: var(--mw-text);
    background: var(--mw-bg);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.mw-app.is-light {
    --mw-bg: #f4f7fb;
    --mw-card: #ffffff;
    --mw-text: #17202b;
    --mw-muted: #44566a;
    --mw-line: #d5e0ea;
    --mw-accent: #0b4f8a;
    --mw-warn: #8a5a00;
}

.mw-top, .mw-controls, .mw-grid, .mw-card {
    display: grid;
    gap: 0.75rem;
}

.mw-top, .mw-controls {
    grid-template-columns: 1fr;
    margin-bottom: 0.75rem;
}

.mw-card {
    background: var(--mw-card);
    border: 1px solid var(--mw-line);
    border-radius: 14px;
    padding: 0.9rem;
}

.mw-app h1, .mw-app h2 {
    color: var(--mw-text);
    margin: 0;
}

.mw-app h1 { font-size: 1.6rem; }
.mw-app h2 { font-size: 1.05rem; }

.mw-app p, .mw-app li, .mw-muted { color: var(--mw-muted); }

.mw-actions, .mw-time-row, .mw-coord-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.mw-app button, .mw-app .mw-link {
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid var(--mw-line);
    background: transparent;
    color: var(--mw-text);
    padding: 0.45rem 0.8rem;
}

.mw-app button.mw-primary, .mw-app a.mw-primary {
    background: var(--mw-accent);
    color: #071018;
    border-color: transparent;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.mw-app input, .mw-app label {
    color: var(--mw-text);
}

.mw-app input[type="text"],
.mw-app input[type="number"],
.mw-app input[type="date"],
.mw-app input[type="search"] {
    min-height: 44px;
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--mw-line);
    background: transparent;
    color: var(--mw-text);
    padding: 0.4rem 0.7rem;
}

.mw-app input[type="range"] { width: 100%; min-height: 44px; }

#mwMap {
    height: min(68vh, 520px);
    min-height: 280px;
    border-radius: 14px;
    background: #0b1218;
}

.mw-locate {
    width: 44px;
    height: 44px;
    display: block;
    border: 0;
    background: #0e141b;
    color: #f4f7fb;
    font-size: 22px;
    line-height: 44px;
    cursor: pointer;
}

.mw-app.is-light .mw-locate {
    background: #f7f4ee;
    color: #1c2430;
}

#mwReadout {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--mw-text);
}

#mwExtra { white-space: pre-wrap; margin: 0; }

#mwPlace {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#mwPlace img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
}

#mwPlace span, #mwPlace a { display: block; }

#mwSearchResults, #mwSaved {
    list-style: none;
    margin: 0;
    padding: 0;
}

#mwSearchResults button, #mwSaved button {
    width: 100%;
    text-align: left;
}

.mw-sky-wrap { display: grid; justify-items: center; }
#mwSky { width: min(100%, 320px); height: auto; border-radius: 12px; }

.mw-arrow-head { background: transparent; border: 0; }
.mw-arrow-head span {
    display: block;
    width: 24px;
    height: 24px;
    text-align: center;
    color: #7ec8ff;
    font-size: 18px;
    line-height: 24px;
}
.mw-arrow-head.is-below span { color: #8d97a8; }

.mw-compass-face {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 2px solid var(--mw-line);
    display: grid;
    place-items: center;
    margin-inline: auto;
}
#mwCompassNeedle {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--mw-warn);
}

.mw-legend { font-size: 0.92rem; }

@media (min-width: 900px) {
    .mw-grid { grid-template-columns: 1.4fr 0.8fr; align-items: start; }
    .mw-coord-row { display: grid; grid-template-columns: 1fr 1fr 0.7fr auto; }
}

.mw-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

body:has(.mw-app.is-shell) {
    margin: 0;
    background: #0e141b;
    overflow: hidden;
}

.mw-app.is-shell {
    height: 100dvh;
    margin: 0;
    padding: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mw-app.is-shell .mw-bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: calc(0.7rem + env(safe-area-inset-top)) 1rem 0.7rem;
    border-bottom: 1px solid var(--mw-line);
    background: #121a24;
}

.mw-app.is-shell.is-light .mw-bar { background: #ffffff; }

.mw-app.is-shell .mw-bar strong { font-size: 1.15rem; }

.mw-app.is-shell #mwBarPlace {
    color: var(--mw-muted);
    font-size: 0.92rem;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mw-app.is-shell .mw-stage { flex: 1; min-height: 0; }

.mw-app.is-shell .mw-screen {
    display: none;
    height: 100%;
    overflow: auto;
}

.mw-app.is-shell .mw-screen.is-active { display: flex; flex-direction: column; }

.mw-app.is-shell .mw-search { position: relative; padding: 0.55rem 0.75rem 0; }

.mw-app.is-shell #mwSearchResults:not([hidden]) {
    position: absolute;
    z-index: 20;
    left: 0.75rem;
    right: 0.75rem;
    max-height: 40vh;
    overflow: auto;
    background: var(--mw-card);
    border: 1px solid var(--mw-line);
    border-radius: 12px;
}

.mw-app.is-shell #mwPlace { margin: 0.55rem 0.75rem 0; padding: 0.55rem 0.7rem; }

.mw-app.is-shell #mwPlace:empty { display: none; }

.mw-app.is-shell #mwMap {
    flex: 1;
    height: auto;
    min-height: 220px;
    margin: 0.55rem 0.75rem;
    border-radius: 16px;
}

.mw-app.is-shell #mwReadout {
    margin: 0 0.9rem;
    font-size: 1rem;
}

.mw-app.is-shell .mw-dock {
    display: grid;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem 0.8rem;
}

.mw-app.is-shell .mw-dock .mw-time-row { display: grid; grid-template-columns: auto 1fr auto auto; }

.mw-app.is-shell .mw-dock .mw-coord-row { display: grid; grid-template-columns: 1fr 1fr 0.8fr; }

.mw-app.is-shell .mw-page {
    display: grid;
    gap: 0.75rem;
    padding: 1rem 1rem 1.25rem;
}

.mw-app.is-shell .mw-block { width: 100%; }

.mw-app.is-shell .mw-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--mw-line);
    background: #121a24;
}

.mw-app.is-shell.is-light .mw-tabs { background: #ffffff; }

.mw-app.is-shell .mw-tab {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--mw-muted);
    font-weight: 650;
}

.mw-app.is-shell .mw-tab.is-active {
    background: #1d4e89;
    color: #f4f7fb;
}
