:root {
  --green: #00bf8f;
  --green-dark: #00a67c;
  --text: #333;
  --muted: #9b9b9b;
  --line: #e5e5e5;
  --gap: #efefef;
  --card: #fff;
  --nav-h: 44px;
  --tab-h: 50px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--gap); }
body {
  margin: 0;
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--gap);
  overscroll-behavior-y: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.app { max-width: 520px; margin: 0 auto; background: var(--gap); min-height: 100dvh; }

/* ---------- Green top bar ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  background: var(--green);
  padding-top: var(--top);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.nav-bar {
  position: relative; height: var(--nav-h);
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.logo {
  font-family: "Pacifico", "Segoe Script", "Brush Script MT", cursive;
  color: #fff; font-size: 25px; line-height: 1; letter-spacing: .3px;
  padding-bottom: 4px; text-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.nav-back {
  position: absolute; left: 4px; top: 0; height: var(--nav-h); width: 44px;
  display: grid; place-items: center; color: #fff;
}

.view {
  padding-top: calc(var(--nav-h) + var(--top));
  padding-bottom: calc(var(--tab-h) + var(--bottom) + 8px);
  min-height: 100dvh;
}

/* ---------- Bottom tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + var(--bottom));
  padding-bottom: var(--bottom);
  background: rgba(255,255,255,.97);
  border-top: 1px solid #dcdcdc;
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}
.tabs a { display: grid; place-items: center; color: #b4b4b4; }
.tabs svg { width: 27px; height: 27px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.tabs svg circle[fill="none"], .tabs svg path[fill="none"] { stroke-width: 2.2; }
.tabs .fill { fill: currentColor; }
.tabs a.on { color: var(--green); }
.tab-main span {
  display: grid; place-items: center;
  width: 50px; height: 34px; border-radius: 7px;
  background: var(--green); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.tab-main svg { width: 24px; height: 24px; stroke: #fff; }
.tab-main:active span { background: var(--green-dark); }

/* ---------- A Vine post ---------- */
.post { background: var(--card); margin-bottom: 10px; }
.post-head { display: flex; gap: 10px; padding: 11px 12px 9px; align-items: flex-start; }
.avatar {
  display: block; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: #dcdcdc center/cover no-repeat; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-who { flex: 1; min-width: 0; }
.post-top { display: flex; align-items: baseline; gap: 6px; }
.name { color: var(--green); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--green); display: inline-grid; place-items: center; transform: translateY(2px);
}
.tick svg { width: 9px; height: 9px; }
.when { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.caption { margin-top: 2px; font-size: 14.5px; word-wrap: break-word; }
.caption b { color: var(--green); font-weight: 600; }

.media { position: relative; width: 100%; aspect-ratio: 1; background: #000; overflow: hidden; cursor: pointer; }
.media img, .media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.media video { opacity: 0; transition: opacity .15s; }
.media.playing video { opacity: 1; }
.spin {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid rgba(255,255,255,.35); border-top-color: var(--green); border-radius: 50%;
  animation: spin .8s linear infinite; opacity: 0; transition: opacity .2s;
}
.media.loading .spin { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
.sound {
  position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,.45); display: grid; place-items: center; opacity: 0; transition: opacity .2s;
}
.sound svg { width: 17px; height: 17px; }
.media.active .sound { opacity: 1; }
.media.active.sound-on .sound { opacity: 0; }
.media.flash .sound { opacity: 1 !important; }
.hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 14px; white-space: nowrap; pointer-events: none;
}
.gone {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #fff; background: rgba(0,0,0,.6); font-size: 14px; padding: 20px;
}

.post-foot { padding: 9px 12px 12px; }
.loops { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
.loops svg { width: 15px; height: 15px; }
.acts { display: flex; gap: 6px; margin-top: 9px; }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: 4px;
  background: #f0f0f0; color: #8a8a8a; font-size: 13px; font-weight: 700;
}
.act svg { width: 18px; height: 18px; fill: currentColor; }
.act.on { background: var(--green); color: #fff; }
.act.like.on svg { animation: pop .3s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }
.act.more { margin-left: auto; padding: 0 9px; }

/* ---------- Grids (Explore + profiles) ---------- */
.section-title {
  padding: 14px 12px 8px; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--muted);
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--card); }
.tile { position: relative; aspect-ratio: 1; background: #222; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile span {
  position: absolute; left: 6px; bottom: 5px; color: #fff; font-size: 11.5px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,.7); display: flex; align-items: center; gap: 3px;
}
.tile span svg { width: 12px; height: 12px; }

/* ---------- Viners list ---------- */
.list { background: var(--card); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.row .avatar { width: 48px; height: 48px; }
.row-main { flex: 1; min-width: 0; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-go { color: #c7c7c7; font-size: 22px; }

/* ---------- Profile header ---------- */
.profile { color: #fff; text-align: center; padding: 22px 16px 18px; }
.profile .avatar { width: 84px; height: 84px; margin: 0 auto 10px; border: 3px solid #fff; }
.profile h1 { margin: 0; font-size: 20px; display: inline-flex; align-items: center; gap: 6px; }
.profile .tick { background: #fff; transform: none; width: 18px; height: 18px; }
.profile .tick svg { width: 11px; height: 11px; }
.profile p { margin: 6px auto 0; max-width: 34ch; font-size: 14px; opacity: .92; }
.stats { display: flex; justify-content: center; gap: 22px; margin-top: 14px; }
.stats b { display: block; font-size: 17px; }
.stats span { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }

/* ---------- About: who made it ---------- */
.makers { background: var(--green); color: #fff; text-align: center; padding: 26px 16px 22px; }
.makers-logo { font-family: "Pacifico", "Segoe Script", "Brush Script MT", cursive; font-size: 40px; line-height: 1.2; }
.makers p { margin: 4px 0 0; font-size: 16px; font-weight: 700; opacity: .95; }
.maker-av { width: 48px; height: 48px; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 700; }
.follow {
  flex: none; background: var(--green); color: #fff; font-size: 14px; font-weight: 700;
  padding: 7px 16px; border-radius: 4px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.makers + .list { margin-bottom: 10px; }

/* ---------- About ---------- */
.page { background: var(--card); padding: 18px 16px 22px; }
.page h2 { margin: 18px 0 6px; font-size: 16px; }
.page h2:first-child { margin-top: 0; }
.page p { margin: 0 0 10px; }
.page a { color: var(--green); font-weight: 600; }
.keys { color: var(--muted); font-size: 13.5px; }

.seo { background: var(--card); padding: 16px; }
.seo h1 { margin: 0 0 6px; font-size: 18px; }
.seo p { margin: 0 0 8px; color: #666; }
.seo a { color: var(--green); font-weight: 600; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- Comments ---------- */
.cmts {
  position: fixed; inset: 0; z-index: 40; max-width: 520px; margin: 0 auto;
  background: var(--card); display: flex; flex-direction: column; animation: up .25s ease-out;
}
.cmts-bar {
  flex: none; position: relative; background: var(--green); color: #fff;
  padding-top: var(--top); text-align: center; font-weight: 700; font-size: 17px;
}
.cmts-bar span { display: block; line-height: var(--nav-h); }
.cmts-close { position: absolute; left: 4px; bottom: 0; width: 44px; height: var(--nav-h); display: grid; place-items: center; color: #fff; }
.cmts-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: calc(16px + var(--bottom)); }
.cmts-note { text-align: center; color: var(--muted); font-size: 12.5px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fafafa; }
.cmts-head { display: flex; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.c-row { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.c-av {
  flex: none; width: 36px; height: 36px; border-radius: 50%; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.c-body { flex: 1; min-width: 0; }
.c-top { display: flex; align-items: baseline; gap: 8px; }
.c-top .name { font-size: 14px; }
.c-text { font-size: 14.5px; word-wrap: break-word; }
.c-text b { color: var(--green); font-weight: 600; }

/* ---------- Add to Home Screen popup ---------- */
.a2hs { position: fixed; inset: 0; z-index: 70; }
.a2hs-dim { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fade .2s; }
.a2hs-box {
  position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--bottom));
  max-width: 420px; margin: 0 auto; background: var(--card); border-radius: 18px;
  padding: 24px 20px 14px; text-align: center; animation: up .28s ease-out;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.a2hs-icon { width: 68px; height: 68px; border-radius: 16px; margin: 0 auto 12px; box-shadow: 0 3px 10px rgba(0,0,0,.18); }
.a2hs-box h2 { margin: 0; font-size: 20px; }
.a2hs-lead { margin: 6px 0 14px; color: #666; font-size: 14.5px; }
.a2hs-steps { list-style: none; margin: 0 0 16px; padding: 0; text-align: left; }
.a2hs-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.a2hs-n {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: -1px;
}
.a2hs-ico { width: 19px; height: 19px; vertical-align: -4px; fill: none; stroke: #0a7cff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.a2hs-go, .a2hs-later { display: block; width: 100%; padding: 13px; border-radius: 8px; font-size: 16px; font-weight: 700; }
.a2hs-go { background: var(--green); color: #fff; margin-bottom: 6px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.a2hs-later { color: var(--muted); font-weight: 600; }
.page .follow { display: inline-block; margin-top: 2px; }

/* ---------- Action sheet + toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-dim { position: absolute; inset: 0; background: rgba(0,0,0,.4); animation: fade .2s; }
.sheet-box {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--bottom));
  max-width: 504px; margin: 0 auto; animation: up .22s ease-out;
}
.sheet-group { background: rgba(250,250,250,.97); border-radius: 13px; overflow: hidden; }
.sheet-btn {
  display: block; width: 100%; padding: 17px; text-align: center; font-size: 18px; color: #0a7cff;
  background: rgba(250,250,250,.97);
}
.sheet-group .sheet-btn + .sheet-btn { border-top: 1px solid #dedede; }
.sheet-btn.red { color: #ff3b30; }
.sheet-cancel { margin-top: 8px; border-radius: 13px; font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--bottom) + 16px); z-index: 60;
  transform: translateX(-50%); background: rgba(30,30,30,.9); color: #fff;
  padding: 9px 16px; border-radius: 18px; font-size: 14px; max-width: calc(100% - 32px); text-align: center;
}

/* ---------- Desktop: the feed sits in a phone-width column ---------- */
@media (min-width: 700px) {
  /* Narrower column on short screens so a whole Vine always fits between the bars. */
  .app, .nav-bar, .tabs, .cmts { max-width: clamp(360px, calc(100dvh - 210px), 520px); }
  html, body { background: #e4e4e4; }
  .app { box-shadow: 0 0 0 1px rgba(0,0,0,.05), 0 10px 40px rgba(0,0,0,.08); }
  .logo { font-size: 28px; }
  .post { margin-bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .act.like.on svg, .sheet-box, .sheet-dim { animation: none; }
}
