/* ================================================================
   FRONTLINE · mobile.css  v4
   Standalone mobile layer. Visibility controlled by mobile.js.
================================================================ */

/* ── Always hidden on desktop ── */
#mobile-header, #mobile-nav, .m-page, #m-comment-bar { display: none; }

/* ════════════════════════════════════════════════════════════════
   MOBILE ONLY  ≤ 700px
════════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow: hidden; -webkit-text-size-adjust: 100%; height: 100%; }
body { overflow: hidden; width: 100vw; height: 100%; background: var(--bg); }
input, textarea, select { font-size: 16px !important; }

/* ── Hide desktop chrome ── */
#alert-bar, #masthead, #site-footer, #intel-col,
#feed-header, #mobile-search-bar { display: none !important; }
#rec-banner {
  border-radius: 0 !important; font-size: 10px !important;
  padding: 3px 12px !important; margin: 0 !important;
}

/* ════════════════════════════════════════════════════════
   TOP BAR  (search + category tabs) — fully fixed
════════════════════════════════════════════════════════ */
#mobile-header {
  flex-direction: column;
  position: fixed; top: 0; left: 0; right: 0; z-index: 400;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border), 0 4px 20px rgba(0,0,0,0.5);
  /* Cover notch / dynamic island */
  padding-top: env(safe-area-inset-top, 0px);
}

/* Search row */
#m-search-row {
  display: flex; align-items: center;
  padding: 9px 14px 7px; gap: 10px;
}
#m-search-box {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 10px; padding: 8px 12px;
  transition: border-color 0.15s;
}
#m-search-box:focus-within { border-color: rgba(107,117,66,0.7); }
#m-search-icon { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }
#m-search-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-bright); font-size: 14px; padding: 0; min-width: 0;
}
#m-search-input::placeholder { color: var(--text-dim); }
#m-search-cancel {
  display: none; background: none; border: none; padding: 0;
  color: var(--olive-light); font-family: var(--mono);
  font-size: 13px; white-space: nowrap; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
#mobile-header.m-searching #m-search-cancel { display: block; }

/* Category tabs */
#m-tabs-row {
  display: flex; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  height: 38px; align-items: stretch; flex-shrink: 0;
  /* left padding so first tab isn't flush */
  padding-left: 4px;
}
#m-tabs-row::-webkit-scrollbar { display: none; }
.m-tab {
  flex-shrink: 0;
  height: 38px; padding: 0 15px; min-width: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; letter-spacing: 0.3px;
  color: var(--text-dim); white-space: nowrap;
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.m-tab.active {
  color: var(--text-bright);
  border-bottom-color: var(--red);
  font-weight: 700;
}

/* ════════════════════════════════════════════════════════
   FEED LAYOUT
════════════════════════════════════════════════════════ */
#layout { display: block !important; padding: 0 !important; gap: 0 !important; }
#feed-col {
  position: fixed !important;
  /* top = safe-area + search-row (~56px) + tabs-row (38px) = ~94px */
  top: calc(env(safe-area-inset-top, 0px) + 94px) !important;
  left: 0 !important; right: 0 !important;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
  overflow-y: auto !important; overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  padding: 0 !important; width: 100% !important; min-width: 0 !important;
}

/* ── News Cards ── */
.news-card {
  display: block !important; margin: 0 !important; border-radius: 0 !important;
  border: none !important; border-bottom: 1px solid var(--border) !important;
  transform: none !important; width: 100% !important;
  background: var(--bg2);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background 0.1s;
}
.news-card:active { background: var(--bg3) !important; }
.card-icon { display: none !important; }
.card-inner { display: block !important; }
.card-body { padding: 14px 16px 0 !important; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px !important; }
.card-tag { font-size: 10px !important; padding: 2px 6px !important; letter-spacing: 0.5px; }
.tag-alert-BREAKING, .tag-featured { font-size: 10px !important; padding: 2px 8px !important; }

.card-title {
  font-size: 16px !important; font-weight: 700 !important;
  line-height: 1.4 !important; margin-bottom: 6px !important;
  color: var(--text-bright) !important; word-break: break-word;
  letter-spacing: -0.2px;
}
.card-desc {
  font-size: 13px !important; color: var(--text-dim) !important;
  line-height: 1.55 !important; margin-bottom: 10px !important;
  display: -webkit-box !important; -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important; overflow: hidden !important;
}
.card-meta {
  font-size: 11px; color: var(--text-dim);
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.card-src { color: var(--olive-light); font-weight: 600; }
.card-time::before { content: '·'; margin-right: 6px; opacity: 0.5; }

/* Card action row */
.card-actions {
  display: flex !important; align-items: center !important;
  padding: 10px 16px !important; gap: 6px !important;
  border-top: 1px solid var(--border) !important;
  margin: 10px 0 0 !important;
}
/* Like + save: pill buttons */
.act-btn {
  height: 30px; padding: 0 11px !important;
  font-size: 12px !important; color: var(--text-dim) !important;
  background: var(--bg3) !important; border: 1px solid var(--border2) !important;
  border-radius: 15px !important;
  display: inline-flex !important; align-items: center !important;
  gap: 4px !important; justify-content: center !important;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.act-btn:active { background: var(--bg4) !important; }
.act-btn.is-liked {
  color: var(--red) !important; border-color: rgba(192,57,43,0.4) !important;
  background: rgba(192,57,43,0.08) !important;
}
.act-btn.is-saved {
  color: var(--amber) !important; border-color: rgba(212,128,10,0.35) !important;
  background: rgba(212,128,10,0.06) !important;
}
/* Read button — right-aligned, filled */
.act-btn-read {
  margin-left: auto !important;
  height: 30px; padding: 0 14px !important; font-size: 11px !important;
  background: var(--red) !important; border: none !important;
  border-radius: 15px !important; color: #fff !important;
  letter-spacing: 0.3px; -webkit-tap-highlight-color: transparent;
  display: inline-flex !important; align-items: center !important;
  /* system font fallback so Chinese/symbols always render */
  font-family: system-ui, -apple-system, sans-serif !important;
}
.act-btn-read:active { opacity: 0.82 !important; }

/* ════════════════════════════════════════════════════════
   BOTTOM NAV  (taller — ~83px visible zone)
════════════════════════════════════════════════════════ */
#mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  /* 82px icon area + safe area */
  height: calc(82px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  align-items: flex-start;
  box-shadow: 0 -1px 0 var(--border), 0 -8px 32px rgba(0,0,0,0.55);
}
.mnav-btn {
  flex: 1;
  /* buttons sit in the 82px zone, shifted UP from center */
  height: 82px; padding-top: 13px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; gap: 3px;
  background: none; border: none; color: var(--text-dim);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer; position: relative; transition: color 0.12s;
}
/* Active state */
.mnav-btn.m-active { color: var(--red); }
/* Active indicator pill beneath icon */
.mnav-btn .mnav-dot {
  display: block; width: 18px; height: 3px; border-radius: 2px;
  background: transparent; transition: background 0.15s; flex-shrink: 0;
}
.mnav-btn.m-active .mnav-dot { background: var(--red); }
/* Nav icon — SVG wrapper, pixel-perfect across all buttons */
.mnav-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 24px; flex-shrink: 0;
}
.mnav-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mnav-btn.m-active .mnav-icon svg { stroke: var(--red); }
.mnav-label { font-size: 10px; font-weight: 500; letter-spacing: 0.2px; line-height: 1; }

/* Publish pill */
.mnav-btn.mnav-pub { flex: 1; }
.mnav-pub-pill {
  width: 52px; height: 32px; background: var(--red); border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; line-height: 1;
  box-shadow: 0 4px 16px rgba(192,57,43,0.55);
  transition: transform 0.1s, box-shadow 0.1s;
}
.mnav-btn.mnav-pub:active .mnav-pub-pill {
  transform: scale(0.88); box-shadow: 0 2px 8px rgba(192,57,43,0.4);
}

/* Badge */
.mnav-badge {
  position: absolute; top: 8px; left: calc(50% + 8px);
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 8px; border: 2px solid var(--bg2);
  display: flex; align-items: center; justify-content: center;
}
.mnav-badge[hidden] { display: none !important; }

/* me avatar handled inline by _updateMeIcon */

/* ════════════════════════════════════════════════════════
   FULL-SCREEN PAGES
════════════════════════════════════════════════════════ */
.m-page {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  flex-direction: column; overflow: hidden;
  overscroll-behavior: none;
  /* Cover safe area including notch/dynamic island */
  padding-top: env(safe-area-inset-top, 0px);
}
#m-article-page { z-index: 350; }

/* Page header bar */
.m-page-hd {
  display: flex; align-items: center;
  min-height: 54px; padding: 0 16px; gap: 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 0 var(--border);
}
.m-page-title {
  font-size: 17px; font-weight: 700;
  color: var(--text-bright); letter-spacing: -0.3px; flex: 1;
}
.m-page-action {
  font-size: 12px; color: var(--olive-light);
  background: rgba(74,82,48,0.15); border: 1px solid var(--border2);
  border-radius: 8px; padding: 6px 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; font-weight: 600;
  transition: background 0.1s;
}
.m-page-action:active { background: rgba(74,82,48,0.28); }

/* Scrollable body */
.m-page-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

/* ── 我的: profile header ── */
#m-donate-bar { display: none; }

#donate-banner {
  margin: 0 !important;
  border-radius: 0 !important;
  border-left-width: 3px !important;
  border-top: none !important;
  border-right: none !important;
  flex-wrap: wrap !important;
  line-height: 1.6 !important;
}

#m-me-header {
  padding: 22px 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(160deg, var(--bg3) 0%, var(--bg) 100%);
}
.m-avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--olive); border: 2px solid var(--olive-light);
  font-weight: 700; font-size: 24px;
  color: var(--text-bright); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 0 0 5px rgba(74,82,48,0.15);
}
.m-user-name {
  font-size: 19px; font-weight: 700;
  color: var(--text-bright); letter-spacing: -0.3px; line-height: 1.2;
}
.m-user-sub {
  font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.3;
}
.m-user-stats { display: flex; gap: 20px; margin-top: 8px; }
.m-user-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.m-user-stat strong { color: var(--text-bright); font-size: 17px; font-weight: 700; line-height: 1; }
.m-user-stat span { font-size: 10px; color: var(--text-dim); letter-spacing: 0.3px; }

/* 我的: inner tabs */
#m-me-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: var(--bg2); position: sticky; top: 0; z-index: 10;
}
.m-me-tab {
  flex: 1; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
  color: var(--text-dim); border: none; background: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: color 0.12s; -webkit-tap-highlight-color: transparent;
}
.m-me-tab.active {
  color: var(--text-bright); border-bottom-color: var(--red); font-weight: 700;
}

/* List items (articles / comments / saves) */
.m-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: var(--bg2); transition: background 0.1s;
}
.m-item:active { background: var(--bg3); }
.m-item-emoji { font-size: 22px; flex-shrink: 0; line-height: 1.3; margin-top: 1px; }
.m-item-body { flex: 1; min-width: 0; }
.m-item-title {
  font-size: 14px; font-weight: 600; color: var(--text-bright);
  margin-bottom: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  letter-spacing: -0.1px;
}
.m-item-sub { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.m-item-preview {
  font-size: 12px; color: var(--text-dim); line-height: 1.45;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-item-del {
  flex-shrink: 0; align-self: center;
  background: none; border: 1px solid var(--border2);
  border-radius: 8px; padding: 5px 10px;
  font-size: 11px; color: var(--text-dim); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: 0.1s;
}
.m-item-del:active { color: var(--red); border-color: rgba(192,57,43,0.5); }

/* ── Notifications ── */
.m-notif {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.m-notif.unread {
  background: rgba(192,57,43,0.04);
  border-left: 3px solid var(--red-dim);
  padding-left: 13px;
}
.m-notif-top {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 5px; margin-bottom: 6px;
}
.m-notif-actor {
  font-size: 13px; font-weight: 700;
  color: var(--olive-light); cursor: pointer;
}
.m-notif-verb { font-size: 12px; color: var(--text-dim); }
.m-notif-time { font-size: 11px; color: var(--text-dim); margin-left: auto; }
.m-notif-preview {
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
  border-left: 2px solid var(--border2); padding: 4px 10px;
  margin-bottom: 6px; background: rgba(0,0,0,0.2); border-radius: 3px;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-notif-link {
  font-size: 11px; font-weight: 600;
  color: var(--olive-light); background: rgba(74,82,48,0.12);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 4px 10px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}

/* ════════════════════════════════════════════════════════
   ARTICLE DETAIL PAGE
════════════════════════════════════════════════════════ */
#m-article-back {
  background: none; border: none; color: var(--text-bright);
  font-size: 24px; padding: 0 10px 0 0;
  cursor: pointer; line-height: 1; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
#m-article-label {
  flex: 1; font-size: 12px; color: var(--text-dim);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-weight: 400;
}
#m-article-body {
  flex: 1; overflow-y: auto;
  padding: 20px 16px 28px;
  -webkit-overflow-scrolling: touch;
  /* Prevent the page itself from scrolling when keyboard opens —
     only this element should scroll */
  overscroll-behavior: contain;
}

/* Article content */
.m-art-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.m-art-title {
  font-size: 22px; font-weight: 800;
  color: var(--text-bright); line-height: 1.28; margin-bottom: 14px;
  letter-spacing: -0.5px;
}
.m-art-desc {
  font-size: 15px; color: var(--text-dim);
  line-height: 1.7; margin-bottom: 18px;
  border-left: 3px solid var(--border2); padding-left: 14px;
}
.m-art-meta {
  font-size: 12px; color: var(--text-dim);
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  margin-bottom: 18px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
/* Clickable author — chip style */
.m-art-author {
  color: var(--olive-light); cursor: pointer;
  font-weight: 700; font-size: 12px;
  background: rgba(74,82,48,0.15);
  border-radius: 20px; padding: 2px 8px;
  -webkit-tap-highlight-color: transparent;
}
.m-art-author:active { background: rgba(74,82,48,0.28); }

/* Actions */
.m-art-actions {
  display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap;
}
.m-act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 18px;
  background: var(--bg3); border: 1px solid var(--border2);
  font-size: 13px; color: var(--text-dim);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: all 0.12s; min-width: 72px; justify-content: center;
  font-weight: 500;
}
.m-act:active { background: var(--bg4); }
.m-act.liked {
  color: var(--red); border-color: rgba(192,57,43,0.4);
  background: rgba(192,57,43,0.1);
}
.m-act.saved {
  color: var(--amber); border-color: rgba(212,128,10,0.4);
  background: rgba(212,128,10,0.07);
}
.m-art-read {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 18px;
  background: var(--red); border: none;
  font-size: 13px; color: #fff; text-decoration: none; font-weight: 600;
}

/* Comments section */
.m-comments-hd {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--text-dim); text-transform: uppercase;
  padding: 16px 0 12px; border-top: 1px solid var(--border); margin-bottom: 4px;
}
.m-cmt {
  padding: 13px 0; border-bottom: 1px solid rgba(46,48,36,0.7);
}
.m-cmt.is-reply {
  margin-left: 20px; padding-left: 12px;
  border-left: 2px solid var(--border2);
}
.m-cmt-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
/* Username chip */
.m-cmt-user {
  font-size: 12px; font-weight: 700;
  color: var(--olive-light); cursor: pointer;
  padding: 3px 8px; border-radius: 12px;
  background: rgba(74,82,48,0.15);
  -webkit-tap-highlight-color: transparent; transition: background 0.1s;
}
.m-cmt-user:active { background: rgba(74,82,48,0.3); }
.m-cmt-time { font-size: 11px; color: var(--text-dim); }
/* Reply button */
.m-cmt-reply-btn {
  font-size: 11px; font-weight: 600;
  color: var(--text-dim); background: var(--bg3);
  border: 1px solid var(--border2); border-radius: 10px;
  padding: 3px 10px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: 0.1s;
}
.m-cmt-reply-btn:active { color: var(--olive-light); border-color: var(--olive-light); }
/* Comment like */
.m-cmt-like {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 10px;
  -webkit-tap-highlight-color: transparent; transition: color 0.1s;
  min-width: 44px; justify-content: center;
}
.m-cmt-like:active { color: var(--red); }
.m-cmt-like.liked { color: var(--red); }
.m-cmt-prefix {
  font-size: 11px; color: var(--olive-light); margin-bottom: 4px; opacity: 0.75;
}
.m-cmt-body {
  font-size: 14px; color: var(--text); line-height: 1.65;
}

/* ══ Comment bar — same height as nav bar ══
   Fixed to bottom, moves UP via transform when keyboard opens.
   Height is fixed: 82px content zone + safe-area. Never grows.
   Input sits flush at the top of the 82px zone with 8px breathing room.
═══════════════════════════════════════════════════════════════════════ */
#m-comment-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 360;
  /* Default height = nav bar. Can grow upward (min-height, no max-height). */
  min-height: calc(82px + env(safe-area-inset-bottom, 0px));
  background: var(--bg2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0,0,0,0.5);
  /* Stack content from the bottom up — input always anchored near bottom */
  display: flex; flex-direction: column;
  justify-content: flex-end;
  padding: 8px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
  /* Keyboard movement via transform */
  transform: translateY(0);
  will-change: transform;
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1),
              border-top-color 0.18s ease,
              box-shadow 0.18s ease;
}
#m-comment-bar.bar-active {
  border-top-color: rgba(107,117,66,0.45);
  box-shadow: 0 -6px 24px rgba(0,0,0,0.55), 0 -1px 0 rgba(107,117,66,0.2);
}

/* Reply banner — sits above the input row, slides down */
#m-reply-banner {
  display: none; /* JS sets display:flex */
  align-items: center; gap: 7px;
  background: rgba(192,57,43,0.07);
  border: 1px solid rgba(192,57,43,0.18);
  border-radius: 7px;
  padding: 5px 10px;
  margin-bottom: 6px;
  flex-shrink: 0;
  overflow: hidden;
}
#m-reply-banner .fl-reply-icon {
  font-size: 11px; color: var(--red); flex-shrink: 0;
}
#m-reply-label {
  flex: 1; color: var(--text-dim); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#m-reply-cancel {
  background: none; border: none;
  color: var(--text-dim); font-size: 15px; line-height: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  padding: 0 2px; flex-shrink: 0;
  transition: color 0.12s;
}
#m-reply-cancel:active { color: var(--red); }

/* Input row */
#m-comment-row {
  display: flex; gap: 8px; align-items: center;
  flex: 1;
}
#m-comment-ta {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 15px;
  resize: none; overflow: hidden;
  min-height: 40px; max-height: 120px;
  line-height: 22px;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-appearance: none;
  overscroll-behavior: none;
}
#m-comment-ta::placeholder { color: var(--text-dim); }
#m-comment-ta:focus {
  border-color: rgba(107,117,66,0.6);
  background: var(--bg4);
  box-shadow: 0 0 0 3px rgba(107,117,66,0.08);
}

/* Send button — circle, same vertical center as input */
#m-comment-send {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--red); border: none;
  color: #fff;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 10px rgba(192,57,43,0.3);
}
#m-comment-send:active { transform: scale(0.88); }
#m-comment-bar.bar-active #m-comment-send {
  background: var(--red-hot);
  box-shadow: 0 2px 14px rgba(232,64,64,0.4);
}

/* ════════════════════════════════════════════════════════
   DIALOGS — bottom sheet
════════════════════════════════════════════════════════ */
.dialog {
  width: 100vw !important; max-width: 100vw !important;
  max-height: 92vh !important;
  border-radius: 16px 16px 0 0 !important;
  position: fixed !important; bottom: 0 !important; top: auto !important;
  left: 0 !important; margin: 0 !important;
  border-top: 2px solid var(--red) !important;
  border-left: none !important; border-right: none !important; border-bottom: none !important;
  transform: none !important; z-index: 600 !important;
}
@keyframes m-sheet {
  from { transform: translateY(100%); opacity: 0; }
  80%  { transform: translateY(-2px); }
  to   { transform: translateY(0); opacity: 1; }
}
.dialog.is-open { animation: m-sheet 0.24s cubic-bezier(0.32,0.72,0,1) both !important; }
.dialog.is-open::before { display: none !important; }
.dlg-head { padding-top: 22px !important; position: relative; }
.dlg-head::after {
  content: ''; position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%); width: 40px; height: 4px;
  background: var(--border2); border-radius: 4px;
}
#backdrop { background: rgba(0,0,0,0.78) !important; z-index: 550 !important; }
#dlg-article { display: none !important; }
.form-grid { grid-template-columns: 1fr !important; }
.field-group.span2 { grid-column: auto !important; }
.field-row { flex-direction: column !important; }
.admin-tab { font-size: 10px !important; padding: 5px 8px !important; }
#admin-tabs { flex-wrap: wrap !important; gap: 4px !important; }

/* ── Empty / login states ── */
.m-empty {
  padding: 56px 20px; text-align: center;
  font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.m-login-cta { padding: 60px 20px; text-align: center; }
.m-login-cta p { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; line-height: 1.5; }

/* ── Login prompt inside pages ── */
.m-login-prompt {
  padding: 48px 20px; text-align: center;
}
.m-login-prompt p { font-size: 13px; color: var(--text-dim); margin-bottom: 16px; }

/* Toast */
#toast-container {
  bottom: calc(82px + env(safe-area-inset-bottom, 8px)) !important;
  left: 50% !important; right: auto !important;
  transform: translateX(-50%) !important; width: 84vw !important;
}
.toast { text-align: center !important; font-size: 12px !important; white-space: normal !important; }

} /* end @media */

/* ════════════════════════════════════════════════════════
   ANIMATIONS  — added for page transitions & micro-interactions
════════════════════════════════════════════════════════ */
@media (max-width: 700px) {

/* ── Full-screen page: fade + slide up on enter ── */
@keyframes m-page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes m-page-exit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(6px); }
}
.m-page.m-page-open {
  animation: m-page-enter 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.m-page.m-page-exit {
  animation: m-page-exit 0.18s ease both;
  pointer-events: none;
}

/* ── Article page: slide in/out from right ── */
@keyframes m-art-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes m-art-out {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}
.m-art-slide-in  { animation: m-art-in  0.26s cubic-bezier(0.32, 0.72, 0, 1) both; }
.m-art-slide-out { animation: m-art-out 0.24s cubic-bezier(0.4, 0, 1, 1) both; }

/* ── Nav icon bounce on activation ── */
@keyframes mnav-bounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.8); }
  65%  { transform: scale(1.18); }
  85%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
.mnav-icon.mnav-bounce { animation: mnav-bounce 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── Button tactile pop (like, save, send) ── */
@keyframes m-btn-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.82); }
  70%  { transform: scale(1.14); }
  90%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.m-btn-pop { animation: m-btn-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── Mobile header slide down on first show ── */
@keyframes m-hdr-drop {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
#mobile-header.m-hdr-ready {
  animation: m-hdr-drop 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ── Bottom nav slide up on first show ── */
@keyframes m-nav-rise {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#mobile-nav.m-nav-ready {
  animation: m-nav-rise 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.08s both;
}

/* ── Card tap feedback — subtle highlight flash ── */
.news-card { transition: background 0.12s ease; }
.m-item    { transition: background 0.1s ease; }

/* ── Like button heart: special color pulse ── */
.m-act.liked, .act-btn.is-liked {
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease !important;
}

/* ── Tab indicator transition ── */
.m-tab { transition: color 0.15s ease, border-bottom-color 0.15s ease; }

/* ── Comment bar slide up when shown ── */
@keyframes m-bar-rise {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
#m-comment-bar:not([style*="none"]) {
  animation: m-bar-rise 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ── Reply banner reveal ── */
@keyframes m-banner-slide {
  from { opacity: 0; transform: translateY(-6px); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
  to   { opacity: 1; transform: translateY(0);    max-height: 60px; margin-bottom: 8px; }
}
#m-reply-banner[style*="flex"] {
  animation: m-banner-slide 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* ── Page header: subtle separator glow on scroll ── */
.m-page-hd {
  transition: box-shadow 0.2s ease;
}

/* ── Toast: smoother in/out ── */
@keyframes m-toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.toast {
  animation: m-toast-in 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both !important;
}

/* ── Dialog bottom sheet: already has m-sheet, just smooth the backdrop ── */
#backdrop { transition: opacity 0.2s ease; }

/* ── Notif unread → read fade ── */
.m-notif { transition: background 0.3s ease, border-left-color 0.3s ease; }

} /* end @media */
