/* ============================================================
   ENDOITTER · papel & tinta editorial
   ============================================================ */

:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-ui: 'Sora', system-ui, -apple-system, sans-serif;
  --radius: 18px;
  --radius-sm: 10px;
  --rail-w: 240px;
  --right-w: 340px;
  --nav-h: 64px;
}

/* -------- Temas -------- */
[data-theme="paper"] {
  --bg: #F3ECDC;
  --bg-soft: #EDE4CF;
  --surface: #FBF6EA;
  --surface-2: #F4EDDC;
  --ink: #1C1913;
  --ink-soft: #3A352A;
  --muted: #716A5A;
  --line: rgba(28, 25, 19, 0.16);
  --line-strong: rgba(28, 25, 19, 0.32);
  --accent: #E0401F;
  --accent-hover: #C43618;
  --accent-soft: rgba(224, 64, 31, 0.10);
  --accent-ink: #FFFFFF;
  --accent2: #0E6B5E;
  --accent2-soft: rgba(14, 107, 94, 0.12);
  --gold: #B8860B;
  --shadow: 0 1px 2px rgba(28,25,19,.06), 0 8px 28px rgba(28,25,19,.10);
  --shadow-pop: 0 2px 6px rgba(28,25,19,.12), 0 24px 64px rgba(28,25,19,.22);
  --glow: rgba(224,64,31,.35);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

[data-theme="ink"] {
  --bg: #15130D;
  --bg-soft: #100E09;
  --surface: #1E1A12;
  --surface-2: #262118;
  --ink: #EFE6D6;
  --ink-soft: #C9BFA9;
  --muted: #93896F;
  --line: rgba(239, 230, 214, 0.14);
  --line-strong: rgba(239, 230, 214, 0.3);
  --accent: #FF6A3D;
  --accent-hover: #E8592E;
  --accent-soft: rgba(255, 106, 61, 0.14);
  --accent-ink: #14120C;
  --accent2: #3DBFB0;
  --accent2-soft: rgba(61, 191, 176, 0.13);
  --gold: #D9A441;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --shadow-pop: 0 4px 12px rgba(0,0,0,.5), 0 28px 70px rgba(0,0,0,.6);
  --glow: rgba(255,106,61,.35);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

[data-theme="dusk"] {
  --bg: #0F131D;
  --bg-soft: #0B0E16;
  --surface: #151A26;
  --surface-2: #1C2231;
  --ink: #E7EAF4;
  --ink-soft: #C3CBDD;
  --muted: #8791AB;
  --line: rgba(231, 234, 244, 0.13);
  --line-strong: rgba(231, 234, 244, 0.28);
  --accent: #5D9BFF;
  --accent-hover: #4C87E8;
  --accent-soft: rgba(93, 155, 255, 0.15);
  --accent-ink: #0B0E16;
  --accent2: #E8B055;
  --accent2-soft: rgba(232, 176, 85, 0.14);
  --gold: #E8B055;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --shadow-pop: 0 4px 12px rgba(0,0,0,.5), 0 28px 70px rgba(0,0,0,.62);
  --glow: rgba(93,155,255,.35);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
}

/* -------- Base -------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--noise);
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

[hidden] { display: none !important; }

/* -------- Boot -------- */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.boot-mark { font-size: 60px; animation: bootPop .6s cubic-bezier(.2,.9,.3,1.4) both; }
.boot-word {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: -0.02em;
  animation: bootFade .5s ease .25s both;
}
.boot-line { color: var(--muted); font-size: 13px; animation: bootFade .5s ease .5s both; }
@keyframes bootPop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bootFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* -------- Shell -------- */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--right-w);
  gap: 0;
  min-height: 100vh;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
}
@media (max-width: 1180px) { .shell { grid-template-columns: 84px minmax(0,1fr); } }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; padding: 0; } }

/* -------- Rail -------- */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 12px 24px 3px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}
.rail-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -0.03em;
  padding: 8px 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  user-select: none;
}
.rail-logo .mark { color: var(--accent); font-size: 24px; }
.rail-logo em { font-style: italic; color: var(--muted); font-weight: 500; font-size: 18px; }
.rail-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 500;
  border-radius: 999px;
  width: 100%;
  text-align: left;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.rail-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.rail-item:hover { background: var(--surface-2); }
.rail-item.active { color: var(--ink); font-weight: 700; background: var(--accent-soft); }
.rail-item.active svg { color: var(--accent); }
.rail-item:active { transform: scale(.97); }

.rail-compose {
  display: none;
  margin-top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 16px;
  border: none;
  border-radius: 999px;
  padding: 14px;
  width: 100%;
  box-shadow: 0 6px 20px var(--glow);
  transition: transform .12s ease, box-shadow .2s ease;
}
.rail-compose:hover { transform: translateY(-1px); box-shadow: 0 10px 26px var(--glow); }
.rail-compose:active { transform: scale(.97); }
.rail-bottom { margin-top: auto; }
.rail-user {
  display: flex;
  align-items: center;
  gap: 12px;
   padding: 10px 0px;
  border-radius: 999px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background .15s;
}
.rail-user:hover { background: var(--surface-2); }
.rail-user .rname { font-weight: 600; font-size: 14px; line-height: 1.2; }
.rail-user .rhandle { color: var(--muted); font-size: 12.5px; }
.rail-user .more { margin-left: auto; color: var(--muted); font-size: 18px; }

@media (max-width: 1180px) {
  .rail { padding: 20px 8px; }
  .rail-logo { font-size: 22px; padding: 8px 6px 16px; justify-content: center; }
  .rail-logo em, .rail-item span:not(.nav-badge), .rail-compose span, .rail-user .rname, .rail-user .rhandle, .rail-user .more { display: none; }
  .rail-item { justify-content: center; padding: 12px; }
  .rail-compose { padding: 14px; font-size: 20px; }
  .rail-compose-red { width: 60px; height: 60px; font-size: 28px; }
  .rail-user { justify-content: center; padding: 8px; }
  .rail-logo .mark { display: inline; }
}
@media (max-width: 860px) {
  .rail {
    position: fixed;
    bottom: 0;
    top: auto;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(10px);
    z-index: 40;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-logo { display: none; }
  .rail-item { flex: 0 0 auto; justify-content: center; width: auto; padding: 8px 12px; min-width: 0; }
  .rail-compose { width: auto; padding: 10px 16px; margin-top: 0; }
  .rail-compose span { display: none; }
  .rail-compose-red { width: 52px; height: 52px; font-size: 24px; margin: 0; }
  .rail-bottom { margin-top: 0; }
  .rail-user { display: none; }
  .nav-badge { display: inline !important; }
}
@media (max-width: 480px) {
  body { overflow-x: clip; }
  .rail-item { padding: 6px; }
  .rail-item svg { width: 20px; height: 20px; }
  .rail-compose-red { width: 46px; height: 46px; font-size: 21px; }
  .composer { padding: 14px 12px 6px; gap: 10px; }
  .composer > div { min-width: 0; }
  .composer .avatar { margin-left: 14px; width: 40px; height: 40px; }
  .composer textarea { font-size: 16px; min-height: 52px; }
  .composer .btn-post { padding: 9px 14px; font-size: 14px; white-space: nowrap; }
  .composer-foot { gap: 8px; max-width: 100%; flex-wrap: wrap; row-gap: 6px; }
  .modal-back { padding: 4vh 10px 30px; }
  .modal { max-width: 100%; }
}

/* -------- Columnas -------- */
.col-main {
  min-height: 100vh;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.col-right {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 20px 12px 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
@media (max-width: 1180px) { .col-right { display: none; } }
@media (max-width: 860px) { .col-main { border: none; padding-bottom: var(--nav-h); } }

/* -------- Header de página -------- */
.page-head {
  position: sticky;
  top: 0;
  z-index: 15;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-head .back {
  background: none; border: none; color: var(--ink); font-size: 20px; padding: 6px 8px; border-radius: 999px;
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
}
.page-head > div { flex: 1; text-align: center; min-width: 0; }
.page-head .back:hover { background: var(--surface-2); }
.page-head .ph-title { font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1.1; }
.page-head .ph-mark { display: inline-flex; vertical-align: middle; margin-right: 8px; color: var(--ink); }
.page-head .ph-mark svg { width: 24px; height: 24px; }
.page-head .ph-mark svg path { stroke-width: 2.4; }
.page-head .ph-sub { color: var(--muted); font-size: 12.5px; }

/* -------- Auth -------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  max-width: 1060px;
  margin: 0 auto;
  align-items: stretch;
}
@media (max-width: 860px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 80% 12%, var(--accent-soft), transparent 60%),
    radial-gradient(500px 380px at 8% 88%, var(--accent2-soft), transparent 60%);
  pointer-events: none;
}
.auth-wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 38px;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
  margin-top: -2px;
}
.auth-wordmark .mark { color: var(--accent); }
.auth-tag {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 540px;
  position: relative;
  z-index: 1;
}
.auth-tag .rule { display: block; width: 64px; height: 4px; background: var(--accent); border-radius: 2px; margin: 12px 0; }
.auth-hero .foot { position: relative; z-index: 1; color: var(--muted); font-size: 13px; }
.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 40px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.auth-mobile-mark { display: none; }
@media (max-width: 860px) { .auth-hero { display: none; } .auth-card { padding: 40px 26px; } }
@media (max-width: 860px) {
  .auth-mobile-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 26px;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 26px;
  }
  .auth-mobile-mark .mark { color: var(--accent); display: inline-flex; }
  .auth-mobile-mark .mark svg { width: 34px; height: 34px; }
  .auth-mobile-mark .mark svg path { stroke-width: 2.4; }
}

.tabbar {
  display: flex;
  gap: 4px;
  margin-bottom: 30px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}
.tabbar button {
  border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: 15px;
  padding: 10px 26px; border-radius: 999px; transition: all .2s;
}
.tabbar button.active { background: var(--ink); color: var(--bg); }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; letter-spacing: .03em; text-transform: uppercase; }
.field input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 15px;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 999px;
  padding: 13px 22px; font-size: 15px; font-weight: 700; width: 100%;
  box-shadow: 0 4px 16px var(--glow);
  transition: transform .1s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: 999px;
  padding: 8px 18px; font-size: 13.5px; font-weight: 600; line-height: 1; transition: all .15s ease;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.rail-compose-red {
  background: #dc2626; color: #fff; border: none; border-radius: 50%;
  width: 104px; height: 104px; font-size: 48px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s ease; padding: 0;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  margin: 0 auto;
}
.rail-compose-red:hover {
  background: #b91c1c; transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.5);
}
.form-err { color: var(--accent); font-size: 13px; margin: 10px 0; min-height: 18px; }
.auth-note { margin-top: 26px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

/* -------- Composer -------- */
.composer {
  padding: 20px 20px 8px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.modal .composer {
  padding: 14px 14px 4px;
  gap: 10px;
}
.composer .avatar { margin-left: 30px; }
.composer > div { min-width: 0; }
.modal .profile-avatar-size-sm { width: 40px; height: 40px; }
.composer textarea {
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  font-size: 18px;
  font-family: var(--font-display);
  line-height: 1.4;
  min-height: 60px;
  outline: none;
  color: var(--ink);
}
.composer textarea::placeholder { color: var(--muted); font-style: italic; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 12px; max-width: 100%; }
.composer-actions { display: flex; align-items: center; gap: 4px; }
.composer-foot > div:last-child { margin-right: 10px; }
.composer .btn-post { width: auto; padding: 10px 24px; }
.icon-btn {
  background: none; border: none; color: var(--muted); padding: 8px; border-radius: 999px; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s;
}
.icon-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.composer .icon-btn { color: var(--ink); }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.composer .char-count { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.composer .char-count.over { color: var(--accent); font-weight: 700; }
.media-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.media-preview .mp { position: relative; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-preview .mp-x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 999px; width: 22px; height: 22px; font-size: 12px; }

/* -------- Tweet card -------- */
.tweet-card {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  transition: background .12s;
}
.tweet-card:hover { background: var(--surface-2); }
.tweet-card.thread-root { border-top: 1px solid var(--line); }
.tc-inner { display: flex; gap: 14px; }
.tc-main { min-width: 0; flex: 1; }
.rt-banner {
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600;
  margin: 0 0 10px 46px; letter-spacing: .02em;
}
.rt-banner svg { width: 15px; height: 15px; color: var(--accent2); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  display: inline-block;
}
.avatar-sm { width: 38px; height: 38px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar.avatar-blank {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: 20px;
}
.tc-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tc-name { font-weight: 700; font-size: 15px; }
.tc-name:hover { text-decoration: underline; }
.tc-handle { color: var(--muted); font-size: 13.5px; }
.tc-dot { color: var(--muted); }
.tc-time { color: var(--muted); font-size: 13.5px; }
.tc-time:hover { text-decoration: underline; }
.tc-body {
  font-size: 15px;
  line-height: 1.55;
  margin-top: 3px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.tc-body .link-mention { color: var(--accent); font-weight: 600; }
.tc-body .link-tag { color: var(--accent2); font-weight: 600; }
.tc-body .link-url { color: var(--accent2); word-break: break-all; }
.tc-media { margin-top: 12px; border-radius: var(--radius); overflow: hidden; display: grid; gap: 4px; }
.tc-media.m1 { grid-template-columns: 1fr; }
.tc-media.m2 { grid-template-columns: 1fr 1fr; }
.tc-media.m3 { grid-template-columns: 1fr 1fr; }
.tc-media.m4 { grid-template-columns: 1fr 1fr; }
.tc-media img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 420px; cursor: zoom-in; }
.tc-media.m2 img { max-height: 280px; }
.tc-media.m3 img:first-child { grid-row: span 2; max-height: 420px; }
.tc-media.m3 img:not(:first-child) { max-height: 210px; }
.tc-media.m4 img { max-height: 210px; }
.tc-quote {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: background .15s;
}
.tc-quote:hover { background: var(--surface-2); }
.tc-quote .q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tc-quote .q-name { font-weight: 700; font-size: 13.5px; }
.tc-quote .q-handle { color: var(--muted); font-size: 13px; }
.tc-quote .q-body { font-size: 13.5px; color: var(--ink-soft); white-space: pre-wrap; word-wrap: break-word; }
.tc-quote .q-media { margin-top: 8px; border-radius: 8px; overflow: hidden; max-height: 220px; }
.tc-quote .q-media img { width: 100%; object-fit: cover; max-height: 220px; display: block; }
.tc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  max-width: 440px;
}
.tc-act {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px; transition: color .15s, background .15s;
  font-variant-numeric: tabular-nums;
}
.tc-act svg { width: 18px; height: 18px; }
.tc-act:hover { background: var(--accent2-soft); color: var(--accent2); }
.tc-act.like:hover { color: var(--accent); background: var(--accent-soft); }
.tc-act.like.on { color: var(--accent); }
.tc-act.rt:hover { color: var(--accent2); background: var(--accent2-soft); }
.tc-act.rt.on { color: var(--accent2); }
.tc-act.rt.on svg { fill: currentColor; }
.tc-act.bm.on { color: var(--gold); }
.tc-act.bm.on svg { fill: currentColor; }
.tc-act.like.on svg { fill: currentColor; }

.tc-menu {
  position: absolute;
  top: 46px;
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 30;
  min-width: 180px;
}
.tc-menu button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  background: none; border: none; color: var(--ink); padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.tc-menu button:hover { background: var(--surface-2); }
.tc-menu button.danger { color: var(--accent); }
.tc-menu button svg { width: 16px; height: 16px; }

/* Quote/retweet popup */
.popup-menu {
  position: absolute;
  z-index: 35;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  min-width: 210px;
}
.popup-menu button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  background: none; border: none; color: var(--ink); padding: 11px 12px; border-radius: 8px; font-size: 14px;
}
.popup-menu button:hover { background: var(--surface-2); }
.popup-menu button svg { width: 17px; height: 17px; color: var(--accent2); }

/* -------- Estado vacío -------- */
.empty {
  padding: 60px 30px;
  text-align: center;
  color: var(--muted);
}
.empty .e-glyph { font-size: 42px; display: block; margin-bottom: 14px; font-family: var(--font-display); font-style: italic; }
.empty .e-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); margin-bottom: 6px; }

/* -------- Modal -------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(10, 8, 4, 0.55); backdrop-filter: blur(4px);
  z-index: 60; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 18px 40px; overflow-y: auto;
  animation: fadeIn .18s ease;
}
.modal {
  background: var(--surface); border-radius: 22px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  animation: popUp .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal svg { color: var(--ink); }
.modal .icon-btn svg { color: var(--ink); width: 24px; height: 24px; }
.modal .icon-btn { padding: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popUp { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head .mh-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.modal-body { padding: 18px; }
.modal-x { background: none; border: none; color: var(--ink); font-size: 20px; padding: 6px 10px; border-radius: 999px; }
.modal-x:hover { background: var(--surface-2); }

/* -------- Profile -------- */
.profile-banner {
  height: 190px;
  background: linear-gradient(120deg, var(--accent-soft), var(--accent2-soft) 55%, var(--surface-2));
  border-bottom: 1px solid var(--line);
  position: relative;
}
.profile-banner img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { position: relative; padding: 0 20px; }
.profile-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-top: -34px; position: relative; padding-bottom: 14px;
}
.profile-avatar {
  width: 128px; height: 128px; border-radius: 50%;
  border: 4px solid var(--surface); object-fit: cover; background: var(--surface-2);
  z-index: 1;
}
.profile-actions { display: flex; gap: 8px; align-items: center; z-index: 2; }
.profile-name { font-family: var(--font-display); font-weight: 900; font-size: 26px; line-height: 1.1; }
.profile-handle { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.profile-bio { font-size: 15px; margin-bottom: 12px; white-space: pre-wrap; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.profile-meta span { display: inline-flex; align-items: center; gap: 6px; }
.profile-meta svg { width: 15px; height: 15px; }
.profile-stats { display: flex; gap: 20px; font-size: 14px; margin-bottom: 16px; }
.profile-stats b { font-weight: 700; }
.profile-stats .st-muted { color: var(--muted); font-weight: 500; }
.profile-tabs {
  display: flex; border-bottom: 1px solid var(--line);
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.profile-tabs::-webkit-scrollbar { display: none; }
.profile-tabs button {
  flex: 0 0 auto; background: none; border: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 14px 16px; border-bottom: 3px solid transparent; transition: all .15s; white-space: nowrap;
}
.profile-tabs button:hover { color: var(--ink); background: var(--surface-2); }
.profile-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

/* -------- Siguientes / usuarios -------- */
.user-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--line); transition: background .12s; cursor: pointer;
}
.user-row:hover { background: var(--surface-2); }
.user-row .u-info { min-width: 0; flex: 1; }
.user-row .u-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .u-handle { color: var(--muted); font-size: 13px; }
.user-row .u-bio { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-btn {
  background: var(--ink); color: var(--bg); border: none; border-radius: 999px;
  padding: 8px 18px; font-weight: 700; font-size: 13.5px; transition: all .15s; flex-shrink: 0;
}
.follow-btn:hover { transform: scale(1.03); }
.follow-btn.on { background: transparent; border: 1.5px solid var(--line-strong); color: var(--ink); }
.follow-btn.on:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* -------- Right rail widgets -------- */
.widget {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.widget-head {
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.widget-body { padding: 6px 0; }
.w-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer;
  transition: background .12s;
}
.w-row:hover { background: var(--accent-soft); }
.w-row .w-rank { font-family: var(--font-display); font-style: italic; color: var(--muted); font-size: 15px; width: 24px; }
.w-row .w-name { font-weight: 700; font-size: 14.5px; }
.w-row .w-count { color: var(--muted); font-size: 12.5px; }
.search-box { position: relative; }
.search-box input {
  width: 100%; padding: 13px 16px 13px 42px; border: 1.5px solid var(--line);
  border-radius: 999px; background: var(--surface-2); font-size: 14px; outline: none; transition: all .15s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

/* -------- Notificaciones -------- */
.notif-row {
  display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: var(--accent-soft); }
.notif-row.unread:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface-2)); }
.notif-glyph { font-size: 20px; width: 30px; text-align: center; flex-shrink: 0; padding-top: 4px; }
.notif-text { font-size: 14px; flex: 1; min-width: 0; }
.notif-text b { font-weight: 700; }
.notif-time { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* -------- DMs -------- */
.dm-wrap { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 70px); }
@media (max-width: 860px) {
  .page-head { padding: 10px 12px; gap: 8px; }
  .page-head .back { margin-left: 0; }
  .page-head .ph-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 860px) { .dm-wrap { grid-template-columns: 1fr; } }
.dm-list { border-right: 1px solid var(--line); }
.dm-list-item { display: flex; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background .12s; }
.dm-list-item:hover, .dm-list-item.active { background: var(--surface-2); }
.dm-list-item .d-msg { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.dm-list-item .d-unread { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
.dm-thread { display: flex; flex-direction: column; height: calc(100vh - 70px); }
.dm-thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.dm-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dm-bubble {
  max-width: 70%; padding: 10px 15px; border-radius: 18px; font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; word-wrap: break-word; position: relative;
}
.dm-bubble.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.dm-bubble.theirs { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.dm-bubble .dm-time { display: block; font-size: 10.5px; opacity: .65; margin-top: 4px; }
.dm-input { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.dm-input input {
  flex: 1; padding: 12px 16px; border: 1.5px solid var(--line-strong); border-radius: 999px;
  background: var(--surface-2); font-size: 14.5px; outline: none;
}
.dm-input input:focus { border-color: var(--accent); }
.dm-input button {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 999px;
  padding: 12px 20px; font-weight: 700;
}
.dm-none { color: var(--muted); text-align: center; padding: 40px; font-style: italic; font-family: var(--font-display); }

/* -------- Imagen ampliada -------- */
.zoom-img { max-width: 100%; max-height: 82vh; border-radius: 8px; margin: 0 auto; display: block; }

/* -------- Badges -------- */
.nav-badge {
  margin-left: auto;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; min-width: 19px; height: 19px; padding: 0 6px;
  font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 1180px) { .nav-badge { position: absolute; margin-left: 26px; margin-top: -8px; } }

/* -------- Toast -------- */
#toast-region { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--bg); padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop);
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1.3);
}
.toast.err { background: var(--accent); color: var(--accent-ink); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* -------- Spinner / carga -------- */
.loading-row { padding: 40px; text-align: center; color: var(--muted); }
.loading-row .spin {
  display: inline-block; width: 26px; height: 26px; border: 3px solid var(--line-strong);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- Micro -------------------------------- */
.divider-tag { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; padding: 10px 20px; }
.divider-tag::before, .divider-tag::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  padding: 20px 20px 8px;
}
.theme-switch { display: flex; gap: 8px; }
.theme-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.theme-dot:hover { transform: scale(1.12); }
.theme-dot.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.td-paper { background: #F3ECDC; }
.td-ink { background: #1E1A12; }
.td-dusk { background: #151A26; }

.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.settings-row .s-label { font-weight: 600; }
.settings-row .s-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.emoji-pick { display: none; }
.avatar-preview-row { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.avatar-preview-row .avatar-lg { border: 3px solid var(--line-strong); }

@media (max-width: 860px) {
  .dm-list { display: none; }
  .dm-list.show-mobile { display: block; }
  .dm-thread.hide-mobile { display: none; }
}
