/* ==========================================================================
   Fralen — design tokens
   Ink base for a screen-lit, video-first platform. Each content type owns a
   facet hue; the facet edge on a card tells you what it is before you read it.
   ========================================================================== */

:root {
  --ink: #0C0E14;
  --panel: #131722;
  --panel-2: #1B2130;
  --line: #252D40;
  --line-soft: #1D2334;
  --paper: #EDF0F7;
  --fog: #98A2B8;
  --fog-2: #6B7488;

  --f-text: #F2B33D;
  --f-image: #9D7BFF;
  --f-short: #FF5977;
  --f-video: #3EC8FF;

  --font-display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;

  --rail-w: 236px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.65);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}

body.locked { overflow: hidden; }

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

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input, textarea, select {
  font: inherit;
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--f-video);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(62, 200, 255, 0.28); }

/* ==========================================================================
   App shell — left rail on desktop, top bar + tab bar on mobile
   ========================================================================== */

.shell {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 14px;
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(600px 300px at -20% -10%, rgba(62, 200, 255, 0.05), transparent 60%),
    var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
}

.brand svg { flex: 0 0 auto; }

.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--fog);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item:hover { background: var(--panel); color: var(--paper); }

.nav-item.active { color: var(--paper); background: var(--panel-2); }

.nav-item.active .nav-dot { opacity: 1; transform: scale(1); }

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-left: auto;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.15s, transform 0.2s var(--ease);
}

.btn-post {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 16px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}

.btn-post:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -10px rgba(237, 240, 247, 0.35); }
.btn-post svg { width: 18px; height: 18px; }

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.15s;
}

.user-chip:hover { background: var(--panel); }

.user-chip .names { min-width: 0; }
.user-chip .dn { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .un { font-family: var(--font-mono); font-size: 11.5px; color: var(--fog-2); }

.rail-signin {
  display: block;
  text-align: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--paper);
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.rail-signin:hover { border-color: var(--fog-2); background: var(--panel); }

/* Mobile chrome */
.topbar, .tabbar { display: none; }

/* ==========================================================================
   Main column
   ========================================================================== */

.main { min-width: 0; padding: 26px 22px 90px; }

.page { max-width: 660px; margin: 0 auto; animation: rise 0.34s var(--ease); }
.page.wide { max-width: 1080px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.page-head { margin: 4px 0 18px; }

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.page-sub { color: var(--fog); font-size: 14.5px; margin: 0; }

/* Tabs + facet filter chips */
.feed-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  width: max-content;
}

.tab {
  padding: 7px 16px;
  border-radius: 8px;
  color: var(--fog);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.tab:hover { color: var(--paper); }
.tab.active { background: var(--panel-2); color: var(--paper); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fog);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--fog-2)); }

.chip:hover { color: var(--paper); border-color: var(--fog-2); }

.chip.active {
  color: var(--paper);
  border-color: var(--dot, var(--fog));
  background: color-mix(in srgb, var(--dot, var(--fog)) 12%, transparent);
}

/* ==========================================================================
   Post cards — the facet edge is the signature
   ========================================================================== */

.feed { display: flex; flex-direction: column; gap: 16px; }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  animation: rise 0.34s var(--ease) both;
}

.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--facet);
  box-shadow: 0 0 18px 0 color-mix(in srgb, var(--facet) 55%, transparent);
}

.card.facet-text  { --facet: var(--f-text); }
.card.facet-image { --facet: var(--f-image); }
.card.facet-short { --facet: var(--f-short); }
.card.facet-video { --facet: var(--f-video); }

.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px 12px 18px;
}

.card-who { min-width: 0; line-height: 1.25; }
.card-who .dn { font-weight: 600; font-size: 14.5px; }
.card-who .dn:hover { text-decoration: underline; }
.card-who .meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fog-2);
  display: flex;
  gap: 8px;
  margin-top: 1px;
}

.type-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--facet);
  border: 1px solid color-mix(in srgb, var(--facet) 45%, transparent);
  background: color-mix(in srgb, var(--facet) 9%, transparent);
  padding: 3px 9px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0 18px 6px;
}

.card-body {
  margin: 0;
  padding: 0 18px 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--paper);
}

.card-body.dim { color: var(--fog); font-size: 14.5px; }

.card-media { background: #05070B; }

.card-media img {
  width: 100%;
  max-height: 620px;
  object-fit: cover;
  cursor: pointer;
}

.media-video { position: relative; cursor: pointer; }

.media-video video { width: 100%; max-height: 620px; background: #05070B; }

.media-video.tall { display: flex; justify-content: center; }
.media-video.tall video { max-height: 540px; width: auto; max-width: 100%; }

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(5, 7, 11, 0) 40%, rgba(5, 7, 11, 0.45));
  transition: background 0.2s;
}

.media-video:hover .play-overlay { background: rgba(5, 7, 11, 0.28); }

.play-disc {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 14, 20, 0.72);
  border: 1px solid rgba(237, 240, 247, 0.28);
  backdrop-filter: blur(6px);
  transition: transform 0.18s var(--ease);
}

.media-video:hover .play-disc { transform: scale(1.07); }
.play-disc svg { width: 22px; height: 22px; margin-left: 3px; }

.dur-badge {
  position: absolute;
  right: 10px; bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(5, 7, 11, 0.78);
  border: 1px solid rgba(237, 240, 247, 0.14);
}

/* Card actions */
.card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--line-soft);
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--fog);
  font-family: var(--font-mono);
  font-size: 12.5px;
  transition: color 0.15s, background 0.15s;
}

.act svg { width: 19px; height: 19px; }
.act:hover { background: var(--panel-2); color: var(--paper); }

.act.liked { color: var(--f-short); }
.act.liked svg { fill: var(--f-short); stroke: var(--f-short); }
.act.pop svg { animation: pop 0.35s var(--ease); }

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

.act.danger:hover { color: var(--f-short); }

.spacer { flex: 1; }

/* ==========================================================================
   Videos grid
   ========================================================================== */

.vid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px 18px;
}

.vid-card { cursor: pointer; }

.vid-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #05070B;
  border: 1px solid var(--line-soft);
  transition: transform 0.2s var(--ease), border-color 0.2s;
}

.vid-card:hover .vid-thumb { transform: translateY(-3px); border-color: var(--line); }

.vid-thumb::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--f-video);
  opacity: 0;
  transition: opacity 0.2s;
}

.vid-card:hover .vid-thumb::after { opacity: 1; }

.vid-thumb video { width: 100%; height: 100%; object-fit: cover; }

.vid-info { display: flex; gap: 11px; padding: 11px 4px 0; }

.vid-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vid-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--fog-2); margin-top: 3px; }

/* ==========================================================================
   Watch / post detail
   ========================================================================== */

.watch-player {
  border-radius: var(--radius);
  overflow: hidden;
  background: #05070B;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow);
}

.watch-player video { width: 100%; max-height: 74vh; }

.watch-player.tall video { max-height: 78vh; width: auto; margin: 0 auto; }

.watch-player img { width: 100%; max-height: 78vh; object-fit: contain; }

.watch-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.015em;
  margin: 18px 0 4px;
}

.watch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.watch-desc {
  margin: 16px 0 0;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  color: var(--fog);
  font-size: 14.5px;
}

.author-line { display: flex; align-items: center; gap: 11px; }

/* ==========================================================================
   Comments
   ========================================================================== */

.comments { margin-top: 26px; }

.comments h3 {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--fog);
  margin: 0 0 14px;
}

.comment-form { display: flex; gap: 10px; margin-bottom: 20px; }

.comment-form textarea {
  flex: 1;
  resize: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  min-height: 44px;
  max-height: 140px;
  transition: border-color 0.15s;
}

.comment-form textarea:focus { outline: none; border-color: var(--fog-2); }

.comment {
  display: flex;
  gap: 11px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}

.comment:last-child { border-bottom: 0; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; }
.comment .c-name { font-weight: 600; font-size: 13.5px; }
.comment .c-time { font-family: var(--font-mono); font-size: 11px; color: var(--fog-2); }
.comment p { margin: 3px 0 0; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.comment .c-del { opacity: 0; color: var(--fog-2); padding: 2px; transition: opacity 0.15s, color 0.15s; }
.comment:hover .c-del { opacity: 1; }
.comment .c-del:hover { color: var(--f-short); }
.comment .c-del svg { width: 15px; height: 15px; }

/* ==========================================================================
   Profile
   ========================================================================== */

.profile-head {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  margin-bottom: 20px;
  overflow: hidden;
}

.profile-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--f-text), var(--f-image), var(--f-short), var(--f-video));
}

.profile-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

.profile-names { flex: 1; min-width: 200px; }

.profile-dn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0;
}

.profile-un { font-family: var(--font-mono); font-size: 13px; color: var(--fog-2); }

.profile-bio { margin: 12px 0 0; color: var(--fog); white-space: pre-wrap; }

.profile-stats {
  display: flex;
  gap: 22px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fog);
}

.profile-stats b { color: var(--paper); font-weight: 600; margin-right: 5px; }

/* ==========================================================================
   Buttons, avatars, misc
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
  transition: transform 0.15s var(--ease), opacity 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.btn.ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--fog-2); }

.btn.small { padding: 6px 14px; font-size: 13px; }

.avatar {
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
  background: var(--panel-2);
}

.avatar-fallback {
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fog);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty .glyph { margin-bottom: 12px; opacity: 0.85; }

.empty h3 {
  font-family: var(--font-display);
  color: var(--paper);
  font-size: 19px;
  margin: 0 0 4px;
}

.empty p { margin: 0; font-size: 14.5px; }

.loading-row { display: flex; justify-content: center; padding: 30px; }

.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--f-video);
  animation: spin 0.8s linear infinite;
}

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

.sentinel { height: 1px; }

/* ==========================================================================
   Shorts overlay
   ========================================================================== */

.shorts-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #05070B;
  animation: fade 0.25s;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.shorts-scroll {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.shorts-scroll::-webkit-scrollbar { display: none; }

.short-item {
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px 0;
}

.short-stage {
  position: relative;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  max-width: min(94vw, 480px);
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
}

.short-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
  background: #000;
}

.short-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 44px 16px 16px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.short-caption .who {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 14.5px;
}

.short-caption .who:hover { text-decoration: underline; }

.short-caption p {
  margin: 7px 0 0;
  font-size: 14px;
  color: rgba(237, 240, 247, 0.92);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.paused-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.short-stage.paused .paused-glyph { opacity: 1; }

.paused-glyph .play-disc { width: 72px; height: 72px; }
.paused-glyph svg { width: 28px; height: 28px; margin-left: 4px; }

.short-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.rail-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.rail-act .disc {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 33, 48, 0.85);
  border: 1px solid var(--line);
  transition: background 0.15s, transform 0.15s var(--ease);
}

.rail-act:hover .disc { background: var(--panel-2); transform: scale(1.06); }
.rail-act svg { width: 21px; height: 21px; }
.rail-act.liked .disc { border-color: var(--f-short); }
.rail-act.liked svg { fill: var(--f-short); stroke: var(--f-short); }

.shorts-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  pointer-events: none;
}

.shorts-top > * { pointer-events: auto; }

.shorts-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.shorts-word .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--f-short); box-shadow: 0 0 12px var(--f-short); }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 33, 48, 0.85);
  border: 1px solid var(--line);
  color: var(--paper);
  transition: background 0.15s;
}

.icon-btn:hover { background: var(--panel-2); }
.icon-btn svg { width: 19px; height: 19px; }

/* Comments drawer inside shorts */
.short-drawer {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(380px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 8;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  transition: transform 0.28s var(--ease);
}

.short-drawer.open { transform: none; }

.short-drawer .drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--fog);
}

.short-drawer .drawer-body { flex: 1; overflow-y: auto; padding: 6px 16px; }
.short-drawer .drawer-foot { padding: 12px 16px; border-top: 1px solid var(--line-soft); }

/* ==========================================================================
   Compose modal + generic modal
   ========================================================================== */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade 0.2s;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  animation: rise 0.28s var(--ease);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.015em;
  margin: 0;
}

.modal-body { padding: 16px 20px 22px; }

.facet-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.facet-tile {
  --facet: var(--fog);
  position: relative;
  text-align: left;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ink);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s var(--ease), background 0.15s;
}

.facet-tile::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--facet);
}

.facet-tile:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--facet) 55%, var(--line));
  background: color-mix(in srgb, var(--facet) 6%, var(--ink));
}

.facet-tile svg { width: 22px; height: 22px; color: var(--facet); margin-bottom: 10px; }

.facet-tile .t {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 16px;
  display: block;
}

.facet-tile .d { color: var(--fog); font-size: 13px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--fog);
  margin-bottom: 7px;
}

.field input[type="text"], .field input[type="password"], .field textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  transition: border-color 0.15s;
}

.field textarea { min-height: 110px; resize: vertical; }

.field input:focus, .field textarea:focus { outline: none; border-color: var(--fog-2); }

.field .hint { font-size: 12.5px; color: var(--fog-2); margin-top: 6px; }

.drop {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 30px 16px;
  text-align: center;
  color: var(--fog);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.drop:hover, .drop.over {
  border-color: var(--facet, var(--fog-2));
  background: color-mix(in srgb, var(--facet, var(--fog)) 5%, transparent);
}

.drop svg { width: 26px; height: 26px; margin-bottom: 8px; color: var(--facet, var(--fog)); }
.drop .big { color: var(--paper); font-weight: 600; }
.drop .small { font-family: var(--font-mono); font-size: 11.5px; margin-top: 4px; }

.preview { position: relative; border-radius: 12px; overflow: hidden; background: #05070B; }
.preview img, .preview video { width: 100%; max-height: 340px; object-fit: contain; }
.preview .clear {
  position: absolute;
  top: 10px; right: 10px;
}

.progress-wrap {
  height: 8px;
  border-radius: 99px;
  background: var(--ink);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-top: 14px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--f-text), var(--f-image), var(--f-short), var(--f-video));
  transition: width 0.2s;
}

.progress-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fog);
  margin-top: 7px;
  text-align: right;
}

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

.form-error {
  background: color-mix(in srgb, var(--f-short) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--f-short) 40%, transparent);
  color: #FFD3DC;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

/* ==========================================================================
   Auth screens
   ========================================================================== */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  background:
    radial-gradient(700px 500px at 20% 10%, rgba(157, 123, 255, 0.10), transparent 60%),
    radial-gradient(700px 500px at 85% 90%, rgba(62, 200, 255, 0.10), transparent 60%),
    #090B10;
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
}

.auth-art .brand { padding: 0; }

.beam-art { margin: auto 0; }

.auth-tag {
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}

.auth-tag .a { color: var(--f-text); }
.auth-tag .b { color: var(--f-image); }
.auth-tag .c { color: var(--f-short); }
.auth-tag .d { color: var(--f-video); }

.auth-note { color: var(--fog-2); font-family: var(--font-mono); font-size: 12px; }

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

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

.auth-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.auth-card .sub { color: var(--fog); margin: 0 0 24px; font-size: 14.5px; }

.auth-swap { margin-top: 18px; font-size: 14px; color: var(--fog); }
.auth-swap a { color: var(--f-video); font-weight: 600; }
.auth-swap a:hover { text-decoration: underline; }

/* ==========================================================================
   Toasts
   ========================================================================== */

#toast-root {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in 0.3s var(--ease);
  display: flex;
  align-items: center;
  gap: 9px;
}

.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--f-video); }
.toast.err .t-dot { background: var(--f-short); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--ink) 86%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
  }

  .topbar .brand { padding: 0; }
  .topbar .brand-word { font-size: 20px; }

  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--ink) 90%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-soft);
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .tabbar .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 7px 4px;
    font-size: 10.5px;
    font-family: var(--font-mono);
    align-items: center;
  }

  .tabbar .nav-item svg { width: 22px; height: 22px; }
  .tabbar .nav-dot { display: none; }
  .tabbar .nav-item.active { background: none; }
  .tabbar .nav-item.active svg { color: var(--paper); }

  .tab-post {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tab-post .plus-pill {
    width: 46px; height: 32px;
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  .tab-post .plus-pill::before,
  .tab-post .plus-pill::after {
    content: "";
    position: absolute;
    top: 4px; bottom: 4px;
    width: 3px;
    border-radius: 3px;
  }

  .tab-post .plus-pill::before { left: -6px; background: var(--f-short); }
  .tab-post .plus-pill::after { right: -6px; background: var(--f-video); }
  .tab-post svg { width: 20px; height: 20px; }

  .main { padding: 18px 14px 96px; }
  .page-title { font-size: 25px; }
  .facet-pick { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .short-item { padding: 0; gap: 0; }
  .short-stage { border-radius: 0; aspect-ratio: auto; width: 100%; max-width: none; }

  .short-rail {
    position: absolute;
    right: 10px;
    bottom: 90px;
    z-index: 4;
  }

  .short-item { position: relative; }
  .short-caption { padding-bottom: 22px; padding-right: 74px; }
}

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

/* ==========================================================================
   Linko ecosystem — rail section, mobile apps menu, account branding
   ========================================================================== */

.rail-sec {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--fog-2);
  padding: 16px 12px 6px;
}

.nav-item .ext {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

.nav-item .ext svg { width: 13px; height: 13px; }
.nav-item:hover .ext { opacity: 0.7; }

.company {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--fog-2);
  text-align: center;
  padding: 12px 4px 2px;
}

.apps-pop {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 70;
  min-width: 216px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.2s var(--ease);
}

.apps-pop .nav-item { color: var(--paper); }
.apps-pop .nav-item .ext { opacity: 0.55; }

.apps-pop .pop-foot {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--fog-2);
  text-align: center;
  padding: 8px 4px 4px;
  border-top: 1px solid var(--line-soft);
  margin-top: 6px;
}

.linko-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--fog);
  margin-bottom: 12px;
}

.linko-mark {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5px;
}

.linko-mark i {
  width: 5px;
  height: 5px;
  border-radius: 1.5px;
  display: block;
}

.linko-mark i:nth-child(1) { background: var(--f-text); }
.linko-mark i:nth-child(2) { background: var(--f-image); }
.linko-mark i:nth-child(3) { background: var(--f-video); }
.linko-mark i:nth-child(4) { background: var(--f-short); }

/* ==========================================================================
   Comment threads, comment likes, creator hearts
   ========================================================================== */

.btn svg { width: 17px; height: 17px; }
.btn.danger:hover { border-color: var(--f-short); color: var(--f-short); }

.c-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.mini-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  color: var(--fog-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  transition: color 0.15s, background 0.15s;
}

.mini-act svg { width: 15px; height: 15px; }
.mini-act:hover { color: var(--paper); background: var(--panel-2); }
.mini-act.liked { color: var(--f-short); }
.mini-act.liked svg { fill: var(--f-short); stroke: var(--f-short); }
.mini-act .n:empty { display: none; }

.creator-heart {
  position: relative;
  display: inline-flex;
  margin: 0 2px;
}

.creator-heart .ch-heart {
  position: absolute;
  right: -5px;
  bottom: -4px;
  color: var(--f-short);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.creator-heart .ch-heart svg { width: 11px; height: 11px; display: block; }

.reply-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 8px;
  color: var(--f-video);
  font-family: var(--font-mono);
  font-size: 11.5px;
  transition: background 0.15s;
}

.reply-toggle:hover { background: color-mix(in srgb, var(--f-video) 10%, transparent); }
.reply-toggle .rt-chev { display: flex; transition: transform 0.2s var(--ease); }
.reply-toggle .rt-chev svg { width: 15px; height: 15px; }
.reply-toggle.open .rt-chev { transform: rotate(180deg); }

.replies {
  margin-top: 8px;
  padding-left: 14px;
  border-left: 2px solid var(--line-soft);
}

.comment.is-reply { padding: 8px 0; border-bottom: 0; }

.reply-box { margin-top: 8px; }

.comment-form.compact { margin-bottom: 4px; }
.comment-form.compact textarea { min-height: 38px; padding: 8px 11px; font-size: 14px; }

.role-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: 5px;
  vertical-align: 1px;
}

.role-badge.role-staff {
  color: var(--f-image);
  border: 1px solid color-mix(in srgb, var(--f-image) 45%, transparent);
  background: color-mix(in srgb, var(--f-image) 10%, transparent);
}

.role-badge.role-admin {
  color: var(--f-video);
  border: 1px solid color-mix(in srgb, var(--f-video) 45%, transparent);
  background: color-mix(in srgb, var(--f-video) 10%, transparent);
}

.pill-susp {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--f-short);
  border: 1px solid color-mix(in srgb, var(--f-short) 45%, transparent);
  background: color-mix(in srgb, var(--f-short) 10%, transparent);
}

/* ==========================================================================
   Staff panel
   ========================================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.stat-grid.four { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 16px 16px 14px;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--facet, transparent);
}

.sc-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--fog-2);
}

.sc-big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 27px;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.sc-sub { font-size: 12.5px; color: var(--fog); margin-top: 2px; }

.a-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--fog-2);
}

.a-search svg { width: 18px; height: 18px; flex: 0 0 auto; }

.a-search input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  font-size: 14.5px;
}

.a-rows { margin-top: 12px; }

.arow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.a-main { flex: 1; min-width: 0; }

.a-title {
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a-un { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--fog-2); }

.a-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fog-2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a-nums {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fog);
  white-space: nowrap;
}

.role-select {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 880px) {
  .arow { flex-wrap: wrap; }
  .a-nums { display: none; }
  .a-main { flex-basis: 100%; order: -1; }
}
