html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[hidden] {
    display: none !important;
}

#map {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    background: #2c3e50;
}

.leaflet-control-layers-expanded {
    background: rgba(255, 255, 255, 0.92) !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    padding: 8px 12px !important;
    font-size: 13px;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

.leaflet-control-layers-separator {
    border-top: 1px solid #ddd !important;
    margin: 6px 0 !important;
}

.leaflet-control-layers label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
    cursor: pointer;
}

#map.add-mode {
    cursor: crosshair;
}

#map.add-mode .leaflet-grab {
    cursor: crosshair;
}

#toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    gap: 6px;
}

#toolbar button {
    background: rgba(255, 255, 255, 0.95);
    color: #222;
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 7px 13px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

#toolbar button:hover {
    background: #fff;
}

#toolbar #info-btn,
#toolbar #layers-btn,
#toolbar #search-btn,
#toolbar #locate-btn {
    width: 32px;
    padding: 0;
    font-size: 16px;
    color: #444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#toolbar #layers-btn svg,
#toolbar #search-btn svg,
#toolbar #locate-btn svg {
    width: 18px;
    height: 18px;
}

#toolbar #locate-btn { display: none; }
#toolbar #locate-btn.active { color: #2563eb; }

.search-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

#search-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}

#search-close:hover {
    background: #f3f4f6;
    color: #222;
}

#layers-modal label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

#layers-modal #category-filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #333;
}

#toolbar #add-pin-btn {
    background: #2563eb;
    color: #fff;
    border-color: #1e40af;
}

#toolbar #add-pin-btn:hover {
    background: #1d4ed8;
}

#toolbar #bulk-import-btn {
    width: 32px;
    padding: 0;
    color: #444;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#toolbar #bulk-import-btn svg {
    width: 18px;
    height: 18px;
}

#hint-bar {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #2563eb;
    color: #fff;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

#hint-bar button {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    width: 100%;
    max-width: 440px;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
}

.pin-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pin-header h2 {
    flex: 1;
    text-align: center;
    margin: 0;
}

.pin-nav {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #111;
    padding: 0;
}

.pin-nav:hover:not(:disabled) {
    background: #e5e7eb;
}

.pin-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.library-btn {
    align-self: flex-start;
    padding: 6px 12px;
    font-size: 13px;
    margin-top: 4px;
}

.file-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.file-button {
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: inline-block;
    user-select: none;
}

.file-button:hover {
    background: #d1d5db;
}

.file-status {
    font-size: 13px;
    color: #555;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
    background: #fafafa;
    border-radius: 6px;
}

.library-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #e5e7eb;
}

.library-item img,
.library-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.library-item.selected {
    border-color: #2563eb;
}

.library-item.selected::after {
    content: "✓";
    position: absolute;
    top: 4px;
    right: 4px;
    background: #2563eb;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.library-item.already {
    opacity: 0.35;
    cursor: not-allowed;
}

.library-delete {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.12s;
}

.library-item:hover .library-delete,
.library-item:focus-within .library-delete {
    opacity: 1;
}

@media (hover: none) {
    .library-delete {
        opacity: 1;
    }
}

.library-delete:hover {
    background: #dc2626;
}

.library-empty {
    padding: 32px;
    text-align: center;
    color: #666;
    grid-column: 1 / -1;
}

.modal h3 {
    margin: 10px 0 4px 0;
    font-size: 14px;
    color: #444;
}

.modal p {
    margin: 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.modal ul.credits {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #444;
    line-height: 1.7;
}

.modal ul.credits a {
    color: #2563eb;
    text-decoration: none;
}

.modal ul.credits a:hover {
    text-decoration: underline;
}

.modal label,
.modal .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #444;
}

.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"],
.modal textarea {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.modal textarea {
    resize: vertical;
}

.modal input[type="file"],
.modal select {
    font-size: 13px;
    padding: 7px 9px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.modal select {
    font-size: 14px;
}

.pin-label {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 600;
    text-shadow:
        -1px -1px 0 #fff, 1px -1px 0 #fff,
        -1px  1px 0 #fff, 1px  1px 0 #fff,
         0 -1px 0 #fff, 0 1px 0 #fff,
        -1px 0 0 #fff, 1px 0 0 #fff;
    white-space: nowrap;
    pointer-events: none;
}

.pin-label::before { display: none !important; }

.place-icon {
    background: transparent;
    border: none;
}

.pin-emoji {
    font-size: 28px;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 3px rgba(255, 255, 255, 0.6);
    user-select: none;
}

.pin-svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
    user-select: none;
}

.pin-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

.coord-row {
    display: flex;
    gap: 10px;
}

.coord-row label {
    flex: 1;
}


.existing-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.existing-files:empty {
    display: none;
}

.existing-file {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9fafb;
    font-size: 12px;
}

.existing-file.image {
    padding: 0;
    overflow: hidden;
}

.existing-file img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    display: block;
}

.existing-file .filename {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #444;
}

.existing-file .remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.existing-file .remove:hover {
    background: #dc2626;
}

.existing-file.image .remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
}

.place-popup .admin-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 6px;
}

.place-popup .admin-actions button {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: #f9fafb;
    cursor: pointer;
}

.place-popup .admin-actions button:hover {
    background: #f3f4f6;
}

.place-popup .admin-actions .delete {
    color: #b00;
    border-color: #fca5a5;
}

.place-popup .admin-actions .delete:hover {
    background: #fee;
}

.modal .error {
    background: #fee;
    color: #b00;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.modal .success {
    background: #e7f7ea;
    color: #147a37;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.modal .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.modal .actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
}

.modal .actions button[type="submit"] {
    background: #2563eb;
    color: #fff;
    border-color: #1e40af;
}

.modal .actions button[type="submit"]:hover {
    background: #1d4ed8;
}

.modal .actions button[type="submit"]:disabled {
    background: #93b4f1;
    cursor: wait;
}

.modal .actions button.secondary {
    background: #f3f4f6;
    color: #222;
    border-color: #d1d5db;
}

#pin-move-btn {
    margin-top: -4px;
    align-self: flex-start;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #222;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

#pin-move-btn:hover {
    background: #e5e7eb;
}

.modal .actions button.secondary:hover {
    background: #e5e7eb;
}

.leaflet-popup-content {
    margin: 13px 8px 13px 16px !important;
}

.place-popup {
    width: 300px;
    max-height: 440px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.place-popup h3 {
    flex-shrink: 0;
    margin: 0 0 8px 0;
    font-size: 16px;
    padding: 0 22px 6px 0;
    border-bottom: 1px solid #eee;
}

.place-popup .popup-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.place-popup .popup-body::-webkit-scrollbar { width: 6px; height: 6px; }
.place-popup .popup-body::-webkit-scrollbar-track { background: transparent; }
.place-popup .popup-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }
.place-popup .popup-body::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.4); }

.place-popup .media-strip {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.place-popup .media-strip::-webkit-scrollbar { height: 6px; }
.place-popup .media-strip::-webkit-scrollbar-track { background: transparent; }
.place-popup .media-strip::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }

.place-popup .thumb {
    flex-shrink: 0;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #f3f4f6;
    transition: transform 0.12s;
}

.place-popup .thumb:hover {
    transform: scale(1.03);
}

.place-popup .thumb.playing {
    height: 200px;
    cursor: default;
}

.place-popup .thumb.playing:hover {
    transform: none;
}

.place-popup .thumb.playing video {
    pointer-events: auto;
}

.place-popup .thumb img,
.place-popup .thumb video {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
}

.place-popup .thumb .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.25));
}

#search-panel {
    position: absolute;
    bottom: 24px;
    left: 12px;
    z-index: 1000;
    width: 260px;
    max-height: min(400px, calc(100vh - 80px));
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 13px;
}

.search-header {
    padding: 8px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#search-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
}

#search-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.search-results {
    overflow-y: auto;
    flex: 1 1 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-track { background: transparent; }
.search-results::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }

.search-item {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 7px 34px 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.search-item-count {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    min-width: 20px;
    padding: 1px 6px;
    background: #e5e7eb;
    color: #555;
    border-radius: 10px;
    font-size: 11px;
    text-align: center;
    line-height: 1.4;
}

.search-item.active .search-item-count {
    background: #c7d8f5;
    color: #1e3a8a;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: #f3f4f6;
}

.search-item.active {
    background: #e0ecff;
    border-left: 3px solid #2563eb;
    padding-left: 9px;
}

.search-item-name {
    color: #222;
    font-size: 13px;
}

.search-item-sami {
    color: #666;
    font-size: 11px;
}

.search-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-style: italic;
    font-size: 12px;
}

.search-hint {
    padding: 16px;
    text-align: center;
    color: #aaa;
    font-size: 12px;
}

#place-list {
    position: absolute;
    bottom: 24px;
    right: 12px;
    z-index: 1000;
    width: 260px;
    max-height: min(600px, calc(100vh - 80px));
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 13px;
}

#place-list.collapsed {
    width: auto;
    max-height: none;
}

#place-list.collapsed .place-list-body {
    display: none;
}

.place-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    color: #222;
    gap: 10px;
}

#place-list:not(.collapsed) .place-list-header {
    border-bottom: 1px solid #eee;
}

.place-list-filter-toggle {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

#place-list.collapsed .place-list-filter-toggle {
    display: none;
}

#filter-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #2563eb;
    padding: 2px 0;
    font-weight: 500;
}

#filter-toggle-btn:hover {
    text-decoration: underline;
}

.place-list-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: #444;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    overflow-y: auto;
    flex-shrink: 0;
}

#place-list.collapsed .place-list-filters {
    display: none !important;
}

.filter-section-title {
    font-weight: 600;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.place-list-filters label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.place-list-filters input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.filter-count {
    color: #888;
    font-size: 11px;
    margin-left: auto;
}

#place-list-title {
    font-weight: 500;
}

#place-list-toggle {
    font-size: 14px;
    color: #666;
    transition: transform 0.2s;
    display: inline-block;
}

#place-list.collapsed #place-list-toggle {
    transform: rotate(180deg);
}

.place-list-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.place-list-body::-webkit-scrollbar { width: 6px; }
.place-list-body::-webkit-scrollbar-track { background: transparent; }
.place-list-body::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 3px; }

.place-list-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 34px 7px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.place-list-count {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    min-width: 20px;
    padding: 1px 6px;
    background: #e5e7eb;
    color: #555;
    border-radius: 10px;
    font-size: 11px;
    text-align: center;
    line-height: 1.4;
}

.place-list-item.active .place-list-count {
    background: #c7d8f5;
    color: #1e3a8a;
}

.place-list-item:last-child {
    border-bottom: none;
}

.place-list-item:hover {
    background: #f3f4f6;
}

.place-list-item.active {
    background: #e0ecff;
    border-left: 3px solid #2563eb;
    padding-left: 9px;
}

.place-list-emoji {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.place-list-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: inline-flex;
}

.place-list-svg svg {
    width: 100%;
    height: 100%;
}

.place-list-name {
    flex: 1;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-list-sami {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.place-list-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-style: italic;
    font-size: 12px;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
}

.lightbox-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img,
.lightbox-content video {
    max-width: calc(100vw - 80px);
    max-height: calc(100vh - 80px);
    display: block;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lightbox-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev  { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 20px; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: 12px;
}

.place-popup .description {
    font-size: 14px;
    line-height: 1.45;
    margin: 8px 0 10px 0;
    color: #333;
    word-wrap: break-word;
}

.place-popup .description p:first-child { margin-top: 0; }
.place-popup .description p:last-child { margin-bottom: 0; }

/* ---------- EXIF assist button in pin form ---------- */

.exif-assist {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    margin-top: 4px;
}
.exif-assist:hover { background: #bae6fd; }

/* ---------- Bulk import modal ---------- */

.modal.bulk-modal { max-width: 900px; }

.bulk-help {
    font-size: 13px;
    color: #555;
    margin: 0 0 12px;
}

.bulk-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.bulk-controls label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.bulk-controls .file-button { margin: 0; }

.bulk-summary {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    margin: 10px 0;
}

.bulk-table-wrap {
    max-height: 50vh;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 10px;
}
.bulk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.bulk-table th,
.bulk-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: middle;
}
.bulk-table th {
    background: #f9fafb;
    position: sticky;
    top: 0;
    font-weight: 600;
}
.bulk-table input[type="text"],
.bulk-table select {
    width: 100%;
    padding: 4px 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.bulk-coords {
    font-family: monospace;
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}
.bulk-thumb-stack {
    position: relative;
    width: 56px;
    height: 56px;
}
.bulk-thumb-stack img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}
.bulk-count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #2563eb;
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid #fff;
}
.bulk-attach-none {
    color: #888;
    font-size: 12px;
    font-style: italic;
}
.bulk-table select.bulk-attach { min-width: 150px; }

.bulk-table input[disabled],
.bulk-table select[disabled] {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    font-style: italic;
    cursor: not-allowed;
}

.bulk-remove {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: #b91c1c;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.bulk-remove:hover { background: #fee2e2; }

/* ---------- Orphan photo badge in library ---------- */

.library-item.orphan { outline: 2px solid #f59e0b; }
.orphan-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(245, 158, 11, 0.95);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
    /* Hide zoom buttons — pinch-zoom works fine, saves screen space */
    .leaflet-control-zoom { display: none; }

    /* Compact toolbar — respect iOS notch / address-bar safe area */
    #toolbar {
        top: calc(8px + env(safe-area-inset-top, 0px));
        right: calc(8px + env(safe-area-inset-right, 0px));
        left: calc(8px + env(safe-area-inset-left, 0px));
        gap: 4px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    /* Push Leaflet top-left controls below the notch too */
    .leaflet-top {
        padding-top: env(safe-area-inset-top, 0px);
    }
    #toolbar button {
        padding: 7px 11px;
        font-size: 12px;
    }
    #toolbar #info-btn {
        width: 30px;
    }
    #toolbar #locate-btn {
        display: inline-flex;
        width: 30px;
    }

    /* Search panel → anchored at top, full width, max 1/3 screen */
    #search-panel {
        top: calc(56px + env(safe-area-inset-top, 0px));
        left: 8px;
        right: 8px;
        bottom: auto;
        width: auto;
        max-height: 33vh;
    }
    .search-results {
        max-height: calc(33vh - 52px);
    }
    .search-item {
        padding: 10px 36px 10px 12px;
    }

    /* Prevent iOS Safari from zooming the page when focusing an input */
    .modal input[type="text"],
    .modal input[type="email"],
    .modal input[type="password"],
    .modal input[type="number"],
    .modal textarea,
    .modal select,
    #search-input {
        font-size: 16px;
    }

    /* Place list → bottom sheet */
    #place-list {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: auto;
        max-width: none;
        max-height: 35vh;
        border-radius: 14px 14px 0 0;
        transition: transform 0.28s ease;
    }
    #place-list.collapsed {
        width: auto;
        max-height: 35vh;
        transform: translateY(calc(100% - 54px));
    }
    #place-list.collapsed .place-list-body { display: block; }
    #place-list.collapsed .place-list-filter-toggle { display: block; }

    /* Drag-handle pill above header */
    .place-list-header {
        position: relative;
        padding-top: 16px;
    }
    .place-list-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: #d0d0d0;
    }
    /* Chevron indicator not needed — the pill is the cue */
    #place-list-toggle { display: none; }

    .place-list-body {
        min-height: 0;
    }
    .place-list-item {
        padding: 10px 36px 10px 12px;
    }

    /* Modals fill the screen */
    .modal-overlay {
        padding:
            calc(8px + env(safe-area-inset-top, 0px))
            8px
            calc(8px + env(safe-area-inset-bottom, 0px))
            8px;
    }
    .modal {
        max-width: 100%;
        max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        padding: 18px;
    }

    /* Place popup fits phone width */
    .place-popup {
        width: calc(100vw - 80px);
        max-width: 280px;
    }

    /* Hint bar fits narrow screens */
    #hint-bar {
        left: 8px;
        right: 8px;
        transform: none;
        top: calc(52px + env(safe-area-inset-top, 0px));
        font-size: 13px;
        justify-content: space-between;
    }

    /* Bottom sheet respects bottom safe area (iPhone home bar) */
    #place-list {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

