:root, html[data-theme="dark"] {
  --bg: #0e1014;
  --card: #171a20;
  --line: #262b34;
  --text: #f2f4f7;
  --muted: #8b93a1;
  --accent: #3dd68c;
  --accent-soft: #123226;
  --sheet: #171a20;
  --heart: #ff5d73;
  --input: #12151b;
  --avatar: #1e2a24;
  --elev: none;
}
html[data-theme="light"] {
  --bg: #f6f4ef;
  --card: #ffffff;
  --line: #ece7dc;
  --text: #161616;
  --muted: #6d6d66;
  --accent: #0f7a4d;
  --accent-soft: #e7f6ee;
  --sheet: #ffffff;
  --heart: #d32f2f;
  --input: #f4f2ec;
  --avatar: #eaf3ec;
  --elev: none;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
}
body {
  --nav-h: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(var(--nav-h) + 10px);
  overscroll-behavior-y: contain;
}
.head-wrap {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  box-shadow: none;
  overflow: visible;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px 12px;
  height: 60px;
  min-height: 60px;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.logo { font-weight: 700; letter-spacing: .02em; }
.stats { display: flex; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); font-weight: 700; }
.stat-link { cursor: pointer; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand { cursor: pointer;
  text-align: center;
  font-family: Caveat, cursive;
  font-weight: 700;
  font-size: 38px;
  letter-spacing: .02em;
  line-height: 1;
  padding: 12px 16px 8px;
  color: var(--accent);
  text-transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
}
.auth-box .brand-mark { width: 42px; height: 42px; }
.auth-box .logo, .brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: none;
}
.body-clamp {
  max-height: 7.3em;
  overflow: hidden;
  position: relative;
}
.body-clamp:not(.is-open)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.6em;
  background: linear-gradient(transparent, var(--card, #fff));
}
.more-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
  padding: 0;
  margin: -4px 0 8px;
  cursor: pointer;
}
@media (display-mode: standalone) {
  .brand {
    padding-top: calc(env(safe-area-inset-top, 54px) + 10px);
  }
}
.tabs {
  display: flex; gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 8px 10px 12px;
  height: 60px;
  min-height: 60px;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .ghost, button.primary, .chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.tabs button.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.ghost { background: transparent; }
button.primary { background: var(--accent); color: var(--bg); font-weight: 700; border: 0; }
.feed, .page { padding: 10px 12px 0; }
.feed, .profile-posts, .profile-likes { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: none; }
.views { color: var(--muted); font-size: 13px; margin-left: auto; padding: 6px 2px; }
.note-link { color: var(--accent); cursor: pointer; font-weight: 700; }
.bottom button[data-screen="notify"] { position: relative; }
.nav-dot {
  position: absolute; top: 4px; right: 18%;
  width: 8px; height: 8px; border-radius: 50%; background: #e53935;
}
.pull-bar {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -160%);
  z-index: 40; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; box-shadow: var(--elev);
  transition: transform .2s ease; pointer-events: none;
}
.pull-bar.show { transform: translate(-50%, -50%); }
.row { display: flex; gap: 10px; align-items: flex-start; }
.name-row { display: flex; align-items: center; gap: 6px; }
.icon-pen {
  border: 0; background: transparent; color: var(--accent); padding: 0 0 0 6px; font-size: 20px; line-height: 1;
}
.status-line { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; }
.status-text { margin: 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; word-break: break-word; color: var(--muted); flex: 1; }
.avatar { width: 38px; height: 38px; min-width: 38px; min-height: 38px; border-radius: 50%; background: var(--avatar); display: grid; place-items: center; font-size: 18px; line-height: 1; flex: 0 0 auto; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.lg { width: 64px; height: 64px; min-width: 64px; min-height: 64px; font-size: 28px; }
.meta { color: var(--muted); font-size: 12px; }
.name { font-weight: 600; }
.body, .comment-text { margin: 8px 0 10px; line-height: 1.45; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.workchip { display: flex; gap: 8px; align-items: center; background: var(--input); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.actions button {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 999px;
}
.actions button.heart { color: var(--heart); }
.score { color: var(--accent); font-weight: 700; }
.profile-posts, .profile-likes { display: flex; flex-direction: column; gap: 12px; }
.profile-tabs { display: flex; gap: 8px; margin: 16px 0 12px; }
.comment { padding: 8px 0; }
.comment .replies { margin-left: 22px; margin-top: 6px; }
.theme-label { margin-bottom: 10px; }
.theme-pick { display: flex; gap: 8px; margin-top: 10px; margin-bottom: 18px; }
.theme-pick button { flex: 0 0 auto; width: auto; }
.bottom {
  position: fixed; left: 50%; bottom: 0; z-index: 9;
  width: min(710px, 100%);
  transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 6px; align-items: center;
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: none;
}
.bottom button[data-screen] {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  width: 100%;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
}
.bottom button[data-screen] svg {
  width: 20px;
  height: 20px;
  display: block;
}
.bottom button[data-screen].on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.bottom .plus, .bottom .to-top-nav {
  width: 100%; height: 36px; border-radius: 999px;
  border: 0; background: var(--accent); color: #062016;
  font-size: 20px; line-height: 1; font-weight: 500;
}
.screen { min-height: 100vh; }
.hidden { display: none !important; }
.pad { padding: 8px 12px 24px; }
.review { color: var(--muted); font-size: 13px; margin: 6px 0 10px; overflow-wrap: anywhere; }
input, textarea, select {
  width: 100%; background: var(--input); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; margin: 8px 0; min-height: 46px; box-sizing: border-box; outline: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: none;
  border-color: var(--line);
}
select { height: 46px; }
textarea { resize: none; }
.shelf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.shelf-toggle { color: var(--muted); width: 14px; display: inline-block; }
.shelf.collapsed .shelf-items,
.shelf.collapsed .actions { display: none; }
.shelf:not(.collapsed) .shelf-toggle { transform: rotate(90deg); }
.icon-btns { display: inline-flex; gap: 6px; }
.center-action { margin-top: 16px; display: flex; justify-content: center; }
.icon-btn { min-width: 36px; padding: 4px 8px; }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.comment-head { justify-content: flex-start; }
.comment-head h3 { margin-right: 8px; }
.comment-sort {
  border: 0; margin: 0 0 8px 0; padding: 4px 0 10px;
  min-height: 48px; height: auto; overflow: visible;
  box-shadow: none; justify-content: flex-start; touch-action: auto;
}
.post-tools { margin-left: auto; display: inline-flex; gap: 4px; }
.post-tools .icon-btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 8px; color: var(--muted); }
.ping-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; vertical-align: middle;
  animation: ping 1s ease 0s 4;
}
@keyframes ping {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .25; transform: scale(1.4); }
}
.sheet-title h3 { margin: 0; }
#profileTabs { border: 0; box-shadow: none; min-height: 52px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.item { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.shelf-items { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 12px; }
body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; overscroll-behavior: contain; }
.sheet {
  width: min(710px, 100%);
  background: var(--sheet);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  max-height: 88vh;
  overflow: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
#commentList {
  flex: 1;
  overflow: auto;
  min-height: 120px;
  scrollbar-width: none;
}
.comment-compose {
  position: sticky;
  bottom: 0;
  background: var(--sheet);
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
#replyHint {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  margin: 0 0 10px;
}
#replyHint:empty { display: none; margin: 0; }
.reply-x {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}
.reply-x .ico { width: 14px; height: 14px; }
.comment-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-row textarea {
  flex: 1;
  min-width: 0;
  margin: 0;
  min-height: 42px;
  max-height: 140px;
  resize: none;
  line-height: 1.35;
}
.send-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}
.send-btn .ico { width: 20px; height: 20px; }
.sheet::-webkit-scrollbar { display: none; }
#commentList { scrollbar-width: none; }
#commentList::-webkit-scrollbar { display: none; }
.shelf { margin-bottom: 16px; }
.shelf h3 { margin: 0 0 8px; font-size: 15px; }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }
.spoiler { filter: blur(6px); cursor: pointer; }
.spoiler.open { filter: none; }
.liked-comment { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.people-list { display: flex; flex-direction: column; gap: 10px; }
.people-list .item { margin: 0; }
.refresh-hint {
  text-align: center; color: var(--muted); font-size: 12px; height: 0; overflow: hidden;
}
.refresh-hint.on { height: 28px; padding-top: 8px; }
.deleted-comment { font-style: italic; font-size: 15px; line-height: 1.45; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.check-row input { width: auto; margin: 0; min-height: auto; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.emoji-btn { font-size: 20px; width: 42px; height: 42px; min-width: 42px; min-height: 42px; padding: 0; display: grid; place-items: center; line-height: 1; }
.site { max-width: 710px; margin: 0 auto; min-height: 100vh; }
.auth-box {
  padding: 28px 22px 22px;
  max-width: 420px;
  width: calc(100% - 32px);
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.search-bar {
  padding: 8px 10px 12px;
  height: 60px;
  min-height: 60px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}
.search-bar input { margin: 0; min-height: 40px; height: 40px; }
#searchResults { display: flex; flex-direction: column; gap: 10px; }
.auth-box .logo, .brand-logo {
  font-family: Caveat, cursive;
  font-size: 40px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}
.auth-tabs { padding-left: 0; padding-right: 0; border: 0; }
#authError { color: #ff6b6b; min-height: 18px; margin-top: 12px; }
#authOk { color: var(--accent); min-height: 18px; text-align: center; margin-top: 10px; }
.pass-wrap { position: relative; margin: 8px 0; }
.pass-wrap input { padding-right: 44px; margin: 0; }
.pass-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; background: transparent; padding: 0;
  color: var(--muted);
}
.pass-eye .ico { color: var(--muted); width: 18px; height: 18px; }
.profile-tools .icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
}
.settings-actions { flex-direction: row; align-items: stretch; }
.settings-actions .btn-accent,
.settings-actions .btn-wide {
  flex: 1;
  width: auto;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.settings-actions .btn-wide {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.auth-actions { display: flex; gap: 8px; align-items: stretch; margin-top: 16px; }
.auth-actions .primary { flex: 1; }
.auth-actions .ghost { flex: 0 0 auto; }
#authScreen.overlay {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(8,10,14,.72);
  overflow: auto;
  display: flex; align-items: center; justify-content: center;
}
.to-top {
  position: fixed;
  right: max(12px, calc(50% - 355px + 12px));
  bottom: 86px;
  z-index: 10;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--accent);
  font-size: 18px;
}
.notfound { text-align: center; padding: 80px 20px; }
.nf-code { font-size: 72px; font-weight: 800; color: var(--accent); line-height: 1; margin: 12px 0; }
.notfound h1 { margin: 0 0 8px; font-size: 22px; }
.nf-btn { display: inline-block; margin-top: 18px; text-decoration: none; padding: 10px 18px; border-radius: 999px; }
.sheet-actions { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
#searchScreen .page { padding: 0; }
.btn-accent {
  flex: 0 0 auto; width: auto; border: 0; background: var(--accent); color: #062016;
  font-weight: 700; font-size: 14px; border-radius: 12px; padding: 10px 14px; min-height: 40px;
}
.btn-side {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 10px 14px; min-height: 40px; font-size: 14px;
}
.btn-danger {
  border: 0; background: #d24a4a; color: #fff;
  font-weight: 700; font-size: 14px; border-radius: 12px; padding: 10px 14px; min-height: 40px;
}
.settings-actions { justify-content: space-between; margin-bottom: 36px; padding-bottom: 8px; flex-direction: row; align-items: stretch; }
.note.unread { border-color: var(--accent); }
#notifyList { display: flex; flex-direction: column; gap: 10px; }
#notifyScreen .page { padding: 10px 12px 0; }
#notifyTabs button { position: relative; }
.focus-comment { animation: blinkFocus 1.2s ease 0s 3; border-radius: 8px; }
@keyframes blinkFocus {
  0%, 100% { background: transparent; }
  50% { background: var(--accent-soft); }
}
.profile-tools { display: inline-flex; gap: 6px; margin-left: 8px; }
#notifyScreen .page { padding: 10px 12px 0; }
#notifyList { padding: 0; width: 100%; gap: 10px; }
.ico { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
#notifyList.feed { width: 100%; }
.sheet > .btn-accent { width: auto; margin-top: 8px; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#profileTabBox {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.auth-box .logo { font-family: Caveat, cursive; }
