*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #0d1117;
    --color-surface: #161b22;
    --color-surface-elevated: #1f2630;
    --color-orange: #fa8c2e;
    --color-green: #34c759;
    --color-blue: #388bf2;
    --color-text: #f5f5f5;
    --color-text-muted: #9aa4b2;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--color-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.menu-open {
    overflow: hidden;
}

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

#map.is-adding-event {
    cursor: crosshair;
}

.app-header {
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    background: rgba(22, 27, 34, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
}

.app-header__brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.app-header__title {
    color: var(--color-text);
    font: 700 20px/1.1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.app-header__subtitle {
    color: var(--color-text-muted);
    font: 12px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 14px;
    background: var(--color-surface-elevated);
    cursor: pointer;
}

.burger-btn span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--color-text);
}

.side-menu[hidden] {
    display: none;
}

.side-menu {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.side-menu__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.side-menu__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(300px, 88vw);
    height: 100%;
    padding: 24px;
    background: var(--color-surface);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
    animation: slide-in 0.28s ease;
}

.side-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.side-menu__title {
    color: var(--color-text);
    font: 700 20px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.side-menu__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--color-surface-elevated);
    color: var(--color-text-muted);
    font: 700 18px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
}

.side-menu__list {
    list-style: none;
}

.side-menu__item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 0;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: var(--color-text);
    font: 500 16px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: left;
    cursor: pointer;
}

.side-menu__item:last-child {
    border-bottom: 0;
}

.side-menu__icon {
    width: 28px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 18px;
}

.side-menu__icon--blue { color: var(--color-blue); }
.side-menu__icon--green { color: var(--color-green); }
.side-menu__icon--orange { color: var(--color-orange); }

.map-btn {
    position: fixed;
    z-index: 1000;
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    background: rgba(22, 27, 34, 0.94);
    color: var(--color-text);
    font: 600 14px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.map-btn:hover {
    background: var(--color-surface-elevated);
}

.map-btn:active {
    transform: scale(0.98);
}

.map-btn--primary {
    background: var(--color-blue);
}

.map-btn--primary:hover {
    background: #2f7be0;
}

.map-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
}

#add-event-btn {
    left: 16px;
    bottom: 24px;
}

#add-event-btn.is-active {
    background: var(--color-orange);
}

.event-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.event-modal[hidden] {
    display: none;
}

.event-modal__card {
    width: min(100%, 380px);
    padding: 20px;
    border-radius: 16px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.event-modal__title {
    margin-bottom: 8px;
    font: 700 20px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.event-modal__hint {
    margin-bottom: 16px;
    color: var(--color-text-muted);
    font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.event-modal__input {
    width: 100%;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font: 16px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.event-modal__input:focus {
    outline: 2px solid rgba(56, 139, 242, 0.65);
    border-color: transparent;
}

.event-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.map-error {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--color-bg);
    color: var(--color-text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
    white-space: pre-wrap;
}

.map-error[hidden] {
    display: none;
}

.geo-notice {
    position: fixed;
    left: 50%;
    bottom: 84px;
    z-index: 1000;
    max-width: min(90vw, 420px);
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(22, 27, 34, 0.92);
    color: var(--color-text);
    font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
    transform: translateX(-50%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.geo-notice[hidden] {
    display: none;
}

.pulse-marker {
    position: relative;
    width: 36px;
    height: 36px;
    transform: translate(-18px, -18px);
}

.pulse-marker__dot {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    background: var(--color-orange);
    box-shadow: 0 0 12px rgba(250, 140, 46, 0.55);
    z-index: 2;
}

.pulse-marker__ring {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(250, 140, 46, 0.55);
    border-radius: 50%;
    animation: pulse-ring 1.8s ease-out infinite;
}

.pulse-marker__ring--2 {
    animation-delay: 0.6s;
}

.pulse-marker__label {
    display: none;
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 140px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font: 600 11px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.map--show-labels .pulse-marker__label {
    display: block;
}

@keyframes slide-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.7);
        opacity: 0.85;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}
