:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1c1d1f;
  --muted: #6b6e73;
  --line: #e4e2dc;
  --accent: #d9480f;
  --accent-soft: #fff1e8;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 20px; padding: 12px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: block; flex-shrink: 0; line-height: 0; }
.brand img { height: 26px; width: auto; display: block; }
@media (max-width: 900px) { .brand img { height: 24px; } }
.url-form { flex: 1; display: flex; gap: 8px; max-width: 760px; }
.url-form input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; background: var(--bg); outline: none;
}
.url-form input:focus { border-color: var(--accent); background: #fff; }
.url-form button {
  padding: 10px 20px; border: 0; border-radius: 999px; background: var(--accent);
  color: #fff; font-weight: 600; cursor: pointer;
}

.layout { flex: 1; display: grid; grid-template-columns: minmax(0, var(--split, 1.15fr)) 16px minmax(0, 1fr); padding: 16px; min-height: 0; position: relative; }
/* Drag (or arrow keys) to resize the panels; double-click resets. app.js sets --split. */
.divider { cursor: col-resize; touch-action: none; position: relative; outline: none; }
.divider::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; border-radius: 1px; background: transparent; transition: background .15s; }
.divider:hover::after, .divider:focus-visible::after, .divider.dragging::after { background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; } /* keep the drag when the pointer crosses the player */
.left, .right { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.left { overflow-y: auto; }
.right { overflow: hidden; }

.player-wrap { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; flex-shrink: 0; }
.player-wrap iframe, .player-wrap #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.video-meta h2 { margin: 0; font-size: 18px; }
.video-meta p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.status { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.status.error { color: #b42318; }
.status:empty { display: none; } /* no gap under the map when idle */
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


.map { height: 38%; min-height: 220px; border-radius: var(--radius); border: 1px solid var(--line); flex-shrink: 0; }
.region { font-size: 13px; color: var(--muted); }
.places { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; scroll-behavior: smooth; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: border-color .2s, box-shadow .2s; flex-shrink: 0;
}
.card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.photos { display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x mandatory; background: #eee; }
.photos a { flex: 0 0 auto; scroll-snap-align: start; cursor: zoom-in; }
.photos img { height: 170px; width: auto; max-width: 300px; object-fit: cover; display: block; }
.photos.single img { width: 100%; max-width: none; }
.photos.single a { flex: 1; }
.card-body { padding: 12px 14px 14px; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.card-head h3 { min-width: 0; }
.card h3 { margin: 0; font-size: 16px; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.ts-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.ts-btn:hover { border-color: var(--accent); color: var(--accent); }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.says { margin: 10px 0 0; font-size: 14px; line-height: 1.5; padding-left: 10px; border-left: 3px solid var(--accent); }
.story { margin: 10px 0 0; font-size: 13.5px; line-height: 1.55; color: #33363a; }
.story.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.more { background: none; border: 0; color: var(--accent); padding: 4px 0 0; cursor: pointer; font-size: 13px; }
.source { font-size: 11px; color: var(--muted); margin-top: 8px; }
.source a { color: var(--muted); }
.badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: #f0efe9; color: var(--muted); margin-left: 6px; }
.osm-credit { font-size: 11px; margin-left: 6px; color: var(--muted); text-decoration: none; }
.osm-credit:hover { text-decoration: underline; }

.pin { background: #1c1d1f; color: #fff; border: 2px solid #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin.active { background: var(--accent); transform: scale(1.25); }

/* ---------- Views: home / results / detail (body[data-view]) ---------- */
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; }
body:not([data-view="home"]) #homeView,
body:not([data-view="results"]) #resultsView,
body:not([data-view="detail"]) #detailView,
body:not([data-view="profile"]) #profileView { display: none; }
.view-enter { animation: viewIn .25s ease-out; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.home-view { display: flex; flex-direction: column; overflow-y: auto; }
.discover-pane { flex: 1; display: grid; place-items: center; padding: 20px; }
.home-pane[hidden] { display: none; }
.welcome { max-width: 600px; text-align: center; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.chips button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--ink); }
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.welcome h1 { font-size: 30px; letter-spacing: -0.5px; }
.welcome p { color: var(--muted); line-height: 1.6; }

@media (max-width: 900px) {
  body { height: auto; }
  .layout { grid-template-columns: minmax(0, 1fr); } /* 1fr would grow to the widest content */
  .layout { gap: 16px; }
  .divider { display: none; }
  .right { overflow: visible; }
  .map { height: 300px; }
  .places { overflow: visible; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .url-form { max-width: none; width: 100%; }
}

.card.enter { animation: cardIn .35s ease-out; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Photo dialog ---------- */
.lb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lb-credit { font-size: 12px; color: rgba(255,255,255,.6); }
.lightbox { padding: 0; border: 0; background: transparent; max-width: min(1100px, 94vw); max-height: 94vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10, 10, 12, .82); }
.lightbox[open] { animation: lbIn .18s ease-out; }
@keyframes lbIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.lb-frame { display: flex; flex-direction: column; gap: 10px; color: #fff; }
.lb-head { display: flex; align-items: center; gap: 12px; }
.lb-head h3 { margin: 0; font-size: 17px; flex: 1; }
.lb-count { font-size: 13px; color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }
.lb-close { background: rgba(255,255,255,.12); color: #fff; border: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.lb-close:hover { background: rgba(255,255,255,.25); }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 200px; }
.lb-stage img { max-width: min(1100px, 94vw); max-height: calc(94vh - 110px); object-fit: contain; border-radius: 8px; display: block; transition: opacity .15s; }
.lb-stage img.loading { opacity: .35; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: var(--accent); }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-nav[hidden] { display: none; }
.lb-foot { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: rgba(255,255,255,.8); }
.lb-foot a { color: rgba(255,255,255,.8); white-space: nowrap; }
.lb-foot a:hover { color: #fff; }

/* ---------- Search results ---------- */
.results-view { overflow-y: auto; }
.results-inner { max-width: 1280px; margin: 0 auto; padding: 18px 20px 40px; }
.results-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; min-height: 24px; }
.results-head h2 { margin: 0; font-size: 18px; }
.results-head span { color: var(--muted); font-size: 13px; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px 16px; }
.result { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); border-radius: var(--radius); outline-offset: 4px; }
.result .thumb { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #ddd; }
.result .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.result:hover .thumb img { transform: scale(1.04); }
.result .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.78); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.result .analyzed { position: absolute; left: 8px; top: 8px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.result h3 { margin: 0; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result .r-meta { color: var(--muted); font-size: 13px; line-height: 1.4; }
.result.skeleton .thumb { animation: pulse 1.2s ease-in-out infinite; }
.result.skeleton .bar { height: 12px; border-radius: 4px; background: #e6e4de; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.results-msg { color: var(--muted); padding: 40px 0; text-align: center; }
.results-msg.error { color: #b42318; }
.results-more { min-height: 1px; padding: 26px 0 8px; text-align: center; color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.results-more .error { color: #b42318; }
.results-more .end { font-size: 13px; }

/* ---------- Detail: back to results ---------- */
.back-btn { align-self: flex-start; border: 0; background: none; color: var(--muted); font-size: 14px; padding: 2px 0; cursor: pointer; }
.back-btn:hover { color: var(--accent); }

/* ---------- View transitions (thumbnail <-> player) ---------- */
::view-transition-group(hero) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .view-enter, .card.enter { animation: none; }
}

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 2000; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .results-inner { padding: 14px 16px 32px; } }

/* ---------- Places panel message (nothing found / failed) ---------- */
.panel-msg { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px 20px; text-align: center; }
.panel-msg h3 { margin: 0 0 6px; font-size: 16px; }
.panel-msg p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.panel-msg.error h3 { color: #b42318; }

/* Search: places matching the query, and where in a video the words are spoken. */
.place-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.results-head { flex-wrap: wrap; }
.place-chip { display: inline-flex; flex-direction: column; gap: 1px; padding: 6px 12px; border: 1px solid var(--line, #ddd); border-radius: 12px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; background: var(--card, #fff); }
.place-chip:hover { border-color: var(--accent); }
.place-chip small { color: var(--muted); font-weight: 400; font-size: 12px; }
.result .r-moment { font-size: 13px; line-height: 1.4; color: var(--ink); background: var(--soft, rgba(0,0,0,.04)); border-radius: 8px; padding: 6px 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result .r-moment em { font-style: normal; font-weight: 700; background: rgba(255, 200, 0, .35); border-radius: 3px; }
.result .r-at { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Accounts and social (social.js) ---------- */
.account { margin-left: auto; position: relative; flex-shrink: 0; }
.home-tabs:not([hidden]) + .account { margin-left: 0; }
.signin-btn, .signin-inline { border: 1px solid var(--accent); color: var(--accent); background: var(--panel); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.signin-btn:hover, .signin-inline:hover { background: var(--accent-soft); }
.signin-btn:disabled, .signin-inline:disabled { cursor: progress; opacity: .8; background: var(--accent-soft); }
.signin-btn .spinner, .signin-inline .spinner { display: inline-block; vertical-align: -2px; width: 12px; height: 12px; border-top-color: var(--accent); }
.me-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font-size: 14px; color: var(--ink); max-width: 220px; }
.me-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; min-width: 160px; z-index: 1500; display: flex; flex-direction: column; }
.me-menu[hidden] { display: none; }
.me-menu a, .me-menu button { text-align: left; padding: 8px 10px; border-radius: 6px; border: 0; background: none; font-size: 14px; color: var(--ink); text-decoration: none; cursor: pointer; }
.me-menu a:hover, .me-menu button:hover { background: var(--bg); }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }

.social-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 10px 0 2px; --liked: #e5243b; }
.social-bar button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; border-radius: 8px; padding: 4px 8px; font-size: 13px; cursor: pointer; color: var(--ink); min-height: 32px; }
.social-bar button:hover { background: rgba(0,0,0,.05); }
.social-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.social-bar .ic { flex-shrink: 0; shape-rendering: geometricPrecision; }
.social-bar.compact .ic { width: 18px; height: 18px; }
.social-bar .sb-like.on, .social-bar .sb-follow.on { color: var(--liked); }
.social-bar .sb-want.on { color: var(--accent); }
.social-bar .sb-dir { display: inline-flex; align-items: center; border-radius: 8px; padding: 4px 8px; min-height: 32px; color: var(--ink); }
.social-bar.compact .sb-dir { padding: 3px 6px; min-height: 30px; }
.social-bar .sb-dir:hover { background: rgba(0,0,0,.05); }
.social-bar .sb-dir:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.social-bar .on .ic { fill: currentColor; }
.social-bar .sb-rate.on { color: var(--ink); }
.social-bar .sb-rate.on .ic { color: var(--liked); fill: var(--liked); }
.social-bar.compact { margin: 0; }
.social-bar.compact button { padding: 3px 6px; font-size: 12px; min-height: 30px; }
.social-bar .sb-rate small { color: var(--muted); font-size: 11px; }
.card-head .social-bar { margin: 0 0 0 auto; gap: 0; }
.rate-pop { position: absolute; z-index: 2100; display: flex; align-items: center; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.rate-pop button { border: 0; background: none; line-height: 0; padding: 4px; color: #c9c5bb; cursor: pointer; min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; }
.rate-pop button .ic { width: 24px; height: 24px; }
.rate-pop button.on { color: #e5243b; }
.rate-pop button.on .ic { fill: currentColor; }
.rate-pop .rp-clear { font-size: 12px; color: var(--muted); margin-left: 6px; min-width: 0; line-height: 1; }
.rate-pop .rp-clear:hover { color: var(--ink); }
.cm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.cm-top .cm-title { margin: 0; font-size: 16px; }
.cm-count { color: var(--muted); font-weight: 400; margin-left: 2px; }
.cm-report-target { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.cm-report-target:hover { color: var(--ink); background: var(--bg); }
.social-bar.busy button, .cm-actions button:disabled, .pf-actions button:disabled { cursor: progress; opacity: .55; }

.comments { margin-top: 18px; }
.cm-title { font-size: 16px; margin: 0 0 12px; }
.composer { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.composer .signin-inline { width: 100%; margin-top: 4px; }
.cp-label { font-weight: 600; font-size: 14px; }
.cp-hint { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.cp-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-main textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.cp-main textarea:focus { outline: none; border-color: var(--accent); }
.cp-row { display: flex; align-items: center; gap: 10px; }
.cp-photo { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 10px; font-size: 13px; cursor: pointer; background: var(--panel); color: var(--ink); }
.cp-photo .ic { width: 18px; height: 18px; color: var(--muted); }
.cp-photo:hover { border-color: var(--accent); }
.cp-count { font-size: 12px; color: var(--muted); margin-right: auto; }
.cp-post { margin-left: auto; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600; padding: 7px 18px; cursor: pointer; font-size: 14px; }
.cp-post:disabled { opacity: .45; cursor: default; }
.cp-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-previews:empty { display: none; }
.cp-previews figure { margin: 0; position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--bg); }
.cp-previews img { width: 100%; height: 100%; object-fit: cover; }
.cp-previews button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; }

.comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.comment.reply { border-top: 0; padding: 8px 0 0; }
.cm-avatar { flex-shrink: 0; text-decoration: none; }
.cm-main { flex: 1; min-width: 0; }
.cm-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.cm-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.cm-name:hover { text-decoration: underline; }
.cm-head time { color: var(--muted); font-size: 12px; }
.cm-body { margin: 4px 0 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-body.deleted { color: var(--muted); font-style: italic; }
.cm-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cm-photos img { height: 120px; width: auto; max-width: 100%; border-radius: 8px; object-fit: cover; display: block; background: var(--bg); }
.cm-actions { display: flex; gap: 4px; margin-top: 4px; }
.cm-actions button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); font-size: 12px; padding: 4px 8px; border-radius: 6px; cursor: pointer; min-height: 28px; }
.cm-actions .ic { width: 16px; height: 16px; }
.cm-actions button:hover { background: var(--bg); color: var(--ink); }
.cm-actions .on { color: #e5243b; }
.cm-actions .on .ic { fill: currentColor; }
.cm-replies { margin-left: 2px; }
.cm-main > .composer { margin: 8px 0 0; }
.comment .composer .cp-main textarea { font-size: 13px; }
.cm-empty { color: var(--muted); font-size: 14px; }
.cm-more { text-align: center; padding: 10px 0; }

.sheet { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: min(86vh, 900px); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet.small { width: min(440px, calc(100vw - 32px)); }
.sheet::backdrop { background: rgba(10,10,12,.5); }
.sheet[open] { display: flex; flex-direction: column; }
#reportForm { display: contents; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { margin: 0; font-size: 17px; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.sheet-body { padding: 14px 18px 18px; overflow-y: auto; }
.sheet-body.comments { margin-top: 0; }
.lb-close.dark { color: var(--ink); background: var(--bg); }
.report-reasons { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.report-reasons label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.report-reasons textarea { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; resize: vertical; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
.sheet-actions .cp-post { margin-left: 0; }

.profile-view { overflow-y: auto; }
.profile { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.pf-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pf-head .avatar.initial { font-size: 30px; }
.pf-id { flex: 1; min-width: 200px; }
.pf-id h1 { margin: 0; font-size: 24px; }
.pf-id p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.pf-counts b { color: var(--ink); }
.pf-actions { display: flex; gap: 8px; }
.pf-actions button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 16px; font-size: 14px; cursor: pointer; min-height: 36px; }
.pf-follow { color: var(--ink); }
.pf-follow.on { color: #e5243b; border-color: #e5243b !important; }
.profile h2 { font-size: 16px; margin: 28px 0 4px; }
.pf-where { display: block; margin-top: 14px; font-size: 13px; color: var(--accent); text-decoration: none; }
.pf-where + .comment { border-top: 0; padding-top: 4px; }

/* ---------- Home: Discover | Following (following.js) ---------- */
.home-tabs { display: flex; align-items: center; gap: 2px; margin-left: auto; margin-right: -8px; flex-shrink: 0; }
.home-tabs[hidden] { display: none; }
.home-tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.home-tabs button:hover { color: var(--ink); background: var(--bg); }
.home-tabs button[aria-current="page"] { color: var(--ink); background: #efede7; }
.home-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tab-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5243b; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.tab-badge[hidden] { display: none; }
.me-btn { position: relative; }
.me-btn.has-news::after { content: ""; position: absolute; left: 24px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: #e5243b; border: 2px solid var(--panel); }

.fl { max-width: 1240px; margin: 0 auto; padding: 8px 20px 48px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 24px; align-items: start; }
.fl-loading { display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--muted); padding: 60px 0; }
.fl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 4px; }
.fl-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.3px; }
.fl-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.fl-sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; font-weight: 700; }
.fl-note { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.fl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.fl-side { position: sticky; top: 56px; }
.fl-side[hidden] { display: none; }
.fl-map { height: calc(100vh - 170px); min-height: 320px; max-height: 720px; border-radius: var(--radius); border: 1px solid var(--line); }
.fl-legend { font-size: 12px; color: var(--muted); margin: 6px 2px 0; display: flex; align-items: center; gap: 4px; }
.fl-legend .fpin { width: 12px; height: 12px; display: inline-block; border-width: 2px; }
.fl-empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; margin-top: 16px; }
.fl-empty h3 { margin: 0 0 6px; font-size: 17px; }
.fl-empty p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 14px; }

.fpin { display: block; width: 18px; height: 18px; border-radius: 50%; background: #1c1d1f; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform .15s; }
.fpin.new { background: #e5243b; }
.fpin.active { transform: scale(1.5); }

.fp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s; --liked: #e5243b; }
.fp-card.is-new { border-color: #f3c9c0; }
.fp-card:hover, .fp-row:hover { border-color: #d8d4ca; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.fp-card.flash, .fp-row.flash { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fp-photos { display: grid; gap: 3px; aspect-ratio: 16/10; background: #eee; }
.fp-photos.n2 { grid-template-columns: 1fr 1fr; }
.fp-photos.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.fp-photos.n3 .fp-tile:first-child { grid-row: span 2; }
.fp-tile { position: relative; border: 0; padding: 0; margin: 0; cursor: zoom-in; overflow: hidden; background: #ddd; min-height: 0; }
.fp-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.fp-tile:hover img { transform: scale(1.04); }
.fp-newtag { position: absolute; left: 8px; top: 8px; background: #e5243b; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.fp-more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45); color: #fff; font-size: 20px; font-weight: 700; }
.fp-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.fp-body h3, .fp-row h3 { margin: 0; font-size: 16px; min-width: 0; }
.fp-news { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 13px; font-weight: 600; color: #c2261a; }
.fp-news .dot { width: 7px; height: 7px; border-radius: 50%; background: #e5243b; flex-shrink: 0; }
.fp-quote { margin: 10px 0 0; display: flex; gap: 8px; font-size: 13px; line-height: 1.45; }
.fp-quote .avatar { margin-top: 1px; font-size: 11px; }
.fp-quote time { color: var(--muted); font-size: 12px; margin-left: 4px; }
.fp-quote p { margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #33363a; }
.fp-quote .muted, .muted { color: var(--muted); }
.fp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; }
.fp-actions .ts-btn { font-size: 13px; padding: 5px 12px; }
.fp-card .card-head .social-bar, .fp-row .card-head .social-bar { margin: 0 -6px 0 auto; gap: 0; }

.fl-rows { display: flex; flex-direction: column; gap: 8px; }
.fp-row { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; transition: border-color .2s, box-shadow .2s; --liked: #e5243b; }
.fp-thumb { width: 76px; height: 76px; flex-shrink: 0; border: 0; padding: 0; border-radius: 8px; overflow: hidden; background: var(--bg); cursor: zoom-in; display: grid; place-items: center; font-size: 24px; }
.fp-thumb:disabled { cursor: default; }
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fp-rmain { flex: 1; min-width: 0; }
.fp-row h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-row .fp-actions { padding-top: 4px; gap: 14px; }
.linkish { border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; cursor: pointer; }
.linkish:hover { color: var(--accent); }

.fl-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fperson { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.fperson header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fperson header .fp-news { margin: 0; }
.fperson-id { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.fperson-id span { display: flex; flex-direction: column; min-width: 0; }
.fperson-id b { font-size: 14px; }
.fperson-id small { color: var(--muted); font-size: 12px; }
.fperson-item { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; font-size: 13px; }
.fperson-item.is-new { box-shadow: inset 3px 0 0 #e5243b; padding-left: 10px; }
.fperson-item time { color: var(--muted); font-size: 12px; margin-left: 6px; }
.fperson-where { color: var(--accent); font-weight: 600; max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.fperson-item p { margin: 4px 0 0; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fperson-photos { display: flex; gap: 4px; margin-top: 6px; }
.fperson-photos button { border: 0; padding: 0; width: 56px; height: 56px; border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--bg); }
.fperson-photos img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 900px) {
  .fl { grid-template-columns: minmax(0, 1fr); padding: 4px 16px 40px; gap: 0; }
  .fl-side { position: static; order: -1; margin-top: 8px; }
  .fl-map { height: 220px; min-height: 0; }
  .fl-cards, .fl-people { grid-template-columns: minmax(0, 1fr); }
  .home-tabs { margin: 0 44px 0 auto; order: 1; } /* in the logo row, left of the avatar */
  .url-form { order: 2; }
  .home-tabs button { padding: 6px 10px; }
}

@media (max-width: 900px) {
  .account { margin-left: 0; order: -1; position: absolute; right: 16px; top: 10px; }
  .topbar { position: relative; }
  .me-btn > span:not(.avatar) { display: none; }
  .me-btn { padding: 3px; }
  .sheet { width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
}

/* Want to visit on profiles (social.js wantsSection) */
.pf-wants h2 { margin-bottom: 8px; }
.pw-tabs { display: inline-flex; gap: 4px; margin-right: 12px; }
.pw-tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 14px; font-size: 13px; cursor: pointer; color: var(--ink); min-height: 32px; }
.pw-tabs button[aria-selected="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.pw-public { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.pw-list { margin-top: 8px; }
.pw-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pw-item img, .pw-noimg { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); display: grid; place-items: center; font-size: 22px; }
.pw-main { flex: 1; min-width: 180px; }
.pw-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.pw-name:hover { text-decoration: underline; }
.pw-where { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pw-note { margin-top: 6px; width: 100%; max-width: 420px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 13px; background: var(--panel); color: var(--ink); }
.pw-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pw-btn { display: inline-flex; gap: 4px; align-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink); text-decoration: none; min-height: 32px; }
.pw-btn .ic { width: 15px; height: 15px; }
.pw-btn:hover { border-color: var(--accent); }
.pf-danger { margin-top: 40px; padding-top: 8px; border-top: 1px solid var(--line); }
.pf-danger p { color: var(--muted); font-size: 14px; }
.pf-delete { border: 1px solid #c62828; color: #c62828; background: var(--panel); border-radius: 999px; padding: 7px 16px; font-size: 14px; cursor: pointer; min-height: 36px; }
.cm-name.gone { color: var(--muted); font-style: italic; }
