/* LetterMap 2026 styles. Mobile first, one site for every screen. */
:root {
  --lm-blue: #1d4ed8;
  --lm-blue-dark: #1e3a8a;
  --lm-ink: #0f172a;
  --lm-muted: #64748b;
  --lm-line: #e2e8f0;
  --lm-bg: #f8fafc;
  --lm-card: #ffffff;
  --lm-red: #b91c1c;
  --lm-green: #15803d;
  --lm-bar-h: 56px;
  --lm-radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--lm-ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--lm-bg); }
a { color: var(--lm-blue); }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
.lm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.lm-bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--lm-bar-h); z-index: 1000;
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right));
  background: var(--lm-card); border-bottom: 1px solid var(--lm-line); box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}
.lm-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--lm-ink); text-decoration: none; white-space: nowrap; }
.lm-logo { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--lm-blue); display: inline-block; box-shadow: inset 0 0 0 7px var(--lm-blue), inset 0 0 0 13px #fff; }
.lm-search { flex: 1; display: flex; min-width: 0; max-width: 520px; margin: 0 auto; }
.lm-search input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--lm-line); border-right: 0; border-radius: 999px 0 0 999px; background: var(--lm-bg); }
.lm-search input:focus { outline: 2px solid var(--lm-blue); outline-offset: -1px; background: #fff; }
.lm-search button { height: 38px; padding: 0 14px; border: 0; border-radius: 0 999px 999px 0; background: var(--lm-blue); color: #fff; font-weight: 600; cursor: pointer; }
.lm-nav { display: flex; align-items: center; gap: 4px; }
.lm-nav a, .lm-text-btn { text-decoration: none; color: var(--lm-ink); padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.lm-nav a:hover, .lm-icon-btn:hover { background: var(--lm-bg); }
.lm-icon-btn { border: 0; background: transparent; cursor: pointer; min-width: 38px; height: 38px; border-radius: 8px; font-size: 1.15rem; color: var(--lm-ink); }
.lm-icon-btn.lm-text-btn { font-size: .95rem; }
.lm-phone-only { display: none; }
a.lm-icon-btn { align-items: center; justify-content: center; text-decoration: none; font-weight: 700; }

/* map */
.lm-map { position: fixed; top: var(--lm-bar-h); left: 0; right: 0; bottom: 0; z-index: 1; background: #dbe4ee; }
.lm-hint {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 500;
  background: rgba(15, 23, 42, .85); color: #fff; padding: 8px 14px; border-radius: 999px; font-size: .9rem;
  transition: opacity .6s; pointer-events: none; max-width: 90vw; text-align: center;
}
.lm-hint-off { opacity: 0; }

/* pins and clusters (pure CSS, no images) */
.lm-pin { background: none; border: 0; }
.lm-pin span {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: 2px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--lm-blue); border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); color: transparent; font-size: 0;
}
.lm-pin-new span { background: #f59e0b; }
.lm-cluster { background: none; border: 0; }
.lm-cluster span {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%;
  background: rgba(29, 78, 216, .88); color: #fff; font-weight: 700; font-size: .85rem;
  box-shadow: 0 0 0 5px rgba(29, 78, 216, .25), 0 2px 6px rgba(0, 0, 0, .3);
}

/* panel: bottom sheet on phones, side panel on larger screens */
.lm-panel {
  position: fixed; z-index: 900; left: 0; right: 0; bottom: 0; height: 62vh; max-height: calc(100vh - var(--lm-bar-h));
  background: var(--lm-card); border-radius: 16px 16px 0 0; box-shadow: 0 -6px 24px rgba(15, 23, 42, .18);
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom);
}
.lm-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; border-bottom: 1px solid var(--lm-line); }
.lm-panel-head h2 { margin: 0; font-size: 1.05rem; }
.lm-panel-head .lm-icon-btn { font-size: 1.6rem; }
.lm-panel-body { overflow-y: auto; padding: 12px 16px 24px; -webkit-overflow-scrolling: touch; }
body.lm-panel-open .lm-hint { display: none; }
@media (min-width: 768px) {
  .lm-panel { top: var(--lm-bar-h); left: auto; right: 0; bottom: 0; width: 400px; height: auto; max-height: none; border-radius: 0; border-left: 1px solid var(--lm-line); box-shadow: -4px 0 18px rgba(15, 23, 42, .10); }
  body.lm-panel-open .lm-map { right: 400px; }
}
@media (min-width: 1200px) {
  .lm-panel { width: 440px; }
  body.lm-panel-open .lm-map { right: 440px; }
}

/* location view */
.lm-loc-meta { margin: 0 0 8px; color: var(--lm-muted); font-size: .85rem; }
.lm-coords { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--lm-ink); }
.lm-share { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.lm-chip { border: 1px solid var(--lm-line); background: var(--lm-bg); color: var(--lm-ink); border-radius: 999px; padding: 4px 11px; font-size: .82rem; text-decoration: none; cursor: pointer; }
.lm-chip:hover { border-color: var(--lm-blue); color: var(--lm-blue); }
.lm-video { border-color: var(--lm-green); color: var(--lm-green); }
.lm-ad-slot { margin: 0 0 12px; padding: 8px 10px; border: 1px dashed var(--lm-line); border-radius: 8px; font-size: .85rem; }
.lm-form { background: var(--lm-bg); border: 1px solid var(--lm-line); border-radius: var(--lm-radius); padding: 12px; margin-bottom: 14px; }
.lm-field { display: block; margin-bottom: 8px; }
.lm-field span { display: block; font-size: .8rem; color: var(--lm-muted); margin-bottom: 3px; }
.lm-field input, .lm-field textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--lm-line); border-radius: 8px; background: #fff; }
.lm-field textarea { resize: vertical; min-height: 76px; }
.lm-field input:focus, .lm-field textarea:focus { outline: 2px solid var(--lm-blue); outline-offset: -1px; }
.lm-form-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lm-count { font-size: .75rem; color: var(--lm-muted); }
.lm-btn { display: inline-block; border: 0; background: var(--lm-blue); color: #fff; padding: 9px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none; }
.lm-btn:hover { background: var(--lm-blue-dark); }
.lm-btn:disabled { opacity: .6; cursor: default; }
.lm-form-note { margin: 8px 0 0; font-size: .75rem; color: var(--lm-muted); }
.lm-error { margin: 8px 0 0; color: var(--lm-red); font-size: .85rem; }
.lm-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* messages */
.lm-list { list-style: none; margin: 0; padding: 0; }
.lm-msg { border: 1px solid var(--lm-line); border-radius: var(--lm-radius); padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.lm-quake { border-left: 4px solid #f59e0b; }
.lm-removed { opacity: .55; }
.lm-msg-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lm-msg-name { font-size: .92rem; overflow-wrap: anywhere; }
.lm-msg-time { font-size: .75rem; color: var(--lm-muted); white-space: nowrap; }
.lm-msg-text { margin: 6px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.lm-msg-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lm-act { border: 1px solid var(--lm-line); background: var(--lm-bg); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: .85rem; }
.lm-act:disabled { opacity: .5; cursor: default; }
.lm-flag { margin-left: auto; color: var(--lm-red); }
.lm-rating { font-size: .85rem; min-width: 22px; text-align: center; color: var(--lm-muted); }
.lm-pos { color: var(--lm-green); }
.lm-neg { color: var(--lm-red); }
.lm-goto { font-size: .8rem; }
.lm-empty { color: var(--lm-muted); padding: 10px 0; }
.lm-feed-form { display: flex; gap: 6px; margin-bottom: 12px; }
.lm-feed-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--lm-line); border-radius: 8px; }
.lm-feed-form select { padding: 8px; border: 1px solid var(--lm-line); border-radius: 8px; background: #fff; }

/* phones: tighter bar */
@media (max-width: 600px) {
  .lm-brand { font-size: 0; gap: 0; }
  .lm-nav a.lm-text-btn { display: none; }
  .lm-phone-only { display: inline-flex; }
  .lm-search input { height: 36px; }
  .lm-search button { height: 36px; padding: 0 12px; }
}

/* static pages */
body.lm-page .lm-bar { position: sticky; }
.lm-doc { max-width: 760px; margin: 0 auto; padding: 24px 18px 48px; line-height: 1.6; }
.lm-doc h1 { line-height: 1.2; }
.lm-lead { font-size: 1.15rem; color: var(--lm-muted); }
.lm-foot { text-align: center; color: var(--lm-muted); font-size: .8rem; padding: 20px; }
body.lm-page .lm-search { display: none; }

/* admin */
.lm-admin { max-width: 1400px; margin: 0 auto; padding: 20px; }
.lm-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--lm-line); border-radius: var(--lm-radius); }
.lm-table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.lm-table th, .lm-table td { padding: 8px 10px; border-bottom: 1px solid var(--lm-line); text-align: left; vertical-align: top; }
.lm-table th { background: var(--lm-bg); position: sticky; top: 0; }
.lm-table td.lm-cell-msg { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lm-row-hidden { background: #fef2f2; }
.lm-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; background: #fee2e2; color: var(--lm-red); }
.lm-login { max-width: 360px; margin: 60px auto; background: #fff; border: 1px solid var(--lm-line); border-radius: var(--lm-radius); padding: 24px; }
.lm-login input { width: 100%; padding: 9px 10px; border: 1px solid var(--lm-line); border-radius: 8px; margin: 4px 0 12px; }
.lm-filters { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; flex-wrap: wrap; }
.lm-inline { display: inline; }
.lm-small-btn { border: 1px solid var(--lm-line); background: #fff; border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: .8rem; }
.lm-note { background: #fff7ed; border: 1px solid #fed7aa; padding: 10px 12px; border-radius: 8px; }
