/* Lomakuume — "matkapäiväkirja" harmaan maailman päällä */
:root {
  --ink: #1d2a33;
  --ink-2: #3c4a53;
  --paper: #f5f0e6;
  --paper-2: #ebe3d3;
  --line: #d6ccb8;
  --muted: #7b776c;
  --real: #2f9e5a;
  --virtual: #e2733a;
  --wish: #3a7bd5;
  --none: #b8b8b2;
  --shadow: 6px 6px 0 rgba(29, 42, 51, .9);
  --soft: 0 18px 40px -18px rgba(0, 0, 0, .55);
  --display: 'Fraunces', Georgia, serif;
  --body: 'Manrope', 'Helvetica Neue', sans-serif;
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2b2e30; }
body { font-family: var(--body); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Kartta ---------- */
#map { position: fixed; inset: 0; background: #3a3d3f; }
/* Kaikki harmaana: tiilet muutetaan harmaiksi app.js:n GrayTileLayerissä (ei CSS-filtteriä: se hidasti vieritystä) */
.leaflet-container { font-family: var(--body); }
.leaflet-control-attribution { background: rgba(245, 240, 230, .8) !important; font-size: 10px; }
.leaflet-control-zoom { border: 2px solid var(--ink) !important; box-shadow: 3px 3px 0 var(--ink) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--paper) !important; color: var(--ink) !important; }
.leaflet-bottom.leaflet-right { margin-bottom: 4px; transition: margin .3s; }
@media (min-width: 861px) { body:has(.panel.open) .leaflet-right { margin-right: min(470px, calc(100vw - 20px)); } }

.city-label {
  background: rgba(29, 42, 51, .82); color: #f5f0e6; border: 0; border-radius: 4px;
  padding: 1px 6px; font-size: 11px; font-weight: 600; box-shadow: none; letter-spacing: .01em;
}
.city-label::before { display: none; }

.sight-pin span {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--virtual); border: 2px solid var(--paper);
  box-shadow: 2px 2px 0 var(--ink); color: #fff; font: 700 12px var(--body);
}
.sight-pin b { transform: rotate(45deg); }

/* ---------- Brändikortti ---------- */
.brand-card {
  position: fixed; top: 18px; left: 18px; z-index: 1000;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 14px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow);
  max-width: calc(100vw - 36px);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { display: block; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: -.02em; font-variation-settings: 'opsz' 144; }
.brand-name em { font-style: italic; font-weight: 400; color: var(--virtual); }
.brand-actions { display: flex; gap: 8px; }

.search { position: relative; display: flex; align-items: center; }
.search > .ic { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search input {
  width: 270px; padding: 10px 12px 10px 36px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fffdf8; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(226, 115, 58, .25); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; width: max(100%, 340px); max-height: 60vh; overflow: auto;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
}
.result {
  display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; align-items: center; width: 100%;
  text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px;
}
.result small { grid-column: 2; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result:hover, .result.sel { background: var(--paper-2); }
.result-wiki { border-top: 1px dashed var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; }
.result.muted { display: block; color: var(--muted); }

/* ---------- Napit ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  border: 2px solid var(--ink); font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .15s;
}
.btn:active { transform: translate(2px, 2px); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--paper-2); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--ink-2); }
.btn-accent { background: var(--virtual); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.btn-accent:hover { background: #d0612a; }
.badge { background: var(--virtual); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; line-height: 20px; min-width: 20px; text-align: center; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(245, 240, 230, .12); color: var(--paper); }
.icon-btn:hover { background: rgba(245, 240, 230, .25); }
.link-btn { background: none; border: 0; padding: 0; color: var(--virtual); font-weight: 700; font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px;
  border: 1.5px solid var(--line); background: #fffdf8; font-size: 12.5px; font-weight: 600; text-decoration: none;
}
.chip .ic { width: 14px; height: 14px; }
.chip:hover { border-color: var(--ink); }

/* ---------- Selite ---------- */
.legend {
  position: fixed; left: 18px; bottom: 28px; z-index: 900; padding: 12px 14px; display: grid; gap: 6px;
  background: rgba(245, 240, 230, .94); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); font-size: 13px;
  transform: rotate(-1.2deg);
}
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-layer { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding: 6px 8px; border: 1.5px dashed var(--ink-2); border-radius: 8px; background: none; font-weight: 700; font-size: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.dot-none { background: var(--none); border: 1.2px solid #3b3f42; }
.dot-real { background: var(--real); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.15); }
.dot-virtual { background: var(--virtual); box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.15); }
.dot-wish { background: #e8eef7; border: 3px solid var(--wish); }

/* ---------- Paneeli ---------- */
.panel {
  position: fixed; top: 18px; right: 18px; bottom: 18px; z-index: 1100; width: min(440px, calc(100vw - 36px));
  background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow), var(--soft);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateX(calc(100% + 40px)); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.panel.open { transform: none; }
.panel-body { overflow-y: auto; flex: 1; scroll-behavior: smooth; }
.panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink);
}
.panel-inner { padding: 18px 22px 26px; }

.hero {
  position: relative; min-height: 230px; display: flex; align-items: flex-end; padding: 22px;
  background: linear-gradient(180deg, rgba(29,42,51,0) 30%, rgba(29,42,51,.88)), var(--hero, none) center/cover, var(--ink-2);
  color: var(--paper);
}
.hero.loading { background: linear-gradient(110deg, var(--ink-2) 30%, #56656e 50%, var(--ink-2) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; opacity: .85; }
.hero h2, .passport-head h2 {
  margin: 4px 0 2px; font-family: var(--display); font-weight: 800; font-size: 44px; line-height: .98;
  letter-spacing: -.03em; font-variation-settings: 'opsz' 144;
}
.hero-desc { font-size: 13px; opacity: .85; }

.passport-head { padding: 34px 22px 18px; background: var(--ink); color: var(--paper); position: relative; overflow: hidden; }
.passport-head::after {
  content: ''; position: absolute; right: -40px; top: -30px; width: 170px; height: 170px; border-radius: 50%;
  border: 3px dashed rgba(226, 115, 58, .6); transform: rotate(12deg);
}
.passport-head.welcome h2 em { font-style: italic; font-weight: 400; color: var(--virtual); }

.mark-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.mark {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 12px;
  border: 2px solid var(--line); background: #fffdf8; font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.2;
  transition: all .15s;
}
.mark span { display: flex; flex-direction: column; }
.mark small { font-weight: 500; font-size: 11px; opacity: .85; }
.mark-cell { display: grid; gap: 4px; align-content: start; }
.mark-date { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 3px 4px; border-radius: 8px; border: 1.5px dashed var(--line); background: #fffdf8; color: var(--ink-2); cursor: pointer; }
.mark-date:hover, .mark-date:focus-within { border-color: var(--ink); }
.mark-date .ic { width: 13px; height: 13px; flex: none; }
.mark-date input { border: 0; background: none; font: 600 12px var(--body); color: inherit; min-width: 0; width: 100%; padding: 0; cursor: pointer; }
.mark:hover { border-color: var(--ink); }
.mark-real.on { background: var(--real); border-color: var(--real); color: #fff; }
.mark-virtual.on { background: var(--virtual); border-color: var(--virtual); color: #fff; }
.mark-wish.on { background: #e8eef7; border-color: var(--wish); color: var(--wish); }
.mark-wish.on .ic { fill: currentColor; }

.clamp { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.clamp p { margin: 0 0 .6em; }
.clampable .clamp { max-height: 7.2em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.clampable.expanded .clamp { max-height: none; -webkit-mask-image: none; mask-image: none; }
.clampable:not(:has(.link-btn)) .clamp { max-height: none; -webkit-mask-image: none; mask-image: none; }
.lead .clamp { font-size: 16px; color: var(--ink); }
.lead-p { font-size: 16px; line-height: 1.6; }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.section-title {
  font-family: var(--display); font-weight: 600; font-size: 24px; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 8px;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px;
}
.section-title small { font-family: var(--body); font-size: 12px; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.error { color: #b3401a; font-weight: 600; }

.sights { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.sight {
  display: grid; grid-template-columns: 112px 1fr; gap: 14px; padding: 10px; border-radius: 14px;
  border: 1.5px solid transparent; transition: background .2s, border-color .2s;
}
.sight:nth-child(even) { grid-template-columns: 1fr 112px; }
.sight:nth-child(even) .sight-img { order: 2; transform: rotate(1.5deg); }
.sight-img { position: relative; margin: 0; transform: rotate(-1.5deg); align-self: start; }
.sight-img img, .noimg {
  width: 112px; height: 112px; object-fit: cover; display: block; border-radius: 6px; cursor: pointer;
  border: 5px solid #fff; box-shadow: 0 6px 14px -6px rgba(0,0,0,.45);
}
.noimg { display: grid; place-items: center; background: var(--paper-2); color: var(--muted); cursor: default; }
.sight .num {
  position: absolute; top: -8px; left: -8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-weight: 800; font-size: 12px; border: 2px solid var(--paper);
}
.sight.heard .num { background: var(--virtual); }
.sight-body h4 { margin: 2px 0 2px; font-family: var(--display); font-size: 19px; font-weight: 600; line-height: 1.15; }
.sight-body .desc { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.sight-body .clamp { font-size: 14px; }
.sight-body .clampable .clamp { max-height: 4.8em; }
.sight-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.lang-tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; background: var(--paper-2); color: var(--muted); }
.sight.active { background: #fffdf8; border-color: var(--line); }
.sight.speaking { background: #fff4ec; border-color: var(--virtual); }
.credits { margin-top: 24px; font-size: 11.5px; color: var(--muted); }

.skeleton { display: grid; gap: 10px; margin: 10px 0; }
.skeleton i { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--paper-2), #f9f5ec, var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton i:nth-child(2) { width: 85%; } .skeleton i:nth-child(3) { width: 60%; }

/* ---------- Passi ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; border-radius: 12px; border: 2px solid var(--ink); background: #fffdf8; display: flex; flex-direction: column; }
.stat b { font-family: var(--display); font-size: 40px; line-height: 1; font-weight: 800; }
.stat b i { font-size: 22px; font-style: normal; }
.stat span { font-weight: 700; font-size: 13px; margin-top: 4px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat-real b { color: var(--real); }
.stat-virtual b { color: var(--virtual); }
.stat-wide { grid-column: 1 / -1; background: var(--ink); color: var(--paper); }
.stat-wide small { color: rgba(245, 240, 230, .7); }

.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; padding: 6px 2px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px; background: transparent; transform: rotate(var(--rot)); text-align: center; position: relative;
  border: 3px solid currentColor; outline: 1.5px dashed currentColor; outline-offset: -9px; transition: transform .15s;
}
.stamp:hover { transform: rotate(0) scale(1.05); }
.stamp-real { color: var(--real); }
.stamp-virtual { color: var(--virtual); }
.stamp strong { font-family: var(--display); font-size: 15px; line-height: 1.05; font-weight: 800; word-break: break-word; }
.stamp-kind { font-size: 9px; text-transform: uppercase; letter-spacing: .16em; font-weight: 800; }
.stamp-date { font-size: 10px; font-weight: 700; opacity: .8; margin-top: 2px; }
.wish-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wish-list .ic { color: var(--wish); }

.settings { display: grid; gap: 12px; }
.settings label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; }
.settings label output { float: right; color: var(--muted); }
.settings select { padding: 8px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #fffdf8; font-weight: 500; }
.settings input[type=range] { accent-color: var(--virtual); }
.settings .btn { justify-self: start; }

.how { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.how li { display: flex; gap: 10px; align-items: center; font-size: 14px; }

/* ---------- Soitin ---------- */
.player {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1200;
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; min-width: 300px; max-width: calc(100vw - 24px);
  background: var(--ink); color: var(--paper); border-radius: 99px; box-shadow: 4px 4px 0 var(--virtual), var(--soft);
}
.player-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.player-text small { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-text strong { font-family: var(--display); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-wave { display: flex; gap: 3px; align-items: center; height: 22px; }
.player-wave i { width: 3px; height: 100%; background: var(--virtual); border-radius: 2px; animation: wave 1s infinite ease-in-out; }
.player-wave i:nth-child(2) { animation-delay: -.25s; } .player-wave i:nth-child(3) { animation-delay: -.5s; } .player-wave i:nth-child(4) { animation-delay: -.75s; }
.player.paused .player-wave i { animation-play-state: paused; }
@keyframes wave { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 22px; left: 50%; z-index: 1300; transform: translate(-50%, -20px); opacity: 0;
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--paper); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); font-size: 14px;
  transition: transform .25s, opacity .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast .ic { color: var(--virtual); }

/* ---------- Mobiili ---------- */
@media (max-width: 860px) {
  .brand-card { flex-wrap: wrap; top: 10px; left: 10px; right: 10px; max-width: none; gap: 8px 10px; padding: 8px 10px; box-shadow: 4px 4px 0 var(--ink); }
  .brand-name { font-size: 19px; }
  .brand img { width: 44px; height: 29px; }
  .brand-actions { margin-left: auto; }
  .brand-actions .btn span { display: none; }
  .brand-actions .btn { padding: 8px 10px; }
  .search { order: 3; flex: 1 1 100%; }
  .search input { width: 100%; }
  .legend { bottom: 18px; left: 10px; padding: 8px 10px; font-size: 11.5px; gap: 4px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 72vh; border-radius: 20px 20px 0 0;
    border-width: 2px 0 0; box-shadow: 0 -10px 40px -10px rgba(0,0,0,.5); transform: translateY(105%);
  }
  .panel.open { transform: none; }
  .hero { min-height: 170px; }
  .hero h2, .passport-head h2 { font-size: 34px; }
  .panel.open ~ .player { bottom: calc(72vh + 10px); }
  .toast { top: auto; bottom: 90px; }
}
@media (max-width: 420px) {
  .sight, .sight:nth-child(even) { grid-template-columns: 84px 1fr; }
  .sight:nth-child(even) .sight-img { order: 0; }
  .sight-img img, .noimg { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kaupunkinäkymän lisät ---------- */
.city-label.leaflet-interactive { cursor: pointer; }
.city-label.leaflet-interactive:hover { background: var(--virtual); }
.hero-gallery { position: absolute; top: 14px; right: 62px; z-index: 2; background: rgba(245, 240, 230, .92); color: var(--ink); }
.hero-local { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12.5px; font-weight: 600; opacity: .92; }
.hero-local:empty { display: none; }
.hero-local .ic { width: 15px; height: 15px; }
.hero-local i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .6; margin: 0 4px; }
.ai-note { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.ai-note .ic { color: var(--virtual); width: 15px; height: 15px; }
.sight-img img { cursor: zoom-in; }
.thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.thumbs:empty { display: none; }
.thumb { width: 52px; height: 40px; padding: 0; border: 2px solid #fff; border-radius: 5px; overflow: hidden; background: var(--paper-2); box-shadow: 0 3px 8px -4px rgba(0,0,0,.5); cursor: zoom-in; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.12); }
.thumb.more { font-weight: 800; font-size: 12px; color: var(--ink); background: var(--paper-2); }
.settings .is-hidden { display: none; }

/* ---------- Kysy oppaalta ---------- */
.guide-log { display: grid; gap: 8px; margin-bottom: 10px; }
.gmsg { max-width: 92%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.5; position: relative; }
.gmsg p { margin: 0; }
.gmsg-user { justify-self: end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.gmsg-assistant { justify-self: start; background: #fffdf8; border: 1.5px solid var(--line); border-bottom-left-radius: 4px; padding-right: 38px; }
.gm-listen { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--paper-2); color: var(--ink); }
.gm-listen .ic { width: 14px; height: 14px; }
.typing p { display: flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.guide-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.guide-form { display: flex; gap: 8px; }
.guide-form input { flex: 1; min-width: 0; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf8; outline: none; }
.guide-form input:focus { border-color: var(--ink); }
.guide-form .btn { padding: 9px 12px; }

/* ---------- Kierroksen kuvanäkymä ---------- */
.cinema {
  position: fixed; top: 0; left: 0; bottom: 0; right: 0; z-index: 1050; overflow: hidden; background: #111;
  opacity: 0; transition: opacity .5s, transform .5s cubic-bezier(.2, .8, .2, 1);
}
@media (min-width: 861px) { body:has(.panel.open) .cinema { right: min(476px, calc(100vw - 36px)); } }
.cinema.open { opacity: 1; }
.cinema.min { transform: translateY(-110%); opacity: 0; pointer-events: none; }
.cin-stage { position: absolute; inset: 0; cursor: pointer; }
.cin-img { position: absolute; inset: -4%; background: center/cover no-repeat; opacity: 0; transition: opacity 1.4s ease; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.cin-img.on { opacity: 1; }
.cin-img.kb { animation: kenburns 9s ease-out forwards; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.14); } }
.cin-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(10,14,17,.7) 0%, rgba(10,14,17,0) 28%, rgba(10,14,17,0) 50%, rgba(10,14,17,.85) 100%); }
.cin-head { position: absolute; top: 110px; left: 34px; right: 34px; color: var(--paper); pointer-events: none; }
.cin-head small { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: #ffd7bf; }
.cin-head h2 { margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-size: clamp(34px, 5vw, 64px); line-height: .98; letter-spacing: -.03em; text-shadow: 0 4px 30px rgba(0,0,0,.5); max-width: 16ch; }
.cin-sub {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); width: min(820px, calc(100% - 48px)); margin: 0;
  color: #fff; font-size: clamp(16px, 1.6vw, 21px); line-height: 1.5; font-weight: 500; text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.8);
}
.cin-sub:empty { display: none; }
.cin-sub.in { animation: subin .5s ease; }
@keyframes subin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.cin-foot { position: absolute; left: 24px; right: 24px; bottom: 92px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.cin-strip { display: flex; gap: 6px; overflow-x: auto; max-width: 70%; scrollbar-width: none; }
.cin-strip button { flex: none; width: 54px; height: 38px; padding: 0; border: 2px solid rgba(255,255,255,.5); border-radius: 5px; overflow: hidden; background: #222; opacity: .7; transition: opacity .2s, border-color .2s; }
.cin-strip button.on { opacity: 1; border-color: var(--virtual); }
.cin-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cin-credit { color: rgba(255,255,255,.65); font-size: 11px; text-align: right; max-width: 40%; }
.cin-min { position: absolute; top: 112px; right: 24px; background: rgba(245, 240, 230, .92); }
.cin-restore { position: fixed; z-index: 1060; left: 50%; transform: translateX(-50%); bottom: 96px; }
body.cinema-on .legend { display: none; }

/* ---------- Kuvakatselin ---------- */
.lightbox { position: fixed; inset: 0; z-index: 1450; background: rgba(12, 16, 19, .94); display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; padding: 24px 70px 12px; opacity: 0; transition: opacity .25s; }
.lightbox.open { opacity: 1; }
.lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-height: 100%; min-height: 0; }
.lb-fig img { max-width: 100%; max-height: calc(100vh - 200px); object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.6); transition: opacity .25s; }
.lb-fig img.loading { opacity: .3; }
.lb-fig figcaption { color: var(--paper); text-align: center; max-width: 760px; display: grid; gap: 4px; font-size: 14px; }
.lb-fig figcaption small { color: rgba(245,240,230,.6); font-size: 11.5px; }
.lb-fig figcaption a { color: #ffd7bf; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--paper); background: transparent; color: var(--paper); display: grid; place-items: center; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(245,240,230,.14); color: var(--paper); display: grid; place-items: center; }
.lb-nav:hover, .lb-close:hover { background: rgba(245,240,230,.25); }
.lb-nav .ic { width: 26px; height: 26px; }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lightbox.single .lb-nav, .lightbox.single .lb-strip { display: none; }
.lb-strip { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; padding: 6px 2px; scrollbar-width: thin; }
.lb-strip button { flex: none; width: 64px; height: 46px; padding: 0; border: 2px solid transparent; border-radius: 5px; overflow: hidden; opacity: .55; background: #222; }
.lb-strip button.on { opacity: 1; border-color: var(--virtual); }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 860px) {
  .cinema { z-index: 1150; }
  .cin-head { top: 120px; left: 18px; right: 18px; }
  .cin-min { top: 16px; bottom: auto; right: 14px; }
  .cin-sub { bottom: 190px; font-size: 16px; }
  .cin-foot { bottom: 96px; left: 14px; right: 14px; }
  .cin-credit { display: none; }
  .cin-strip { max-width: 100%; }
  body.cinema-on .panel.open ~ .player { bottom: 24px; }
  .lightbox { padding: 60px 8px 8px; }
  .lb-nav { display: none; }
}

@media (max-width: 860px) { .cin-restore { bottom: auto; top: 128px; z-index: 1160; } }

/* ---------- Kaupunkiselain ---------- */
.cb-intro { display: flex; gap: 8px; align-items: flex-start; }
.cb-intro .ic { color: var(--virtual); flex: none; margin-top: 1px; }
.cb-search { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf8; outline: none; margin: 6px 0 10px; }
.cb-search:focus { border-color: var(--ink); }
.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .dot { width: 9px; height: 9px; }
.cb-group h4 { font-family: var(--display); font-size: 17px; font-weight: 600; margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px dashed var(--line); display: flex; gap: 6px; align-items: baseline; }
.cb-group h4 small { font-family: var(--body); font-size: 11px; color: var(--muted); font-weight: 700; }
.cb-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.cb-city { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border: 0; background: none; border-radius: 6px; text-align: left; font-size: 13.5px; min-width: 0; }
.cb-city span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-city small { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.cb-city:hover { background: var(--paper-2); }
.cb-city .dot { width: 9px; height: 9px; }
.cb-tag { color: var(--virtual); display: inline-flex; }
.cb-tag .ic { width: 13px; height: 13px; }
@media (max-width: 860px) { .brand-actions #btn-cities span { display: none; } }

/* ---------- Lähteet ---------- */
.cin-source { display: inline-block; margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.8); pointer-events: auto; text-decoration: underline; text-underline-offset: 3px; }
.legend-credits { background: none; border: 0; padding: 2px 0; font-size: 11.5px; color: var(--muted); text-decoration: underline; text-align: left; }
.src-list { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 12px; }
.src-list li { display: grid; gap: 2px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf8; }
.src-list span { font-size: 13.5px; color: var(--ink-2); }
.src-list small { font-size: 12px; color: var(--muted); font-weight: 700; }
.credits .link-btn { font-size: 11.5px; }

/* ---------- Tili ---------- */
.brand-actions { position: relative; }
.account-btn.signed { padding: 4px; border-color: var(--ink); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--real); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.account-menu {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 1200; width: 280px; padding: 14px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow); display: grid; gap: 6px;
}
.account-menu small { color: var(--muted); font-size: 12px; }
.account-menu p { margin: 4px 0; }
.am-sync { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--real); }
.account-menu .btn { justify-self: start; }
@media (max-width: 860px) { .brand-actions .account-btn > span { display: inline; } }

/* ---------- Omat muistot ---------- */
.mem-list { display: grid; gap: 22px; margin-top: 10px; }
.mem-city header { display: grid; gap: 2px; margin-bottom: 8px; }
.mem-title { justify-self: start; background: none; border: 0; padding: 0; font-family: var(--display); font-size: 22px; font-weight: 600; text-align: left; }
.mem-title:hover { color: var(--virtual); }
.mem-city small { color: var(--muted); font-size: 12px; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mem-photo { aspect-ratio: 1; padding: 0; border: 3px solid #fff; border-radius: 6px; overflow: hidden; background: var(--paper-2); box-shadow: 0 4px 10px -5px rgba(0,0,0,.5); cursor: zoom-in; }
.mem-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.mem-photo:hover img { transform: scale(1.06); }
.mem-photo.cover { grid-column: span 2; grid-row: span 2; transform: rotate(-1.2deg); }
.mem-photo.more { font-weight: 800; color: var(--ink); }

/* ---------- Muistot: kartta, aikajana, tuonti ---------- */
.photo-pin img { display: block; width: 40px !important; height: 40px !important; object-fit: cover; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--real), 0 6px 14px -4px rgba(0,0,0,.6); transition: transform .15s; }
.photo-pin:hover img { transform: scale(1.25); }
.mem-otd { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px; margin-bottom: 14px; border: 2px solid var(--ink); border-radius: 12px; background: #fff4ec; box-shadow: 4px 4px 0 var(--virtual); text-align: left; }
.mem-otd img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.mem-otd span { display: grid; gap: 2px; }
.mem-otd small { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--virtual); }
.mem-otd b { font-family: var(--display); font-size: 20px; }
.mem-otd i { font-style: normal; font-size: 12px; color: var(--muted); }
.mem-timeline { display: grid; gap: 18px; margin-top: 8px; border-left: 2px dashed var(--line); padding-left: 14px; }
.mem-month h4 { margin: 0 0 6px; font-family: var(--display); font-size: 18px; font-weight: 600; position: relative; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.mem-month h4::before { content: ''; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--real); border: 2px solid var(--paper); }
.mem-month h4 span { text-transform: capitalize; }
.mem-month small { flex-basis: 100%; font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 600; }
.mem-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; }
.mem-import { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: start; padding: 14px; border: 2px dashed var(--ink-2); border-radius: 12px; background: #fffdf8; transition: background .15s, border-color .15s; }
.mem-import.drag { background: #eef7f1; border-color: var(--real); }
.mem-import > .ic { width: 26px; height: 26px; color: var(--real); }
.mem-import div { display: grid; gap: 2px; font-size: 13px; }
.mem-import div span { color: var(--muted); }
.mem-import .btn { grid-column: 1 / -1; justify-self: start; }
.mem-fallback { grid-column: 1 / -1; display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mem-fallback input { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font-weight: 500; }
.mem-progress { grid-column: 1 / -1; margin: 0; font-size: 13px; font-weight: 700; color: var(--real); }
.mem-suggest { padding: 12px; margin-bottom: 14px; border: 2px solid var(--real); border-radius: 12px; background: #eef7f1; display: grid; gap: 10px; }
.mem-suggest p { margin: 0; font-size: 13.5px; }
.mem-suggest .chip small { color: var(--muted); font-weight: 500; }
.mem-suggest .btn { justify-self: start; }

/* Yläpalkki ei saa mennä oikean paneelin alle: kapeammilla näytöillä napeista jää vain ikonit */
@media (min-width: 861px) {
  body:has(.panel.open) .brand-card { max-width: calc(100vw - min(476px, 100vw) - 36px); }
  .search input { width: 240px; }
}
@media (min-width: 861px) and (max-width: 1560px) {
  body:has(.panel.open) .brand-actions .btn > span { display: none; }
  body:has(.panel.open) .brand-actions .btn { padding: 9px 11px; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  body:has(.panel.open) .search input { width: 170px; }
}
/* Kirjaudu-teksti näkyy aina: se on tärkein löytää */
@media (min-width: 861px) {
  body:has(.panel.open) .brand-actions .account-btn > span { display: inline; }
}
@media (min-width: 861px) and (max-width: 1180px) {
  body:has(.panel.open) .brand-name { display: none; }
}
.mark-date input::-webkit-calendar-picker-indicator { display: none; }
.legend-toggle { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.legend-toggle input { accent-color: var(--real); width: 14px; height: 14px; margin: 0; }
.legend-select { display: grid; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.legend-select select { font: 600 12px var(--body); padding: 4px 6px; border: 1.5px solid var(--line); border-radius: 6px; background: #fffdf8; }

/* ---------- Reissut ---------- */
.trip-add { position: relative; margin-bottom: 14px; }
.trip-add input { width: 100%; padding: 11px 12px; border: 1.5px solid var(--ink); border-radius: 10px; background: #fffdf8; outline: none; font-weight: 500; }
.trip-results:empty { display: none; }
.trip-results { margin-top: 6px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf8; padding: 4px; }
.trip-results .result .ic { color: var(--wish); width: 15px; height: 15px; }
.trip-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.trip { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fffdf8; box-shadow: 3px 3px 0 var(--wish); }
.trip-name, .idea-name { display: grid; text-align: left; background: none; border: 0; padding: 0; }
.trip-name b, .idea-name b { font-family: var(--display); font-size: 20px; font-weight: 600; }
.trip-name small, .idea-name small { color: var(--muted); font-size: 12px; }
.trip-when { display: flex; align-items: center; gap: 5px; align-self: start; padding: 5px 8px; border: 1.5px dashed var(--line); border-radius: 8px; cursor: pointer; }
.trip-when .ic { width: 14px; height: 14px; color: var(--wish); }
.trip-when input { border: 0; background: none; font: 600 12.5px var(--body); width: 112px; cursor: pointer; }
.trip-when input::-webkit-calendar-picker-indicator { display: none; }
.trip-count { grid-column: 1 / -1; font-size: 12.5px; font-weight: 700; color: var(--wish); }
.trip-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.idea-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.idea { display: grid; gap: 6px; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fffdf8; }
.idea .chip { justify-self: start; }
.past-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.past-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 6px; background: none; border: 0; border-radius: 6px; text-align: left; font-size: 14px; }
.past-list button:hover { background: var(--paper-2); }
.past-list small { margin-left: auto; color: var(--muted); }

/* ---------- Mobiilin alapalkki ja sovellusnäkymä ---------- */
.appnav { display: none; }
@media (max-width: 860px) {
  .appnav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 1250;
    background: var(--paper); border-top: 2px solid var(--ink); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .appnav button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; background: none; border: 0; border-radius: 10px; font-size: 11px; font-weight: 700; color: var(--muted); }
  .appnav button .ic { width: 22px; height: 22px; }
  .appnav button.on { color: var(--ink); background: var(--paper-2); }
  .appnav button.on .ic { color: var(--virtual); }
  /* Kartta-välilehdellä paneeli ja soitin alapalkin yläpuolella */
  .panel { bottom: 62px; height: calc(72vh - 62px); }
  .legend { bottom: 76px; }
  .leaflet-bottom { margin-bottom: 62px; }
  .player { bottom: 76px; }
  /* Sovellusnäkymä: ei karttaa, paneeli koko näytön kokoisena */
  body.app-view #map, body.app-view .legend, body.app-view .leaflet-control-container { display: none; }
  body.app-view { background: var(--paper); }
  body.app-view .brand-card { box-shadow: none; }
  body.app-view .brand-actions > .btn:not(.account-btn) { display: none; }
  body.app-view .panel { top: 128px; bottom: 62px; height: auto; border-radius: 0; border-width: 2px 0 0; box-shadow: none; transform: none; }
  body.app-view .panel:not([data-mode="city"]) .panel-close { display: none; }
  body.app-view .panel.open ~ .player { bottom: 76px; }
}

/* ---------- Kaverit ---------- */
.friend-note { display: grid; gap: 6px; margin: -6px 0 14px; }
.friend-note p { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 9px 11px; border-radius: 10px; background: #fdecef; border: 1.5px solid #e8a3b2; font-size: 13.5px; line-height: 1.4; }
.friend-note p:nth-child(2), .friend-note p:only-child:has(.ic use[href="#i-plane"]) { background: #eef7f1; border-color: #9fd2b3; }
.friend-note .ic { flex: none; width: 16px; height: 16px; color: #c94a68; margin-top: 1px; }
.invite { display: grid; gap: 8px; padding: 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fffdf8; }
.invite p { margin: 0; }
.invite-row { display: flex; gap: 6px; }
.invite-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; font: 500 13px var(--body); }
.invite .code { font-family: ui-monospace, monospace; letter-spacing: .08em; color: var(--ink); }
.friend-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.friend-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 10px; }
.friend-list small { grid-column: 1; color: var(--muted); font-size: 12px; }
.friend-list .link-btn { grid-row: 1 / 3; grid-column: 2; align-self: center; color: var(--muted); }
.match-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.match-list button { display: grid; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 2px solid #c94a68; background: #fdecef; }
.match-list b { font-family: var(--display); font-size: 18px; }
.match-list span { font-size: 13px; color: var(--ink-2); }
.section-title .ic { width: 18px; height: 18px; color: #c94a68; }

/* ---------- Passin valikko ja alasivut ---------- */
.pp-menu { display: grid; gap: 0; margin: 16px 0 6px; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fffdf8; }
.pp-link { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.pp-link:last-child { border-bottom: 0; }
.pp-link:hover { background: var(--paper-2); }
.pp-link .ic { width: 20px; height: 20px; color: var(--virtual); }
.pp-link span { display: grid; }
.pp-link b { font-size: 14.5px; }
.pp-link small { font-size: 12px; color: var(--muted); }
.pp-link i { font-style: normal; font-size: 22px; color: var(--muted); }
.pp-back { justify-self: start; display: block; margin-bottom: 6px; padding: 4px 10px 4px 6px; border: 1.5px solid rgba(245,240,230,.5); border-radius: 99px; background: none; color: var(--paper); font: 700 13px var(--body); }
.pp-back:hover { background: rgba(245,240,230,.12); }
.share-preview { margin: 0 0 14px; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 4px 4px 0 var(--ink); background: var(--paper-2); min-height: 120px; }
.share-preview img { display: block; width: 100%; }
.share-preview .skeleton { padding: 20px; }
.share-actions { display: grid; gap: 8px; }
.share-actions .btn { justify-content: center; }
.share-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
