/* =============================================================
   app.css — Travel Memory Map
   Design: Refined cartographic — warm parchment tones,
           deep ink typography, jewel-toned emotion accents.
   ============================================================= */

/* ── Reset & custom properties ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Palette */
    --ink:        #1a1714;
    --ink-soft:   #3d3830;
    --muted:      #8a8075;
    --parchment:  #f5f0e8;
    --parchment2: #ede7d8;
    --parchment3: #e4dcc8;
    --white:      #fdfaf5;
    --border:     #d4caba;

    /* Accent */
    --gold:       #c9974a;
    --gold-dark:  #a07535;

    /* Emotions */
    --happy:       #f5c842;
    --love:        #e8637a;
    --adventure:   #4a9eda;
    --peaceful:    #5bbf85;
    --sad:         #6b8fc9;
    --achievement: #b07fd4;

    /* Layout */
    --nav-h:    60px;
    --mobile-bottom-nav-h: 78px;
    --mobile-nav-offset: calc(var(--mobile-bottom-nav-h) + 26px);
    --radius:   10px;
    --shadow:   0 2px 16px rgba(26,23,20,.10);
    --shadow-lg:0 8px 40px rgba(26,23,20,.16);

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

      --action: #FF6B35;
  --action-hover: #E85A2A;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
      background: #F8F9FB;
    font-family: var(--font-body);
    background: var(--parchment);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
}

img { max-width: 100%; display: block; }
a   { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ── Emotion utility classes ────────────────────────────────── */
.emotion-happy       { --em-color: var(--happy);       --em-bg: #fff9e6; }
.emotion-love        { --em-color: var(--love);        --em-bg: #fef0f3; }
.emotion-adventure   { --em-color: var(--adventure);   --em-bg: #edf6fd; }
.emotion-peaceful    { --em-color: var(--peaceful);    --em-bg: #edf8f3; }
.emotion-sad         { --em-color: var(--sad);         --em-bg: #edf1fa; }
.emotion-achievement { --em-color: var(--achievement); --em-bg: #f6f0fc; }
.emotion-joy         { --em-color: var(--happy);       --em-bg: #fff9e6; }
.emotion-heartbreak  { --em-color: var(--love);        --em-bg: #fef0f3; }
.emotion-growth      { --em-color: var(--peaceful);    --em-bg: #edf8f3; }
.emotion-nostalgia   { --em-color: var(--achievement); --em-bg: #f6f0fc; }
.emotion-first_love  { --em-color: var(--love);        --em-bg: #fef0f3; }
.emotion-friendship  { --em-color: var(--gold);        --em-bg: #fff6ea; }
.emotion-loss        { --em-color: var(--sad);         --em-bg: #edf1fa; }
.emotion-family      { --em-color: var(--peaceful);    --em-bg: #edf8f3; }
.emotion-childhood   { --em-color: #f0a55a;            --em-bg: #fff5e8; }
.emotion-transition  { --em-color: var(--adventure);   --em-bg: #edf6fd; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 1px 8px rgba(26,23,20,.06);
}

.nav-brand {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    display: flex; align-items: center; gap: 8px;
    text-decoration: none;
}
.nav-logo { color: var(--gold); font-size: 1.3rem; }

.nav-links {
    display: flex; align-items: center; gap: 8px;
}
.nav-links a {
    color: var(--ink-soft);
    font-size: .9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 6px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.nav-links a:hover, .nav-links a.active {
    background: var(--parchment2);
    color: var(--ink);
}
.nav-links .nav-cta {
    background: var(--ink);
    color: var(--white);
}
.nav-links .nav-cta:hover {
    background: var(--ink-soft);
    color: var(--white);
}
.btn-logout {
    background: none; border: 1px solid var(--border);
    color: var(--muted); font-size: .85rem; font-weight: 500;
    padding: 6px 14px; border-radius: 6px;
    transition: border-color .15s, color .15s;
}
.btn-logout:hover { border-color: var(--ink-soft); color: var(--ink); }

.mobile-bottom-nav {
    display: none;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-size: .9rem; font-weight: 500;
    border: none; transition: all .15s;
    white-space: nowrap;
}
.btn-primary {
    background: var(--ink); color: var(--parchment);
}
.btn-primary:hover { background: var(--ink-soft); color: var(--white); text-decoration: none; }

.btn-secondary {
    background: #ffffff;
    border: 1px solid #dfe2e5;
    color: #202124;
}
.btn-secondary:hover {
    background: #f7f8f9;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink-soft);
}
.btn-ghost:hover { border-color: var(--ink-soft); background: var(--parchment2); text-decoration: none; }

.btn-full { width: 100%; justify-content: center; }
.btn-icon { gap: 8px; }

.auth-note {
    margin-top: 12px;
    font-size: .9rem;
    color: var(--ink-soft);
}

/* Google Sign-In Button */
.g_id_signin {
    margin: 16px 0;
}

.g_id_signin > div {
    width: 100% !important;
    max-width: none !important;
}

/* One Tap prompt positioning */
#credential_picker_container {
    z-index: 10000;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; }
.alert-error   { background: #fef0f0; border: 1px solid #f5c5c5; color: #b33; }
.alert-success { background: #edf8f3; border: 1px solid #a8dfc0; color: #2a7a50; }
.alert p + p { margin-top: 4px; }

/* ── Auth ────────────────────────────────────────────────────── */
.auth-page { background: var(--parchment); }

.auth-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 420px 1fr;
}
@media (max-width: 768px) {
    .auth-container { grid-template-columns: 1fr; }
    .auth-visual    { display: none; }
}

.auth-card {
    background: var(--white);
    padding: 48px 40px;
    display: flex; flex-direction: column; justify-content: center;
    border-right: 1px solid var(--border);
    min-height: 100vh;
}

.auth-brand {
    margin-bottom: 32px;
    text-align: center;
}
.auth-logo {
    display: block;
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 8px;
}
.auth-brand h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ink);
}
.auth-brand p { color: var(--muted); margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-switch {
    margin-top: 24px;
    text-align: center;
    font-size: .9rem;
    color: var(--muted);
}

/* Visual panel */
.auth-visual {
    background: var(--ink);
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}
.auth-visual::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(201,151,74,.15) 0%, transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(91,191,133,.08) 0%, transparent 50%);
}
.auth-visual-inner { position: relative; z-index: 1; text-align: center; }

.pin-grid {
    display: grid;
    grid-template-columns: repeat(4, 32px);
    gap: 20px;
    justify-content: center;
    margin-bottom: 24px;
}
.mini-pin {
    width: 32px; height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--em-color, var(--gold));
    opacity: 0;
    animation: pinPop .5s forwards;
}
@keyframes pinPop {
    to { opacity: .85; transform: rotate(-45deg) scale(1); }
    50% { transform: rotate(-45deg) scale(1.2); }
    from { transform: rotate(-45deg) scale(0); }
}
.auth-tagline { color: rgba(255,255,255,.5); font-size: .85rem; letter-spacing: .05em; }

/* ── Form elements (shared) ──────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-group label {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.hint  { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.required { color: var(--love); }

.field-group input,
.field-group select,
.field-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--ink);
    font-size: .95rem;
    font-family: var(--font-body);
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201,151,74,.15);
}
.field-group textarea { resize: vertical; min-height: 80px; }

.location-chip-field {
    position: relative;
}

.location-chip-field input[readonly] {
    padding-left: 42px;
    background: linear-gradient(180deg, #fbf7ef, #f4ecde);
    color: var(--ink-soft);
    font-weight: 500;
}

.location-coords {
    padding-left: 42px;
   
    color: var(--ink-soft);
    font-weight: 500;
    font-family: monospace;
    font-size: .8rem;
    display: block;
    padding: 12px 16px 12px 42px;

}

.location-edit-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--parchment2);
    border: 1px solid var(--parchment3);
    color: var(--ink-soft);
    font-size: .7rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-edit-btn:hover {
    background: var(--parchment3);
    color: var(--ink);
}

.location-chip-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.location-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.location-options .btn {
    flex: 1;
    min-width: 150px;
    font-size: 0.85rem;
    padding: 8px 12px;
}

.location-display {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #5bbf8510, #4a9eda10);
    border: 1px solid #5bbf8520;
    border-radius: 8px;
    margin-bottom: 12px;
}

.location-display-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.location-display-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-display-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--ink-soft);
    font-weight: 600;
}

.location-display-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.location-display-details {
    font-size: 0.7rem;
    color: var(--ink-soft);
    margin: 2px 0 0 0;
    display: none;
    line-height: 1.2;
}

.location-display-coords {
    font-size: 0.65rem;
    color: var(--ink-soft);
    font-family: monospace;
    opacity: 0.8;
}

/* ── Map page ────────────────────────────────────────────────── */
.map-page .navbar { position: fixed; z-index: 1100; }
.map-page {
    overscroll-behavior: none;
    touch-action: manipulation;
}

.map-wrapper {
    position: fixed;
    top: var(--nav-h); left: 0; right: 0; bottom: 0;
    overflow: hidden;
}

#map {
    width: 100%; height: 100%;
    z-index: 1;
}

.map-atmosphere {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 18%, rgba(255,255,255,.20), transparent 20%),
        radial-gradient(circle at 85% 24%, rgba(255,255,255,.16), transparent 18%),
        linear-gradient(180deg, rgba(112,170,208,.14), transparent 25%, transparent 75%, rgba(248,251,255,.12));
}

/* Leaflet tile credits */
.leaflet-control-attribution { font-size: 10px !important; }
.leaflet-control-zoom { display: none !important; }
.leaflet-top, .leaflet-bottom { z-index: 400 !important; }
.map-page .leaflet-tile-pane,
#profile-map .leaflet-tile-pane {
    filter: none;
}

.map-live-card {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 905;
    width: min(320px, calc(100vw - 32px));
    padding: 18px 20px;
    border-radius: 22px;
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(255,255,255,.7);
    box-shadow: 0 18px 48px rgba(31,63,92,.18);
    backdrop-filter: blur(14px);
    pointer-events: none;
}

.map-live-eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #3d6d8d;
    margin-bottom: 8px;
}

.map-live-card h2 {
    font-family: var(--font-display);
    font-size: 1.45rem;
    line-height: 1.15;
    color: #233443;
    margin-bottom: 8px;
}

.map-live-copy {
    font-size: .9rem;
    line-height: 1.5;
    color: #5e7180;
}

/* Map toolbar */
.map-toolbar {
    position: absolute;
    top: 24px;
    right: 24px;
    left: auto;
    transform: none;
    z-index: 910;
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: min(520px, calc(100vw - 32px));
    pointer-events: none;
}
.map-toolbar .btn { pointer-events: all; box-shadow: var(--shadow); }

.map-fab {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 915;
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
     background: linear-gradient(135deg, #FF6B35, #F2C94C);
    color: #fff;
    box-shadow: 0 18px 38px rgba(24,41,55,.28);
    pointer-events: all;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.map-fab:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 42px rgba(24,41,55,.32);
}

.map-fab.is-active {
    background: linear-gradient(180deg, #c34f5c, #992f3c);
    box-shadow: 0 20px 40px rgba(153,47,60,.34);
}

.map-fab-icon {
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 500;
}

.map-fab.is-active .map-fab-icon {
    font-size: 2rem;
}

.map-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(212,202,186,.95);
    border-radius: 999px;
    background: rgba(253,250,245,.96);
    box-shadow: 0 12px 30px rgba(31,63,92,.12);
    pointer-events: all;
    backdrop-filter: blur(12px);
}

.map-mode-tab {
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: .88rem;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 999px;
    transition: background .15s, color .15s, transform .15s;
}

.map-mode-tab:hover {
    background: var(--parchment2);
    color: var(--ink);
}

.map-mode-tab.is-active {
  background: var(--action);
  color: white;
}

.map-status {
    background: rgba(255,255,255,.84);
    color: #466173;
    border: 1px solid rgba(255,255,255,.82);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: .8rem;
    box-shadow: 0 12px 30px rgba(31,63,92,.12);
    pointer-events: all;
    backdrop-filter: blur(12px);
}

.map-status.is-error {
    color: #9f2c2c;
    border-color: #e9b2b2;
    background: rgba(254,240,240,.98);
}

.popup-edit-btn {
    /* display: inline-flex; */
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 29px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ababab, #b7b7b7);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
    transition: all 0.25s ease;
    border-radius: 20px 20px 20px 5px;
    /* padding: 6px; */
}

.popup-edit-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.35);
}

.popup-edit-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.2);
}

.popup-edit-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

#map-search-box {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(420px, 90vw);
}

.map-search-bar {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  overflow: hidden;
  padding: 4px 4px 4px 16px;
}

#map-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  background: transparent;
  padding: 8px 0;
  color: #333;
}

#map-search-btn {
  background: #2a7a50;
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}

#map-search-results {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  margin-top: 6px;
  overflow: hidden;
}

#map-search-results.hidden { display: none; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f7faf9; }
.search-result-item.no-result { color: #999; cursor: default; font-size: 0.9rem; }

.search-result-icon { font-size: 1rem; flex-shrink: 0; }

.search-result-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #222;
}

.search-result-sub {
  font-size: 0.78rem;
  color: #888;
  margin-top: 2px;
}

.map-hint {
    position: fixed;
    display: none;
    background: rgba(26,23,20,.75);
    color: var(--parchment);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: .8rem;
    opacity: 0;
    transition: opacity .3s cubic-bezier(0.34, 1.56, 0.64, 1), transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    white-space: normal;
    z-index: 920;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%) translateY(6px);
}
.map-hint.visible {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    animation: hintPop .4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hintPop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Custom map pin markers */
.map-pin-shell {
    position: relative;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
}

.map-pin-icon {
    width: 38px;
    height: 38px;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 28%, rgba(255,255,255,0.35), rgba(255,255,255,0) 40%),
        var(--pin-color, var(--gold));
    border: 3px solid rgba(255,255,255,.95);
    overflow: hidden;
    box-shadow: 
        0 0 16px rgba(var(--pin-rgb, 201, 151, 74), 0.38),
        0 12px 24px rgba(37,63,84,.18),
        0 3px 8px rgba(37,63,84,.12),
        inset 0 1px 2px rgba(255,255,255,0.4);
    cursor: pointer;
       transition: transform .18s, box-shadow .2s, filter .18s;
    animation: mapPinFloat 3.2s ease-in-out infinite;
    filter: saturate(1.15) brightness(1.02);
}

.map-pin-icon span {
    font-size: 1.15rem;
    line-height: 1;
    filter: saturate(1.05);
}

.map-pin-photo {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: inherit;
    display: block;
    flex: 0 0 auto;
}

.map-pin-shell:hover .map-pin-icon {
    transform: scale(1.1);
    box-shadow: 
        0 0 24px rgba(var(--pin-rgb, 201, 151, 74), 0.48),
        0 18px 36px rgba(37,63,84,.22),
        0 4px 12px rgba(37,63,84,.16),
        inset 0 1px 2px rgba(255,255,255,0.5);
    filter: saturate(1.25) brightness(1.08);
}

.pin-hovered .map-pin-icon {
    transform: scale(1.14);
    box-shadow: 
        0 0 28px rgba(var(--pin-rgb, 201, 151, 74), 0.52),
        0 20px 40px rgba(37,63,84,.26),
        0 5px 14px rgba(37,63,84,.18),
        inset 0 1px 3px rgba(255,255,255,0.6);
    filter: saturate(1.3) brightness(1.1);
}

.hovering-pin {
    filter: brightness(1.1);
}

.map-pin-count {
    position: absolute;
    right: -2px;
    top: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #253341;
    color: #fff;
    border: 2px solid #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .67rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 6px 14px rgba(37,63,84,.16);
}

@keyframes mapPinFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

@keyframes mapPinBounce {
    0%   { transform: translateY(-40px) scale(0.9); opacity: 0; }

    30%  { transform: translateY(0) scale(1.1); opacity: 1; }   /* hit ground */
    45%  { transform: translateY(-18px) scale(0.98); }          /* bounce 1 */

    60%  { transform: translateY(0) scale(1.05); }
    72%  { transform: translateY(-8px) scale(0.99); }           /* bounce 2 */

    85%  { transform: translateY(0) scale(1.02); }
    92%  { transform: translateY(-3px) scale(1); }              /* bounce 3 */

    100% { transform: translateY(0) scale(1); }
}

@keyframes mapPinPulse {
    0%, 100% {
        box-shadow:
            0 0 0 rgba(var(--pin-rgb, 255,107,53), 0),
            0 12px 24px rgba(37,63,84,.22);
    }
    50% {
        box-shadow:
            0 0 18px rgba(var(--pin-rgb, 255,107,53), 0.45),
            0 16px 30px rgba(37,63,84,.28);
    }
}

@keyframes mapPinExpand {
    from { 
        opacity: 0;
        transform: scale(0.3);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes mapLinesFade {
    from { 
        opacity: 0;
        stroke-dashoffset: 100;
    }
    to { 
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

.map-spiderfied-marker {
    animation: mapPinExpand 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.map-spiderfied-line {
    animation: mapLinesFade 0.4s ease-out !important;
    stroke-dasharray: 100;
}

.map-center-marker-pulse .map-pin-icon {
    animation: mapPinPulse 2s ease-in-out infinite,
               mapPinFloat 3.2s ease-in-out infinite;
}

.memory-cluster-shell {
    background: transparent;
    border: none;
}

.memory-cluster-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,.45), transparent 45%),
        linear-gradient(135deg, #6db7ff, #4f8df7 55%, #6f66ff);
    color: var(--white);
    border: 4px solid rgba(255,255,255,.96);
    box-shadow: 0 16px 34px rgba(31,63,92,.24);
    font-weight: 700;
    font-size: .92rem;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: transparent;
}

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(26,23,20,.55);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal {
    background: var(--white);
    border-radius: 16px;
    padding: 32px;
    width: 100%; max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalIn .25s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.modal h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.modal-close {
    position: absolute; top: 16px; right: 16px;
    background: var(--parchment2);
    border: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    font-size: .85rem;
    color: var(--muted);
    line-height: 1;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--parchment3); color: var(--ink); }

/* Modal form layout */
.form-row         { margin-bottom: 16px; }
.form-row-2       { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-row-check   { display: flex; align-items: center; }

/* ── Emotion Grid Picker (Elegant & Compact) ────────────────── */
.emotion-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.emotion-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 6px;
    border-radius: 11px;
    border: 1.5px solid #e0d5ca;
    background: #fafaf8;
    cursor: pointer;
    transition: all .15s ease;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    text-align: center;
    aspect-ratio: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
}

.emotion-option:hover {
    border-color: #d4a574;
    background: #fffbf7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(147, 94, 33, 0.08);
}

.emotion-option.active {
    border-color: #935e21;
    background: var(--em-bg, #fff6ea);
    color: var(--em-color, #935e21);
    box-shadow: 0 2px 10px rgba(147, 94, 33, 0.15);
    font-weight: 700;
}

.emotion-emoji {
    font-size: 1.4rem;
    display: block;
    line-height: 1;
}

.emotion-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    line-height: 1;
}

.checkbox-label {
    display: flex; align-items: center; gap: 8px;
    font-size: .9rem; color: var(--ink-soft); cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer;
}

.form-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 12px; margin-top: 24px;
    padding-top: 16px; border-top: 1px solid var(--border);
}
.form-error {
    flex: 1;
    font-size: .85rem;
    color: #b33;
}
.btn-spinner { font-style: italic; }

/* Image upload */
.image-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color .15s;
    position: relative;
}
.image-upload-area:hover { border-color: var(--gold); }
.image-upload-area input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    padding: 0; border: none;
    z-index: 2;
}
.upload-placeholder {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; pointer-events: none;
    color: var(--muted); font-size: .85rem;
}
.upload-icon { font-size: 1.8rem; }

.upload-actions {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.upload-actions .btn {
    min-width: 140px;
}

.image-previews {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 8px;
    position: relative;
    z-index: 3;
    pointer-events: none;
}
.preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    pointer-events: none;
}
.preview-thumb {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
}
.preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(26,23,20,.88);
    color: #fff;
    font-size: .72rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(26,23,20,.2);
    pointer-events: auto;
}
.preview-remove:hover {
    background: #9f2c2c;
}

/* ── Memory popup (custom) ───────────────────────────────────── */
.memory-popup {
    position: fixed;
    top: 86px;
    right: 24px;
    width: 340px;
    max-height: min(72vh, 560px);
    background: rgba(255,255,255,.95);
    border-radius: 22px;
    box-shadow: 0 20px 48px rgba(31,63,92,.22);
    overflow: hidden;
    z-index: 1500;
    border: 1px solid rgba(255,255,255,.84);
    backdrop-filter: blur(16px);
    animation: popupIn .25s ease-out;
}
.memory-popup.hidden { display: none; }

@keyframes popupIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.popup-close {
    position: absolute;
    top: 9px;
    right: 7px;
    background: #fff;
    border: 1px solid rgba(31,63,92,.10);
    color: #6a7988;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: .78rem;
    z-index: 1000;
}
.popup-body {
    padding: 18px 18px 0px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(72vh, 560px);
}

.popup-kicker {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6a7d8c;
    padding-right: 30px;
}

.popup-body h3 {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    color: #243849;
}

.popup-location {
    font-size: .9rem;
    color: #5f7483;
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-location-icon {
    flex-shrink: 0;
}

.popup-memory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 4px;
}

.popup-memory-item {
    display: flex;
        flex-wrap: wrap; /* 🔥 important */
    gap: 12px;
    align-items: flex-start;
    padding: 10px 0;
    border-top: 1px solid rgba(197,213,224,.55);
    background: transparent;
}

.popup-memory-item:first-child {
    padding-top: 0;
    border-top: none;
}

.popup-item-thumb {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    overflow: hidden;
    background: #eef3f7;
    flex-shrink: 0;
    flex: 0 0 72px;
}

.popup-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-item-thumb-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    background: var(--em-bg, var(--parchment2));
}

.popup-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* 🔥 ensures everything starts from left */
    text-align: left;
}

.popup-item-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.popup-item-emotion {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #4e74ff;
}

.popup-item-date {
    font-size: .72rem;
    color: #8b9cab;
}

.popup-item-content h4 {
    font-size: .95rem;
    font-weight: 600;
    color: #243849;
    line-height: 1.35;
    margin-bottom: 3px;
        margin-left: 0;
    padding-left: 0;
    text-align: left;
}

.popup-item-author {
    font-size: .78rem;
    color: #607482;
}

.popup-item-story {
        flex: 0 0 100%;   /* 🔥 takes full row */
    margin-top: 6px;
    font-size: .83rem;
    line-height: 1.5;
    color: #44596a;
        margin-left: 0;
    padding-left: 0;
    text-align: left;
}

.popup-item-shared {
    flex: 0 0 100%;   /* 🔥 full width */
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(197,213,224,.7);
    font-size: .75rem;
    color: #8b9cab;
        margin-left: 0;
    padding-left: 0;
    text-align: left;
}

.guest-prompt-modal {
    max-width: 500px;
}

.guest-prompt-kicker {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #4e74ff;
    margin-bottom: 10px;
}

.guest-prompt-copy {
    color: #607482;
    margin-top: 10px;
}

.guest-prompt-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.map-bottom-dock {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 905;
    width: min(760px, calc(100vw - 32px));
    padding: 16px 22px;
    border-radius: 22px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(255,255,255,.76);
    box-shadow: 0 18px 42px rgba(31,63,92,.16);
    backdrop-filter: blur(14px);
    text-align: center;
    pointer-events: none;
}

.map-bottom-title {
    font-size: 1rem;
    font-weight: 600;
    color: #31495b;
}

.map-bottom-meta {
    font-size: .9rem;
    color: #6a7d8c;
    margin-top: 2px;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h2 { font-family: var(--font-display); color: var(--ink-soft); margin-bottom: 8px; }
.empty-state p { margin-bottom: 24px; }

/* ── Error page ──────────────────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    gap: 12px;
}
.error-page .error-icon { font-size: 4rem; }
.error-page h1 { font-family: var(--font-display); font-size: 4rem; color: var(--gold); }

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .modal { padding: 24px 18px; }
    .form-row-2 { grid-template-columns: 1fr; }
    .emotion-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .emotion-option { padding: 8px 4px; font-size: 0.65rem; }
    .emotion-emoji { font-size: 1.2rem; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-stats { justify-content: center; }
    .memory-list-item { flex-direction: column; }
    .list-item-thumb { width: 100%; height: 160px; }
    .navbar { padding: 0 16px; }
    .nav-links a { padding: 6px 8px; font-size: .85rem; }
    .map-live-card {
        top: 12px;
        left: 8px;
        width: calc(100vw - 16px);
        padding: 14px 16px;
    }
    .map-live-card h2 { font-size: 1.18rem; }
    .map-toolbar {
        top: auto;
        right: 8px;
        left: 8px;
        bottom: 108px;
        gap: 6px;
        width: auto;
        max-width: none;
        justify-content: center;
    }
    .map-mode-switch, .map-status { width: 100%; justify-content: center; }
    .map-mode-tab { flex: 1; }
    .memory-popup {
        right: 8px;
        top: 92px;
        width: calc(100vw - 16px);
        max-height: 58vh;
    }
    .popup-body { max-height: 58vh; }
    .map-bottom-dock {
        bottom: 8px;
        width: calc(100vw - 16px);
        padding: 13px 16px;
    }
    .map-bottom-title { font-size: .9rem; }
    .map-bottom-meta { font-size: .82rem; }
}



/* ── Popup memory card — NGL/TETR style header + carousel ───── */
.popup-memory-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(197,213,224,.55);
  position: relative;
}
.popup-memory-card:first-child { padding-top: 0; border-top: none; }

/* Header row: avatar + meta */
.popup-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Round avatar */
.popup-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--em-bg, var(--parchment2));
  border: 2px solid rgba(255,255,255,.8);
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center;
   transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.popup-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.popup-avatar img { width: 100%; height: 100%; object-fit: cover; }
.popup-avatar-emoji { font-size: 1.25rem; }

/* Meta: title + emotion row */
.popup-card-meta { flex: 1; min-width: 0; }

.popup-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: #1a1714;
  line-height: 1.3;
padding-right: 4px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}

.popup-card-emotion {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.popup-emotion-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--em-bg, #f5f0e8);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.popup-emotion-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.popup-reactions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.popup-reactions .reaction-btn.heart-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #e0364f;
  border: none;
  border-radius: 20px 20px 20px 5px;
  padding: 6px 12px 6px 10px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(224,54,79,0.35);
  transition: transform 0.15s, background 0.15s;
}

.popup-reactions .reaction-btn.heart-btn:hover {
  transform: scale(1.06);
  background: #c8203d;
}

.popup-reactions .reaction-btn.heart-btn.user-reacted {
  background: #b01e36;
}

.popup-reactions .heart-icon {
  color: #fff;
  font-size: 17px;
  line-height: 1;
}

.popup-reactions .reaction-count {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin-left: 0;
}

.reaction-heart-badge {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #e02e4e;
  border-radius: 20px 20px 20px 4px; /* speech-bubble bottom-left corner */
  padding: 5px 10px 5px 8px;
  min-width: 58px;
  box-shadow: 0 2px 8px rgba(224, 46, 78, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.reaction-heart-badge:has(.heart-btn.user-reacted) {
  background: #c0203d;
}

.reaction-heart-badge:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(224, 46, 78, 0.45);
}

.heart-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: transform 0.15s ease;
}

.heart-btn:hover { background: transparent; transform: scale(1.2); }
.heart-btn:active { transform: scale(0.9); }

.heart-icon {
  color: #fff;
  font-size: 18px;
  line-height: 1;
  display: block;
}

.reaction-heart-badge .reaction-count {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 6px;
  min-width: 18px;
  text-align: center;
}

/* Reaction layer - animation canvas */
.reaction-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
  
}

.popup-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
}
/* Floating heart animation */
.floating-heart {
  position: absolute;
  bottom: 20px;
  font-size: 18px;
  opacity: 0;
  animation: floatUp 1.2s ease forwards;
}

@keyframes floatUp {
  0% {
    transform: translate(0, 0) scale(0.8) rotate(0deg);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(var(--x, 0px)), -140px) scale(1.5) rotate(20deg);
    opacity: 0;
  }
}

/* Image carousel */
.popup-img-carousel {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #e8edf2;
  aspect-ratio: 16/10;
  width: 100%;
}

.popup-img-track {
  display: flex;
  height: 100%;
  transition: transform .28s ease;
}

.popup-img-slide {
  min-width: 100%;
  height: 100%;
  flex-shrink: 0;
}
.popup-img-slide img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Prev/Next buttons */
.popup-img-prev,
.popup-img-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: #243849;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.popup-img-prev { left: 8px; }
.popup-img-next { right: 8px; }

/* Dots */
.popup-img-dots {
  position: absolute;
  bottom: 22px;
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px;
  z-index: 2;
}
.popup-img-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  transition: background .2s;
}
.popup-img-dot.active { background: #fff; }

/* Counter */
.popup-img-counter {
  position: absolute;
  bottom: 7px;
  left: 50%; transform: translateX(-50%);
  font-size: .68rem;
  color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.28);
  padding: 1px 8px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 2;
}


/* ── Popup card footer: location + author + date ─────────────── */
.popup-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 9px;
  margin-top: 4px;
  border-top: 1px solid rgba(197, 213, 224, .55);
  flex-wrap: wrap;
  width: 100%;          /* ← add this */
  flex-basis: 100%;     /* ← add this */
  align-self: stretch;  /* ← add this */
  position: relative;
}

.popup-card-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
  width: 100%;
  background: rgba(197, 213, 224, .55);

  opacity: 0;
  transform: scaleX(0.8);
  transform-origin: left;

  animation: dividerIn 0.4s ease forwards;
  animation-delay: 0.1s;
}

@keyframes dividerIn {
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}


.popup-footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.popup-footer-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  color: #5f7483;
  font-weight: 500;
  white-space: wrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.popup-footer-location:hover {
  color: #3d5a70;
}

.popup-footer-pin {
  font-size: .8rem;
  flex-shrink: 0;
}

.popup-footer-author {
  font-size: .74rem;
  color: #8b9cab;
  text-decoration: none;
}

.popup-footer-author-link {
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.popup-footer-author-link:link,
.popup-footer-author-link:visited {
  text-decoration: none;
}

.popup-footer-author strong {
  color: #3d5a70;
  font-weight: 600;
  transition: color 0.2s ease;
}

.popup-footer-author-link:hover strong {
  color: #4f8df7;
  text-decoration: underline;
}

.popup-footer-date {
  font-size: .7rem;
  color: #aab8c4;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-end;
}

.popup-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #4f8df7, #2563eb);
  border: none;
  border-radius: 20px 20px 20px 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79,141,247,0.35);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.popup-share-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(79,141,247,0.45);
  background: linear-gradient(135deg, #378add, #1d4ed8);
}

.popup-share-btn:active {
  transform: scale(0.94);
}

.popup-share-btn::before {
  content: '↗';
  font-size: 13px;
  line-height: 1;
}
.sr-text {
  display: none;
}

@media (max-width: 768px) {
    :root {
        --nav-h: 0px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 8px;
        min-height: var(--mobile-bottom-nav-h);
        border-radius: 26px;
        background: rgba(255,255,255,.9);
        border: 1px solid rgba(213,225,234,.96);
        box-shadow: 0 18px 42px rgba(31,63,92,.16);
        backdrop-filter: blur(20px);
        z-index: 1300;
    }

    .mobile-bottom-link {
        min-height: 62px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border-radius: 18px;
        color: #5d6874;
        text-decoration: none;
        font-size: .76rem;
        font-weight: 700;
        letter-spacing: .01em;
        transition: background .15s ease, color .15s ease, transform .15s ease;
    }

    .mobile-bottom-link:hover {
        text-decoration: none;
        background: rgba(233,239,244,.9);
    }

    .mobile-bottom-link.is-active {
        background: linear-gradient(180deg, rgba(36,56,73,.98), rgba(28,46,62,.98));
        color: #fff;
        transform: translateY(-1px);
        box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
    }

    .mobile-bottom-icon {
        font-size: 1.15rem;
        line-height: 1;
    }

    .mobile-bottom-label {
        line-height: 1;
    }

    .navbar {
        display: none;
    }



  

    .map-page {
        --nav-h: 0px;
        background: #dcecf5;
    }

    .map-page .navbar {
        display: none;
    }

    .map-wrapper {
        top: 0;
        bottom: 0;
    }

    .map-live-card {
        display: none;
    }

    .map-toolbar {
        top: calc(12px + env(safe-area-inset-top, 0px));
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translateX(-50%);
        width: auto;
        max-width: calc(100vw - 24px);
        gap: 0;
        justify-content: center;
    }

    .map-status,
    .map-bottom-dock {
        display: none;
    }

    .map-mode-switch {
        width: auto;
        padding: 4px;
        border-radius: 18px;
        box-shadow: 0 12px 28px rgba(31,63,92,.12);
    }

    .map-mode-tab {
        flex: 0 0 auto;
        min-width: 92px;
        min-height: 38px;
        font-size: .82rem;
        padding: 8px 14px;
    }

    .map-hint {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        top: auto;
        bottom: calc(var(--mobile-nav-offset) + 12px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-width: min(280px, calc(100vw - 24px));
        text-align: center;
        white-space: normal;
        border-radius: 18px;
        padding: 12px 16px;
        box-shadow: 0 18px 36px rgba(24,41,55,.26);
        background: linear-gradient(135deg, rgba(26,23,20,.92), rgba(58,50,42,.88));
        border: 1px solid rgba(255,255,255,.12);
        backdrop-filter: blur(12px);
        font-size: .85rem;
        font-weight: 600;
        letter-spacing: 0.3px;
        line-height: 1.5;
        z-index: 920;
    }

    .memory-popup {
        left: 10px;
        right: 10px;
        top: auto;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        width: auto;
        max-height: min(56vh, 480px);
        border-radius: 24px;
        box-shadow: 0 20px 44px rgba(31,63,92,.2);
         animation: popupFadeIn 0.28s ease;
  transform-origin: center;
    }

    @keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

    .map-fab {
        right: 12px;
        bottom: calc(var(--mobile-nav-offset) + 12px + env(safe-area-inset-bottom, 0px));
        width: 58px;
        height: 58px;
        box-shadow: 0 18px 36px rgba(24,41,55,.26);
    }

    .map-fab-icon {
        font-size: 1.8rem;
    }

    .popup-body {
        max-height: min(56vh, 480px);
        padding: 16px;
    }

    .popup-item-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .popup-item-thumb {
        width: 64px;
        height: 64px;
        border-radius: 16px;
    }

    .guest-prompt-modal {
        width: calc(100vw - 20px);
        max-width: none;
        padding: 24px 18px 20px;
        border-radius: 24px 24px 18px 18px;
        margin-top: auto;
        margin-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .guest-prompt-actions {
        flex-direction: column;
    }

    .guest-prompt-actions .btn {
        width: 100%;
        justify-content: center;
    }
}


