:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #1a1f2c;
  --muted: #5a6478;
  --primary: #f56040;
  --border: #e3e6ee;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #ffe6e0 0, transparent 45%),
    radial-gradient(circle at 90% 20%, #e7f0ff 0, transparent 40%), var(--bg);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  position: relative;
}

.top-header {
  display: block;
  padding-right: 96px;
}

.top-header-copy {
  min-width: 0;
}

.language-switcher {
  position: absolute;
  top: 2rem;
  right: 1rem;
  z-index: 40;
}

.language-button {
  min-width: 80px;
  height: 40px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.language-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  max-height: 360px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 25, 45, 0.12);
  padding: 0.35rem;
  z-index: 50;
}

.language-option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
}

.language-option:hover {
  background: #f3f6fc;
}

.language-option.is-active {
  background: #eef1f7;
  font-weight: 700;
}

h1 {
  margin: 0 0 0.6rem;
}

p {
  color: var(--muted);
  margin-top: 0;
}

.search-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1.2rem;
}

.subscription-help {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.row {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.6rem;
}

input {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 0 0.9rem;
  font-size: 1rem;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0 1rem;
  min-width: 140px;
  background: linear-gradient(135deg, #fd7e4f, var(--primary));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.status {
  min-height: 1.5rem;
  margin-top: 1rem;
  color: var(--muted);
}

.meta {
  margin: 0.4rem 0 1rem;
  font-size: 0.94rem;
  color: var(--muted);
}

.profile {
  margin: 0.4rem 0 1rem;
}

.profile-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.profile-avatar-stack {
  position: relative;
  width: 72px;
  height: 72px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f0f2f8;
}

.profile-avatar-link {
  display: inline-block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.profile-avatar-open {
  border: 0;
  padding: 0;
  min-width: 0;
  background: transparent;
  cursor: zoom-in;
}

.profile-avatar-download {
  width: 30px;
  height: 30px;
  min-width: 0;
  padding: 0;
  border-radius: 999px;
  border: 3px solid #fff;
  background: #16d39a;
  color: #fff;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;
  position: absolute;
  right: -4px;
  bottom: -2px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.profile-avatar-download:hover {
  filter: brightness(0.96);
}

.avatar-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 25, 0.68);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 1rem;
}

.avatar-modal[hidden] {
  display: none;
}

.avatar-modal-card {
  position: relative;
  width: min(96vw, 920px);
  max-height: min(92vh, 920px);
}

.avatar-modal-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(92vh, 920px);
  object-fit: contain;
  border-radius: 10px;
}

.avatar-modal-download {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 46px;
  height: 46px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #16d39a;
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 1.2rem;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.profile-fullname-link {
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
}

.profile-fullname-link:hover {
  text-decoration: underline;
}

.profile-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.profile-private-banner {
  margin-top: 0.55rem;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #ffd4c6;
  background: #fff1eb;
  color: #cf4e2e;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
  padding: 0.65rem 0.85rem;
}

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

.verified-badge {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #2b8cff;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.profile-link {
  color: #e45b39;
  text-decoration: none;
}

.profile-link:hover {
  text-decoration: underline;
}

.profile-stats {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.profile-bio {
  margin: 0.4rem 0 0;
  white-space: pre-wrap;
  font-size: 0.93rem;
}

.profile-bio a {
  color: #e45b39;
  text-decoration: none;
}

.profile-bio a:hover {
  text-decoration: underline;
}

.account-sections {
  margin-top: 0.8rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  padding-top: 0.7rem;
}

.account-tab {
  border: 0;
  background: transparent;
  color: #9aa3b4;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  padding: 0.2rem 0.3rem;
  border-radius: 8px;
  min-width: 0;
}

.account-tab.is-active {
  color: var(--text);
  background: #eef1f7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img,
.card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: transparent;
}

.card .tag {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.media-caption {
  padding: 0 0.7rem 0.45rem;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.45;
  min-height: 5.8rem;
  max-height: 11rem;
  overflow: auto;
}

.media-meta {
  padding: 0 0.7rem 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.story-time {
  padding-top: 0.8rem;
  font-size: 1rem;
  font-weight: 700;
}

.download-button {
  display: block;
  margin: auto 0.7rem 0.8rem;
  text-align: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #16c784, #0ea86d);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.download-button:hover {
  filter: brightness(0.97);
}

.highlight-empty,
.card-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 1rem;
  text-align: center;
}

.infinite-loader {
  grid-column: 1 / -1;
  margin: 0.6rem 0 0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.infinite-loader-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.scroll-sentinel {
  width: 1px;
  height: 1px;
}

.grid.highlights-view {
  display: block;
}

.highlights-carousel {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.4rem 0 0.7rem;
  scrollbar-width: thin;
}

.highlight-pill {
  border: 0;
  background: transparent;
  color: var(--text);
  min-width: 92px;
  width: 92px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.highlight-pill.is-active .highlight-pill-thumb {
  outline: 3px solid #fd7e4f;
  outline-offset: 2px;
}

.highlight-pill-thumb {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #f0f2f8;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
}

.highlight-pill-title {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highlight-stories-wrap {
  margin-top: 0.5rem;
}

.highlight-stories-grid {
  margin-top: 0.2rem;
}

@media (max-width: 600px) {
  .top-header {
    padding-right: 74px;
  }

  .language-switcher {
    top: 1.55rem;
    right: 1rem;
  }

  .row {
    flex-direction: column;
  }

  button {
    height: 42px;
  }

  .card img,
  .card video {
    aspect-ratio: 9 / 16;
  }
}
