/* Nook — calm colorful UI: neutral surfaces, one accent per section,
   every button turns a light tint of its own color while pressed. */
:root {
  --coral: #FF5A5F;
  --teal: #0E8F82;   --teal-nav: #2DD4BF;
  --orange: #EA580C;
  --purple: #7C3AED; --purple-nav: #A78BFA;
  --blue: #2563EB;   --blue-nav: #60A5FA;
  --nav-bg: #0F0F13;
  --nav-idle: #9A9AA2;
  --ink: #17181C;
  --muted: #5E6470;
  --line: #E6E8EC;
  --surface: #FAFAFA;
  --card: #FFFFFF;
  --nav-h: 64px;
  /* Padauk loads from Google Fonts; the others are Myanmar fonts already on phones/PCs */
  --font: 'Sora', 'Padauk', 'Noto Sans Myanmar', 'Myanmar Text', 'Pyidaungsu', system-ui, sans-serif;
}

* { box-sizing: border-box; }
/* The page itself never scrolls or bounces — only the inside of each screen does.
   (Stops the whole app, including the bottom menu, sliding up and down on phones.) */
html, body { margin: 0; height: 100%; background: #0B0B0E; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; width: 100%; }
body {
  font-family: var(--font); color: var(--ink); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
:lang(my) body, body:lang(my) { line-height: 1.75; }
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, video { display: block; }
.hidden { display: none !important; }

/* ---- app frame (phone-width column, centered on desktop) ---- */
#app {
  position: relative; height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden; background: var(--surface);
}
#view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; overscroll-behavior: contain; }
#view.dark { background: #0B0B0E; color: #fff; overflow: hidden; }

/* ---- pressed state: light tint of the button's own color ---- */
.btn, .nav-btn, .chip, .tile, .icon-btn {
  transition: background-color .12s ease, transform .12s ease, color .12s ease;
}
.btn:active, .chip:active {
  background-color: color-mix(in srgb, var(--c, #888) 32%, white) !important;
  color: #17171C !important; transform: scale(.96);
}
.icon-btn:active { background-color: color-mix(in srgb, var(--c, #888) 40%, white) !important; color: #17171C !important; transform: scale(.92); }
.nav-btn:active { background-color: color-mix(in srgb, var(--c) 26%, transparent); transform: scale(.94); }
.tile:active { transform: scale(.97); filter: brightness(1.08); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn {
  --c: var(--blue); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; font-weight: 700; font-size: 15px;
  background: var(--c); color: #fff;
}
.btn.soft { background: color-mix(in srgb, var(--c) 10%, white); color: var(--c); }
.btn.ghost { background: #F1F2F4; color: #3A3F47; --c: #6B7280; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---- bottom navigation ---- */
#nav {
  height: var(--nav-h); flex-shrink: 0; background: var(--nav-bg);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; padding: 0 6px;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0;
  border-radius: 14px; color: var(--nav-idle); font-size: 11.5px;
}
.nav-btn.active { color: var(--active); font-weight: 700; }
.nav-plus {
  --c: #F97316; justify-self: center; width: 54px; height: 38px; border-radius: 12px;
  background: #F97316; color: #fff; display: flex; align-items: center; justify-content: center;
}
.nav-plus:active { background: color-mix(in srgb, #F97316 35%, white); color: #431407; transform: scale(.94); }
.nav-plus.active { background: #FDBA74; color: #431407; }

/* ---- feed ---- */
.feed { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.feed::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; background: #15151B; overflow: hidden; }
.slide video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center;
  justify-content: space-between; padding: 12px 12px 0; pointer-events: none;
}
.feed-top > * { pointer-events: auto; }
.logo { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 22px; color: var(--coral); letter-spacing: -.5px; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.feed-tabs { display: flex; gap: 16px; }
.feed-tab { color: rgba(255,255,255,.72); font-size: 15px; padding: 8px 2px; border-bottom: 3px solid transparent; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.feed-tab.active { color: #fff; font-weight: 700; border-color: var(--coral); }
.round-dark {
  --c: #ffffff; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.actions { position: absolute; right: 10px; bottom: 22px; display: flex; flex-direction: column; gap: 14px; align-items: center; z-index: 3; }
.act { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.act .icon-btn { width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: flex; align-items: center; justify-content: center; }
.act .icon-btn.on { background: var(--c); }
.act .icon-btn.on svg path { fill: currentColor; }
.meta { position: absolute; left: 14px; right: 80px; bottom: 22px; z-index: 3; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.65); }
.meta .who { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.meta .who a { font-weight: 700; text-decoration: none; font-size: 16px; }
.meta .caption { font-size: 15px; line-height: 1.5; overflow: hidden; word-break: break-word; }
:lang(my) .meta .caption { line-height: 1.7; }
.meta .caption .tag { font-weight: 700; color: #fff; text-decoration: none; }
.follow-pill { --c: var(--coral); background: var(--coral); color: #fff; font-size: 13px; font-weight: 700; padding: 2px 14px; min-height: 30px; border-radius: 999px; text-shadow: none; }
.shade { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; background: linear-gradient(transparent, rgba(0,0,0,.55)); pointer-events: none; z-index: 2; }
.paused-icon, .unmute-hint { position: absolute; z-index: 4; pointer-events: none; }
.paused-icon { inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); }
.unmute-hint { top: 70px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: 13px; padding: 4px 12px; border-radius: 999px; pointer-events: auto; }
.ad-badge { background: #F5C542; color: #2A2208; font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 6px; text-shadow: none; }
.ad-cta { --c: var(--coral); margin-top: 10px; width: 100%; }
.feed-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; color: #B4B4BE; text-align: center; }

/* ---- light pages ---- */
.page { min-height: 100%; background: var(--surface); padding-bottom: 24px; }
.page-head {
  position: sticky; top: 0; z-index: 4; background: #fff; border-bottom: 1px solid var(--line);
  padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.page-head h1 { margin: 0; font-size: 22px; color: var(--accent); }
.page-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.search {
  display: flex; align-items: center; gap: 10px; background: #F1F4F4; border-radius: 14px; padding: 0 14px;
  height: 48px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { --c: var(--accent); min-height: 40px; padding: 0 16px; border-radius: 999px; background: #fff; border: 1.5px solid #E1E5E8; font-size: 14px; color: #2A2F33; }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; font-weight: 700; }
.section-title { font-size: 16px; font-weight: 700; margin: 4px 0 -6px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 9 / 14; border-radius: 10px; overflow: hidden; background: #DDE3EA; color: #fff; text-decoration: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-info { position: absolute; left: 6px; bottom: 4px; font-size: 12px; display: flex; align-items: center; gap: 3px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.tile .tile-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; background: rgba(15,15,19,.55); padding: 6px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; text-decoration: none; }
.avatar {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; background: var(--av, #6B7280); font-size: 17px; text-transform: uppercase;
}
.avatar.big { width: 88px; height: 88px; font-size: 34px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.user-row .name { font-weight: 700; }
.user-row .handle, .muted { color: var(--muted); font-size: 13px; }

/* upload */
.dropzone {
  border: 2px dashed #F59E0B; background: #FFFBEB; border-radius: 18px; padding: 22px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.dropzone .circle { width: 60px; height: 60px; border-radius: 50%; background: #FDE68A; color: #92400E; display: flex; align-items: center; justify-content: center; }
.preview { width: 100%; max-height: 360px; border-radius: 14px; background: #000; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field input, .field textarea, .field select {
  font-weight: 400; font-size: 15px; border: 1.5px solid #E1E5E8; border-radius: 12px; padding: 11px 12px;
  background: #fff; outline: none; width: 100%;
}
.field textarea { resize: none; height: 92px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.progress { height: 8px; border-radius: 999px; background: #F1E7DC; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--orange); transition: width .2s; }

/* inbox */
.notif { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.notif .text { flex: 1; min-width: 0; font-size: 14px; }
.notif .thumb { width: 44px; height: 58px; border-radius: 8px; object-fit: cover; background: #DDE3EA; }

/* profile */
.profile-top { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.profile-top .bar { width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.profile-top .name { font-size: 20px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; margin-top: 6px; }
.stats b { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
.bio { font-size: 14px; color: #3A3F47; max-width: 320px; white-space: pre-line; }
.row-btns { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.row-btns .btn { flex: 1; }
.subtabs { display: flex; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); background: #fff; }
.subtab { padding: 10px 2px; color: var(--muted); font-size: 15px; border-bottom: 3px solid transparent; }
.subtab.active { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.icon-light { --c: #64748B; width: 44px; height: 44px; border-radius: 50%; background: #F1F5F9; color: #334155; display: flex; align-items: center; justify-content: center; }
.icon-light:active { background: color-mix(in srgb, var(--c) 30%, white); transform: scale(.94); }

/* ---- bottom sheet ---- */
#sheet-backdrop {
  position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity .18s;
}
#sheet-backdrop.open { opacity: 1; pointer-events: auto; }
#sheet {
  width: 100%; max-height: 82%; background: #fff; color: var(--ink); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; transform: translateY(30px); transition: transform .18s;
  padding-bottom: env(safe-area-inset-bottom);
}
#sheet-backdrop.open #sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 17px; }
.sheet-body { padding: 4px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment .avatar { width: 34px; height: 34px; font-size: 14px; }
.comment .c-body { flex: 1; min-width: 0; font-size: 14px; word-break: break-word; }
.comment .c-del { color: var(--muted); font-size: 12px; padding: 4px 6px; min-height: 32px; }
.comment-form { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }
.comment-form input { flex: 1; min-width: 0; border: 1.5px solid #E1E5E8; border-radius: 999px; padding: 0 14px; height: 44px; outline: none; }
.menu-item { --c: #6B7280; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 12px; border-radius: 12px; text-align: left; width: 100%; font-size: 15px; background: #F6F7F8; }
.menu-item.danger { --c: #DC2626; color: #B91C1C; }
.menu-item:active { background: color-mix(in srgb, var(--c) 18%, white); transform: scale(.98); }
.form-error { color: #B91C1C; font-size: 13px; min-height: 1em; }
.link-btn { color: var(--blue); font-size: 14px; padding: 8px; min-height: 40px; }

/* ---- toast ---- */
#toast {
  position: absolute; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%) translateY(20px);
  background: #17181C; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---- profile photos + story rings ---- */
img.avatar { object-fit: cover; background: #DDE3EA; padding: 0; }
.ring { display: inline-flex; padding: 2px; border-radius: 50%; border: 2.5px solid var(--coral); flex-shrink: 0; }
.ring.seen { border-color: #C9CDD3; }
.ring .avatar { border: 0; box-shadow: none; }
.meta .who .avatar { width: 34px; height: 34px; font-size: 14px; border: 1.5px solid #fff; }
.avatar-edit { display: flex; align-items: center; gap: 14px; }
.avatar-edit .avatar { width: 72px; height: 72px; font-size: 28px; }
.avatar-edit .btns { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-edit .btn { min-height: 40px; font-size: 14px; }
button.avatar-btn { padding: 0; border-radius: 50%; }

/* ---- story strip ---- */
.stories { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story-item { --c: var(--coral); flex-shrink: 0; width: 70px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--ink); border-radius: 12px; padding: 2px 0; }
.story-item:active { background: color-mix(in srgb, var(--coral) 12%, white); transform: scale(.95); }
.story-item .avatar { width: 56px; height: 56px; font-size: 22px; }
.story-item .name { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add { width: 64px; height: 64px; border-radius: 50%; border: 2px dashed var(--coral); color: var(--coral); display: flex; align-items: center; justify-content: center; background: #FFF5F5; }

/* ---- story viewer ---- */
.story-viewer { position: absolute; inset: 0; z-index: 40; background: #000; color: #fff; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; }
.sv-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.sv-media img, .sv-media video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.sv-top { position: relative; z-index: 2; padding: 10px 10px 0; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.sv-bars { display: flex; gap: 4px; }
.sv-bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.sv-bars i { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.sv-head .avatar { width: 36px; height: 36px; font-size: 15px; }
.sv-head .who { flex: 1; min-width: 0; font-size: 14px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.sv-head .who a { font-weight: 700; text-decoration: none; }
.sv-icon { --c: #ffffff; width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.3); color: #fff; display: flex; align-items: center; justify-content: center; }
.sv-icon:active { background: rgba(255,255,255,.35); }
.sv-tap { position: absolute; top: 90px; bottom: 70px; z-index: 1; }
.sv-tap.left { left: 0; width: 35%; }
.sv-tap.right { right: 0; width: 65%; }
.sv-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 16px 22px; display: flex; justify-content: center; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.sv-views { --c: #ffffff; color: #fff; background: rgba(255,255,255,.16); border-radius: 999px; padding: 0 16px; min-height: 40px; display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---- upload mode switch ---- */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #F1F2F4; padding: 4px; border-radius: 14px; }
.mode-switch button { min-height: 42px; border-radius: 10px; font-weight: 700; color: #5E6470; }
.mode-switch button.on { background: #fff; color: var(--orange); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.mode-switch button:active { transform: scale(.97); }
.preview-img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 14px; background: #000; }

/* ---- TikTok-style feed details ---- */
.meta { right: 84px; }
.meta .who a { font-size: 17px; }
.cap-more { color: #fff; font-weight: 700; padding: 0; min-height: 0; font-size: inherit; text-shadow: inherit; }
.meta .caption.open { max-height: 42vh; overflow-y: auto; white-space: pre-line; overscroll-behavior: contain; }
.slide .shade { transition: height .2s, background .2s; }
.slide.cap-open .shade { height: 75%; background: linear-gradient(transparent, rgba(0,0,0,.8)); }
.act-avatar { position: relative; margin-bottom: 8px; }
.act-avatar .avatar { width: 50px; height: 50px; font-size: 20px; border: 2px solid #fff; }
.follow-plus { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%;
  background: var(--coral); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .2s, background .2s; }
.follow-plus:active { transform: translateX(-50%) scale(.85); }
.follow-plus.done { background: #fff; color: var(--coral); transform: translateX(-50%) scale(0); transition: transform .5s .1s, background .1s; }

/* ---- story "+" on own profile photo ---- */
.avatar-wrap { position: relative; display: inline-flex; }
.story-plus { position: absolute; right: -2px; bottom: 2px; width: 30px; height: 30px; border-radius: 50%; background: #20C3D0;
  color: #fff; border: 3px solid var(--card); display: flex; align-items: center; justify-content: center; text-decoration: none; }
.story-plus:active { transform: scale(.88); background: color-mix(in srgb, #20C3D0 45%, white); }

/* ---- TikTok-style comments ---- */
.sheet-head.center { position: relative; justify-content: center; }
.sheet-head.center h2 { font-size: 15px; }
.sheet-head.center .icon-light { position: absolute; right: 12px; top: 8px; background: transparent; }
#sheet .sheet-body.c-list, .c-list { gap: 18px; min-height: 40vh; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment > a .avatar { width: 40px; height: 40px; font-size: 16px; }
.comment.reply > a .avatar { width: 28px; height: 28px; font-size: 12px; }
.comment .c-body { flex: 1; min-width: 0; font-size: 15px; word-break: break-word; }
.c-name { font-size: 13px; color: var(--muted); }
.c-creator { color: var(--coral); font-weight: 700; font-size: 12px; }
.c-text { margin: 2px 0; }
.c-text .tag { color: var(--blue); text-decoration: none; font-weight: 600; }
.c-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.c-link { color: var(--muted); font-weight: 700; padding: 6px 0; font-size: 13px; }
.c-link:active { color: var(--ink); }
.c-replies { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.c-replies:empty { display: none; }
.c-view { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; padding: 8px 0 0; }
.c-view::before { content: ''; width: 24px; height: 1px; background: var(--line); }
.c-like { --c: #E5484D; display: flex; flex-direction: column; align-items: center; min-width: 36px; color: var(--muted); font-size: 12px; padding: 4px 0; }
.c-like.on { color: #E5484D; }
.c-like.on svg path { fill: currentColor; }
.c-like:active { transform: scale(.85); }
.replying { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px; background: var(--soft); font-size: 13px; color: var(--muted); }
.comment-form { align-items: center; }
.comment-form .avatar { width: 34px; height: 34px; font-size: 14px; }
.comment-form input { background: var(--soft); border-color: transparent; color: var(--ink); }
.send-btn { width: 44px; height: 44px; border-radius: 50%; color: var(--coral); display: flex; align-items: center; justify-content: center; }
.send-btn:active { background: color-mix(in srgb, var(--coral) 15%, transparent); }

/* ---- theme picker / segmented control ---- */
.menu-item.on { outline: 2px solid var(--blue); }
.menu-item .check { margin-left: auto; color: var(--blue); font-weight: 700; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; background: var(--soft); padding: 4px; border-radius: 14px; font-weight: 600; }
.seg button { min-height: 44px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--blue); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg button:active { transform: scale(.96); }

/* ---- shared surface tokens (light) ---- */
:root { --soft: #F1F2F4; --border: #E1E5E8; --tile-bg: #DDE3EA; }

/* ================= DARK MODE ================= */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #EEEEF2; --muted: #9A9DA8; --line: #26262E; --surface: #0B0B0E; --card: #15151B;
  --soft: #1F1F27; --border: #2C2C35; --tile-bg: #23232B;
}
html[data-theme="dark"] .btn.soft { background: color-mix(in srgb, var(--c) 22%, #15151B); color: color-mix(in srgb, var(--c) 55%, white); }
html[data-theme="dark"] .btn.ghost { background: var(--soft); color: #D4D6DD; }
html[data-theme="dark"] .page-head,
html[data-theme="dark"] .profile-top,
html[data-theme="dark"] .subtabs,
html[data-theme="dark"] #sheet { background: var(--card); }
html[data-theme="dark"] .page-head h1,
html[data-theme="dark"] .subtab.active { color: color-mix(in srgb, var(--accent) 55%, white); border-color: color-mix(in srgb, var(--accent) 55%, white); }
html[data-theme="dark"] .search { background: var(--soft); }
html[data-theme="dark"] .chip { background: var(--card); border-color: var(--border); color: #D4D6DD; }
html[data-theme="dark"] .chip.on { background: var(--c); border-color: var(--c); color: #fff; }
html[data-theme="dark"] .tile, html[data-theme="dark"] img.avatar, html[data-theme="dark"] .notif .thumb { background: var(--tile-bg); }
html[data-theme="dark"] .avatar.big { border-color: var(--card); }
html[data-theme="dark"] .dropzone { background: #1E1A12; border-color: #B45309; }
html[data-theme="dark"] .dropzone .circle { background: #3D2E0F; color: #FCD34D; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field textarea, html[data-theme="dark"] .field select { background: var(--soft); border-color: var(--border); color: var(--ink); }
html[data-theme="dark"] .progress { background: #2A221B; }
html[data-theme="dark"] .bio { color: #C4C6CE; }
html[data-theme="dark"] .icon-light { background: var(--soft); color: #D4D6DD; }
html[data-theme="dark"] .menu-item { background: var(--soft); }
html[data-theme="dark"] .menu-item.danger { color: #F87171; }
html[data-theme="dark"] .form-error { color: #F87171; }
html[data-theme="dark"] .link-btn, html[data-theme="dark"] .c-text .tag { color: #60A5FA; }
html[data-theme="dark"] .ring.seen { border-color: #4A4A55; }
html[data-theme="dark"] .story-add { background: #2A1517; }
html[data-theme="dark"] .story-item:active { background: color-mix(in srgb, var(--coral) 18%, #15151B); }
html[data-theme="dark"] .mode-switch { background: var(--soft); }
html[data-theme="dark"] .mode-switch button { color: var(--muted); }
html[data-theme="dark"] .mode-switch button.on { background: #2A2A33; color: #FB923C; }
html[data-theme="dark"] .seg button.on { background: #2A2A33; color: #93C5FD; }
html[data-theme="dark"] .menu-item.on { outline-color: #60A5FA; }
html[data-theme="dark"] .menu-item .check { color: #93C5FD; }
html[data-theme="dark"] #toast { background: #EEEEF2; color: #17181C; }
html[data-theme="dark"] .sheet-head.center .icon-light { background: transparent; }
.danger-text { color: #B91C1C !important; }
html[data-theme="dark"] .danger-text { color: #F87171 !important; }
.act-avatar a { text-decoration: none; display: block; border-radius: 50%; }
