/* ==========================================================================
   KavyaManch – Bilingual Editorial-Social Design System
   Light: Ivory (#FAF7F2) · Surface (#FFFFFF) · Burgundy (#542333)
          Muted Rose (#EADDE0) · Antique Gold (#B89455) · Charcoal (#282629)
   Dark:  Canvas (#191619) · Card (#262126) · Primary (#8C435B)
          Accent (#C5A15A) · Text (#F7F0E9)
   ========================================================================== */

:root {
  /* Light Theme Palette */
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-muted: #F3EDE6;
  --surface-tint: #F7F2EB;

  --text: #282629;
  --text-muted: #77747A;
  --border: #E8E2DA;
  --border-strong: #D7CFC4;

  --accent: #542333;
  --accent-hover: #6B2E42;
  --accent-soft: #F5ECEE;
  --secondary-rose: #EADDE0;
  --secondary-rose-hover: #DFCDD1;
  --gold: #B89455;
  --gold-ink: #8E6E35;

  /* Semantic States */
  --success: #166534;
  --success-bg: #F0FDF4;
  --danger: #991B1B;
  --danger-bg: #FEF2F2;
  --info: #1E40AF;
  --info-bg: #EFF6FF;

  /* Subtle Minimal Elevation */
  --shadow-sm: 0 1px 2px rgba(40, 38, 41, 0.04);
  --shadow-card: 0 1px 3px rgba(40, 38, 41, 0.04), 0 4px 14px rgba(40, 38, 41, 0.03);
  --shadow-card-hover: 0 4px 14px rgba(40, 38, 41, 0.07), 0 1px 3px rgba(84, 35, 51, 0.06);
  --shadow-md: 0 10px 28px rgba(40, 38, 41, 0.12);

  /* Geometry & Typography */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: 'Inter', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Noto Serif', 'Noto Serif Devanagari', Georgia, serif;
  --header-height: 58px;
  --nav-height: 60px;
  --ease-ui: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #191619;
  --surface: #262126;
  --surface-elevated: #2D272D;
  --surface-muted: #312A31;
  --surface-tint: #2B242B;

  --text: #F7F0E9;
  --text-muted: #B2AAB0;
  --border: #3B343B;
  --border-strong: #4E454E;

  --accent: #8C435B;
  --accent-hover: #A14F6A;
  --accent-soft: #35232A;
  --secondary-rose: #3B2930;
  --secondary-rose-hover: #4A333C;
  --gold: #C5A15A;
  --gold-ink: #C5A15A;

  --success: #86EFAC;
  --success-bg: #14281D;
  --danger: #FCA5A5;
  --danger-bg: #361A1E;
  --info: #93C5FD;
  --info-bg: #18253A;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 6px 18px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.55);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  padding-top: var(--header-height);
  padding-bottom: calc(var(--nav-height) + 24px);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.16s var(--ease-ui);
}

a:hover {
  text-decoration: underline;
}

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

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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

.km-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   Compact Literary Header (58px, Clean Surface + Language Switcher)
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 60;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  flex-shrink: 1;
}

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

.brand-emblem {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #FFFFFF;
  border: 1px solid var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.12rem;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

@media (max-width: 640px) {
  .brand-tagline {
    display: none;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Bilingual Language Switcher */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--text-muted);
}

.lang-switcher-icon {
  display: inline-flex;
  align-items: center;
  padding: 0 3px 0 4px;
  color: var(--text-muted);
}

.lang-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 28px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-option:hover {
  text-decoration: none;
  color: var(--text);
  background: var(--surface-muted);
}

.lang-option.is-active {
  background: var(--accent);
  color: #FFFFFF;
}

.header-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.header-icon-btn:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  text-decoration: none;
  color: var(--accent);
}

.header-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--surface);
  font-variant-numeric: tabular-nums;
}

.header-write-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 13px;
  border-radius: 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  transition: background-color 0.16s ease, transform 0.15s ease;
}

.header-write-btn:hover {
  text-decoration: none;
  background: var(--accent-hover);
  color: #FFFFFF;
}

.header-write-btn:active {
  transform: scale(0.98);
}

.header-ghost-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-ghost-link:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

@media (max-width: 480px) {
  .header-write-label {
    display: none;
  }
  .header-write-btn {
    padding: 6px 10px;
  }
  .lang-switcher-icon {
    display: none;
  }
}

/* ==========================================================================
   App Shell Grid & Desktop Sidebar
   ========================================================================== */
.app-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.desktop-sidebar {
  display: none;
}

.main-column {
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  min-width: 0;
}

@media (min-width: 900px) {
  body {
    padding-bottom: 36px;
  }

  .mobile-bottom-nav {
    display: none !important;
  }

  .app-shell {
    grid-template-columns: 248px 1fr;
    align-items: start;
    padding: 24px 18px;
  }

  .desktop-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + 18px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 10px;
    box-shadow: var(--shadow-card);
  }

  .sidebar-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 10px 10px 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    font-size: 0.91rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .sidebar-link-main {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }

  .sidebar-link-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-link:hover {
    background: var(--surface-muted);
    text-decoration: none;
    color: var(--text);
  }

  .sidebar-link.active {
    background: var(--secondary-rose);
    color: var(--accent);
    font-weight: 700;
  }

  [data-theme="dark"] .sidebar-link.active {
    color: var(--text);
  }
}

/* ==========================================================================
   Mobile Bottom Navigation (5 Tabs: Home, Explore, Create, Mehfil, Profile)
   ========================================================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(40, 38, 41, 0.06);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 65;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  min-height: 44px;
  transition: color 0.15s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  text-decoration: none;
  color: var(--accent);
}

[data-theme="dark"] .mobile-nav-item.active {
  color: var(--gold);
}

.mobile-nav-create {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.mobile-nav-item:active .mobile-nav-create {
  transform: scale(0.94);
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.63rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Editorial Cards, Surfaces, Dividers & Typography
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.post-card,
.interactive-card {
  transition: transform 0.18s var(--ease-ui), box-shadow 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
  .post-card:hover,
  .interactive-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
  }
}

.studio-card,
.reader-surface {
  transform: none !important;
}

.hero-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold);
}

.auth-card {
  max-width: 460px;
  margin: 18px auto;
  padding: 26px 24px;
  border-top: 2px solid var(--gold);
}

.page-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: balance;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.91rem;
}

.gold-divider {
  height: 1px;
  border: 0;
  margin: 12px 0;
  background: var(--border);
}

.empty-state-card {
  text-align: center;
  padding: 34px 22px;
  background: var(--surface);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--gold-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

/* Literary Typography */
.poetry-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  user-select: text;
  margin: 12px 0;
  max-width: 68ch;
}

.poetry-title {
  font-family: var(--font-serif);
  font-size: 1.24rem;
  font-weight: 700;
  line-height: 1.38;
  margin: 10px 0 6px;
  text-wrap: balance;
}

.hashtag-link {
  color: var(--accent);
  font-weight: 600;
}

[data-theme="dark"] .hashtag-link {
  color: var(--gold);
}

/* ==========================================================================
   Buttons & Touch Targets (Minimum 44px accessible interactive targets)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.15s ease;
}

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

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background: var(--secondary-rose);
  border-color: transparent;
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--secondary-rose-hover);
}

.btn-gold {
  background: var(--surface-tint);
  border-color: var(--gold);
  color: var(--gold-ink);
}

.btn-gold:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="dark"] .btn-gold {
  color: var(--gold);
}

[data-theme="dark"] .btn-gold:hover {
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  min-height: 40px;
  padding: 6px 11px;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.btn-ghost.is-active {
  color: var(--accent);
  background: var(--secondary-rose);
}

.btn-sm {
  min-height: 38px;
  padding: 6px 13px;
  font-size: 0.84rem;
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.89rem;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 148, 85, 0.2);
}

textarea.form-control {
  min-height: 130px;
  resize: vertical;
}

.form-control-sm {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.86rem;
  width: auto;
}

.form-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.81rem;
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.91rem;
  border: 1px solid transparent;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(153, 27, 27, 0.25);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(22, 101, 52, 0.25);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(30, 64, 175, 0.22);
}

/* ==========================================================================
   Tabs & Clean Unboxed Metadata
   ========================================================================== */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.91rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-link:hover {
  text-decoration: none;
  color: var(--text);
}

.tab-link.active {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
}

[data-theme="dark"] .tab-link.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Minimal Category Tag (zero pill clutter) */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  color: var(--accent);
  white-space: nowrap;
}

[data-theme="dark"] .category-badge {
  color: var(--gold);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

a.chip:hover {
  text-decoration: none;
  border-color: var(--gold);
  color: var(--accent);
}

.post-meta-strip {
  font-size: 0.81rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Post Card Header, MoreHorizontal Dropdown & Action Bar
   ========================================================================== */
.post-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.post-author-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.post-author-name {
  font-weight: 700;
  color: var(--text);
  display: block;
  line-height: 1.25;
}

.post-author-meta {
  font-size: 0.81rem;
  color: var(--text-muted);
}

.post-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.more-menu {
  position: relative;
}

.more-menu summary {
  list-style: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.more-menu summary::-webkit-details-marker {
  display: none;
}

.more-menu summary:hover,
.more-menu[open] summary {
  background: var(--surface-muted);
  color: var(--text);
}

.more-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 196px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.more-menu-item:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

.more-menu-item.is-danger {
  color: var(--danger);
}

.post-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.action-btn:hover {
  background: var(--surface-muted);
  text-decoration: none;
  color: var(--text);
}

.action-btn.is-active {
  color: var(--accent);
  background: var(--secondary-rose);
}

[data-theme="dark"] .action-btn.is-active {
  color: var(--gold);
}

/* Clean all-around bordered callout (zero thick left borders) */
.reply-link-banner,
.collab-section-box {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

/* ==========================================================================
   Writer Profile Portfolio
   ========================================================================== */
.profile-header-card {
  padding: 0;
  overflow: hidden;
}

.profile-cover-banner {
  height: 88px;
  background: var(--accent);
  border-bottom: 2px solid var(--gold);
  position: relative;
}

.profile-header-inner {
  padding: 0 20px 20px;
}

.profile-top {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  margin-top: -36px;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
}

.avatar-lg {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  background: var(--surface);
}

.avatar-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Discover & Community Hub Grids
   ========================================================================== */
.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 540px) {
  .hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hub-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.hub-tile-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.hub-tile:hover {
  text-decoration: none;
  border-color: var(--gold);
  background: var(--surface-tint);
}

.kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .kpi-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.kpi-box {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
}

/* ==========================================================================
   Create Studio & Poetry Card Generator
   ========================================================================== */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.studio-editor-box {
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.85;
  background: var(--surface);
}

.draft-status-pill {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.card-preview-frame {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#poetryCardCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

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

@media (min-width: 560px) {
  .template-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.template-btn {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.template-btn.active {
  border-color: var(--accent);
  background: var(--secondary-rose);
  color: var(--accent);
}

[data-theme="dark"] .template-btn.active {
  border-color: var(--gold);
  color: var(--text);
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 540px) {
  .controls-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .checkbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

/* ==========================================================================
   Feed Filters, Books, Covers, TOC & Distraction-Free Reader
   ========================================================================== */
.feed-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.post-media-img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
}

.book-card-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 10px;
}

.book-thumb-sm {
  width: 82px;
  height: 118px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  background: var(--surface-muted);
}

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

@media (min-width: 560px) {
  .book-hero {
    flex-direction: row;
    align-items: flex-start;
  }
}

.book-cover-lg {
  width: 136px;
  height: 194px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--gold);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  margin: 0 auto;
}

@media (min-width: 560px) {
  .book-cover-lg {
    margin: 0;
  }
}

.book-cover-fallback {
  background: var(--accent);
  color: #FAF7F2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

[data-theme="dark"] .progress-fill {
  background: var(--gold);
}

.toc-list {
  display: flex;
  flex-direction: column;
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

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

/* Reader Progress Bar & Comfort Toolbar */
.reader-scroll-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 62;
  pointer-events: none;
}

#readerScrollFill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.1s linear;
}

.reader-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.87rem;
  margin-bottom: 12px;
}

.reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
}

.reader-tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.reader-surface {
  margin-left: auto;
  margin-right: auto;
  transition: max-width 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.reader-surface[data-reader-width="narrow"] { max-width: 560px; }
.reader-surface[data-reader-width="comfort"] { max-width: 700px; }
.reader-surface[data-reader-width="wide"] { max-width: 860px; }

.reader-surface[data-reader-theme="light"] {
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --surface-muted: #F3EDE6;
  --text: #282629;
  --text-muted: #77747A;
  --border: #E8E2DA;
  background: #FFFFFF;
  color: #282629;
}

.reader-surface[data-reader-theme="sepia"] {
  --surface: #F6EEDB;
  --surface-elevated: #F6EEDB;
  --surface-muted: #EBDFC4;
  --text: #3B2D1E;
  --text-muted: #6F5A43;
  --border: #DECFA9;
  background: #F6EEDB;
  color: #3B2D1E;
}

.reader-surface[data-reader-theme="dark"] {
  --surface: #191619;
  --surface-elevated: #262126;
  --surface-muted: #312A31;
  --text: #F7F0E9;
  --text-muted: #B2AAB0;
  --border: #3B343B;
  background: #191619;
  color: #F7F0E9;
}

.reader-body {
  font-size: 1.14rem;
  line-height: 1.92;
  margin: 18px 0;
}

.chapter-nav-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Distraction-Free Focus Mode */
body.is-focus-mode .desktop-sidebar,
body.is-focus-mode .mobile-bottom-nav,
body.is-focus-mode .site-footer {
  display: none !important;
}

body.is-focus-mode .app-shell {
  grid-template-columns: 1fr !important;
  max-width: 920px;
}

body.is-focus-mode .main-column {
  max-width: 860px;
}

/* ==========================================================================
   Community Battles & Prompts
   ========================================================================== */
.battle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (min-width: 640px) {
  .battle-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.battle-corner {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.battle-corner.is-winner {
  border-color: var(--gold);
  background: var(--surface-tint);
}

.featured-prompt-box {
  border: 1px solid var(--gold);
  background: var(--surface-tint);
  border-radius: 10px;
  padding: 13px;
  margin-bottom: 10px;
}

/* Loading Skeleton Utility */
.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-tint) 50%, var(--surface-muted) 75%);
  background-size: 200% 100%;
  animation: kmShimmer 1.4s infinite linear;
}

@keyframes kmShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

/* Footer */
.site-footer {
  max-width: 740px;
  margin: 26px auto 0;
  padding: 16px 12px 6px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
