:root {
  --paper: #0b0d12;
  --paper-2: #11141b;
  --card: #181c25;
  --ink: #ffffff;
  --cdts: #d9a441;
  --chop: #d9a441;
  --muted: #c8c8c8;
  --faint: #a3a3a3;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #d9a441;
  --accent-ink: #17110a;
  --good: #4ade80;
  --good-bg: #10281c;
  --bad: #ff8a90;
  --bad-bg: #3a1216;
  --warn: #f0b429;
  --warn-bg: #2a2108;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 28px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --tab-h: calc(64px + env(safe-area-inset-bottom, 0px));
  --rail-w: 260px;
  --ease: 160ms ease;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, .nav, .tab, .post-card, .chan, .day, .chip {
  transition: background var(--ease), color var(--ease), border-color var(--ease), box-shadow var(--ease);
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-lockup { display: flex; align-items: center; gap: 10px; }
.lockup-img { height: 38px; width: auto; display: block; }
svg.lockup-img, svg.unlock-lockup { overflow: visible; flex: 0 0 auto; max-width: 100%; }
.rail .lockup-img { height: 46px; }
.unlock-lockup { height: 64px; width: auto; display: block; margin: 0 auto 28px; }
.app-mark, .bears-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--paper);
}
.wordmark { font-size: 20px; font-weight: 720; letter-spacing: -0.04em; line-height: 1; }

.rail { display: none; }
.stage { min-height: 100%; min-width: 0; background: var(--paper); }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-actions { display: flex; gap: 8px; align-items: center; }
main { max-width: 1120px; margin: 0 auto; padding: 16px 16px calc(var(--tab-h) + 20px); }

h1 { font-size: 26px; font-weight: 730; letter-spacing: -0.035em; line-height: 1.15; margin: 0 0 14px; }
h2 { font-size: 15px; font-weight: 700; margin: 0; }
.lead { color: var(--muted); margin: 0 0 18px; }
.hint { color: var(--faint); font-size: 13px; }
.error { color: var(--bad); background: var(--bad-bg); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }

.install-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.install-line button { border: 0; background: transparent; color: var(--ink); font-weight: 650; min-height: 36px; }

/* Channel avatars */
.channel-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.channel-rail { display: none; }
.chan {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0;
  width: 44px;
  height: 44px;
}
.chan-av {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 720;
  font-size: 16px;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px transparent;
}
.chan-av.all { background: var(--card); font-size: 11px; letter-spacing: 0.02em; }
.chan.on .chan-av { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.chan.off { opacity: 0.72; }
.chan-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px var(--paper);
  display: grid;
  place-items: center;
  color: #0b0d12;
}
.chan-badge svg { width: 12px; height: 12px; }
.chan-plus {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  font-weight: 700;
}
.chan-add {
  width: auto;
  padding: 0 8px;
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
}

/* Composer */
.workspace { display: grid; gap: 20px; align-items: start; }
.composer-card, .preview-card, .acct-group, .post-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.composer-card { padding: 16px; }
.compose-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
  align-items: center;
}
.editor textarea {
  width: 100%;
  border: 0;
  background: transparent;
  min-height: 140px;
  resize: vertical;
  font-size: 18px;
  font-weight: 450;
  line-height: 1.45;
  padding: 4px 0 8px;
  border-radius: 0;
}
.editor textarea:focus { outline: none; }
.editor { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.meter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: flex-end;
  color: var(--faint);
  font-size: 12px;
  font-weight: 650;
  padding: 0 0 10px;
}
.meter-item.over, .meter.over { color: var(--bad); }

.add-media {
  width: auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 999px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}
.add-media-icon {
  width: 20px; height: 20px; border-radius: 99px;
  background: var(--paper-2); color: var(--ink);
  display: grid; place-items: center; font-size: 16px; line-height: 1;
}
.drop { margin: 0 0 14px; }
.drop.over .add-media { border-color: var(--accent); background: rgba(217, 164, 65, 0.16); }
.thumbs { display: flex; gap: 10px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.thumb { position: relative; flex: 0 0 88px; height: 88px; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb button[data-remove-file] {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border: 0; border-radius: 99px;
  background: rgba(31,35,40,0.75); color: white;
}
.thumb-move { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; }
.thumb-move button {
  width: 26px; height: 26px; border: 0; border-radius: 8px;
  background: rgba(255,255,255,0.94); color: var(--ink);
}

.prompt {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 0 0 14px;
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  font: inherit;
  color: inherit;
}
.prompt strong { font-size: 15px; }

.schedule-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin-bottom: 8px;
}
.schedule-panel input[type="date"], .schedule-panel input[type="time"] {
  width: auto;
  border: 1px solid var(--line-strong);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
}
.row, .pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip, .small, .ghost, .text-btn {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  border-radius: 999px;
  min-height: 36px;
  padding: 6px 12px;
  font-weight: 650;
}
.text-btn { border: 0; background: transparent; color: var(--muted); min-height: 40px; }
.hash-chip { font-size: 13px; }
.hash-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.compose-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.more { border: 0; padding: 0; margin: 0; }
.more summary { min-height: 40px; display: flex; align-items: center; font-weight: 650; color: var(--muted); cursor: pointer; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.share-split { display: flex; align-items: stretch; margin-left: auto; }
.share-split .primary {
  border-radius: 10px 0 0 10px;
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 720;
}
.share-menu { position: relative; }
.share-menu > summary {
  list-style: none;
  min-width: 44px;
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  border-left: 1px solid rgba(255,255,255,0.25);
  font-weight: 700;
}
.share-menu > summary::-webkit-details-marker { display: none; }
.share-menu-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 6;
  min-width: 200px;
  display: grid;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.share-menu-list button {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 650;
}
.share-menu-list button:hover { background: var(--paper); }

.primary, .secondary {
  border: 0;
  border-radius: 10px;
  min-height: 48px;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 720;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: 0.55; }
.secondary { background: var(--paper-2); color: var(--ink); border: 1px solid var(--line-strong); }

.preview-card { padding: 14px; }
.preview-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.preview-tabs button {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--paper-2);
  display: grid; place-items: center;
}
.preview-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.preview-tabs button.off { opacity: 0.35; }
.phone { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--paper-2); }
.phone-head, .phone-foot { padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 99px; color: #fff; display: grid; place-items: center; font-weight: 700; }
.phone-name { font-weight: 700; }
.phone-sub, .phone-foot { color: var(--faint); font-size: 13px; }
.phone-body { padding: 0 14px 14px; white-space: pre-wrap; }
.frame { margin: 0 0 8px; }
.frame img, .frame video { width: 100%; display: block; }
.yt-title { font-weight: 700; padding: 0 14px 8px; }

/* Queue */
.history-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.seg {
  display: flex; gap: 4px; overflow-x: auto;
  background: var(--paper-2);
  border-radius: 10px;
  padding: 3px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  border-radius: 8px; min-height: 36px; padding: 0 14px;
  font-weight: 650; white-space: nowrap;
}
.seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.cal-nav { display: flex; gap: 6px; margin: 0 0 10px; }
.cal-nav button {
  border: 0; background: var(--paper-2); color: var(--muted);
  border-radius: 999px; min-height: 36px; padding: 0 14px; font-weight: 650;
}
.cal-nav button.on { background: var(--accent); color: var(--accent-ink); }
.day {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; min-height: 64px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.day strong { font-size: 16px; }
.day em { font-style: normal; color: var(--faint); font-size: 11px; }
.day.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day.on em, .day.on .hint { color: rgba(255,255,255,0.7); }
.day-head {
  margin: 20px 0 10px;
  font-size: 13px;
  font-weight: 720;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.day-head:first-of-type { margin-top: 4px; }
.post-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  padding: 14px;
  margin: 0 0 10px;
}
.post-card img.mini, .mini-fallback {
  width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--paper-2);
}
.post-card p { margin: 4px 0 8px; }
.post-when { font-size: 12px; font-weight: 650; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: #c8c0b6; display: inline-block; }
.dot.published { background: var(--good); }
.dot.failed, .dot.needs_login, .dot.partial { background: var(--bad); }
.dot.publishing, .dot.queued, .dot.scheduled, .dot.awaiting { background: #d97706; }
.empty { text-align: center; padding: 56px 16px 40px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.empty strong { display: block; font-size: 17px; font-weight: 720; margin-bottom: 6px; }
.empty .hint { margin: 0 0 18px; }

/* Channels management */
.acct-group { margin: 0 0 14px; overflow: hidden; }
.acct-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.swatch { width: 10px; height: 10px; border-radius: 99px; display: inline-block; }
.acct-mark { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; background: var(--paper); }
.acct-head h2 { flex: 1; font-size: 15px; font-weight: 720; }
.tag-edit {
  border: 0; background: var(--paper-2); color: var(--muted);
  border-radius: 999px; min-height: 32px; min-width: 32px; padding: 0 10px; font-weight: 700;
}
.acct-tags { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.acct-tags input, textarea, input[type="text"], input[type="url"], input[type="password"] {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  min-height: 44px;
}
.acct-tags input { flex: 1; min-width: 0; }
.setting-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 6px 14px; border-top: 1px solid var(--line);
}
.setting-list .setting-row:first-child { border-top: 0; }
.setting-row .name { flex: 1; min-width: 0; font-weight: 650; }
.status-ok { color: var(--good); font-weight: 700; font-size: 13px; }
.connect-btn {
  min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink); font-weight: 650; font-size: 13px;
}
.row-more { position: relative; }
.row-more > summary {
  list-style: none; min-width: 36px; min-height: 36px;
  display: grid; place-items: center; border-radius: 99px; cursor: pointer;
  color: var(--muted); font-weight: 800; letter-spacing: 0.08em;
}
.row-more > summary::-webkit-details-marker { display: none; }
.row-more-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 3;
  min-width: 150px; display: grid; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.row-more-menu button {
  width: 100%; min-height: 44px; border: 0; background: transparent;
  text-align: left; padding: 0 12px; border-radius: 8px; font-weight: 650;
}
.icon { width: 22px; height: 22px; display: grid; place-items: center; }

.update-banner {
  position: fixed; z-index: 28; left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + 10px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 12px 14px;
  box-shadow: var(--shadow);
}
.update-banner button { background: #fff; color: #000; min-height: 40px; border: 0; border-radius: 10px; padding: 0 14px; font-weight: 700; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 12;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 50px rgba(20, 24, 28, 0.16);
  transform: translateY(110%);
  transition: transform 220ms ease;
}
.sheet.open { transform: translateY(0); }
.sheet-grab { width: 42px; height: 4px; border-radius: 99px; background: rgba(255,255,255,0.28); margin: 0 auto 10px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 8;
}
.tab {
  min-height: 56px; border: 0; background: transparent; border-radius: 12px;
  color: var(--faint); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 650;
}
.tab.on { color: var(--accent); background: rgba(217, 164, 65, 0.22); }
.tab-icon { width: 24px; height: 24px; display: grid; place-items: center; }
.tab-icon svg { display: block; }

.lightbox {
  position: fixed; inset: 0;
  background: rgba(22, 16, 12, 0.72);
  display: grid; place-items: center;
  z-index: 20; padding: 24px;
}
.lightbox img { max-width: min(960px, 100%); max-height: 80vh; border-radius: 16px; }
.lightbox-close { position: absolute; top: 16px; right: 16px; min-height: 48px; }


.chan-av-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: block; background: var(--paper); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px transparent; }
.chan.on .chan-av-img { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--accent); }
.chan-line .chan-av-img { width: 36px; height: 36px; }

/* Unlock */
.unlock {
  max-width: 360px;
  min-height: calc(100dvh - 48px);
  margin: 0 auto;
  padding: 24px 8px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.unlock .bears-mark, .unlock .app-mark {
  width: 88px; height: 88px; border-radius: 20px;
  margin: 0 auto 28px; display: block; box-shadow: var(--shadow);
}
.unlock form { width: 100%; display: grid; gap: 12px; text-align: left; }
.unlock .primary { width: 100%; }

body.locked { display: block !important; }
body.locked .tabs,
body.locked .rail,
body.locked .top,
body.locked .channel-row,
body.locked .install-line { display: none !important; }
body.locked main { padding: 0 20px 40px; max-width: 400px; margin: 0 auto; }
body.signin-open, body.signin-open .stage { overflow: hidden; overscroll-behavior: none; }

@media (max-width: 959px) {
  .editor textarea { min-height: 120px; font-size: 17px; }
}

@media (min-width: 960px) {
  body { display: grid; grid-template-columns: var(--rail-w) 1fr; }
  .rail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 0 16px;
    border-right: 1px solid var(--line);
    min-height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    background: var(--paper);
    overflow: hidden;
  }
  .rail .brand-lockup { padding: 0 16px 16px; }
  .rail-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px 10px; }
  .rail .nav {
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    padding: 0 12px;
    color: var(--muted);
    font-weight: 650;
    display: flex;
    width: 100%;
    text-align: left;
  }
  .rail .nav.on { background: var(--accent); color: var(--accent-ink); }
  .channel-rail {
    display: block;
    flex: 1;
    overflow: auto;
    padding: 4px 10px 20px;
    border-top: 1px solid var(--line);
  }
  .chan-all {
    width: 100%;
    min-height: 36px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    text-align: left;
    padding: 0 10px;
    font-weight: 650;
    color: var(--muted);
    margin: 8px 0 6px;
  }
  .chan-all.on { background: rgba(217, 164, 65, 0.22); color: #fff; }
  .chan-group { margin: 10px 0 14px; }
  .chan-group-label {
    font-size: 11px;
    font-weight: 720;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--faint);
    padding: 0 10px 6px;
  }
  .chan-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 10px;
  }
  .chan-line .chan { width: 36px; height: 36px; }
  .chan-line .chan-av { width: 36px; height: 36px; font-size: 14px; }
  .chan-meta { min-width: 0; flex: 1; text-align: left; }
  .chan-meta strong { display: block; font-size: 13px; font-weight: 650; }
  .chan-line.on, .chan-line:has(.chan.on) { background: rgba(217, 164, 65, 0.18); }
  .tabs, .mobile-mark, .channel-row, .sheet, .sheet-btn { display: none !important; }
  .workspace { grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.9fr); }
  main { padding: 24px 28px 48px; max-width: 1280px; }
  .top { display: none; }
  .stage { min-width: 0; }
  .update-banner { left: calc(var(--rail-w) + 16px); right: 16px; bottom: 16px; }
  .install-line { padding-left: 28px; padding-right: 28px; }
  h1 { font-size: 28px; }
  .composer-card { padding: 20px; }
  .preview-card { position: sticky; top: 16px; }
  .editor textarea { min-height: 180px; font-size: 18px; }
}
@media (display-mode: standalone) {
  .top { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
}
/* Sign-in: full-screen, opaque, safe-area aware */
.signin {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.signin-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px 8px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.signin.at-top .signin-bar { padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.signin-bar strong {
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.03em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signin-bar #signin-cancel {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 64px;
  border: 0;
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 999px;
  font-weight: 650;
  padding: 0 16px;
}
.signin-shot-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
}
.signin img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 430 / 780;
  object-fit: fill;
  margin: 0;
  background: #fff;
  cursor: crosshair;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.signin-keys {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  width: auto; height: 16px; font-size: 16px; opacity: 0;
  color: var(--ink); background: transparent; border: 0; padding: 0; margin: 0;
  pointer-events: none; caret-color: transparent; z-index: 2;
}
.signin-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.signin-hint {
  margin: 0;
  padding: 10px 16px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}
.signin-error {
  margin: 8px 16px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bad);
  color: #fff;
  font-size: 15px;
  line-height: 1.35;
}
.signin-drawer-toggle {
  margin: 8px 16px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  min-height: 44px;
  text-align: left;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.signin-fields { display: grid; gap: 10px; padding: 8px 16px 0; }
.signin-field { display: grid; gap: 4px; }
.signin-field > span { font-size: 13px; font-weight: 650; color: var(--muted); }
.signin-field-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
.signin input, .signin textarea {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.3;
  min-height: 48px;
  -webkit-text-fill-color: var(--ink);
}
.signin input::placeholder { color: var(--muted); }
.signin button {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 16px;
  min-height: 48px;
  font-weight: 650;
}
.signin button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#signin-drawer-toggle {
  margin: 0 16px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 15px;
  min-height: 36px;
  text-align: left;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 0;
  box-shadow: none;
}
.signin-hint { padding-bottom: 2px; }
.signin-dock {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.signin:not(.at-top) .signin-dock { padding-bottom: 10px; }
.signin-dock #signin-save { flex: 1; min-height: 52px; font-size: 17px; font-weight: 720; }
.signin-overflow { position: relative; flex: 0 0 auto; }
.signin-overflow summary {
  list-style: none;
  min-height: 48px;
  min-width: 64px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--paper-2);
  font-weight: 650;
  cursor: pointer;
  padding: 0 12px;
}
.signin-overflow summary::-webkit-details-marker { display: none; }
.signin-overflow-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
  min-width: 140px;
  z-index: 2;
}
.signin-overflow-menu button { width: 100%; min-height: 44px; border: 0; background: transparent; text-align: left; }

@media (min-width: 900px) {
  .signin {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .signin-bar { grid-column: 1 / -1; width: 100%; padding-top: 10px; }
  .signin.at-top .signin-bar { padding-top: 10px; }
  .signin-shot-wrap {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-2);
  }
  .signin img {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
  }
  .signin-side {
    grid-column: 2;
    grid-row: 2;
    width: auto;
    max-width: none;
    border-top: 0;
    border-left: 1px solid var(--line);
    overflow: auto;
    padding-top: 8px;
  }
  .signin-drawer-toggle { display: none !important; }
  .signin-fields, #signin-fields[hidden] { display: grid !important; }
  .signin-dock { margin-top: auto; padding-bottom: 16px; }
}

.acct-group.acct-sub { margin-top: -6px; margin-left: 14px; }
.acct-group.acct-sub .acct-head h2 { font-size: 14px; }
.chan-group.chan-sub { margin-left: 10px; padding-left: 8px; border-left: 2px solid var(--cdts); }

/* Three Bears Company Social */
.chan-badge { color: #0b0d12; }
.brand-lockup { padding: 4px 0; }
.unlock-lockup { max-width: 92vw; }
