/* Shared styles: design tokens, phone frame, bottom navigation, toast and shared components. */
/* Layout: one phone-sized app column. Full screen on phones, framed device on larger screens.
   Deliberately dark-only: INYEON's identity is black + white + violet. */
:root {
  --bg: #050407;          /* app background */
  --surface: #121019;     /* tiles, pills */
  --line: #26213a;        /* hairlines and borders */
  --fg: #f6f4fb;          /* primary text */
  --muted: #8f88a3;       /* secondary text */
  --accent: #9d5cff;      /* INYEON violet */
  --accent-light: #b98bff;
  --accent-soft: rgba(157, 92, 255, 0.18);
  --glow: rgba(157, 92, 255, 0.55);
  --pink: #ff6fb5;
  --amber: #ffb547;
  --stage: #020103;       /* desktop backdrop around the phone */

  --font-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --status-h: 0px;        /* fake iPhone status bar, only shown in the desktop frame */
  --header-h: calc(env(safe-area-inset-top, 0px) + var(--status-h) + 56px);
  /* bottom nav: 66px of tabs + the home-indicator area (at least 12px of breathing room) */
  --nav-pad: max(12px, env(safe-area-inset-bottom, 0px));
  --nav-h: calc(66px + var(--nav-pad));
  --app-max-w: 430px;     /* widest the app column gets (large phones); desktop shows a framed phone */

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html {
  /* the app scrolls inside its screens, never the page itself */
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;   /* no double-tap zoom */
}
body {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  margin: 0;
  background: var(--stage);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* ---------- App shell ---------- */
/* Phones: fills the screen. inset: 0 on a fixed element follows the visible
   viewport as Safari / Chrome toolbars show and hide (same as 100dvh). */
.phone {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: var(--app-max-w);
  margin-inline: auto;
  background: var(--bg);
  overflow: hidden;
}
@supports (height: 100dvh) {
  .phone { bottom: auto; height: 100dvh; }
}
/* every scrolling area: vertical only, momentum, no scroll chaining to the page */
.phone :is([class$="-scroll"], .feed, .sheet) {
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
/* iOS zooms into text fields under 16px; keep them at 16px on iPhone only */
@supports (-webkit-touch-callout: none) {
  input, textarea, select { font-size: max(16px, 1em) !important; }
}
.statusbar, .home-indicator, .stage-caption { display: none; }

@media (min-width: 640px) and (min-height: 700px) {
  :root { --status-h: 48px; }
  body {
    background:
      radial-gradient(60% 50% at 50% 45%, rgba(157, 92, 255, 0.14), transparent 70%),
      var(--stage);
  }
  .phone {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 390px;
    max-width: none;
    margin: 0;
    height: min(844px, calc(100% - 64px));
    border-radius: 50px;
    box-shadow:
      0 0 0 10px #0d0b12,
      0 0 0 11px #2a2438,
      0 40px 120px rgba(157, 92, 255, 0.22);
  }
  .statusbar {
    display: flex;
    position: absolute; top: 0; left: 0; right: 0;
    height: var(--status-h);
    z-index: 6;
    align-items: center;
    justify-content: space-between;
    padding: 6px 30px 0 40px;
    font-weight: 700; font-size: 15px;
  }
  .statusbar .icons { display: flex; gap: 6px; align-items: center; }
  .home-indicator {
    display: block;
    position: absolute; z-index: 7;
    left: 50%; bottom: 7px; transform: translateX(-50%);
    width: 132px; height: 5px; border-radius: 3px;
    background: var(--fg);
  }
  .stage-caption {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 14px;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
}

@media (min-width: 640px) and (min-height: 960px) {
  .stage-caption { display: block; }
}

/* ---------- Bottom navigation ---------- */
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  height: var(--nav-h);
  padding-top: 10px;
  padding-bottom: var(--nav-pad);
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tab {
  min-width: 0; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--muted);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.tab svg { width: 27px; height: 27px; }
.tab.active { color: var(--accent-light); }
.tab.active svg { color: var(--accent); filter: drop-shadow(0 0 6px var(--glow)); }
.tab.create { margin-top: -28px; }
.tab.create .plus {
  width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #b98bff, var(--accent) 60%, #7a35e8);
  color: #fff;
  box-shadow: 0 0 0 6px var(--bg), 0 0 28px var(--glow);
}
.tab.create .plus svg { width: 28px; height: 28px; }
.tab .me {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #ff6fb5, #7a35e8);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px);
  transform: translate(-50%, 10px);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #1c1828;
  border: 1px solid var(--line);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast { z-index: 30; }
.toast.top { bottom: auto; top: calc(var(--header-h) + 8px); }

/* ---------- Screens ---------- */
/* Every screen fills the phone; the router shows one at a time. */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 15px; font-weight: 800;
  transition: background 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: radial-gradient(circle at 30% 20%, #b98bff, var(--accent) 65%);
  color: #fff;
  box-shadow: 0 0 24px rgba(157, 92, 255, 0.4);
}
.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg);
}
.btn-going {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 20px rgba(157, 92, 255, 0.3), inset 0 0 12px rgba(157, 92, 255, 0.15);
}

/* ---------- Chips (selectable pills) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: #d9d5e3;
  font-size: 14px; font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg);
  box-shadow: 0 0 14px rgba(157, 92, 255, 0.3);
}
.chip.on::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 6px var(--accent);
}

/* ---------- Bottom sheet ---------- */
.sheet-layer {
  position: absolute; inset: 0;
  z-index: 20;
}
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 1, 4, 0.5);
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: min(86%, calc(100% - env(safe-area-inset-top, 0px) - var(--status-h) - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: 10px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  border-radius: 30px 30px 0 0;
  background: linear-gradient(to bottom, #151120, #0b0911 40%);
  border-top: 1px solid rgba(185, 139, 255, 0.3);
  box-shadow: 0 -10px 50px rgba(157, 92, 255, 0.22);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 5px; border-radius: 3px;
  margin: 0 auto 6px;
  background: #3a3350;
}
.sheet-close {
  position: absolute; top: 16px; right: max(16px, env(safe-area-inset-right, 0px));
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}
.sheet-close svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop { transition: none; }
}

/* ---------- Video viewer (full screen, like a story) ---------- */
.viewer {
  position: absolute; inset: 0;
  z-index: 25;
  background: #000;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.2s, transform 0.2s;
}
.viewer.open { opacity: 1; transform: scale(1); }
.viewer-video, .viewer-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewer.is-photo .viewer-play, .viewer.is-photo .viewer-progress { display: none; }
.viewer::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 22%, transparent 65%, rgba(0,0,0,0.8));
  pointer-events: none;
}
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 1;
  padding-top: calc(env(safe-area-inset-top, 0px) + var(--status-h) + 8px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 12px;
}
.viewer-progress { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.viewer-progress i { display: block; height: 100%; background: #fff; transform-origin: left; transform: scaleX(0); }
.viewer-head { display: flex; align-items: center; gap: 10px; }
.viewer-mark {
  flex: none;
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(157, 92, 255, 0.25);
  border: 1px solid rgba(185, 139, 255, 0.45);
}
.viewer-mark span { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #fff, var(--accent) 70%); box-shadow: 0 0 12px var(--accent); }
.viewer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-shadow: 0 1px 8px rgba(0,0,0,0.6); }
.viewer-title { font-size: 16px; font-weight: 800; }
.viewer-meta { font-size: 12px; color: rgba(255, 255, 255, 0.8); font-weight: 600; }
.viewer-close {
  flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.viewer-close svg { width: 16px; height: 16px; }
.viewer-play {
  position: absolute; top: 50%; left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.2s;
}
.viewer-play svg { width: 26px; height: 26px; }
.viewer.playing .viewer-play { opacity: 0; }
.viewer-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 34px);
  padding-left: max(18px, env(safe-area-inset-left, 0px));
  padding-right: max(18px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 6px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}
.viewer-caption { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 600; }
.viewer-views { font-size: 12px; color: var(--accent-light); font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  .viewer { transition: none; }
}

/* ---------- Touch targets ----------
   Small controls keep their look but get an invisible hit area of about 44px,
   so they're comfortable to tap on a phone. */
:is(.credits-pill, .vd-link, .cp-venue, .pp-link, .rw-venue, .bp-venue, .cr-text-btn,
    .pf-privacy-link, .vb-tonight-venue, .vb-tonight-person, .rw-how-btn, .rw-btn,
    .cp-tag, .vd-offer-btn, .viewer-close) { position: relative; }
:is(.vd-link, .cp-venue, .pp-link, .rw-venue, .bp-venue, .cr-text-btn,
    .pf-privacy-link, .vb-tonight-venue)::before { content: ""; position: absolute; inset: -11px -6px; }
:is(.credits-pill, .cp-tag)::before { content: ""; position: absolute; inset: -7px -3px; }
:is(.vb-tonight-person, .rw-how-btn, .rw-btn, .vd-offer-btn, .bell, .sheet-close, .viewer-close)::before { content: ""; position: absolute; inset: -4px; }
.trend-open::before { content: ""; position: absolute; inset: -9px; }

/* ---------- Tap feedback ----------
   Every tappable thing responds when pressed: a slight press-in, no grey flash. */
[data-tap], [data-hint] { cursor: pointer; }
[data-tap] { transition: transform 0.15s, border-color 0.15s; }
[data-tap]:active { transform: scale(0.985); border-color: rgba(185, 139, 255, 0.45); }
[data-hint]:active { transform: scale(0.94); }
.btn, .chip, .tab, .rw-btn, .sf-option, .sf-card, .sf-tool { transition: transform 0.12s, background 0.2s, box-shadow 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s; }
.btn:active, .chip:active, .rw-btn:active { transform: scale(0.97); }
.sf-option:active, .sf-card:active, .sf-tool:active, .tn-night:active, .tn-visibility:active, .hs-notif:active { background: rgba(157, 92, 255, 0.08); }
.tab:active svg, .tab:active .me { transform: scale(0.9); }
.tab svg, .tab .me { transition: transform 0.12s; }
.tab.create:active .plus { transform: scale(0.93); }
.tab.create .plus { transition: transform 0.12s; }
button:disabled { cursor: default; }

/* "You" avatar when you picked a colour instead of a photo (meAvatar in core.js) */
.me-initial { display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #ff6fb5, #7a35e8); }
.iv-pair .me-initial { font-size: 20px; }
.chip { min-height: 40px; }
.rw-venue::before { inset: -13px -6px; }
