/* SoftBook: a cool pale background, deep navy text, indigo for actions, crimson for likes.
   The brand motif is a shelf of soft books in the logo, on the sign-in screen and on the profile cover. */

:root {
  --paper: #EEF1F8;
  --surface: #FFFFFF;
  --surface-2: #F6F7FC;
  --ink: #1A2142;
  --ink-2: #3A4368;
  --muted: #646D90;
  --line: #DFE3F0;
  --line-strong: #C9D0E6;

  --indigo: #4552D9;
  --indigo-hover: #3843C4;
  --indigo-soft: #E5E8FD;
  --periwinkle: #8E9AFB;
  --rose: #E2456E;
  --rose-soft: #FCE6EC;
  --mint: #1F9E77;
  --mint-soft: #DCF3EA;
  --amber: #E9A23B;

  --display: 'Unbounded', 'Segoe UI', system-ui, sans-serif;
  --body: 'Onest', 'Segoe UI', system-ui, sans-serif;

  --r-xl: 26px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --lift: 0 1px 2px rgba(26, 33, 66, 0.05), 0 12px 32px -18px rgba(26, 33, 66, 0.28);
  --lift-strong: 0 24px 60px -20px rgba(26, 33, 66, 0.45);
  --focus: 0 0 0 3px rgba(69, 82, 217, 0.35);

  --rail-w: 248px;
  --side-w: 300px;
  --feed-w: 620px;
  --tabbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(#D6DBEC 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: var(--indigo);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* ---------- icons, brand ---------- */

.icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: none;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.logo-mark {
  display: inline-flex;
  flex: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.brand-light {
  color: #fff;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--indigo);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--indigo-hover);
}

.btn-soft {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.btn-soft:hover:not(:disabled) {
  background: #D8DCFB;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--muted);
}

.btn-danger {
  background: var(--rose);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #C9365C;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn.is-busy {
  position: relative;
  color: transparent;
}

.btn.is-busy > * {
  visibility: hidden;
}

.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: rgba(255, 255, 255, 0.9) rgba(255, 255, 255, 0.9) transparent transparent;
  animation: spin 0.7s linear infinite;
}

.btn-soft.is-busy::after,
.btn-ghost.is-busy::after {
  border-color: var(--indigo) var(--indigo) transparent transparent;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}

.icon-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

.icon-btn-sm .icon {
  width: 17px;
  height: 17px;
}

.icon-btn-primary {
  background: var(--indigo);
  color: #fff;
}

.icon-btn-primary:hover:not(:disabled) {
  background: var(--indigo-hover);
  color: #fff;
}

.icon-btn-light {
  color: #fff;
}

.icon-btn-light:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ---------- forms ---------- */

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
}

.field input,
.field textarea,
.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea,
textarea.input {
  resize: vertical;
  min-height: 88px;
}

.field input:hover,
.input:hover,
.select:hover {
  border-color: var(--muted);
}

.field input:focus,
.field textarea:focus,
.input:focus,
.select:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: var(--focus);
}

.field [aria-invalid='true'] {
  border-color: var(--rose);
}

.select {
  width: auto;
  min-height: 40px;
  padding: 0 34px 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23646D90' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.field-hint {
  font-size: 13px;
  color: var(--muted);
}

.field-error,
.form-error {
  font-size: 13.5px;
  color: #B92A50;
}

.form-error {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--rose-soft);
}

.code-input {
  font-size: 22px !important;
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.search-box {
  position: relative;
  display: block;
}

.search-box .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.input-search {
  padding-left: 42px;
  border-radius: 999px;
}

.dev-hint {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: #FFF4DF;
  color: #7A5208;
  font-size: 13px;
}

/* ---------- auth ---------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 44px 56px 0;
  overflow: hidden;
  background: var(--indigo);
  color: #fff;
}

.auth-copy {
  max-width: 600px;
}

.auth-headline {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 3.6vw, 50px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.auth-lead {
  margin-top: 20px;
  max-width: 40ch;
  font-size: 17px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

/* the shelf of soft books */
.shelf {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 300px;
  padding: 0 4px;
  border-bottom: 14px solid #2F3AA8;
  margin: 0 -56px;
  padding-left: 56px;
}

.book {
  display: block;
  width: 62px;
  border-radius: 31px 31px 10px 10px;
  transform-origin: bottom center;
  animation: book-rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.b1 { height: 62%; background: #8E9AFB; animation-delay: 0.05s; }
.b2 { height: 88%; background: #FFFFFF; animation-delay: 0.12s; }
.b3 { height: 72%; background: #E2456E; animation-delay: 0.19s; }
.b4 { height: 96%; width: 84px; background: #C7CDFE; animation-delay: 0.26s; }
.b5 { height: 58%; background: #1F9E77; animation-delay: 0.33s; }
.b6 { height: 80%; background: #E9A23B; animation-delay: 0.4s; }
.b7 { height: 70%; background: #FFFFFF; opacity: 0.35; transform: rotate(14deg); animation-name: book-lean; animation-delay: 0.47s; }

@keyframes book-rise {
  from { transform: translateY(105%); }
  to { transform: translateY(0); }
}

@keyframes book-lean {
  from { transform: translateY(105%) rotate(0deg); }
  to { transform: translateY(0) rotate(14deg); }
}

.auth-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.01em;
}

.auth-sub {
  margin-top: -8px;
  color: var(--muted);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.auth-switch {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------- frame ---------- */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, var(--feed-w)) var(--side-w);
  justify-content: center;
  gap: 32px;
  min-height: 100vh;
  padding: 0 24px;
}

.app.is-wide {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  max-width: 1280px;
  margin: 0 auto;
}

.app.is-wide .side {
  display: none;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 16px;
}

.topbar {
  display: none;
}

/* left panel: a solid indigo column with a book shelf at the bottom, like the sign-in screen */
.rail {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 32px);
  margin: 16px 0;
  padding: 24px 14px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  border-radius: 28px;
  background: var(--indigo);
  color: #fff;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail .brand {
  padding: 0 10px 22px;
}

.rail-create {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-height: 48px;
  margin-bottom: 18px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--indigo);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 10px 24px -12px rgba(10, 14, 60, 0.6);
  transition: transform 0.12s, background-color 0.15s;
}

.rail-create:hover {
  background: #F1F2FF;
}

.rail-create:active {
  transform: translateY(1px);
}

.rail-create:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.nav {
  display: grid;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  font-size: 15.5px;
  transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.nav-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}

.nav-link.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
}

.nav-link .badge {
  border-color: var(--indigo);
}

.rail-friends {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.rail-caption-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 8px;
}

.rail-caption {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13.5px;
  font-weight: 600;
}

.rail-block > .rail-caption {
  padding: 0 10px 8px;
}

.rail-count {
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

.rail-count:hover {
  background: rgba(255, 255, 255, 0.28);
  text-decoration: none;
}

.rail-friend-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.rail-friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  color: #fff;
}

.rail-friend:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.rail-friend .avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.rail-friend-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-friend-icon {
  width: 17px;
  height: 17px;
  opacity: 0;
  transition: opacity 0.15s;
}

.rail-friend:hover .rail-friend-icon,
.rail-friend:focus-visible .rail-friend-icon {
  opacity: 0.85;
}

.rail-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.rail-empty:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.rail-shelf {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 7px;
  height: 86px;
  margin: auto -14px 0;
  padding: 0 22px;
  border-bottom: 7px solid #2F3AA8;
}

.rail-book {
  display: block;
  width: 20px;
  border-radius: 10px 10px 3px 3px;
}

.r1 { height: 52%; background: #8E9AFB; }
.r2 { height: 84%; background: #FFFFFF; }
.r3 { height: 66%; background: #E2456E; }
.r4 { height: 94%; width: 28px; background: #C7CDFE; }
.r5 { height: 56%; background: #1F9E77; }
.r6 { height: 74%; background: #E9A23B; transform: rotate(12deg); transform-origin: bottom left; }

.nav-icon {
  position: relative;
  display: inline-flex;
}

.nav-icon .icon {
  width: 22px;
  height: 22px;
}

.badge {
  position: absolute;
  top: -6px;
  right: -9px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.rail-foot {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  padding-top: 10px;
}

.rail-foot .icon-btn {
  color: rgba(255, 255, 255, 0.8);
}

.rail-foot .icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.me-chip {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border-radius: var(--r-md);
  color: #fff;
}

.me-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.me-chip .avatar {
  box-shadow: 0 0 0 2px #fff;
}

.me-text {
  display: grid;
  min-width: 0;
}

.me-name {
  overflow: hidden;
  font-weight: 600;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-handle {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-width: 0;
  padding: 28px 0 64px;
}

.main:focus {
  outline: none;
}

.side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  padding: 24px 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.side::-webkit-scrollbar {
  display: none;
}

.side-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
}

.side-badge .icon {
  width: 16px;
  height: 16px;
}

.badge-indigo { background: var(--indigo-soft); color: var(--indigo); }
.badge-mint { background: var(--mint-soft); color: var(--mint); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }

.icon-btn-soft {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.icon-btn-soft:hover:not(:disabled) {
  background: var(--indigo);
  color: #fff;
}

.icon-btn-soft.is-done {
  background: var(--mint-soft);
  color: var(--mint);
}

.popular {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  margin: -4px;
  border-radius: 14px;
  color: var(--ink);
}

.popular-item:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.popular-thumb {
  position: relative;
  flex: none;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--line);
}

.popular-thumb img,
.popular-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.popular-rank {
  position: absolute;
  left: 4px;
  top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
}

.popular-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.popular-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.popular-meta {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.popular-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.popular-meta .icon {
  width: 14px;
  height: 14px;
}

/* feed greeting */
.hello {
  display: grid;
  gap: 6px;
  margin: 4px 0 22px;
}

.hello-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.hello-date {
  color: var(--muted);
  font-size: 15px;
}

.side-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}

.side-list {
  display: grid;
  gap: 10px;
}

.side-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.side-actions {
  display: flex;
  gap: 4px;
}

.side-more {
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 14px;
}

.side-foot {
  margin-top: auto;
  color: var(--muted);
  font-size: 12.5px;
}

.tabbar {
  display: none;
}

.boot-error {
  max-width: 480px;
  margin: 15vh auto 0;
  padding: 0 24px;
}

/* ---------- page heading ---------- */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.015em;
}

.page-actions {
  display: flex;
  gap: 8px;
}

.section-title {
  margin: 28px 0 14px;
  font-size: 17px;
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px 12px 6px 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
}

.back-link:hover {
  background: var(--surface);
}

.muted-note {
  color: var(--muted);
  font-size: 14px;
}

.stack {
  display: grid;
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(26, 33, 66, 0.04);
}

/* ---------- avatars, people ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  background: var(--tone, var(--indigo));
  color: #fff;
  font-weight: 600;
  object-fit: cover;
  user-select: none;
}

.avatar-xs { width: 28px; height: 28px; font-size: 11px; }
.avatar-sm { width: 36px; height: 36px; font-size: 13px; }
.avatar-md { width: 44px; height: 44px; font-size: 15px; }
.avatar-lg { width: 60px; height: 60px; font-size: 20px; }
.avatar-xl { width: 112px; height: 112px; font-size: 38px; font-family: var(--display); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
}

.chip:hover {
  text-decoration: none;
}

.chip:hover .chip-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chip-text {
  display: grid;
  min-width: 0;
}

.chip-name {
  overflow: hidden;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.chip-light,
.chip-light .chip-sub {
  color: #fff;
}

.chip-light .chip-sub {
  opacity: 0.8;
}

.people {
  overflow: hidden;
}

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.person + .person {
  border-top: 1px solid var(--line);
}

.person-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: var(--ink);
}

.person-main:hover {
  text-decoration: none;
}

.person-main:hover .person-name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.person-text {
  display: grid;
  min-width: 0;
}

.person-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-sub {
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.tag .icon {
  width: 15px;
  height: 15px;
}

.tag-mint {
  background: var(--mint-soft);
  color: #13795A;
}

/* ---------- stories ---------- */

.stories {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  padding: 4px 2px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.stories::-webkit-scrollbar {
  display: none;
}

.story {
  display: grid;
  justify-items: center;
  gap: 6px;
  flex: none;
  width: 76px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.story-ring {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--indigo), var(--periwinkle), var(--rose), var(--indigo));
}

.story-ring .avatar {
  border: 3px solid var(--paper);
  width: 66px;
  height: 66px;
}

.story-ring-add {
  background: var(--line-strong);
}

.story-plus {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
}

.story-plus .icon {
  width: 14px;
  height: 14px;
}

.story-add.is-busy .story-ring {
  animation: pulse 1.2s ease-in-out infinite;
}

.story-name {
  max-width: 76px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 38, 0.92);
}

.story-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw);
  height: min(92vh, 760px);
  overflow: hidden;
  border-radius: var(--r-xl);
  background: #0E1330;
}

.story-bars {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 4px;
}

.story-bar {
  flex: 1;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.story-bar-fill {
  display: block;
  height: 100%;
  background: #fff;
}

.story-top {
  position: absolute;
  top: 24px;
  left: 14px;
  right: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.story-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-zone {
  position: absolute;
  top: 80px;
  bottom: 80px;
  z-index: 2;
  width: 40%;
  border: 0;
  background: transparent;
}

.story-zone:focus-visible {
  box-shadow: inset var(--focus);
}

.story-zone-prev { left: 0; }
.story-zone-next { right: 0; }

.story-foot {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.story-views {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

/* ---------- composer ---------- */

.composer {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer.is-drop {
  border-color: var(--indigo);
  box-shadow: var(--focus);
}

.composer-top {
  display: flex;
  gap: 12px;
}

.composer-text {
  flex: 1;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-size: 16px;
  resize: none;
}

.composer-text:focus {
  outline: none;
  box-shadow: none;
}

.composer-preview {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.composer-preview .media {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.preview-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(26, 33, 66, 0.7);
  color: #fff;
}

.preview-clear:hover:not(:disabled) {
  background: var(--ink);
  color: #fff;
}

.composer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.spacer {
  flex: 1;
}

.composer-bar .btn-icon {
  width: 42px;
  padding: 0;
}

.composer-bar .btn-icon .icon {
  width: 20px;
  height: 20px;
}

.composer-bar .btn-primary {
  margin-left: auto;
  padding: 0 18px;
}

.composer-bar .select {
  padding-right: 30px;
  background-position: right 10px center;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.segment {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.segment[aria-checked='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(26, 33, 66, 0.14);
}

/* ---------- posts ---------- */

.post {
  overflow: hidden;
}

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}

.post-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.meta-tag .icon {
  width: 13px;
  height: 13px;
}

.meta-reels {
  color: var(--indigo);
}

.post-text {
  max-width: 68ch;
  padding: 0 18px 14px;
  font-size: 15.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.post-media {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.post-media .media {
  width: 100%;
  max-height: 640px;
  object-fit: contain;
  margin: 0 auto;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.15s, color 0.15s;
}

.act:hover:not(.act-static) {
  background: var(--surface-2);
}

.act.act-like:hover {
  background: var(--rose-soft);
  color: var(--rose);
}

.act.act-comment:hover {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.act.act-repost:hover {
  background: var(--mint-soft);
  color: var(--mint);
}

.act-static {
  margin-left: auto;
  color: var(--muted);
  font-weight: 500;
  cursor: default;
}

.act-count {
  font-variant-numeric: tabular-nums;
}

.act.is-liked,
.reel-act.is-liked {
  color: var(--rose);
}

.act.is-liked svg,
.reel-act.is-liked svg {
  fill: currentColor;
}

.act[aria-expanded='true'] {
  color: var(--indigo);
}

.pop .icon {
  animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes pop {
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.is-repost .repost-head {
  display: grid;
  gap: 6px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.repost-who {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 14px;
}

.repost-who .icon {
  width: 17px;
  height: 17px;
  color: var(--indigo);
}

.repost-text {
  padding-left: 23px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- comments ---------- */

.comments-panel {
  padding: 4px 18px 16px;
  border-top: 1px solid var(--line);
}

.comments {
  display: grid;
  gap: 14px;
  padding: 12px 0 14px;
}

.comment {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
}

.comment .chip {
  grid-column: 1;
}

.comment-text {
  grid-column: 1;
  padding-left: 38px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-remove {
  grid-column: 2;
  grid-row: 1;
}

.comments-empty {
  color: var(--muted);
  font-size: 14px;
}

.comment-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-form .input {
  min-height: 40px;
  border-radius: 999px;
}

/* ---------- reels ---------- */

.reels {
  display: grid;
  gap: 28px;
  justify-content: center;
}

.reel {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  scroll-margin-top: 24px;
}

.reel-stage {
  position: relative;
  width: min(380px, calc(100vw - 110px));
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  border-radius: var(--r-xl);
  background: #0E1330;
  box-shadow: var(--lift);
}

.reel-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.reel-sound {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(14, 19, 48, 0.45);
}

.reel-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 8px;
  padding: 60px 16px 18px;
  background: linear-gradient(to top, rgba(14, 19, 48, 0.85), transparent);
  color: #fff;
  pointer-events: none;
}

.reel-info .chip {
  pointer-events: auto;
}

.reel-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 14.5px;
}

.reel-actions {
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
}

.reel-act {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 56px;
  padding: 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
}

.reel-act .icon {
  width: 24px;
  height: 24px;
}

.reel-act:hover:not(.act-static) {
  border-color: var(--line-strong);
}

.reel-act.act-static {
  margin: 0;
  border-color: transparent;
  background: transparent;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected='true'] {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.tab-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--indigo);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.search {
  display: grid;
  gap: 16px;
}

/* ---------- messages ---------- */

.app.is-wide .main {
  padding: 16px 0;
}

.messenger {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.dialogs {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.dialogs-title {
  padding: 22px 20px 14px;
}

.dialogs-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 14px;
}

.dialog-list {
  display: grid;
  gap: 2px;
}

.list-caption {
  margin: 18px 10px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.dialog {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-md);
  color: var(--ink);
}

.dialog:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.dialog.is-active {
  background: var(--indigo-soft);
}

.dialog-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dialog-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-time {
  flex: none;
  color: var(--muted);
  font-size: 12px;
}

.dialog-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.chat-placeholder {
  justify-content: center;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.chat-back {
  display: none;
}

.chat-scroll {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px;
  background: var(--surface-2);
}

.chat-older {
  align-self: center;
  margin-bottom: 12px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

.chat-day {
  align-self: center;
  margin: 12px 0 6px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.bubble {
  align-self: flex-start;
  max-width: min(72%, 520px);
  padding: 9px 14px 7px;
  border-radius: 18px 18px 18px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.bubble-mine {
  align-self: flex-end;
  border: 0;
  border-radius: 18px 18px 6px 18px;
  background: var(--indigo);
  color: #fff;
}

.bubble-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bubble-time {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  text-align: right;
  opacity: 0.65;
}

.chat-empty {
  align-self: center;
  margin: auto 0;
  color: var(--muted);
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 160px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 21px;
  background: var(--surface);
  resize: none;
}

.chat-input:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: var(--focus);
}

.chat-locked {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- notifications ---------- */

.notices {
  overflow: hidden;
}

.notice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  background: transparent;
  text-align: left;
}

.notices li + li .notice {
  border-top: 1px solid var(--line);
}

.notice:hover {
  background: var(--surface-2);
}

.notice.is-unread {
  background: #F4F5FE;
}

.notice-pic {
  position: relative;
  flex: none;
}

.notice-kind {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
}

.notice-kind .icon {
  width: 12px;
  height: 12px;
}

.notice-kind.kind-like {
  background: var(--rose);
}

.notice-kind.kind-like svg {
  fill: currentColor;
}

.notice-text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-time {
  color: var(--muted);
  font-size: 13px;
}

.notice-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--indigo);
}

/* ---------- profile ---------- */

.profile {
  overflow: hidden;
}

.profile-cover {
  position: relative;
  height: 128px;
  overflow: hidden;
  background: var(--indigo);
}

.cover-shelf {
  position: absolute;
  right: 28px;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 100%;
}

.spine {
  display: block;
  width: 26px;
  border-radius: 13px 13px 4px 4px;
}

.s1 { height: 54%; background: #8E9AFB; }
.s2 { height: 80%; background: #fff; }
.s3 { height: 64%; background: #E2456E; }
.s4 { height: 88%; width: 36px; background: #C7CDFE; }
.s5 { height: 50%; background: #1F9E77; }
.s6 { height: 70%; background: #E9A23B; }

.profile-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 20px;
  padding: 0 24px 22px;
}

.profile-avatar {
  position: relative;
  z-index: 1;
  margin-top: -48px;
}

.profile-avatar .avatar {
  border: 5px solid var(--surface);
}

.profile-info {
  display: grid;
  align-content: start;
  gap: 2px;
  padding-top: 14px;
  min-width: 0;
}

.profile-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.profile-handle {
  color: var(--muted);
  font-weight: 500;
}

.profile-line {
  color: var(--ink-2);
  font-size: 14.5px;
}

.profile-stats {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}

.stat {
  color: var(--muted);
  font-size: 14.5px;
}

.stat strong {
  color: var(--ink);
  font-size: 16px;
}

a.stat:hover {
  text-decoration: none;
}

a.stat:hover strong {
  color: var(--indigo);
}

.profile-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.grid-item {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--line);
}

.grid-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.grid-item:hover .grid-media {
  transform: scale(1.04);
}

.grid-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ---------- empty, loading ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  border-radius: 22px;
  background: var(--indigo-soft);
  color: var(--indigo);
}

.empty-icon .icon {
  width: 28px;
  height: 28px;
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
}

.empty-text {
  max-width: 42ch;
  color: var(--muted);
}

.empty .btn {
  margin-top: 10px;
}

.loading {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--indigo-soft);
  border-top-color: var(--indigo);
  animation: spin 0.8s linear infinite;
}

.skeleton-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.sk-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sk {
  display: inline-block;
  background: linear-gradient(90deg, #E7EAF4 0%, #F3F5FA 50%, #E7EAF4 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.sk-line {
  height: 12px;
  border-radius: 6px;
  width: 70%;
}

.sk-short {
  width: 30%;
}

.sk-block {
  height: 260px;
  border-radius: var(--r-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

/* ---------- modal, toasts ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 33, 66, 0.45);
  animation: fade-in 0.15s ease-out;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--lift-strong);
  animation: modal-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-wide {
  width: min(680px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 6px 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-body {
  overflow-y: auto;
  padding: 10px 24px 24px;
}

.modal-body .composer {
  margin: 0;
  padding: 0;
  border: 0;
}

.modal-body .comments-panel {
  padding: 0;
  border: 0;
}

.modal-text {
  color: var(--ink-2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form .modal-actions {
  margin-top: 4px;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  display: grid;
  gap: 8px;
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  box-shadow: var(--lift-strong);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast .icon {
  width: 18px;
  height: 18px;
  color: #7FE0BC;
}

.toast-error {
  background: #8F1F3D;
}

.toast-error .icon {
  color: #FFC2D1;
}

.toast-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* ---------- adaptive ---------- */

@media (max-width: 1180px) {
  .app {
    grid-template-columns: 220px minmax(0, var(--feed-w));
  }

  .side {
    display: none;
  }

  .app.is-wide {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth-art {
    padding: 24px 24px 0;
    gap: 18px;
  }

  .auth-copy {
    max-width: none;
  }

  .auth-headline {
    font-size: 26px;
  }

  .auth-lead {
    display: none;
  }

  .shelf {
    height: 90px;
    margin: 0 -24px;
    padding-left: 24px;
    gap: 8px;
    border-bottom-width: 8px;
  }

  .book {
    width: 34px;
  }

  .b4 {
    width: 46px;
  }

  .auth-side {
    align-items: flex-start;
    padding: 32px 20px 48px;
  }
}

@media (max-width: 860px) {
  .app,
  .app.is-wide {
    display: block;
    padding: 0;
  }

  .rail {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(238, 241, 248, 0.92);
    backdrop-filter: blur(10px);
  }

  .topbar .brand-name {
    font-size: 17px;
  }

  .main {
    max-width: var(--feed-w);
    margin: 0 auto;
    padding: 18px 12px calc(var(--tabbar-h) + 32px);
  }

  .app.is-wide .main {
    max-width: none;
    padding: 0 0 var(--tabbar-h);
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .tab-link {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
  }

  .tab-link:hover {
    text-decoration: none;
  }

  .tab-link.is-active {
    color: var(--indigo);
  }

  .tab-link .nav-icon .icon {
    width: 24px;
    height: 24px;
  }

  .tab-link .badge {
    border-color: var(--surface);
  }

  .page-title {
    font-size: 22px;
  }

  .messenger {
    grid-template-columns: 1fr;
    height: calc(100vh - 58px - var(--tabbar-h));
    border: 0;
    border-radius: 0;
  }

  .messenger.has-chat .dialogs,
  .messenger:not(.has-chat) .chat {
    display: none;
  }

  .dialogs {
    border-right: 0;
  }

  .chat-back {
    display: inline-flex;
  }

  .chat-head {
    padding: 10px 12px;
  }

  .chat-scroll {
    padding: 14px;
  }

  .bubble {
    max-width: 84%;
  }
}

@media (max-width: 560px) {
  .tab-link .nav-label {
    display: none;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hide-sm {
    display: none;
  }

  .composer-bar .btn-primary {
    flex: 1 0 100%;
  }

  .post-head,
  .post-actions {
    padding-left: 12px;
    padding-right: 12px;
  }

  .post-text {
    padding-left: 12px;
    padding-right: 12px;
  }

  .person {
    flex-wrap: wrap;
    padding: 14px;
  }

  .person-actions {
    width: 100%;
    padding-left: 58px;
  }

  .profile-body {
    grid-template-columns: 1fr;
    padding: 0 18px 18px;
  }

  .profile-info {
    padding-top: 4px;
  }

  .avatar-xl {
    width: 92px;
    height: 92px;
    font-size: 32px;
  }

  .cover-shelf {
    right: 16px;
    gap: 6px;
  }

  .spine {
    width: 18px;
  }

  .s4 {
    width: 26px;
  }

  .tab {
    padding: 0 10px;
    font-size: 14px;
  }

  .reel-stage {
    width: calc(100vw - 96px);
  }

  .reel-act {
    width: 52px;
  }

  .backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
}

@media (max-height: 760px) {
  .rail-shelf {
    display: none;
  }

  .rail-foot {
    margin-top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
