:root {
  --bg: #000;
  --surface: #0a0a0a;
  --text: #fff;
  --text-dim: #a3a3a3;
}

* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: #000; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: inherit; }

/* PUBLIC PAGE */
.page-shell {
  position: relative;
  min-height: 100vh;
  background: #000;
  overflow-x: hidden;
}

.page-shell-bg {
  position: fixed;
  inset: 0; z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(60px) saturate(1.2) brightness(0.55);
  transform: scale(1.2);
  pointer-events: none;
}

@media (max-width: 600px) {
  .page-shell-bg { display: none; }
}

.page-column {
  position: relative; z-index: 1;
  max-width: 430px;
  margin: 0 auto;
}

@media (min-width: 601px) {
  .page-column {
    margin-top: 32px; margin-bottom: 32px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    background: #000;
  }
}

.hero-wrap {
  position: relative;
  width: 100%;
  height: auto;
}

.hero {
  position: sticky;
  top: 0;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  overflow: hidden;
  z-index: 1;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Static gradient at bottom of hero — stronger and longer so it blends seamlessly into caption row */
.hero-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 30%,
    rgba(0,0,0,0.5) 65%,
    rgba(0,0,0,0.95) 92%,
    #000 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Scroll-driven black overlay that fades hero to dark as user scrolls past it.
   Uses CSS animation-timeline (modern browsers) with fallback. */
.hero-scroll-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  animation: hero-darken linear both;
  animation-timeline: view();
  animation-range: exit 0% exit 100%;
}

@keyframes hero-darken {
  from { opacity: 0; }
  to   { opacity: 0.92; }
}

/* Caption row sits flush against hero with no visible seam */
.caption-row {
  position: relative;
  z-index: 4;
  padding: 0 16px 14px;
  margin-top: -2px; /* eliminates any sub-pixel gap */
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #000;
}

.hero-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center;
  padding: 0 24px 28px; text-align: center;
  z-index: 4;
}

.hero-name {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.02em; line-height: 1.1;
  text-shadow: 0 2px 16px rgba(0,0,0,0.5);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  filter: drop-shadow(0 2px 6px rgba(123,140,255,0.4));
  vertical-align: -2px;
}

.verified-badge svg {
  display: block;
}

.hero-handle {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px; font-weight: 500;
}

.hero-socials {
  display: flex; gap: 14px;
  margin-top: 14px;
  align-items: center; justify-content: center;
}

.hero-socials a {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  transition: transform .15s ease;
  text-decoration: none;
}

.hero-socials a:hover { transform: scale(1.08); }

.link-card {
  position: relative; display: block;
  width: calc(100% - 16px);
  margin: 0 8px 8px;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  transition: transform .15s ease, box-shadow .2s ease;
  cursor: pointer; text-decoration: none; color: #fff;
}

.link-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  /* Default smooth rendering — explicitly auto so iOS uses high-quality bilinear/bicubic */
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}

.link-card-fade {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 50%, rgba(0,0,0,0.85) 100%);
}

.link-card-label {
  position: absolute; bottom: 14px; left: 0; right: 0;
  text-align: center; font-weight: 700; font-size: 17px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
  letter-spacing: -0.01em;
}

.link-card-badge {
  position: absolute; top: 10px; left: 10px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  font-size: 16px; font-weight: 700;
  /* subtle drop shadow so logo stays readable on light photos */
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.link-card-badge svg,
.link-card-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* The "?" help badge keeps a subtle background so it's visible on its own */
.link-card-badge.is-help {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
}

/* ADMIN */
.admin-shell {
  background: #0a0a0a;
  min-height: 100vh; color: #fff;
}

.admin-header {
  border-bottom: 1px solid #1a1a1a;
  background: #080808;
  position: sticky; top: 0; z-index: 10;
}

.admin-header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

.admin-card {
  background: #141414;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}

.admin-input, .admin-select {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}

.admin-input:focus, .admin-select:focus { border-color: #525252; }

.admin-label {
  display: block; font-size: 12px; font-weight: 600;
  color: #a3a3a3; margin: 12px 0 6px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.btn-primary {
  background: #fff; color: #000;
  font-weight: 600; padding: 9px 16px;
  border-radius: 8px; font-size: 14px;
  border: none; cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent; color: #fff;
  border: 1px solid #2a2a2a;
  padding: 9px 16px; border-radius: 8px;
  font-size: 14px; cursor: pointer;
  transition: background .15s;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
}

.btn-ghost:hover { background: #1a1a1a; }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
  background: #2a0a0a; color: #ff6b6b;
  border: 1px solid #4a1a1a;
  padding: 6px 10px; border-radius: 6px;
  font-size: 13px; cursor: pointer;
  font-family: inherit;
}

.btn-danger:hover { background: #3a1010; }

.nav-link {
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: #999; text-decoration: none;
}

.nav-link.active { color: #fff; background: #1a1a1a; }

.flash-ok { color: #4ade80; font-size: 13px; }
.flash-err { color: #ff6b6b; font-size: 13px; }

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

.stat {
  background: #141414; border: 1px solid #262626;
  border-radius: 12px; padding: 18px;
}

.stat-label {
  font-size: 12px; color: #888;
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-value {
  font-size: 28px; font-weight: 700; margin-top: 6px;
}

.bar-list-row {
  margin-bottom: 8px;
}

.bar-list-meta {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 4px;
}

.bar-list-meta span:first-child { color: #ddd; }
.bar-list-meta span:last-child { color: #888; }

.bar-list-track {
  height: 6px; background: #1a1a1a;
  border-radius: 3px; overflow: hidden;
}

.bar-list-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff5da2, #ff7a59);
  border-radius: 3px;
}

.range-tabs {
  display: flex; gap: 4px;
  background: #141414;
  border: 1px solid #1f1f1f;
  border-radius: 8px; padding: 4px;
}

.range-tab {
  padding: 6px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 600;
  background: transparent; color: #888;
  border: none; cursor: pointer; text-decoration: none;
  font-family: inherit;
}

.range-tab.active { background: #fff; color: #000; }

.activity-table {
  width: 100%; font-size: 13px; border-collapse: collapse;
}

.activity-table th {
  color: #888; text-align: left; padding: 8px;
  border-bottom: 1px solid #1a1a1a; font-weight: 600;
}

.activity-table td {
  padding: 8px; border-bottom: 1px solid #141414;
}

.tag-pageview, .tag-click {
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}

.tag-pageview { background: #1a2a3a; color: #5dafff; }
.tag-click { background: #3a1a2a; color: #ff5da2; }

.link-row {
  border: 1px solid #1f1f1f;
  border-radius: 10px; padding: 14px;
  background: #0c0c0c;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .link-row { grid-template-columns: 1fr; }
}

.image-uploader {
  border: 1px dashed #2a2a2a;
  border-radius: 10px;
  padding: 12px;
  display: flex; gap: 12px; align-items: center;
}

.image-preview {
  width: 80px; flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  background-size: cover; background-position: center;
}

.social-row {
  display: grid;
  grid-template-columns: 40px 140px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
}

@media (max-width: 600px) {
  .social-row {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }
  .social-row > select { grid-column: 2; }
  .social-row > input { grid-column: 1 / -1; }
  .social-row > button { grid-column: 1 / -1; justify-self: end; }
}

/* ===== NSFW BADGE ON CARD ===== */
.link-card-nsfw-badge {
  position: absolute;
  top: 10px; right: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ff5da2, #ff7a59);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(255,93,162,0.4);
}

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.open { opacity: 1; }
.modal-overlay[data-inapp="1"] { display: flex; opacity: 1; }

.modal-card {
  background: #0e0e0e;
  border: 1px solid #1f1f1f;
  border-radius: 18px;
  padding: 28px 24px;
  width: 100%;
  max-width: 360px;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: modal-pop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #888;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: #1a1a1a; color: #fff; }

/* ===== AGE WARNING MODAL ===== */
.age-modal-card {
  text-align: center;
}

.age-title {
  font-size: 22px;
  font-weight: 800;
  margin: 4px 0 14px;
  letter-spacing: -0.01em;
  color: #fff;
}

.age-text {
  font-size: 14px;
  line-height: 1.55;
  color: #c0c0c0;
  margin: 0 0 22px;
}

.age-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-modal-cancel,
.btn-modal-go {
  flex: 1;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, opacity 0.15s;
}

.btn-modal-cancel {
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #2a2a2a;
}
.btn-modal-cancel:hover { background: #232323; }

.btn-modal-go {
  background: linear-gradient(135deg, #ff5da2, #ff7a59);
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,93,162,0.4);
}
.btn-modal-go:hover { transform: translateY(-1px); }
.btn-modal-go:active { transform: translateY(0); }

/* ===== IN-APP BROWSER MODAL ===== */
.inapp-modal-card {
  padding: 24px 22px 20px;
}

.inapp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.inapp-icon-wrap {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff5da2, #ff7a59);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,93,162,0.3);
}

.inapp-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.inapp-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #161616;
  border: 1px solid #232323;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.inapp-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5da2, #ff7a59);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inapp-step-text {
  font-size: 14px;
  color: #ddd;
  line-height: 1.4;
}

.inapp-step-text strong {
  color: #fff;
  font-weight: 700;
}

.inapp-app-tag {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: #666;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
