:root {
    color-scheme: dark;
    --bg: #090b0f;
    --panel: #121923;
    --panel-2: #172231;
    --line: #273545;
    --text: #f7f9fc;
    --muted: #9aa8b7;
    --blue: #62a8ff;
    --cyan: #28d7d2;
    --green: #67dc91;
    --amber: #f3bd54;
    --red: #ff6f6f;
    --violet: #c4a5ff;
    --shadow: 0 18px 54px rgba(0, 0, 0, 0.36);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100dvh;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(103, 220, 145, 0.1), transparent 32rem),
        linear-gradient(145deg, rgba(196, 165, 255, 0.08), transparent 40rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

button,
.primary-action,
.secondary-action {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #162231;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.54;
}

button:active,
.primary-action:active,
.secondary-action:active {
    transform: translateY(1px);
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0d131a;
    color: var(--text);
    padding: 0 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.topbar,
.room-topbar {
    position: sticky;
    top: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px clamp(12px, 3vw, 28px);
    border-bottom: 1px solid var(--line);
    background: rgba(9, 11, 15, 0.92);
    backdrop-filter: blur(16px);
}

.room-topbar {
    grid-template-columns: 1fr auto auto;
}

.brand {
    color: var(--text);
    font-weight: 900;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 6px;
}

nav a {
    display: grid;
    min-height: 36px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 10px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

nav a:hover {
    border-color: var(--line);
    color: var(--text);
}

.share-landing {
    width: min(1000px, 100%);
    margin: 0 auto;
    padding: clamp(28px, 7vw, 78px) clamp(12px, 3vw, 28px) 40px;
}

.hero {
    max-width: 760px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--green);
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(3rem, 12vw, 6.6rem);
    line-height: 0.92;
    letter-spacing: 0;
}

.tagline {
    max-width: 680px;
    margin: 18px 0 0;
    color: #c7d1dc;
    font-size: clamp(1rem, 2.5vw, 1.28rem);
    line-height: 1.52;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.primary-action,
.secondary-action {
    display: inline-grid;
    place-items: center;
    padding: 0 16px;
    font-weight: 900;
}

.primary-action {
    border-color: transparent;
    background: var(--green);
    color: #06100a;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}

.feature-grid div,
.room-panel,
.room-summary > div,
.participant-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)), var(--panel);
}

.feature-grid div {
    min-height: 176px;
    padding: 16px;
}

.feature-grid span,
.room-summary span,
.participant-row span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.feature-grid strong {
    display: block;
    margin-top: 10px;
    font-size: 1rem;
    line-height: 1.4;
}

.room-app {
    min-height: 100dvh;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.status-pill,
.icon-button {
    min-height: 34px;
    min-width: 116px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0e151d;
    color: var(--muted);
    padding: 0 10px;
    font-size: 0.72rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pill.active {
    border-color: rgba(103, 220, 145, 0.55);
    color: var(--green);
}

.status-pill.warn {
    border-color: rgba(243, 189, 84, 0.55);
    color: var(--amber);
}

.room-main {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.85fr);
    gap: 10px;
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: 10px;
}

.room-map-stage {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    height: calc(100dvh - 84px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #101820;
    box-shadow: var(--shadow);
}

#shareMap {
    width: 100%;
    height: 100%;
}

.leaflet-container {
    background: #101820;
    font-family: inherit;
}

.room-map-actions {
    position: absolute;
    z-index: 900;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 8px;
    pointer-events: none;
}

.room-map-actions button {
    background: rgba(12, 18, 25, 0.9);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
    font-weight: 900;
}

#enableBtn {
    border-color: rgba(103, 220, 145, 0.55);
    color: var(--green);
}

.room-panel {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 12px;
}

.room-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.room-summary > div {
    min-width: 0;
    padding: 10px;
}

.room-summary strong {
    display: block;
    overflow-wrap: anywhere;
    margin-top: 5px;
    font-size: 1.05rem;
}

.participant-list {
    display: grid;
    gap: 8px;
}

.participant-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.participant-dot {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--blue);
}

.participant-row strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participant-row small {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.share-marker {
    display: grid;
    place-items: center;
    width: 30px !important;
    height: 30px !important;
    margin-left: -15px !important;
    margin-top: -15px !important;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--blue);
    color: #05080d;
    font-size: 0.72rem;
    font-weight: 900;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

#toast,
#siteToast {
    position: fixed;
    z-index: 2100;
    left: 50%;
    width: min(460px, calc(100% - 24px));
    transform: translate(-50%, 16px);
    padding: 12px 14px;
    border: 1px solid rgba(243, 189, 84, 0.5);
    border-radius: 8px;
    background: rgba(20, 16, 9, 0.94);
    color: #ffe0a3;
    font-size: 0.88rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

#toast {
    bottom: max(16px, env(safe-area-inset-bottom));
}

#siteToast {
    top: max(12px, env(safe-area-inset-top));
    bottom: auto;
    transform: translate(-50%, -12px);
    border-color: rgba(98, 168, 255, 0.45);
    background: rgba(8, 14, 19, 0.94);
    color: var(--text);
}

#toast.show,
#siteToast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.is-offline .status-pill::after {
    content: " offline";
    color: var(--amber);
}

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

    .room-main {
        grid-template-columns: 1fr;
    }

    .room-map-stage {
        min-height: 390px;
        height: 48dvh;
    }
}

@media (max-width: 520px) {
    .topbar {
        grid-template-columns: 1fr;
        align-items: start;
    }

    nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    nav a {
        border-color: var(--line);
    }

    .feature-grid,
    .hero-actions,
    .room-summary {
        grid-template-columns: 1fr;
    }

    .primary-action,
    .secondary-action {
        width: 100%;
    }

    .room-map-actions {
        grid-template-columns: 1fr;
    }

    .room-topbar {
        grid-template-columns: 1fr auto;
    }

    .icon-button {
        display: none;
    }
}
