:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e0e2e7;
  --text: #1a1c22;
  --text-dim: #6b7280;
  --accent: #3d6df2;
  --accent-text: #ffffff;
  --liked: #22a06b;
  --pending_like: #d99a1f;
  --not_liked: #9aa1ac;
  --unknown: #b06bd6;
  --danger: #d64545;
  --voice: #3d6df2;
  --source-meeff: #e0529c;
  --source-langmate: #2f6fed;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 20, 30, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --surface: #1c1e25;
    --surface-2: #24262f;
    --border: #33353f;
    --text: #eceef2;
    --text-dim: #9aa0ac;
    --accent: #6d8bff;
    --accent-text: #0c0d10;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #14151a; --surface: #1c1e25; --surface-2: #24262f; --border: #33353f;
  --text: #eceef2; --text-dim: #9aa0ac; --accent: #6d8bff; --accent-text: #0c0d10;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f1f4; --border: #e0e2e7;
  --text: #1a1c22; --text-dim: #6b7280; --accent: #3d6df2; --accent-text: #ffffff;
  --shadow: 0 2px 10px rgba(20, 20, 30, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.topbar h1 { font-size: 18px; margin: 0; }
.counts { font-size: 13px; color: var(--text-dim); }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

#keyword, #sortSelect {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
}
#keyword { min-width: 200px; flex: 1 1 200px; }
#sortSelect { cursor: pointer; }

.btn-outline, .btn-primary {
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.btn-outline:hover { background: var(--border); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-like { background: var(--liked); border-color: var(--liked); }
.btn-danger { background: var(--danger); border-color: var(--danger); }

.section-tabs {
  position: sticky; top: 57px; z-index: 15;
  display: flex; gap: 6px; padding: 8px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.section-tab {
  position: relative;
  border: 1px solid transparent; background: transparent; color: var(--text-dim);
  width: 38px; height: 38px; padding: 0; border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex: none;
}
.section-tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.section-tab[data-section="grid"] svg { fill: currentColor; }
.section-tab:hover { background: var(--surface-2); color: var(--text); }
.section-tab.is-active { background: var(--accent); color: var(--accent-text); }
.tab-dot { position: absolute; top: 4px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.layout { display: flex; align-items: flex-start; }

.filters {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-height: calc(100vh - 102px);
  position: sticky; top: 102px;
  overflow-y: auto;
  max-height: calc(100vh - 102px);
}
.filters-inner { padding: 16px; }
.filter-group { margin-bottom: 20px; }
.filter-group h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin: 0 0 10px; }

.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input[type=number] {
  width: 0; flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
}
.range-row span { color: var(--text-dim); }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow-y: auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}
.chip input { accent-color: var(--accent); }
.chip-checkbox { display: flex; width: 100%; margin-bottom: 4px; }
.chip .count { color: var(--text-dim); font-size: 11px; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-liked { background: var(--liked); }
.dot-pending_like { background: var(--pending_like); }
.dot-not_liked { background: var(--not_liked); }
.dot-unknown { background: var(--unknown); }
.dot-voice { background: var(--voice); }
.dot-favorite { background: #f5a623; }
.dot-source-meeff { background: var(--source-meeff); }
.dot-source-langmate { background: var(--source-langmate); }

.dropdown summary {
  cursor: pointer; list-style: none;
  font-size: 13px; color: var(--text);
  padding: 6px 0;
  display: flex; align-items: center; gap: 6px;
}
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown summary::before { content: '▸'; color: var(--text-dim); font-size: 11px; }
.dropdown[open] summary::before { content: '▾'; }
.dropdown .dd-count { color: var(--text-dim); font-size: 12px; }
.dropdown .chip-list { margin-top: 8px; }

.content { flex: 1; padding: 20px; min-width: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  border: 2px solid transparent;
}
.card.status-liked { border-color: var(--liked); }
.card.status-pending_like { border-color: var(--pending_like); }
.card.status-not_liked { border-color: var(--not_liked); }
.card.status-unknown { border-color: var(--unknown); }

.card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: var(--surface-2);
}
.card .no-photo {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 13px;
}
.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0));
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 4px;
}
.card-overlay .nat { font-weight: 800; }
.card-status-dot {
  position: absolute; top: 8px; right: 8px;
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}
.card-voice-icon {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.card-voice-icon svg { width: 12px; height: 12px; fill: #fff; }

.card-source-badge {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  font-size: 10px; font-weight: 800; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px; color: #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}
.card-source-badge.source-meeff { background: var(--source-meeff); }
.card-source-badge.source-langmate { background: var(--source-langmate); }

.card-select {
  position: absolute; top: 8px; left: 8px;
  width: 24px; height: 24px; border-radius: 6px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.8);
}
.card-select.checked { background: var(--accent); border-color: var(--accent); }
.card-select.checked::after {
  content: ''; position: absolute; left: 7px; top: 3px;
  width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.card-select.disabled { opacity: 0.3; }
.card.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.card.select-mode-disabled { opacity: 0.45; }

.empty-state, .loading { text-align: center; color: var(--text-dim); padding: 60px 0; }
.loading[hidden] { display: none; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40;
}

.detail {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  overflow-y: auto;
}
.detail-close {
  position: fixed; top: 14px; right: 16px; z-index: 60;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.5); color: #fff;
  font-size: 22px; line-height: 1; cursor: pointer;
}
.detail-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  z-index: 60; width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.4); color: #fff;
  font-size: 26px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.detail-prev { left: 12px; }
.detail-next { right: 12px; }
.detail-nav:disabled { opacity: 0.25; cursor: default; }

.detail-panel {
  max-width: 960px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  padding: 60px 20px 40px;
}
@media (max-width: 800px) {
  .detail-panel { grid-template-columns: 1fr; padding-top: 56px; }
}

.carousel { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; aspect-ratio: 3/4; }
.carousel-track img {
  scroll-snap-align: start; flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover;
}
.carousel-thumbs {
  display: flex; gap: 6px; margin-top: 8px;
  overflow-x: auto;
}
.carousel-thumbs img {
  width: 56px; height: 56px; flex: 0 0 auto;
  object-fit: cover; border-radius: 6px; cursor: pointer;
  opacity: 0.55; border: 2px solid transparent;
}
.carousel-thumbs img.active { opacity: 1; border-color: var(--accent); }

.detail-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-header h2 { margin: 0; font-size: 24px; }
.status-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}
.status-badge.liked { background: var(--liked); }
.status-badge.pending_like { background: var(--pending_like); }
.status-badge.not_liked { background: var(--not_liked); }
.status-badge.unknown { background: var(--unknown); }
.source-badge {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px; color: #fff;
}
.source-badge.source-meeff { background: var(--source-meeff); }
.source-badge.source-langmate { background: var(--source-langmate); }

.detail-meta { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.detail-description { margin-top: 14px; white-space: pre-wrap; line-height: 1.5; }

.btn-small { padding: 5px 10px; font-size: 12px; }
.translate-row { margin-top: 8px; display: flex; gap: 8px; }
.translate-row .btn-small:disabled { opacity: 0.5; cursor: not-allowed; }
.translation-result {
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.translation-label { font-size: 11px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
.translation-result p { margin: 0 0 8px; white-space: pre-wrap; line-height: 1.5; }

.detail-section { margin-top: 22px; }
.detail-section h3 { font-size: 13px; text-transform: uppercase; color: var(--text-dim); margin: 0 0 8px; }

.lang-list { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 13px;
}
.lang-chip .lvl { color: var(--text-dim); margin-left: 4px; }

.extra-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 16px;
  font-size: 13px;
}
.extra-grid div span:first-child { color: var(--text-dim); display: block; font-size: 11px; text-transform: uppercase; }
.extra-grid .empty-val { color: var(--text-dim); font-style: italic; }

.detail-map {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  height: 220px;
}
.detail-map iframe { width: 100%; height: 100%; border: 0; display: block; }

body.select-mode-active .content { padding-bottom: 90px; }

.detail-actions { margin-top: 26px; display: flex; align-items: center; gap: 12px; }
.action-msg { font-size: 13px; color: var(--text-dim); }
.action-msg.success { color: var(--liked); }
.action-msg.error { color: var(--danger); }

.select-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
#selectModeBtn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ==========================================================================
   Inbox (Chats / Liked / Visitors) — list + detail, reuses the grid's design
   tokens (source/status colors, surfaces) rather than a separate palette.
   ========================================================================== */
.content.inbox {
  display: flex; padding: 0; align-items: stretch;
  height: calc(100vh - 102px);
}
.inbox-list-col {
  width: 340px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.inbox-list-head { padding: 16px 16px 10px; flex: none; }
.inbox-list-head h2 { margin: 0 0 2px; font-size: 18px; }
.inbox-sub { margin: 0; font-size: 12px; color: var(--text-dim); }
.inbox-list-body { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.inbox-loading, .inbox-empty { padding: 30px 16px; text-align: center; color: var(--text-dim); font-size: 13px; }

.inbox-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border: 0; background: transparent; border-radius: 10px;
  text-align: left; cursor: pointer; color: inherit; font: inherit;
}
.inbox-row:hover { background: var(--surface-2); }
.inbox-row.is-active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.inbox-avatar {
  position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--text-dim);
}
/* border-radius lives on the img itself (not overflow:hidden on the parent)
   so the recency badge below can sit half outside the circle without being
   clipped along with it. */
.inbox-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.inbox-avatar.src-meeff { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--source-meeff); }
.inbox-avatar.src-langmate { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--source-langmate); }
.inbox-recency-dot {
  position: absolute; right: -2px; bottom: -2px; z-index: 1;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  background: #2ecc71; color: #fff; font-size: 8.5px; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.inbox-row-mid { flex: 1; min-width: 0; }
.inbox-row-top { display: flex; align-items: center; gap: 6px; }
.inbox-row-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row-height { font-size: 14px; font-weight: 700; color: inherit; flex: none; }
.inbox-row-flag { font-size: 11px; }
.inbox-row-preview { font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-row-preview.is-pending { font-style: italic; }
.inbox-row-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.inbox-row-time { font-size: 10.5px; color: var(--text-dim); }
.inbox-unread {
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text); font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

.inbox-detail-col { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.inbox-detail-empty { margin: auto; color: var(--text-dim); text-align: center; padding: 20px; font-size: 13px; }
.inbox-back-btn { display: none; position: absolute; top: 10px; left: 10px; z-index: 3; }

.inbox-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.inbox-thread-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.inbox-thread-who {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  border: 0; background: transparent; padding: 4px 6px; margin: -4px -6px;
  border-radius: 10px; text-align: left; color: inherit; cursor: pointer; font: inherit;
}
.inbox-thread-who:hover { background: var(--surface-2); }
.inbox-thread-meta { font-size: 12px; color: var(--text-dim); }
.inbox-thread-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.inbox-star-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 15px; line-height: 1; }
.inbox-star-btn.is-on { color: #f5a623; border-color: #f5a623; }
.inbox-thread-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; }

/* one consecutive-same-sender run — avatar (them only) + a tight column of
   bubbles. Only the last bubble in the run gets a timestamp and the
   "tail" corner; the rest sit flush together like a real chat app. */
.inbox-bubble-group { display: flex; align-items: flex-end; gap: 8px; max-width: 78%; margin: 3px 0; }
.inbox-bubble-group.is-me { align-self: flex-end; justify-content: flex-end; }
.inbox-bubble-group.is-them { align-self: flex-start; }
.inbox-bubble-group .inbox-avatar { width: 30px; height: 30px; font-size: 11px; flex: none; }
.inbox-bubble-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inbox-bubble-group.is-me .inbox-bubble-col { align-items: flex-end; }
.inbox-bubble-group.is-them .inbox-bubble-col { align-items: flex-start; }

.inbox-bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.inbox-bubble {
  padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.4;
  white-space: pre-wrap; word-break: break-word; max-width: 260px;
}
.is-them .inbox-bubble { background: var(--surface-2); }
.is-me .inbox-bubble { background: var(--accent); color: var(--accent-text); }
.inbox-bubble-group.is-them .inbox-bubble-row.is-last .inbox-bubble { border-bottom-left-radius: 4px; }
.inbox-bubble-group.is-me .inbox-bubble-row.is-last .inbox-bubble { border-bottom-right-radius: 4px; }
.inbox-bubble-time { font-size: 10.5px; color: var(--text-dim); white-space: nowrap; padding-bottom: 2px; }
.inbox-bubble-system { align-self: center; font-size: 11.5px; color: var(--text-dim); font-style: italic; margin: 6px 0; }

.inbox-date-pill { display: flex; justify-content: center; margin: 14px 0 6px; }
.inbox-date-pill span {
  background: var(--surface-2); color: var(--text-dim); font-size: 11.5px; font-weight: 700;
  padding: 5px 14px; border-radius: 999px;
}

.inbox-composer { flex: none; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.inbox-composer input {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 14px; color: var(--text); font-size: 13.5px;
}

.inbox-note { font-size: 12px; color: var(--text-dim); margin: 0 0 18px; line-height: 1.5; }

/* horizontal "new matches — say hi first" strip atop the Chats list */
.matches-strip { padding: 6px 2px 14px; }
.matches-label { padding: 0 8px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.matches-track { display: flex; gap: 12px; overflow-x: auto; padding: 2px 8px 4px; }
.match-item { flex: none; width: 60px; border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.match-item .inbox-avatar { width: 52px; height: 52px; font-size: 15px; }
.match-item span { font-size: 11px; font-weight: 700; color: var(--text); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  .content.inbox { position: relative; }
  .inbox-list-col { width: 100%; }
  .inbox-detail-col {
    position: absolute; inset: 0; background: var(--bg);
    transform: translateX(100%); transition: transform .2s ease; z-index: 5;
  }
  .content.inbox.show-detail .inbox-detail-col { transform: translateX(0); }
  .content.inbox.show-detail .inbox-list-col { visibility: hidden; }
  .inbox-back-btn { display: inline-flex; }
}

@media (max-width: 900px) {
  .filters {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
    width: 84vw; max-width: 320px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .filters.open { transform: translateX(0); }
}
@media (min-width: 901px) {
  #filtersToggle { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .topbar-right { width: 100%; }
  #keyword { flex-basis: 100%; min-width: 0; }
  #sortSelect { flex: 1 1 auto; min-width: 0; }
  .content { padding: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .extra-grid { grid-template-columns: 1fr; }
  .detail-panel { padding-left: 14px; padding-right: 14px; }
  .select-bar { padding: 10px 14px; justify-content: center; }
}

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-box {
  text-align: center;
  padding: 32px;
  max-width: 300px;
}
.lock-icon { font-size: 48px; margin-bottom: 12px; }
.lock-title { font-size: 16px; color: var(--text); margin: 0 0 20px; }
.lock-msg { font-size: 13px; color: var(--danger); margin-top: 14px; min-height: 16px; }
.lock-box input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 12px;
}
.lock-box input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.lock-box .btn-primary { width: 100%; }
