/* YouppyHome — UI styles */
:root {
  --brand: #0f766e;
  --brand-600: #0d6b63;
  --brand-700: #0c5648;
  --brand-050: #e6f3f1;
  --gold: #e8a33d;
  --gold-700: #b45309;

  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface-2: #f8fafa;
  --line: #e4e9e9;
  --text: #0e1726;
  --muted: #5b6b6a;
  --muted-2: #8a9897;
  --danger: #d6455d;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(13, 42, 38, .06), 0 8px 24px rgba(13, 42, 38, .06);
  --shadow-sm: 0 1px 2px rgba(13, 42, 38, .08);
  --nav-h: 64px;
  --maxw: 1120px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1211;
    --surface: #111b19;
    --surface-2: #0e1715;
    --line: #22302d;
    --text: #e8efed;
    --muted: #9fb0ad;
    --muted-2: #74857f;
    --brand-050: #113029;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1211; --surface: #111b19; --surface-2: #0e1715; --line: #22302d;
  --text: #e8efed; --muted: #9fb0ad; --muted-2: #74857f; --brand-050: #113029;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; }
svg { flex: none; }

/* Layout shell */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}
.sidebar { display: none; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + var(--safe-t)) 16px 10px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.3px; font-size: 19px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; display: block; box-shadow: var(--shadow-sm); }
.brand .you { color: var(--brand); }
.brand small { font-weight: 600; color: var(--muted-2); font-size: 11px; display: block; margin-top: -3px; letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text);
}
.iconbtn:hover { background: var(--surface-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px; background: var(--brand);
}

/* Main scroll area */
.main { padding: 16px 16px calc(var(--nav-h) + 24px + var(--safe-b)); }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin: 4px 0 2px; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.section-title { font-size: 16px; font-weight: 800; margin: 22px 2px 10px; display: flex; align-items: center; gap: 8px; }
.section-title .link { margin-left: auto; font-size: 13px; color: var(--brand); font-weight: 600; }

/* Search bar */
.searchbox {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.searchbox input { border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; width: 100%; }
.searchbox svg { color: var(--muted); }

/* Segmented control */
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.segment button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.segment button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Chips / filters */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 8px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Grid of cards */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid.g3 { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .media { position: relative; aspect-ratio: 3 / 2; background: var(--surface-2); }
.card .media img { width: 100%; height: 100%; object-fit: cover; }
.card .media .tagrow { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.badge {
  background: rgba(14,23,38,.72); color: #fff; font-size: 11px; font-weight: 700;
  padding: 5px 9px; border-radius: 8px; backdrop-filter: blur(4px); letter-spacing: .2px;
}
.badge.gold { background: var(--gold); color: #3a2400; }
.badge.brand { background: var(--brand); }
.like {
  position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255,255,255,.9); color: #0e1726; border: 0;
}
.like.on { color: var(--danger); }
.card .body { padding: 12px 14px 14px; }
.price { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.price small { font-weight: 600; color: var(--muted); font-size: 12px; }
.card h3 { font-size: 15px; margin: 4px 0 2px; font-weight: 700; line-height: 1.25; }
.loc { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 5px; }
.specs { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
.specs span { display: inline-flex; align-items: center; gap: 5px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; font-size: 14.5px;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.gold { background: var(--gold); color: #3a2400; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 13px; font-size: 13px; border-radius: 10px; }

/* Detail */
.detail-hero { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.detail-hero .scroller { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.detail-hero .scroller::-webkit-scrollbar { display: none; }
.detail-hero .scroller img { width: 100%; flex: none; scroll-snap-align: center; aspect-ratio: 16/10; object-fit: cover; }
.back {
  position: sticky; top: calc(10px + var(--safe-t)); z-index: 5; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px 8px 10px;
  font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.detail h2 { font-size: 21px; font-weight: 800; margin: 14px 0 4px; letter-spacing: -.4px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.kpi b { display: block; font-size: 17px; }
.kpi span { color: var(--muted); font-size: 12px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.panel h4 { margin: 0 0 10px; font-size: 14px; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); }
.feat-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.feat-list li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.feat-list li svg { color: var(--brand); }
.sys-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.sys-row:last-child { border-bottom: 0; }
.sys-row .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-050); color: var(--brand); flex: none; }
.sys-row .t b { font-size: 13.5px; }
.sys-row .t span { display: block; color: var(--muted); font-size: 12.5px; }

.studio-row { display: flex; align-items: center; gap: 12px; }
.studio-row .av { width: 46px; height: 46px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.verified-pill { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 12px; font-weight: 700; }

.callout { background: var(--brand-050); border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line)); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.callout svg { color: var(--brand); flex: none; }
.callout .t { font-size: 13px; color: var(--text); }
.callout .t b { color: var(--text); font-weight: 800; }

.sticky-cta { position: sticky; bottom: calc(var(--nav-h) + 10px + var(--safe-b)); margin-top: 18px; display: flex; gap: 10px; }

/* Reels */
.reels {
  position: fixed; inset: 0; max-width: var(--maxw); margin: 0 auto;
  background: #000; z-index: 40; overflow-y: auto; scroll-snap-type: y mandatory;
}
.reels .reel {
  position: relative; height: 100dvh; scroll-snap-align: start; display: grid; place-items: center; overflow: hidden;
}
.reels .reel .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reels .reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.reels .reel .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 28%, transparent 55%, rgba(0,0,0,.72) 100%); }
.reels .reel .meta { position: absolute; left: 16px; right: 84px; bottom: calc(var(--nav-h) + 22px + var(--safe-b)); color: #fff; }
.reels .reel .meta .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.reels .reel .meta .who .av { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; font-weight: 800; border: 2px solid rgba(255,255,255,.7); }
.reels .reel .meta .who b { font-size: 15px; }
.reels .reel .meta .cap { font-size: 14px; line-height: 1.4; opacity: .95; }
.reels .reel .meta .proj {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.25); backdrop-filter: blur(6px); padding: 9px 13px; border-radius: 12px; color: #fff; font-weight: 700; font-size: 13px;
}
.reels .reel .rail { position: absolute; right: 12px; bottom: calc(var(--nav-h) + 36px + var(--safe-b)); display: flex; flex-direction: column; gap: 18px; align-items: center; color: #fff; }
.reels .reel .rail button { background: transparent; border: 0; color: #fff; display: grid; place-items: center; gap: 4px; }
.reels .reel .rail .n { font-size: 11px; font-weight: 700; }
.reels .reel .rail .on { color: var(--danger); }
.reels .reel .playpause { position: absolute; inset: 0; background: transparent; border: 0; }
.reels-top { position: fixed; top: calc(12px + var(--safe-t)); left: 0; right: 0; max-width: var(--maxw); margin: 0 auto; z-index: 41; display: flex; align-items: center; gap: 14px; padding: 0 16px; color: #fff; pointer-events: none; }
.reels-top button { pointer-events: auto; }
.reels-top .ttl { font-weight: 800; font-size: 17px; text-shadow: 0 1px 6px rgba(0,0,0,.5); }

/* Forms */
.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-weight: 500; font-size: 12px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 12px 13px; font-size: 15px; outline: 0;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-050); }
.textarea { min-height: 96px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.dropzone {
  border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: var(--radius);
  background: var(--surface-2); padding: 22px; text-align: center; color: var(--muted); display: grid; place-items: center; gap: 8px;
}
.dropzone svg { color: var(--brand); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs .th { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); position: relative; background: var(--surface-2); }
.thumbs .th img, .thumbs .th video { width: 100%; height: 100%; object-fit: cover; }
.thumbs .th button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; display: grid; place-items: center; }

/* Publish type picker */
.pick { display: grid; gap: 12px; }
.pick-opt { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; }
.pick-opt .ic { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.pick-opt b { display: block; font-size: 15px; }
.pick-opt span { color: var(--muted); font-size: 13px; }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head .big { width: 72px; height: 72px; border-radius: 22px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 28px; }
.stat-row { display: flex; gap: 10px; margin: 16px 0; }
.stat { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.list-row .ic { color: var(--muted); }
.list-row .t { flex: 1; font-weight: 600; font-size: 14.5px; }
.list-row .t span { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { color: var(--muted-2); margin-bottom: 10px; }

/* Bottom navigation */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  max-width: var(--maxw); margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-b);
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted); padding: 9px 0 7px;
  display: grid; place-items: center; gap: 3px; font-size: 10.5px; font-weight: 600;
}
.tabbar button.active { color: var(--brand); }
.tabbar button .pub { width: 42px; height: 42px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; margin-top: -4px; box-shadow: 0 6px 16px rgba(15,118,110,.4); }
.tabbar button.active .pub { background: var(--brand-600); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); transform: translateX(-50%);
  background: #0e1726; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  z-index: 60; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* Desktop layout: left rail nav */
@media (min-width: 900px) {
  .app { grid-template-columns: 240px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    padding: 18px 14px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .sidebar .brand { padding: 6px 8px 18px; }
  .sidebar .navitem {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
    color: var(--muted); font-weight: 600; font-size: 14.5px; border: 0; background: transparent; width: 100%; text-align: left;
  }
  .sidebar .navitem:hover { background: var(--surface-2); color: var(--text); }
  .sidebar .navitem.active { background: var(--brand-050); color: var(--brand); }
  .sidebar .navitem.pub { background: var(--brand); color: #fff; margin-top: 8px; }
  .sidebar .spacer { flex: 1; }
  .tabbar { display: none; }
  .topbar { display: none; }
  .main { padding: 26px 30px 60px; }
  .content-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
  .reels { left: 240px; }
  .reels .reel .meta { bottom: calc(30px + var(--safe-b)); }
  .reels .reel .rail { bottom: calc(44px + var(--safe-b)); }
  .reels-top { display: none; }
}
@media (min-width: 900px) and (max-width: 1119px) { .reels { left: 240px; right: 0; max-width: none; margin: 0; } }
