:root {
  color-scheme: dark;
  --bg: #090d14;
  --surface: #111827;
  --surface-2: #172033;
  --text: #f4f7fb;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.1);
  --brand: #58f2b2;
  --blue: #6db8ff;
  --coral: #ff7a76;
  --gold: #ffd166;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.36);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(88, 242, 178, 0.09), transparent 28%),
    linear-gradient(225deg, rgba(255, 122, 118, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

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

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

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

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: rgba(9, 13, 20, 0.84);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
}

.brand,
.avatar-link,
.user-main,
.conversation,
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--blue));
  color: #061016;
  font-weight: 800;
}

.brand small,
.avatar-link small,
.user-main small,
.conversation small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.nav-exit {
  color: var(--coral) !important;
}

.avatar-link img,
.user-main img,
.conversation img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.flash.success {
  border-color: rgba(88, 242, 178, 0.45);
}

.flash.error {
  border-color: rgba(255, 122, 118, 0.55);
}

.auth-grid,
.grid.two,
.feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.feed-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.auth-copy {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 60px) 0;
}

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

h1 {
  font-size: clamp(34px, 6vw, 68px);
  line-height: 1.02;
  margin-bottom: 16px;
}

.panel h1,
.profile-hero h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: 24px;
  margin-bottom: 14px;
}

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.eyebrow {
  display: inline-flex;
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.panel,
.post,
.profile-hero {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

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

.form.compact {
  gap: 10px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(88, 242, 178, 0.7);
  box-shadow: 0 0 0 3px rgba(88, 242, 178, 0.12);
}

.btn,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--brand), var(--blue));
  color: #061016;
  font-weight: 800;
  cursor: pointer;
}

.btn.ghost,
button.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.btn.wide {
  width: 100%;
}

.auth-page .panel .btn.wide {
  min-height: 44px;
  max-height: 48px;
  padding: 10px 14px;
  font-size: 16px;
}

.auth-page .panel .btn.wide .icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.text-link,
.link-button {
  color: var(--brand);
  background: transparent;
  padding: 0;
  min-height: 0;
  border: 0;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.break {
  overflow-wrap: anywhere;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-row,
.inline-controls,
.action-row,
.chip-row,
.stats,
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.cards,
.stack,
.post-stack {
  display: grid;
  gap: 12px;
}

.user-card,
.conversation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  padding: 10px;
}

.pill,
.social-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--line);
}

.social-chip {
  color: var(--text);
}

.search {
  display: flex;
  gap: 8px;
  min-width: min(100%, 380px);
}

.profile-hero {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 180px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.stats strong {
  color: var(--brand);
}

.story-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0 16px;
  margin-bottom: 6px;
}

.story-dot {
  flex: 0 0 78px;
  display: grid;
  gap: 7px;
  justify-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

button.story-dot {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
}

.story-dot img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--brand);
}

.story-tray {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 16px;
  margin-bottom: 8px;
}

.story-avatar-wrap {
  position: relative;
  display: inline-grid;
}

.story-avatar-wrap img {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

.story-dot.has-story .story-avatar-wrap img {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(88, 242, 178, 0.12);
}

.story-dot.mine .story-avatar-wrap b {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--blue));
  color: #061016;
  border: 2px solid var(--bg);
}

.story-dot.mine .story-avatar-wrap b .icon {
  width: 14px;
  height: 14px;
}

.story-sheet {
  width: min(100%, 560px);
}

.story-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.story-upload-form {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.upload-choice {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.upload-choice .icon {
  width: 28px;
  height: 28px;
  color: var(--brand);
}

.upload-choice input {
  max-width: 220px;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.story-reply-form {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reply-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.reply-card p {
  margin: 0;
}

.reply-card > small {
  color: var(--muted);
}

.grid-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tile {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.tile p,
.tile small {
  padding: 10px;
  margin: 0;
}

.tile-media {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #05070b;
}

.composer {
  position: sticky;
  top: 92px;
}

.post {
  padding: 0;
  overflow: hidden;
}

.post header,
.post footer,
.comments,
.post-body {
  padding: 12px 14px;
}

.post header,
.post footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.post-media {
  width: 100%;
  max-height: 740px;
  object-fit: contain;
  background: #05070b;
}

.post-body {
  margin: 0;
  font-size: 16px;
}

.post footer {
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.comments {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.comments p {
  margin: 0;
}

.comments form {
  display: flex;
  gap: 8px;
}

.qr-panel {
  text-align: center;
}

.qr-img {
  width: min(100%, 420px);
  margin: 14px auto;
  border-radius: 8px;
  border: 10px solid #fff;
  background: #fff;
}

.qr-preview {
  display: grid;
  place-items: center;
  min-height: 420px;
}

.phone-card {
  width: min(100%, 280px);
  min-height: 440px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101827;
  padding: 24px;
  display: grid;
  gap: 16px;
  align-content: center;
  text-align: center;
}

.mini-avatar {
  width: 82px;
  height: 82px;
  margin: 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--coral));
}

.fake-qr {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border: 10px solid #fff;
  background:
    linear-gradient(90deg, #000 14px, transparent 14px) 0 0 / 28px 28px,
    linear-gradient(#000 14px, transparent 14px) 0 0 / 28px 28px,
    #fff;
}

.conversation {
  position: relative;
}

.conversation em {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  font-style: normal;
  font-size: 12px;
}

.chat {
  min-height: 70vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.chat-head {
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.chat-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 360px;
  max-height: 65vh;
  overflow: auto;
  padding: 4px;
}

.bubble {
  max-width: min(78%, 560px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.bubble.mine {
  align-self: flex-end;
  background: rgba(88, 242, 178, 0.13);
}

.bubble.theirs {
  align-self: flex-start;
}

.bubble p {
  margin-bottom: 6px;
}

.bubble small {
  color: var(--muted);
  font-size: 11px;
}

.message-media {
  max-height: 320px;
  border-radius: 8px;
  object-fit: contain;
  background: #05070b;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 240px) auto;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.story-view {
  display: grid;
  gap: 14px;
}

.story-media {
  max-height: 76vh;
  margin: 0 auto;
  border-radius: 8px;
  background: #05070b;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.metric strong {
  display: block;
  font-size: 28px;
  color: var(--brand);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 22px;
  overflow: hidden;
  border-radius: 8px;
}

th,
td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 209, 102, 0.42);
  color: var(--gold);
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 18px, 680px);
    padding-bottom: 86px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand small,
  .nav .avatar-link span {
    display: none;
  }

  .nav {
    gap: 4px;
  }

  .nav a {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 13px;
  }

  .auth-grid,
  .grid.two,
  .feed-layout {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: unset;
    padding: 18px 0;
  }

  .composer {
    position: static;
  }

  .profile-hero {
    grid-template-columns: 1fr;
  }

  .profile-avatar {
    width: 130px;
  }

  .grid-gallery,
  .metrics,
  .social-grid {
    grid-template-columns: 1fr;
  }

  .inline-controls,
  .chat-form,
  .comments form,
  .search {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 92%;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.brand-mark {
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav a {
  gap: 7px;
}

.mobile-tabbar {
  display: none;
}

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

.icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
}

.icon-button span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.icon-button.liked {
  color: var(--coral);
  border-color: rgba(255, 122, 118, 0.45);
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.range-grid,
.qr-style-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.avatar-cropper {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

#avatarPreview {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.post-actions {
  justify-content: flex-start !important;
}

.post-actions form {
  margin: 0;
}

.views {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.views .icon {
  width: 17px;
  height: 17px;
}

.comments.is-collapsed {
  display: none;
}

.comments form input {
  min-width: 0;
}

.sheet[hidden] {
  display: none;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 18px;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.sheet-panel {
  position: relative;
  width: min(100%, 460px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101827;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.qr-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(88, 242, 178, 0.12), rgba(109, 184, 255, 0.06)),
    var(--surface);
}

.qr-card h2 {
  margin-bottom: 0;
}

.qr-emoji {
  position: absolute;
  right: 10px;
  top: 6px;
  font-size: 52px;
  opacity: 0.16;
  pointer-events: none;
}

.qr-img.small {
  width: min(100%, 220px);
  margin: 6px auto;
  border-width: 8px;
}

.qr-modal {
  display: grid;
  justify-items: center;
  text-align: center;
}

.site-hero-image,
.admin-site-image {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.site-hero-image {
  min-height: 420px;
  max-height: 560px;
}

.admin-site-image {
  aspect-ratio: 16 / 10;
  margin-bottom: 14px;
}

.admin-site-image.empty {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.admin-site-image.empty .icon {
  width: 54px;
  height: 54px;
}

.shared-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.shared-card small {
  display: block;
  color: var(--muted);
}

.shared-media {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 8px;
  background: #05070b;
}

.single-layout,
.reels-page {
  width: min(760px, 100%);
  margin: 0 auto;
}

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

.reel-card {
  min-height: 78vh;
}

.reel-card .reel-media {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #05070b;
}

.single-post .post-media,
.single-post .reel-media {
  max-height: 82vh;
}

@media (max-width: 860px) {
  .shell {
    padding-bottom: 118px;
  }

  .topbar {
    position: static;
  }

  .topbar .main-nav {
    display: none;
  }

  .mobile-tabbar {
    position: fixed;
    left: 9px;
    right: 9px;
    bottom: 9px;
    z-index: 40;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(64px, 1fr);
    overflow-x: auto;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(9, 13, 20, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
  }

  .mobile-tabbar a {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    text-decoration: none;
    border-radius: 8px;
    min-width: 64px;
    flex-direction: column;
    gap: 3px;
    justify-content: center;
    text-align: center;
    padding: 7px 8px;
  }

  .mobile-tabbar a.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
  }

  .nav-label {
    font-size: 11px;
  }

  .qr-grid,
  .range-grid,
  .qr-style-row,
  .story-upload-grid {
    grid-template-columns: 1fr;
  }

  .site-hero-image {
    min-height: 320px;
  }
}
