:root {
  --bg: #0d0d0f;
  --card: #17171b;
  --card2: #1f1f26;
  --text: #f5f5f7;
  --muted: #9b9ba4;
  --yellow: #fffc00;
  --yellow-dark: #e6e000;
  --danger: #ff5a5a;
  --radius: 14px;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  min-height: 100vh;
}

/* ---------- header ---------- */
.top {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(180deg, #131316, var(--bg));
  border-bottom: 1px solid #232329;
  position: sticky; top: 0; z-index: 50; backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .ghost { font-size: 34px; }
.brand h1 { margin: 0; font-size: 22px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card2); border: 1px solid #2c2c35; border-radius: 999px;
  padding: 6px 8px; min-width: 340px;
}
.search .at { color: var(--yellow); font-weight: 800; font-size: 18px; padding: 0 2px 0 0; }
.search input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-size: 15px; padding: 8px 4px; direction: ltr; text-align: left;
}
.search input::placeholder { color: #6d6d78; direction: rtl; text-align: right; }
.search button {
  background: var(--yellow); color: #111; border: none; border-radius: 999px;
  padding: 9px 22px; font-size: 14.5px; font-weight: 800; cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.search button:hover { background: var(--yellow-dark); }
.search button:active { transform: scale(.96); }
.search button:disabled { opacity: .55; cursor: wait; }

/* ---------- notice ---------- */
.notice {
  margin: 14px 28px 0; padding: 12px 16px; border-radius: var(--radius);
  background: #2a1d1d; border: 1px solid #573030; color: #ffb3b3; font-size: 14px;
}
.notice.hidden { display: none; }

/* ---------- profile ---------- */
.profile { display: flex; gap: 18px; align-items: flex-start; padding: 26px 28px 8px; }
.avatar-wrap { position: relative; width: 96px; }
#avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  background: var(--card2); border: 2px solid #2c2c35;
}
#snapcode {
  position: absolute; bottom: -14px; left: -14px; width: 44px; height: 44px;
  background: #fff; border-radius: 10px; padding: 3px; border: 1px solid #333;
}
.pinfo { flex: 1; }
.pinfo h2 { margin: 6px 0 2px; font-size: 26px; }
#plink { color: var(--muted); font-size: 14px; text-decoration: none; direction: ltr; display: inline-block; }
#plink:hover { color: var(--yellow); }

.tabs { display: flex; gap: 4px; margin-top: 14px; border-bottom: 1px solid #232329; }
.tab {
  background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 700;
  padding: 10px 18px; cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-color: var(--yellow); }
.tab:hover { color: var(--text); }

/* ---------- grid ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px; padding: 18px 28px 8px;
}
.card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--card); aspect-ratio: 9/14; transition: transform .12s ease;
}
.card:hover { transform: translateY(-3px); }
.card video, .card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .badge {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700;
}
.card .badge.spotlight { background: rgba(255,252,0,.9); color: #111; }
.card .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.card .play span {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff;
  border: 1.5px solid rgba(255,255,255,.35);
}
.card:hover .play span { background: rgba(0,0,0,.75); }

.empty-tab { padding: 30px 28px; color: var(--muted); text-align: center; }
.empty-tab.hidden { display: none; }

/* ---------- more ---------- */
.more-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 28px 30px; }
.more {
  background: var(--card2); color: var(--text); border: 1px solid #2c2c35;
  border-radius: 999px; padding: 12px 34px; font-size: 15px; font-weight: 800; cursor: pointer;
}
.more:hover { border-color: var(--yellow); color: var(--yellow); }
.more:disabled { opacity: .5; cursor: wait; }
.status { color: var(--muted); font-size: 13px; min-height: 18px; }

/* ---------- welcome ---------- */
.welcome { display: flex; justify-content: center; padding: 60px 20px; }
.welcome.hidden, main.hidden { display: none; }
.w-card {
  text-align: center; background: var(--card); border: 1px solid #232329;
  border-radius: 20px; padding: 42px 50px; max-width: 480px;
}
.w-emoji { font-size: 52px; margin-bottom: 8px; }
.w-card h2 { margin: 0 0 10px; }
.w-card p { color: var(--muted); line-height: 1.9; }
.w-card b { color: var(--text); }
.chip {
  background: var(--card2); color: var(--yellow); border: 1px solid #2c2c35;
  border-radius: 999px; padding: 6px 16px; margin: 4px; cursor: pointer; font-size: 13.5px; font-weight: 700;
}
.chip:hover { border-color: var(--yellow); }

/* ---------- viewer ---------- */
.viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.viewer.hidden { display: none; }
#v-video { max-width: min(92vw, 480px); max-height: 80vh; border-radius: 16px; background: #000; }
#v-image { max-width: min(92vw, 480px); max-height: 80vh; border-radius: 16px; background: #000; object-fit: contain; }
.v-bar { display: flex; gap: 18px; align-items: center; color: #ddd; font-size: 14px; }
#v-open { color: var(--yellow); text-decoration: none; }
.v-close {
  position: absolute; top: 18px; left: 18px; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.1); color: #fff; border: none; font-size: 18px; cursor: pointer;
}
.v-close:hover { background: rgba(255,255,255,.2); }

.foot { text-align: center; color: #55555f; font-size: 12px; padding: 18px; }

@media (max-width: 640px) {
  .top { padding: 14px 16px; }
  .search { min-width: 0; width: 100%; }
  .profile { padding: 20px 16px 8px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px 16px 6px; }
  .more-wrap { padding: 14px 16px 24px; }
}