    #feed-screen {
      background: #000;
    }

    .feed-refresh-indicator {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%) translateY(-60px);
      z-index: 120;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      border-radius: 999px;
      background: rgba(20,20,20,.92);
      border: 1px solid rgba(255,255,255,.1);
      color: #fff;
      font-size: 12px;
      box-shadow: 0 10px 30px rgba(0,0,0,.35);
      opacity: 0;
      pointer-events: none;
      transition: opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1);
    }
    .feed-refresh-indicator.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(12px);
    }
    .feed-refresh-indicator .loading-spinner { width: 14px; height: 14px; border-width: 2px; }

    .feed-container {
      flex: 1 1 auto;
      min-width: 0;
      min-height: 0;
      width: 100%;
      max-width: 100%;
      height: var(--app-height, 100dvh);
      max-height: var(--app-height, 100dvh);
      overflow-x: hidden;
      overflow-y: scroll;
      scroll-behavior: smooth;
      scroll-snap-type: y mandatory;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior-x: none;
    }

    .feed-container::-webkit-scrollbar {
      display: none;
    }

    .video-card {
      position: relative;
      flex: 0 0 100%;
      min-width: 0;
      max-width: 100%;
      min-height: 0;
      max-height: 100%;
      contain: layout paint;
      content-visibility: auto;
      contain-intrinsic-size: 100dvh;
      height: var(--app-height, 100dvh);
      width: 100%;
      scroll-snap-align: start;
      scroll-snap-stop: always;
      background: #111;
      overflow: hidden;
    }

    .video-loading {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 5;
      pointer-events: none;
      background: radial-gradient(circle at center, rgba(0,0,0,.14), rgba(0,0,0,0));
      transition: opacity .18s ease, visibility .18s ease;
    }
    .video-loading.hidden {
      opacity: 0;
      visibility: hidden;
    }
    .video-pause-indicator {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      opacity: 0;
      transform: scale(.82);
      transition: opacity .18s ease, transform .22s cubic-bezier(.22,.8,.25,1);
      z-index: 18;
    }
    .video-pause-indicator.visible { opacity: 1; transform: scale(1); }
    .video-pause-indicator .pause-badge {
      width: 64px; height: 64px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      background: rgba(0,0,0,.58); backdrop-filter: blur(10px);
      border: 1px solid rgba(255,255,255,.16);
      box-shadow: 0 12px 30px rgba(0,0,0,.28);
    }
    .video-pause-indicator svg { width: 26px; height: 26px; }
    .loading-spinner {
      width: 34px;
      height: 34px;
      border: 3px solid rgba(255,255,255,.24);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .8s linear infinite;
      filter: drop-shadow(0 2px 10px rgba(0,0,0,.35));
    }
    .upload-spinner {
      width: 16px;
      height: 16px;
      border-width: 2px;
      flex: 0 0 auto;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .video-card video,
    .video-card > img {
      display: block;
      width: 100%;
      height: 100%;
      max-width: 100%;
      max-height: 100%;
      min-width: 0;
      min-height: 0;
      object-fit: cover;
      background: #000;
      position: relative;
      z-index: 3;
    }

    /* WebView-safe video cover: never let the browser's native poster/play artwork
       become the visible first frame. The real cover sits above the video until
       playback actually starts. */
    .video-cover {
      position: absolute;
      inset: 0;
      z-index: 4;
      background: #111;
      pointer-events: none;
      opacity: 1;
      visibility: visible;
      transition: opacity .18s ease, visibility .18s ease;
      overflow: hidden;
    }
    .video-cover img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .video-card.video-started .video-cover {
      opacity: 0;
      visibility: hidden;
    }


    .video-blocked-state {
      position:absolute;
      inset:0;
      z-index:12;
      display:flex;
      flex-direction:column;
      align-items:center;
      justify-content:center;
      gap:10px;
      padding:28px;
      text-align:center;
      background:
        radial-gradient(circle at 50% 38%, rgba(254,44,85,.16), transparent 40%),
        linear-gradient(180deg, #111116 0%, #070709 100%);
      color:#fff;
    }
    .video-blocked-title {
      font-size:20px;
      font-weight:850;
      letter-spacing:-.02em;
    }
    .video-blocked-text {
      max-width:360px;
      color:#d4d4dc;
      font-size:14px;
      line-height:1.5;
    }
    .video-blocked-reason {
      max-width:360px;
      padding:8px 10px;
      border-radius:10px;
      background:rgba(255,255,255,.06);
      border:1px solid rgba(255,255,255,.08);
      color:#a8a8b2;
      font-size:12px;
    }
    .video-overlay-blocked { pointer-events:none; }
    .account-blocked-state {
      position:relative;
      inset:auto;
      min-height:280px;
      width:min(100%,520px);
      margin:80px auto 20px;
      border-radius:22px;
      border:1px solid rgba(255,255,255,.08);
    }

    .video-overlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    /* Left side - subscribe */
    .subscribe-btn {
      display: none !important;
      position: absolute;
      top: calc(var(--top-h) + var(--safe-top) + 12px);
      left: 12px;
      pointer-events: auto;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 4px;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
      z-index: 10;
      transition: background 0.2s, transform 0.15s;
    }

    .subscribe-btn.subscribed {
      background: #3a3a3d !important;
      color: #d7d7da;
      border: 1px solid rgba(255,255,255,.08);
    }

    .subscribe-btn:active {
      transform: scale(0.95);
    }

    /* Right side actions */
    .side-actions {
      position: absolute;
      right: 10px;
      bottom: calc(var(--bottom-h) + var(--safe-bottom) + 80px);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 18px;
      pointer-events: auto;
      z-index: 10;
    }

    .side-action {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      cursor: pointer;
      color: #fff;
    }

    .side-action .avatar-wrap {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: 2px solid #fff;
      overflow: hidden;
      position: relative;
      background: #333;
    }

    .side-action .avatar-wrap img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .side-action .avatar-follow {
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      width: 20px;
      height: 20px;
      background: var(--accent);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      border: 2px solid #000;
    }

    .side-action .icon-btn {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: rgba(0,0,0,0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      transition: transform 0.15s;
    }

    .side-action .icon-btn:active {
      transform: scale(0.9);
    }

    .side-action .icon-btn.liked {
      color: var(--accent);
    }

    .video-sound-btn {
      position: absolute;
      top: calc(var(--top-h) + var(--safe-top) + 8px);
      right: 12px;
      width: 42px;
      height: 42px;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 50%;
      background: rgba(0,0,0,.42);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 12;
      pointer-events: auto;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      box-shadow: 0 8px 24px rgba(0,0,0,.22);
      transition: transform .15s ease, background .18s ease, opacity .18s ease;
    }

    .video-sound-btn:active { transform: scale(.9); }
    .video-sound-btn:hover { background: rgba(0,0,0,.58); }
    .video-sound-btn svg { width: 21px; height: 21px; }

    .side-action .count {
      font-size: 12px;
      font-weight: 600;
      text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    }

    /* Bottom info */
    .video-info {
      position: absolute;
      left: 12px;
      right: 70px;
      bottom: calc(var(--bottom-h) + var(--safe-bottom) + 16px);
      pointer-events: auto;
      z-index: 10;
    }

    .video-info .author {
      font-weight: 700;
      font-size: 15px;
      margin-bottom: 6px;
      display: flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
    }

    .video-info .desc {
      font-size: 14px;
      line-height: 1.35;
      margin-bottom: 6px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .video-info .hashtags {
      font-size: 13px;
      color: #ddd;
      margin-bottom: 4px;
    }

    .video-info .music {
      font-size: 13px;
      display: flex;
      align-items: center;
      gap: 6px;
      opacity: 0.9;
    }

    /* Progress bar */
    .video-progress {
      position: absolute;
      bottom: calc(var(--bottom-h) + var(--safe-bottom));
      left: 0;
      right: 0;
      height: 3px;
      background: rgba(255,255,255,0.2);
      z-index: 20;
    }

    .video-progress .bar {
      height: 100%;
      background: #fff;
      width: 0%;
      transition: width 0.1s linear;
    }

    /* ========== INBOX ========== */
    #inbox-screen {
      background: var(--bg);
      padding-top: calc(var(--top-h) + var(--safe-top));
      padding-bottom: calc(var(--bottom-h) + var(--safe-bottom));
    }

    .inbox-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: calc(var(--top-h) + var(--safe-top));
      padding-top: var(--safe-top);
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--surface);
      border-bottom: 1px solid rgba(255,255,255,0.08);
      z-index: 50;
      font-weight: 700;
      font-size: 17px;
    }

    .inbox-tabs {
      display: flex;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      background: var(--surface);
    }

    .inbox-tabs .itab {
      flex: 1;
      text-align: center;
      padding: 12px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-muted);
      cursor: pointer;
      position: relative;
    }

    .inbox-tabs .itab.active {
      color: #fff;
    }

    .inbox-tabs .itab.active::after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 20%;
      right: 20%;
      height: 2px;
      background: var(--accent);
    }

    .inbox-list {
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .notif-item, .chat-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      border-bottom: 1px solid rgba(255,255,255,0.05);
      cursor: pointer;
    }

    .notif-item:active, .chat-item:active {
      background: rgba(255,255,255,0.05);
    }
    .inbox-notification-source { cursor:pointer; user-select:none; transition:background .16s ease, transform .16s ease; }
    .inbox-notification-source:hover { background:rgba(255,255,255,.035); }
    .inbox-notification-source:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
    .notification-open-icon { color:var(--text-muted); opacity:.65; display:flex; align-items:center; justify-content:center; flex:0 0 auto; }
    .notification-source-highlight { animation:notification-source-pulse 1.8s ease both; }
    @keyframes notification-source-pulse { 0%{box-shadow:0 0 0 0 rgba(255,255,255,0)} 18%{box-shadow:0 0 0 5px rgba(255,255,255,.13)} 100%{box-shadow:0 0 0 0 rgba(255,255,255,0)} }

    .notif-item .avatar, .chat-item .avatar {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: #333;
      overflow: hidden;
      flex-shrink: 0;
    }

    .notif-item .avatar img, .chat-item .avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .notif-item .content, .chat-item .content {
      flex: 1;
      min-width: 0;
    }

    .notif-item .content .text, .chat-item .content .name {
      font-size: 14px;
      line-height: 1.3;
    }

    .notif-item .content .time, .chat-item .content .preview {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .chat-item .badge {
      background: var(--accent);
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      min-width: 18px;
      height: 18px;
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 5px;
    }

    /* ========== PROFILE ========== */
    #profile-screen {
      background: var(--bg);
      padding-bottom: calc(var(--bottom-h) + var(--safe-bottom));
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    .profile-settings-btn {
      position:absolute; top:calc(var(--safe-top) + 10px); right:12px;
      width:42px; height:42px; border-radius:50%;
      border:1px solid rgba(255,255,255,.14); background:rgba(0,0,0,.42); color:#fff;
      display:flex; align-items:center; justify-content:center; cursor:pointer; z-index:15;
      backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
      box-shadow:0 8px 24px rgba(0,0,0,.22);
    }
    .profile-settings-btn:active { transform:scale(.92); }
    body.light-theme .profile-settings-btn { background:rgba(255,255,255,.82); color:#161616; border-color:rgba(0,0,0,.1); }
    .profile-header {
      position: relative;
      padding: calc(var(--top-h) + var(--safe-top) + 8px) 16px 16px;
      background: var(--surface);
    }

    .profile-back {
      position: absolute;
      top: calc(var(--safe-top) + 12px);
      left: 12px;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(0,0,0,0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      cursor: pointer;
      z-index: 10;
    }

    .profile-top {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 16px;
    }

    .profile-avatar {
      width: 88px;
      height: 88px;
      border-radius: 50%;
      background: #333;
      overflow: hidden;
      flex-shrink: 0;
      border: 3px solid #333;
    }

    .profile-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .profile-stats {
      display: flex;
      flex: 1;
      justify-content: space-around;
      text-align: center;
    }

    .profile-stats .stat .num {
      font-size: 18px;
      font-weight: 700;
    }

    .profile-stats .stat .label {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .profile-name {
      font-size: 18px;
      font-weight: 700;
      margin-bottom: 2px;
    }

    .profile-username {
      font-size: 14px;
      color: var(--text-muted);
      margin-bottom: 12px;
    }

    .profile-bio {
      font-size: 14px;
      line-height: 1.4;
      margin-bottom: 14px;
    }

    .profile-actions {
      display: flex;
      gap: 8px;
    }

    .profile-actions button {
      flex: 1;
      padding: 10px;
      border-radius: 6px;
      border: none;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
    }

    .btn-primary {
      background: var(--accent);
      color: #fff;
    }

    .btn-secondary {
      background: #3a3a3d;
      color: #e4e4e7;
      border: 1px solid rgba(255,255,255,.08) !important;
    }
    .profile-actions .btn-secondary { box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }

    .profile-tabs {
      display: flex;
      border-bottom: 1px solid rgba(255,255,255,0.08);
      background: var(--surface);
      position: sticky;
      top: 0;
      z-index: 20;
    }

    .profile-tabs .ptab {
      flex: 1;
      text-align: center;
      padding: 12px;
      font-size: 14px;
      font-weight: 600;
      color: var(--text-muted);
      cursor: pointer;
      position: relative;
    }

    .profile-tabs .ptab.active {
      color: #fff;
    }

    .profile-tabs .ptab.active::after {
      content: "";
      position: absolute;
      bottom: 0;
      left: 25%;
      right: 25%;
      height: 2px;
      background: #fff;
    }

    .profile-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 2px;
      padding: 2px;
    }

    .profile-grid .thumb {
      appearance: none;
      border: 0;
      padding: 0;
      font: inherit;
      color: inherit;
      width: 100%;
      aspect-ratio: 9/16;
      background: #222;
      position: relative;
      overflow: hidden;
      cursor: pointer;
    }
    .profile-grid .thumb:hover { filter: brightness(1.06); }
    .profile-grid .thumb:active { transform: scale(.985); }
    .profile-grid .thumb:focus-visible { outline: 2px solid rgba(255,255,255,.92); outline-offset: -2px; }

    .profile-grid .thumb img,
    .profile-grid .thumb video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .profile-grid .thumb .views {
      position: absolute;
      bottom: 6px;
      left: 6px;
      font-size: 11px;
      font-weight: 600;
      text-shadow: 0 1px 2px #000;
      display: flex;
      align-items: center;
      gap: 3px;
    }

    /* ========== SEARCH ========== */
    #search-screen {
      background: var(--bg);
      padding-top: calc(var(--top-h) + var(--safe-top));
      padding-bottom: calc(var(--bottom-h) + var(--safe-bottom));
    }

    .search-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: calc(var(--top-h) + var(--safe-top));
      padding: var(--safe-top) 12px 0;
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--surface);
      border-bottom: 1px solid rgba(255,255,255,0.08);
      z-index: 50;
    }

    .search-input {
      flex: 1;
      background: var(--surface-2);
      border: none;
      border-radius: 8px;
      padding: 10px 14px;
      color: #fff;
      font-size: 15px;
      outline: none;
    }

    .search-input::placeholder {
      color: var(--text-muted);
    }

    .search-results {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
    }

    .search-section-title {
      font-size: 13px;
      color: var(--text-muted);
      margin: 12px 0 8px;
      font-weight: 600;
    }

    /* ========== CREATE / RECORD ========== */
    #create-screen {
      background: #000;
    }

    .camera-view {
      flex: 1;
      position: relative;
      background: #000;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .camera-view video#cameraPreview {
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: #000;
    }

    .camera-placeholder {
      display: none !important;
      text-align: center;
      color: var(--text-muted);
      padding: 20px;
    }

    .camera-placeholder .big-icon {
      font-size: 64px;
      margin-bottom: 12px;
    }

    .record-controls {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 16px 14px calc(12px + var(--safe-bottom));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.55) 55%, transparent 100%);
      z-index: 20;
    }

    /* ===== New TikTok-like camera UI ===== */
    .cam-top-bar {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 30;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: calc(var(--safe-top) + 10px) 12px 10px;
      pointer-events: none;
    }
    .cam-top-bar > * { pointer-events: auto; }

    .cam-icon-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: none;
      background: rgba(0,0,0,0.38);
      color: #fff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      backdrop-filter: blur(10px);
      font-weight: 800;
      font-size: 13px;
    }
    .cam-icon-btn:active { transform: scale(0.92); }
    .cam-hd-btn { font-size: 12px; letter-spacing: 0.5px; }

    .cam-timer-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 7px 14px;
      border-radius: 999px;
      border: none;
      background: rgba(0,0,0,0.45);
      color: #fff;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      backdrop-filter: blur(10px);
    }
    .cam-timer-pill:active { transform: scale(0.96); }

    .cam-top-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .cam-side-tools {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-42%);
      z-index: 28;
      display: flex;
      flex-direction: column;
      gap: 14px;
      align-items: center;
    }

    .cam-side-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      background: transparent;
      border: none;
      color: #fff;
      cursor: pointer;
      padding: 0;
      min-width: 52px;
      text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    }
    .cam-side-btn svg {
      filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
    }
    .cam-side-btn span {
      font-size: 10px;
      font-weight: 600;
      line-height: 1.1;
      opacity: 0.95;
    }
    .cam-side-btn:active { transform: scale(0.92); }
    .cam-side-btn.active {
      color: #fe2c55;
    }

    .cam-speed-bar {
      position: absolute;
      left: 50%;
      bottom: 118px;
      transform: translateX(-50%);
      z-index: 25;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border-radius: 999px;
      background: rgba(0,0,0,0.42);
      backdrop-filter: blur(12px);
    }
    .cam-speed-opt {
      border: none;
      background: transparent;
      color: rgba(255,255,255,0.7);
      font-size: 13px;
      font-weight: 700;
      padding: 5px 9px;
      border-radius: 999px;
      cursor: pointer;
      min-width: 38px;
    }
    .cam-speed-opt.active {
      background: #fff;
      color: #111;
    }

    .cam-grid-overlay {
      position: absolute;
      inset: 0;
      z-index: 15;
      pointer-events: none;
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      grid-template-rows: 1fr 1fr 1fr;
    }
    .cam-grid-overlay > div {
      border: 1px solid rgba(255,255,255,0.22);
    }
    .cam-grid-overlay[hidden] { display: none !important; }

    .cam-bottom-bar {
      flex-wrap: nowrap;
      align-items: flex-end;
      padding-bottom: calc(10px + var(--safe-bottom));
    }

    .cam-gallery-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      background: transparent;
      border: none;
      color: #fff;
      cursor: pointer;
      min-width: 56px;
      padding: 0;
    }
    .cam-gallery-thumb {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      overflow: hidden;
      background: rgba(255,255,255,0.12);
      border: 2px solid rgba(255,255,255,0.35);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }
    .cam-gallery-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .cam-gallery-label {
      font-size: 11px;
      font-weight: 600;
      opacity: 0.9;
    }

    .cam-record-wrap {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      bottom: calc(52px + var(--safe-bottom));
      z-index: 22;
    }

    .cam-mode-tabs {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-left: auto;
    }
    .cam-mode-tab {
      background: transparent;
      border: none;
      color: rgba(255,255,255,0.55);
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      padding: 4px 2px;
      position: relative;
    }
    .cam-mode-tab.active {
      color: #fff;
    }
    .cam-mode-tab.active::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      bottom: -4px;
      height: 2px;
      background: #fff;
      border-radius: 2px;
    }

    /* Adjust record button for new layout */
    .cam-bottom-bar .record-btn {
      width: 76px;
      height: 76px;
      border-width: 5px;
    }
    .cam-bottom-bar .record-btn .inner {
      width: 58px;
      height: 58px;
      background: #fe2c55;
    }
    .cam-bottom-bar .record-btn.recording .inner {
      width: 30px;
      height: 30px;
      border-radius: 6px;
    }

    .record-timer {
      top: calc(var(--safe-top) + 58px);
    }
    .next-btn {
      right: 14px;
      bottom: 160px;
      top: auto;
      transform: none;
    }

    .camera-extra-btn {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: rgba(255,255,255,.14);
      border: 1px solid rgba(255,255,255,.12);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      cursor: pointer;
      font-weight: 800;
      font-size: 20px;
      backdrop-filter: blur(8px);
    }
    .camera-extra-btn:active, .ctrl-btn:active { transform: scale(.92); }

    .camera-top-controls {
      position: absolute;
      top: calc(var(--safe-top) + 12px);
      right: 12px;
      display: flex;
      gap: 8px;
      z-index: 25;
    }
    .camera-top-controls .camera-extra-btn {
      width: 42px;
      height: 42px;
      background: rgba(0,0,0,.38);
    }

    .camera-enable-btn {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
      z-index: 26;
      border: 0;
      border-radius: 999px;
      padding: 12px 18px;
      background: var(--accent);
      color: #fff;
      font-size: 14px;
      font-weight: 800;
      box-shadow: 0 12px 30px rgba(0,0,0,.35);
      cursor: pointer;
    }
    .camera-enable-btn:active { transform: translate(-50%,-50%) scale(.96); }
    .camera-enable-btn.hidden { display: none; }

    .ctrl-btn {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: rgba(255,255,255,0.15);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      cursor: pointer;
      border: none;
      color: #fff;
    }

    .record-btn {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      border: 4px solid #fff;
      background: transparent;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      position: relative;
    }

    .record-btn .inner {
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background: var(--accent);
      transition: all 0.2s;
    }

    .record-btn.recording .inner {
      width: 28px;
      height: 28px;
      border-radius: 6px;
    }

    .record-timer {
      position: absolute;
      top: calc(var(--safe-top) + 16px);
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0,0,0,0.6);
      padding: 4px 12px;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 600;
      display: none;
    }

    .record-timer.visible {
      display: block;
    }

    .next-btn {
      position: absolute;
      right: 16px;
      top: 50%;
      transform: translateY(-50%);
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 20px;
      padding: 10px 18px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      display: none;
      z-index: 30;
    }

    .next-btn.visible {
      display: block;
    }

    /* Publish form */
    #publish-screen {
      background: var(--bg);
      padding-top: calc(var(--top-h) + var(--safe-top));
      padding-bottom: calc(var(--bottom-h) + var(--safe-bottom) + 20px);
      overflow-y: auto;
    }

    .publish-header {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: calc(var(--top-h) + var(--safe-top));
      padding-top: var(--safe-top);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-left: 12px;
      padding-right: 12px;
      background: var(--surface);
      border-bottom: 1px solid rgba(255,255,255,0.08);
      z-index: 50;
      font-weight: 700;
      font-size: 16px;
    }

    .publish-header .back {
      font-size: 22px;
      cursor: pointer;
      padding: 4px 8px;
    }

    .publish-body {
      padding: 16px;
    }

    .cover-section {
      display: flex;
      gap: 14px;
      margin-bottom: 20px;
    }

    .cover-preview {
      width: 100px;
      height: 160px;
      background: #222;
      border-radius: 8px;
      overflow: hidden;
      flex-shrink: 0;
      position: relative;
    }

    .cover-preview video,
    .cover-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .cover-label {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,.18));
      text-align: center;
      font-size: 11px;
      padding: 14px 4px 6px;
      pointer-events: none;
    }
    .cover-edit-btn {
      position: absolute;
      left: 8px;
      right: 8px;
      top: 8px;
      border: 0;
      border-radius: 9px;
      padding: 8px 10px;
      background: rgba(0,0,0,.62);
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      cursor: pointer;
      z-index: 3;
      backdrop-filter: blur(8px);
    }
    .cover-edit-btn:active { transform: scale(.97); }

    .feed-end-message {
      min-height: 48vh;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 8px;
      scroll-snap-align: start;
      color: rgba(255,255,255,.72);
      background: #000;
      text-align: center;
      padding: 24px;
    }
    .feed-end-message .end-title { color:#fff; font-size:18px; font-weight:850; }
    .feed-end-message .end-subtitle { color:rgba(255,255,255,.5); font-size:13px; }

    .publish-fields {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .field {
      background: var(--surface-2);
      border-radius: 8px;
      padding: 12px;
    }

    .field label {
      display: block;
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .field input,
    .field textarea {
      width: 100%;
      background: transparent;
      border: none;
      color: #fff;
      font-size: 14px;
      outline: none;
      resize: none;
      font-family: inherit;
    }

    .field textarea {
      min-height: 60px;
    }

    .publish-btn {
      width: 100%;
      padding: 14px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
      margin-top: 20px;
    }

    .publish-btn {
      position: relative;
      overflow: hidden;
      transform: translateZ(0);
    }
    .publish-btn:not(:disabled):active {
      transform: scale(.985);
    }
    .publish-btn.publish-success {
      animation: publishSuccess .55s cubic-bezier(.2,.8,.25,1);
    }
    .publish-btn.publish-success::after {
      content: "✓";
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      font-size: 25px;
      font-weight: 900;
      background: rgba(0,0,0,.18);
      animation: publishCheck .55s ease both;
    }
    @keyframes publishSuccess {
      0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254,44,85,0); }
      40% { transform: scale(.96); box-shadow: 0 0 0 10px rgba(254,44,85,.14); }
      100% { transform: scale(1); box-shadow: 0 0 0 22px rgba(254,44,85,0); }
    }
    @keyframes publishCheck {
      0% { opacity: 0; transform: scale(.55); }
      55% { opacity: 1; transform: scale(1.15); }
      100% { opacity: 1; transform: scale(1); }
    }
    .publish-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    /* Upload progress toast */
    .upload-toast {
      position: absolute;
      top: calc(var(--safe-top) + 12px);
      left: 12px;
      background: rgba(30,30,30,0.95);
      border-radius: 10px;
      padding: 10px 14px;
      display: none;
      align-items: center;
      gap: 10px;
      z-index: 200;
      box-shadow: 0 4px 20px rgba(0,0,0,0.5);
      min-width: 180px;
      max-width: 260px;
    }

    .upload-toast.visible {
      display: flex;
      animation: slideIn 0.3s ease;
    }

    @keyframes slideIn {
      from { transform: translateY(-20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    .upload-toast .thumb {
      width: 36px;
      height: 48px;
      border-radius: 4px;
      background: #333;
      overflow: hidden;
      flex-shrink: 0;
    }

    .upload-toast .thumb img,
    .upload-toast .thumb video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .upload-toast .info {
      flex: 1;
      min-width: 0;
    }

    .upload-toast .info .title {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 4px;
    }

    .upload-toast .progress-track {
      height: 4px;
      background: rgba(255,255,255,0.15);
      border-radius: 2px;
      overflow: hidden;
    }

    .upload-toast .progress-fill {
      height: 100%;
      background: var(--accent);
      width: 0%;
      transition: width 0.2s;
    }

    .upload-toast .pct {
      font-size: 11px;
      color: var(--text-muted);
      margin-top: 2px;
    }

    /* Modal / overlays */
    .modal-overlay {
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.7);
      z-index: 300;
      display: none;
      align-items: flex-end;
      justify-content: center;
    }

    .modal-overlay.visible {
      display: flex;
    }
    .modal-overlay.auth-centered { align-items: center; }

    .modal-sheet {
      background: var(--surface);
      border-radius: 16px 16px 0 0;
      width: 100%;
      max-height: 70%;
      padding: 16px;
      padding-bottom: calc(16px + var(--safe-bottom));
      overflow-y: auto;
    }

    .modal-sheet .handle {
      width: 36px;
      height: 4px;
      background: #444;
      border-radius: 2px;
      margin: 0 auto 16px;
    }

    .modal-sheet h3 {
      font-size: 16px;
      margin-bottom: 12px;
      text-align: center;
    }

    .share-sheet {
      max-height: 78%;
    }

    .share-preview {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px;
      border-radius: 14px;
      background: rgba(255,255,255,.05);
      border: 1px solid rgba(255,255,255,.08);
      margin-bottom: 14px;
    }

    .share-preview-thumb {
      width: 56px;
      height: 78px;
      flex: 0 0 56px;
      border-radius: 9px;
      overflow: hidden;
      background: #222;
    }

    .share-preview-thumb img {
      width: 100%;
      height: 100%;
      display: block;
      object-fit: cover;
    }

    .share-preview-info {
      min-width: 0;
      flex: 1;
    }

    .share-preview-title {
      font-size: 14px;
      font-weight: 750;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .share-preview-subtitle {
      color: var(--text-muted);
      font-size: 12px;
      margin-top: 4px;
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .share-options {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }

    .share-option {
      appearance: none;
      border: 0;
      background: transparent;
      color: #fff;
      min-width: 0;
      padding: 8px 4px 6px;
      border-radius: 12px;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 7px;
      font: inherit;
    }

    .share-option:hover { background: rgba(255,255,255,.06); }
    .share-option:active { transform: scale(.96); }

    .share-option-icon {
      width: 54px;
      height: 54px;
      border-radius: 17px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #242426;
      border: 1px solid rgba(255,255,255,.09);
      overflow: hidden;
      box-shadow: 0 6px 18px rgba(0,0,0,.14);
    }

    .share-option-icon > svg {
      width: 28px;
      height: 28px;
      display: block;
    }

    .share-option-icon.brand-telegram { background: #229ED9; border-color: transparent; color: #fff; }
    .share-option-icon.brand-whatsapp { background: #25D366; border-color: transparent; color: #fff; }
    .share-option-icon.brand-vk { background: #0077FF; border-color: transparent; color: #fff; }
    .share-option-icon.brand-native { background: #3a3a3e; color: #fff; }
    .share-option-icon.brand-email { background: #5f6368; color: #fff; }
    .share-option-icon.brand-copy { background: #444449; color: #fff; }

    .share-brand-svg {
      width: 32px !important;
      height: 32px !important;
    }

    .share-vk-mark {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: 900;
      letter-spacing: -.06em;
      font-family: Arial, Helvetica, sans-serif;
      color: #fff;
    }

    .share-option-label {
      font-size: 11px;
      color: #e9e9eb;
      line-height: 1.2;
      text-align: center;
    }

    .share-note {
      margin-top: 10px;
      color: #77777e;
      font-size: 11px;
      line-height: 1.35;
      text-align: center;
    }

    body.light-theme .share-preview {
      background: rgba(0,0,0,.035);
      border-color: #dedee4;
    }

    body.light-theme .share-option { color: #161616; }
    body.light-theme .share-option:hover { background: rgba(0,0,0,.045); }
    body.light-theme .share-option-icon { background: #f0f0f2; border-color: #dedee4; }
    body.light-theme .share-option-label { color: #303038; }
    body.light-theme .share-note { color: #6f7078; }

    .speed-options, .menu-options {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .speed-options button,
    .menu-options button {
      background: transparent;
      border: none;
      color: #fff;
      padding: 14px;
      font-size: 15px;
      text-align: left;
      border-radius: 8px;
      cursor: pointer;
    }

    .speed-options button:active,
    .menu-options button:active,
    .speed-options button.active {
      background: rgba(255,255,255,0.1);
    }

    .comments-list {
      height: min(56vh, 520px);
      max-height: none;
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }

    #commentsModal .modal-sheet {
      position: relative;
      max-height: 88%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #commentsModal .comments-list {
      flex: 1 1 auto;
      min-height: 220px;
    }

    #commentsModal .comment-tools,
    #commentsModal .sticker-picker {
      flex-shrink: 0;
    }

    .comment-item {
      display: flex;
      gap: 10px;
      padding: 10px 0;
      border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .comment-item .c-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #333;
      overflow: hidden;
      flex-shrink: 0;
    }

    .comment-item .c-avatar { cursor:pointer; transition:transform .18s ease, border-color .18s ease; }
    .comment-item .c-avatar:hover { transform:scale(1.04); border-color:rgba(255,255,255,.34); }
    .comment-item .c-avatar:active { transform:scale(.96); }

    .comment-item .c-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .comment-item .c-body .c-name {
      font-size: 13px;
      font-weight: 600;
    }

    .comment-item .c-body .c-text {
      font-size: 14px;
      margin-top: 2px;
    }

    .comment-input-row {
      display: flex;
      gap: 8px;
      margin-top: 12px;
      align-items: center;
    }

    .comment-input-row input {
      flex: 1;
      background: var(--surface-2);
      border: none;
      border-radius: 20px;
      padding: 10px 14px;
      color: #fff;
      font-size: 14px;
      outline: none;
    }

    .comment-input-row button {
      background: var(--accent);
      border: none;
      color: #fff;
      border-radius: 20px;
      padding: 10px 16px;
      font-weight: 600;
      cursor: pointer;
    }

    .comment-tools { display:flex; align-items:center; gap:6px; margin-top:12px; }
    .comment-sticker-btn { width:42px; height:42px; border-radius:50%; border:1px solid rgba(255,255,255,.09); background:var(--surface-2); color:#fff; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; flex:0 0 auto; }
    .comment-sticker-btn:active { transform:scale(.95); }
    .sticker-picker { display:none; margin-top:10px; padding:10px; border-radius:14px; background:#0f0f10; border:1px solid rgba(255,255,255,.08); box-shadow:0 16px 40px rgba(0,0,0,.35); }
    .sticker-picker.visible { display:block; }
    .sticker-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:4px; border-radius:10px; background:#191919; margin-bottom:10px; }
    .sticker-tab { border:0; background:transparent; color:#8f8f95; padding:9px 8px; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; }
    .sticker-tab.active { background:#2a2a2c; color:#fff; }
    .sticker-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; max-height:210px; overflow-y:auto; }
    .sticker-grid button { border:1px solid transparent; border-radius:12px; background:#171718; min-height:54px; display:flex; align-items:center; justify-content:center; cursor:pointer; color:#fff; transition:transform .12s,border-color .12s,background .12s; }
    .sticker-grid button:active { transform:scale(.94); }
    .sticker-grid button:hover { border-color:rgba(255,255,255,.13); background:#1d1d1f; }
    .sticker-add-button { grid-column: 1 / -1; min-height: 44px !important; justify-content:flex-start !important; padding: 0 12px; gap: 8px; background: rgba(255,255,255,.04) !important; border: 1px dashed rgba(255,255,255,.14) !important; color:#cfcfd4 !important; font-size:13px; font-weight:700; }
    .sticker-add-button svg { flex:0 0 auto; }
    .custom-sticker-item { width:42px; height:42px; object-fit:contain; border-radius:9px; }
    .sticker-item { width:42px; height:42px; display:block; }
    .emoji-item { font-size:28px; line-height:1; }
    .comment-item { position:relative; align-items:flex-start; }
    .comment-main { flex:1; min-width:0; }
    .comment-actions { display:flex; align-items:center; gap:10px; margin-top:6px; }
    .comment-like-btn { border:0; background:transparent; color:#8e8e95; padding:0; display:inline-flex; align-items:center; gap:4px; font-size:12px; cursor:pointer; }
    .comment-like-btn.liked { color:var(--accent); }
    .comment-like-btn svg { width:16px; height:16px; }
    .comment-context-menu { position:fixed; z-index:500; min-width:190px; padding:6px; border-radius:12px; background:#171719; border:1px solid rgba(255,255,255,.1); box-shadow:0 20px 50px rgba(0,0,0,.5); display:none; }
    .comment-context-menu.visible { display:block; }
    .comment-context-menu button { width:100%; border:0; background:transparent; color:#fff; text-align:left; padding:11px 12px; border-radius:8px; cursor:pointer; font-size:13px; display:flex; align-items:center; gap:8px; }
    .comment-context-menu button:hover { background:rgba(255,255,255,.07); }
    .comment-context-menu button.danger { color:#ff7a95; }
    .comment-sticker {
      width:74px;
      height:74px;
      max-width:74px;
      max-height:74px;
      display:flex;
      align-items:center;
      justify-content:center;
      margin-top:6px;
      overflow:hidden;
    }
    .comment-sticker img,
    .comment-sticker svg {
      width:74px !important;
      height:74px !important;
      max-width:74px !important;
      max-height:74px !important;
      object-fit:contain;
      display:block;
    }
    .comment-textual { white-space:pre-wrap; word-break:break-word; }

    @media (max-width: 600px) {
      #commentsModal .modal-sheet { max-height: 92%; padding-top: 12px; }
      #commentsModal .comments-list { height: auto; min-height: 260px; }
      .comment-sticker, .comment-sticker img, .comment-sticker svg { width:64px !important; height:64px !important; max-width:64px !important; max-height:64px !important; }
    }

    .moderation-note {
      margin:0 14px 14px; padding:11px 12px; border-radius:11px;
      border:1px solid rgba(255,255,255,.07); background:rgba(255,255,255,.035);
      color:#9b9ba2; font-size:11px; line-height:1.45;
    }
    .moderation-note strong { color:#f4f4f6; }
    body.light-theme .moderation-note { background:#f5f5f7; border-color:#e3e3e8; color:#666872; }
    body.light-theme .moderation-note strong { color:#1b1b1f; }


/* ========== RESPONSIVE VIDEO BOUNDS ========== */
html, body, #app {
  overflow-x: hidden;
}

#feed-screen,
#feed-screen .feed-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
}

#feed-screen .video-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: var(--app-height, 100dvh);
  min-height: 0;
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
}

#feed-screen .video-card video,
#feed-screen .video-card > img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block;
}

@media (max-width: 859px) {
  #app {
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
  }
  #feed-screen,
  #feed-screen .feed-container {
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
  }
}


/* ========== FULLSCREEN CAMERA ========== */
#create-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height, 100dvh);
  max-width: none;
  z-index: 250;
  background: #000;
}
#create-screen .camera-view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height, 100dvh);
  min-width: 100vw;
  min-height: 0;
  background: transparent;
  display: block;
  overflow: hidden;
}
#create-screen .camera-view video#cameraPreview {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  background: transparent;
  border: 0;
  outline: 0;
  transform-origin: center center;
}
#create-screen .record-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: max(20px, calc(20px + var(--safe-bottom)));
}
#create-screen .camera-top-controls {
  top: max(12px, calc(12px + var(--safe-top)));
}
#create-screen .camera-enable-btn {
  z-index: 40;
}
/* Publish remains inside the app; the camera itself is the immersive screen. */
#publish-screen { z-index: 260; }

/* Music selector */
.music-pick-field input {
  width: 100%;
  min-height: 42px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}
.music-pick-hint {
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

.music-pick-field input:focus { border-color: rgba(94,160,255,.55); box-shadow: 0 0 0 3px rgba(94,160,255,.12); }


/* Share to friend / download */
.share-friend-sheet,.download-sheet{max-height:78%;}.download-description,.share-friend-subtitle{color:var(--text-muted);font-size:12px;line-height:1.45;margin:-2px 2px 12px}.download-options,.share-friend-list{display:flex;flex-direction:column;gap:8px}.download-option{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.035);color:inherit;border-radius:14px;padding:13px 14px;cursor:pointer;text-align:left}.download-option:hover{background:rgba(255,255,255,.07)}.download-option:disabled{opacity:.55;cursor:wait}.download-option-main{min-width:0;display:flex;flex-direction:column;gap:3px}.download-option-name{font-size:15px;font-weight:800}.download-option-meta{font-size:11px;color:var(--text-muted)}.download-option-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--accent)}.download-note{margin-top:10px;color:var(--text-muted);font-size:10px;line-height:1.4}.share-friend-row{width:100%;display:flex;align-items:center;gap:11px;border:1px solid rgba(255,255,255,.07);background:rgba(255,255,255,.025);color:inherit;border-radius:14px;padding:10px 12px;cursor:pointer;text-align:left}.share-friend-row:hover{background:rgba(255,255,255,.06)}.share-friend-avatar{width:46px;height:46px;flex:0 0 46px;border-radius:50%;overflow:hidden;background:#2a2a2d}.share-friend-avatar img{width:100%;height:100%;object-fit:cover;display:block}.share-friend-main{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}.share-friend-name{font-size:14px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.share-friend-username{font-size:11px;color:var(--text-muted)}.share-friend-arrow{color:var(--accent);display:inline-flex;align-items:center}.chat-video-share{width:100%;display:flex;align-items:center;gap:10px;border:1px solid rgba(255,255,255,.08);background:rgba(0,0,0,.12);color:inherit;border-radius:13px;padding:7px;text-align:left;cursor:pointer}.chat-video-share:active{transform:scale(.99)}.chat-video-share-thumb{width:62px;height:78px;border-radius:9px;overflow:hidden;background:#121214;flex:0 0 62px;display:flex;align-items:center;justify-content:center}.chat-video-share-thumb img{width:100%;height:100%;object-fit:cover;display:block}.chat-video-share-play{color:#fff;opacity:.82}.chat-video-share-info{min-width:0;flex:1;display:flex;flex-direction:column;gap:4px}.chat-video-share-title{font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-video-share-desc{font-size:11px;color:var(--text-muted);line-height:1.3}.chat-video-share-icon{width:30px;height:30px;border-radius:50%;background:rgba(255,255,255,.10);display:inline-flex;align-items:center;justify-content:center;flex:0 0 30px}body.light-theme .download-option,body.light-theme .share-friend-row,body.light-theme .chat-video-share{background:#fff;border-color:#e2e2e7}


/* ========== LOW-END DEVICE MODE ========== */
.low-performance .video-card {
  animation: none !important;
  will-change: auto !important;
}
.low-performance .video-card,
.low-performance .feed-container {
  scroll-behavior: auto;
}
.low-performance .video-pause-indicator .pause-badge,
.low-performance .top-nav .refresh-btn,
.low-performance .virtual-back,
.low-performance .download-sheet,
.low-performance .share-friend-sheet {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.low-performance .video-pause-indicator,
.low-performance .feed-refresh-indicator,
.low-performance .loading-spinner {
  transition: none !important;
}
.low-performance .loading-spinner {
  animation: none !important;
}
.low-performance .video-pause-indicator {
  transform: none !important;
}
.low-performance .video-card::after {
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.28) 42%, transparent 100%);
}

/* Fullscreen sticker viewer */
.sticker-viewer-overlay { z-index: 900; background: rgba(0,0,0,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.sticker-viewer-sheet { width: min(100%, 760px); height: min(100%, 900px); max-height: 100%; background: transparent; display:flex; flex-direction:column; overflow:hidden; }
.sticker-viewer-head { display:flex; align-items:center; justify-content:space-between; padding: max(14px, env(safe-area-inset-top)) 16px 12px; color:#fff; flex:0 0 auto; }
.sticker-viewer-title { font-size:15px; font-weight:800; }
.sticker-viewer-close { width:40px; height:40px; border-radius:50%; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.08); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.sticker-viewer-close:active { transform:scale(.94); }
.sticker-viewer-stage { flex:1 1 auto; min-height:0; display:flex; align-items:center; justify-content:center; padding:24px; overflow:auto; }
.sticker-viewer-image, .sticker-viewer-svg { width:min(82vw, 78vh, 560px); height:min(82vw, 78vh, 560px); max-width:100%; max-height:100%; object-fit:contain; display:block; filter: drop-shadow(0 24px 55px rgba(0,0,0,.45)); }
.comment-hide-btn { border:0; background:transparent; color:#777980; padding:0; display:inline-flex; align-items:center; gap:4px; font-size:12px; cursor:pointer; }
.comment-hide-btn:hover { color:#b8b9c0; }
.comment-hide-btn:active { transform:scale(.97); }
.comment-sticker { border:0; padding:0; background:transparent; color:inherit; cursor:zoom-in; }
.comment-sticker:focus-visible { outline:2px solid var(--accent); outline-offset:3px; border-radius:10px; }
@media (max-width:600px){
  .sticker-viewer-stage { padding:18px; }
  .sticker-viewer-image, .sticker-viewer-svg { width:min(88vw, 70vh, 460px); height:min(88vw, 70vh, 460px); }
}

/* ========== COUNTRY FLAG + COAT OF ARMS COMMENT EASTER EGG ========== */
.country-flag-animation-layer {
  position:absolute;
  z-index:35;
  inset:52px 0 82px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:12px;
  pointer-events:none;
  overflow:hidden;
  contain:layout paint;
}
.country-flag-card {
  position:relative;
  width:min(228px, 58vw);
  min-height:196px;
  padding:18px 18px 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  border:1px solid rgba(255,255,255,.13);
  border-radius:22px;
  background:linear-gradient(180deg,rgba(31,31,36,.88),rgba(17,17,20,.80));
  box-shadow:0 18px 55px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter:blur(13px);
  -webkit-backdrop-filter:blur(13px);
  transform:translate3d(0,20px,0) scale(.82);
  opacity:0;
  will-change:transform,opacity;
  animation:countryFlagCardIn .42s cubic-bezier(.18,.82,.25,1.14) forwards,
             countryFlagCardHold 1s ease .42s forwards,
             countryFlagCardOut .33s cubic-bezier(.4,0,.75,.2) 1.42s forwards;
}
.country-flag-card.reduced-motion {
  animation:countryFlagCardInReduced .24s ease forwards,
             countryFlagCardOut .25s ease .38s forwards;
}
.country-flag-glow { position:absolute; inset:12px; border-radius:19px; background:radial-gradient(circle at 50% 30%,rgba(160,120,255,.18),transparent 65%); filter:blur(8px); opacity:.8; pointer-events:none; }
.country-flag-media { position:relative; z-index:1; display:flex; align-items:center; justify-content:center; gap:14px; width:100%; min-height:104px; }
.country-flag-visual { position:relative; width:148px; display:flex; align-items:center; justify-content:center; }
.country-flag-emoji { display:block; font-size:68px; line-height:1; filter:drop-shadow(0 7px 15px rgba(0,0,0,.24)); transform-origin:50% 75%; animation:countryFlagWave .68s ease-in-out .4s 2 alternate; }
.country-flag-image { display:block; width:min(138px,34vw); height:auto; max-height:86px; object-fit:contain; border-radius:7px; box-shadow:0 7px 18px rgba(0,0,0,.26); transform-origin:50% 75%; animation:countryFlagWave .68s ease-in-out .4s 2 alternate; }
.country-coat-visual { width:56px; height:86px; display:flex; align-items:center; justify-content:center; }
.country-coat-image { display:block; width:54px; height:78px; object-fit:contain; filter:drop-shadow(0 6px 12px rgba(0,0,0,.24)); animation:countryCoatFloat .72s ease-in-out .46s 2 alternate; }
.country-media-fallback { display:flex; align-items:center; justify-content:center; color:rgba(255,255,255,.88); font-weight:800; font-size:26px; }
.country-coat-visual .country-media-fallback { width:54px; height:78px; border-radius:12px; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.08); }
.country-flag-title { position:relative; z-index:1; max-width:100%; color:#fff; font-size:14px; font-weight:700; line-height:1.15; text-align:center; text-wrap:balance; text-shadow:0 1px 8px rgba(0,0,0,.24); }
.country-flag-particle { position:absolute; z-index:1; width:4px; height:4px; border-radius:50%; background:rgba(207,184,255,.82); box-shadow:0 0 9px rgba(167,132,255,.7); opacity:0; animation:countryFlagParticle 1.05s ease-out .5s 1 forwards; }
.country-flag-particle-1 { left:17%; top:39%; }
.country-flag-particle-2 { right:18%; top:30%; animation-delay:.62s; }
.country-flag-particle-3 { left:25%; bottom:25%; animation-delay:.55s; }
.country-flag-particle-4 { right:28%; bottom:20%; animation-delay:.68s; }
.low-performance .country-flag-card { backdrop-filter:none !important; -webkit-backdrop-filter:none !important; box-shadow:0 12px 32px rgba(0,0,0,.28); }
.low-performance .country-coat-image { animation:none !important; }
.country-name-flash { display:inline; border-radius:4px; box-shadow:0 0 0 1px rgba(180,150,255,.08),0 0 12px rgba(168,130,255,.46); background:rgba(168,130,255,.08); animation:countryNameFlash .58s ease both; }
@keyframes countryFlagCardIn { 0%{opacity:0;transform:translate3d(0,22px,0) scale(.82);filter:blur(5px)} 65%{opacity:1;transform:translate3d(0,-2px,0) scale(1.035);filter:blur(0)} 100%{opacity:1;transform:translate3d(0,0,0) scale(1);filter:blur(0)} }
@keyframes countryFlagCardHold { 0%,100%{transform:translate3d(0,0,0) scale(1)} }
@keyframes countryFlagCardOut { 0%{opacity:1;transform:translate3d(0,0,0) scale(1);filter:blur(0)} 100%{opacity:0;transform:translate3d(0,-10px,0) scale(.96);filter:blur(3px)} }
@keyframes countryFlagCardInReduced { 0%{opacity:0;transform:scale(.94)} 100%{opacity:1;transform:scale(1)} }
@keyframes countryFlagWave { 0%,100%{transform:rotate(-1.6deg) translate3d(0,0,0)} 50%{transform:rotate(1.6deg) translate3d(0,-1px,0)} }
@keyframes countryCoatFloat { 0%,100%{transform:translate3d(0,1px,0) rotate(-1deg)} 50%{transform:translate3d(0,-2px,0) rotate(1deg)} }
@keyframes countryFlagParticle { 0%{opacity:0;transform:translate3d(0,8px,0) scale(.65)} 25%{opacity:.9} 100%{opacity:0;transform:translate3d(0,-20px,0) scale(1.08)} }
@keyframes countryNameFlash { 0%{background:rgba(168,130,255,.12);box-shadow:0 0 0 1px rgba(180,150,255,.16),0 0 14px rgba(168,130,255,.52)} 100%{background:transparent;box-shadow:none} }
@media(max-width:600px){
  .country-flag-animation-layer{inset:48px 0 74px}
  .country-flag-card{width:min(194px,68vw);min-height:172px;padding:14px 13px 11px;border-radius:18px}
  .country-flag-media{gap:10px;min-height:88px}
  .country-flag-visual{width:116px}
  .country-flag-emoji{font-size:56px}
  .country-flag-image{width:min(108px,36vw);max-height:66px}
  .country-coat-visual{width:48px;height:72px}
  .country-coat-image,.country-coat-visual .country-media-fallback{width:46px;height:66px}
  .country-flag-title{font-size:13px}
}
@media(prefers-reduced-motion:reduce){
  .country-flag-card,.country-flag-card.reduced-motion,.country-flag-emoji,.country-flag-image,.country-coat-image,.country-name-flash{animation-duration:.26s!important;animation-iteration-count:1!important}
  .country-flag-particle{display:none}
}


/* ===== Доступность видео: не обрезаем кадр и не выпускаем его за экран ===== */
.feed-item,
.video-card,
.video-wrap,
.video-player,
.video-container {
  max-width: 100%;
}

.video-feed video,
.video-feed img,
.feed video,
.feed img,
.video-card video,
.video-card img {
  max-width: 100%;
}

.video-feed video,
.feed video,
.video-card video {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(88dvh, 980px);
  object-fit: contain !important;
  display: block;
  margin: 0 auto;
}

/* Контейнер использует реальный размер кадра, когда это возможно,
   вместо принудительного crop через height:100%. */
.video-cover,
.video-loading {
  max-width: 100%;
}

.video-cover img {
  width: 100%;
  height: auto !important;
  max-height: min(88dvh, 980px);
  object-fit: contain !important;
  object-position: center;
}

.video-overlay {
  max-width: 100%;
  overflow: hidden;
}

/* Узкие телефоны: оставляем поля вокруг широких роликов,
   но вертикальные ролики по-прежнему занимают большую часть экрана. */
@media (max-width: 900px) {
  .video-feed video,
  .feed video,
  .video-card video {
    max-height: 84dvh;
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 600px) {
  .video-feed video,
  .feed video,
  .video-card video,
  .video-cover img {
    max-width: calc(100vw - 16px);
    max-height: 78dvh;
  }
}

/* Фоллбек для браузеров без поддержки dvh */
@supports not (height: 1dvh) {
  .video-feed video,
  .feed video,
  .video-card video,
  .video-cover img {
    max-height: 88vh;
  }
}

/* ========== DESKTOP FEED ACTIONS FIX ========== */
@media (min-width: 860px) {
  /* Keep the feed card centered at the intended desktop width. */
  #feed-screen .feed-container {
    width: 100% !important;
    max-width: 760px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* The media layer must stay below the interactive overlay. */
  #feed-screen .video-card video,
  #feed-screen .video-card > img {
    z-index: 1 !important;
  }

  #feed-screen .video-card .video-overlay {
    z-index: 20 !important;
    overflow: visible !important;
  }

  #feed-screen .video-card .side-actions {
    z-index: 30 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}



/* LIVE entry remains part of the normal top feed tabs; stream creation is in the camera screen. */
.live-feed-tab { letter-spacing: .1px; user-select: none; -webkit-tap-highlight-color: transparent; }
.camera-live-start-btn {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  left: 64px;
  z-index: 27;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(239,42,81,.93);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .1px;
  white-space: nowrap;
  box-shadow: 0 9px 28px rgba(0,0,0,.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  touch-action: manipulation;
}
.camera-live-start-btn:active { transform: scale(.96); }
.camera-live-start-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.camera-live-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.14); }
@media (min-width: 860px) { .camera-live-start-btn { left: 310px; } }
@media (max-width: 360px) { .camera-live-start-btn { min-height: 38px; padding: 0 10px; font-size: 11px; } }

/* ===== TikTok-style camera filters and programmatic AR masks ===== */
#create-screen .camera-view .camera-effects-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  background: #000;
}
#create-screen .camera-view.camera-effects-active #cameraPreview {
  visibility: hidden;
}
.camera-effects-panel {
  position: absolute;
  z-index: 48;
  left: 10px;
  right: 10px;
  bottom: max(118px, calc(118px + var(--safe-bottom, 0px)));
  padding: 12px 12px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: rgba(17,17,20,.91);
  color: #fff;
  box-shadow: 0 16px 48px rgba(0,0,0,.42);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  max-height: min(244px, 42vh);
  overflow: hidden;
}
.camera-effects-panel[hidden] { display: none !important; }
.camera-effects-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
}
.camera-effects-heading > div { display: flex; flex-direction: column; gap: 2px; }
.camera-effects-heading strong { font-size: 14px; font-weight: 800; }
.camera-effects-heading span { color: rgba(255,255,255,.58); font-size: 10px; }
.camera-effects-close {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.camera-effects-tabs {
  display: flex;
  gap: 7px;
  margin: 9px 0 8px;
}
.camera-effects-tabs button {
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  padding: 6px 13px;
  color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.camera-effects-tabs button.active {
  color: #fff;
  border-color: rgba(255,255,255,.48);
  background: rgba(255,255,255,.19);
}
.camera-effects-items {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 1px 7px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.camera-effects-items::-webkit-scrollbar { display: none; }
.camera-effect-item {
  min-width: 62px;
  max-width: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.78);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.camera-effect-item > span:last-child {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.camera-effect-preview,
.camera-mask-preview {
  width: 51px;
  height: 51px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(145deg,#777,#24242a 55%,#b8a3a8);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.13), 0 5px 12px rgba(0,0,0,.24);
  position: relative;
  overflow: hidden;
}
.camera-effect-preview i {
  width: 24px;
  height: 31px;
  border-radius: 48% 48% 43% 43%;
  background: linear-gradient(145deg,#ffd4b7,#b87565);
  box-shadow: 0 0 0 5px rgba(255,255,255,.08);
}
.camera-mask-preview {
  background: radial-gradient(circle at 35% 25%,#48435e,#1f1d2b 70%);
  font-size: 25px;
}
.camera-effect-item.selected { color: #fff; }
.camera-effect-item.selected .camera-effect-preview,
.camera-effect-item.selected .camera-mask-preview {
  border-color: #ff315b;
  box-shadow: 0 0 0 2px rgba(255,49,91,.2), 0 0 18px rgba(255,49,91,.28);
}
.camera-effects-hint {
  min-height: 15px;
  color: rgba(255,255,255,.55);
  font-size: 10px;
  line-height: 1.35;
  padding: 1px 2px 0;
}
#create-screen .camera-view.camera-effects-panel-open .cam-side-tools,
#create-screen .camera-view.camera-effects-panel-open .cam-speed-bar {
  opacity: 0;
  pointer-events: none;
}
@media (max-height: 700px) {
  .camera-effects-panel {
    bottom: max(108px, calc(108px + var(--safe-bottom, 0px)));
    max-height: min(218px, 39vh);
    padding: 9px 10px 8px;
  }
  .camera-effect-preview, .camera-mask-preview { width: 45px; height: 45px; }
  .camera-effects-tabs { margin: 6px 0; }
}
