:root {
    --frame-w: 430px;
    --frame-h: 932px;
    --icon: 72px;
    --icon-radius: 21px;
    --text: #ffffff;
  }

  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { width: 100%; min-height: 100%; margin: 0; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Arial, sans-serif;
    background: #ffffff;
    color: var(--text);
    overflow-x: hidden;
  }
  button, input, textarea { font-family: inherit; }
  button { cursor: pointer; }

  .web-stage {
    min-height: 100vh;
    padding: 28px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(circle at 50% 16%, rgba(0,0,0,.08), transparent 34%),
      linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
  }

  .iphone18-frame {
    width: min(94vw, var(--frame-w));
    height: min(calc(100vh - 56px), var(--frame-h));
    min-height: 780px;
    position: relative;
    padding: 10px;
    border-radius: 64px;
    background: linear-gradient(145deg, #f7fafc 0%, #c7d0d8 11%, #171b20 35%, #060709 56%, #cfd6df 100%);
    border: 1px solid rgba(0,0,0,.45);
    box-shadow:
      0 70px 140px rgba(15, 23, 42, .28),
      0 26px 60px rgba(15, 23, 42, .22),
      0 6px 16px rgba(15, 23, 42, .14),
      inset 0 0 0 1px rgba(255,255,255,.4),
      inset 0 24px 52px rgba(255,255,255,.22),
      inset 0 -22px 48px rgba(0,0,0,.48);
  }
  .iphone18-frame::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 54px;
    border: 1px solid rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.52), inset 0 0 46px rgba(0,0,0,.58);
    pointer-events: none;
    z-index: 8;
  }
  .metal-highlight {
    position: absolute; inset: 1px; border-radius: 64px; pointer-events: none;
    background: linear-gradient(110deg, rgba(255,255,255,.60), transparent 14%, transparent 79%, rgba(255,255,255,.34)); opacity: .52;
  }
  .side-button {
    position: absolute; width: 4px; border-radius: 99px;
    background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(255,255,255,.42), rgba(0,0,0,.34));
    box-shadow: 0 6px 10px rgba(0,0,0,.25);
  }
  .side-button-left-a { left: -3px; top: 146px; height: 52px; }
  .side-button-left-b { left: -3px; top: 218px; height: 86px; }
  .side-button-right { right: -3px; top: 202px; height: 124px; }

  .phone-screen {
    width: 100%; height: 100%; position: relative; overflow: hidden; border-radius: 54px;
    background: linear-gradient(180deg, rgba(15, 67, 124, .92), rgba(58, 142, 206, .84) 34%, rgba(179, 218, 238, .8) 54%, rgba(88, 153, 100, .92) 100%), radial-gradient(circle at 42% 38%, rgba(255,255,255,.92), transparent 18%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), inset 0 0 70px rgba(0,0,0,.24);
  }
  .wallpaper-clouds, .wallpaper-clouds::before, .wallpaper-clouds::after { position: absolute; content: ""; pointer-events: none; }
  .wallpaper-clouds { inset: 0; z-index: 0; background: radial-gradient(circle at 72% 32%, rgba(255,255,255,.72) 0 6%, transparent 15%), radial-gradient(circle at 58% 36%, rgba(255,255,255,.68) 0 9%, transparent 18%), radial-gradient(circle at 42% 46%, rgba(255,255,255,.58) 0 6%, transparent 17%), linear-gradient(145deg, transparent 0 56%, rgba(29,98,61,.7) 57% 100%); }
  .wallpaper-clouds::before { left: -40px; right: -60px; bottom: 88px; height: 230px; background: linear-gradient(130deg, transparent 0 30%, rgba(27,88,56,.84) 31% 100%); clip-path: polygon(0 100%, 22% 40%, 42% 74%, 62% 28%, 82% 76%, 100% 36%, 100% 100%); opacity: .85; }
  .wallpaper-clouds::after { left: 16px; right: 10px; bottom: 165px; height: 210px; background: linear-gradient(120deg, rgba(255,255,255,.16), transparent), repeating-linear-gradient(113deg, rgba(255,255,255,.34) 0 2px, transparent 2px 13px); clip-path: polygon(0 100%, 30% 24%, 58% 86%, 82% 20%, 100% 100%); opacity: .32; }

  .status-bar {
    position: absolute; top: 18px; left: 24px; right: 24px; height: 24px; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
  }
  .status-left { width: 22px; height: 22px; }
  .colorful-status { display: flex; align-items: center; gap: 8px; }
  .sig-bars { display: inline-flex; align-items: end; gap: 2px; height: 14px; }
  .sig-bars i { width: 3px; border-radius: 3px; display: block; background: linear-gradient(180deg,#7dd3fc,#2563eb); }
  .sig-bars i:nth-child(1){ height: 5px; } .sig-bars i:nth-child(2){ height: 8px; } .sig-bars i:nth-child(3){ height: 11px; } .sig-bars i:nth-child(4){ height: 14px; }
  .wifi-icon { position: relative; width: 18px; height: 14px; display: inline-block; }
  .wifi-icon i { position: absolute; left: 50%; transform: translateX(-50%); border: 2px solid transparent; border-top-color: #06b6d4; border-radius: 50%; }
  .wifi-icon i:nth-child(1){ width: 18px; height: 18px; top: -5px; }
  .wifi-icon i:nth-child(2){ width: 12px; height: 12px; top: -2px; border-top-color: #38bdf8; }
  .wifi-icon i:nth-child(3){ width: 6px; height: 6px; top: 1px; border-top-color: #7dd3fc; }
  .sun-icon {
    width: 16px; height: 16px; border-radius: 50%; display: inline-block; position: relative;
    background: radial-gradient(circle, #fde68a 0 48%, #f59e0b 55% 100%);
    box-shadow: 0 0 8px rgba(245,158,11,.45);
  }
  .sun-icon::before {
    content:""; position:absolute; inset:-3px; border-radius:50%;
    background: conic-gradient(from 0deg, transparent 0 10%, rgba(245,158,11,.8) 10% 13%, transparent 13% 25%, rgba(245,158,11,.8) 25% 28%, transparent 28% 40%, rgba(245,158,11,.8) 40% 43%, transparent 43% 55%, rgba(245,158,11,.8) 55% 58%, transparent 58% 70%, rgba(245,158,11,.8) 70% 73%, transparent 73% 85%, rgba(245,158,11,.8) 85% 88%, transparent 88% 100%);
    -webkit-mask: radial-gradient(circle, transparent 0 55%, #000 56% 100%);
            mask: radial-gradient(circle, transparent 0 55%, #000 56% 100%);
  }
  .battery-pill {
    min-width: 36px; height: 18px; padding: 0 6px 0 3px; border-radius: 999px; border: 1px solid rgba(0,0,0,.10);
    background: rgba(255,255,255,.85); color: #0f172a; position: relative; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 900;
  }
  .battery-pill::after { content:""; position:absolute; right:-3px; top:5px; width:2px; height:8px; border-radius:0 2px 2px 0; background:#9ca3af; }
  .battery-level { width: 16px; height: 10px; border-radius: 999px; background: linear-gradient(90deg,#22c55e,#84cc16); display:inline-block; }

  .dynamic-island {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 132px; height: 34px; z-index: 22;
    border-radius: 999px; background: rgba(9,11,15,.96); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px rgba(0,0,0,.28);
  }

  .screen-view { position: absolute; inset: 0; z-index: 4; }
  .hidden { display: none !important; }

  .home-view { padding: 92px 28px 130px; }
  .app-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
    column-gap: 18px; row-gap: 22px;
  }
  .app-item { text-align: center; }
  .app-icon {
    width: var(--icon); height: var(--icon); border: 0; border-radius: var(--icon-radius);
    display: grid; place-items: center; margin: 0 auto 7px; font-size: 36px; font-weight: 800;
    box-shadow: 0 14px 30px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.42);
  }
  .app-symbol { display: block; line-height: 1; transform: translateY(-1px); }
  .app-label { font-size: 13px; line-height: 1.15; font-weight: 650; color: rgba(255,255,255,.98); text-shadow: 0 1px 6px rgba(0,0,0,.28); }

  .search-pill {
    position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
    min-width: 166px; height: 36px; border-radius: 999px; border: 1px solid rgba(255,255,255,.34);
    background: rgba(59, 65, 75, .42); color: rgba(255,255,255,.95); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 620;
  }
  .dock-grid {
    position: absolute; left: 18px; right: 18px; bottom: 26px; padding: 14px 18px; border-radius: 30px;
    background: rgba(255,255,255,.30); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 18px 42px rgba(0,0,0,.18);
    display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; z-index: 5;
  }
  .dock-grid .app-item .app-label { display: none; }
  .dock-grid .app-icon { margin-bottom: 0; width: 68px; height: 68px; font-size: 34px; }

  .icon-claude { background: linear-gradient(135deg, #f59e7b, #e98d61); color: #fff; }
  .icon-chatgpt { background: #ffffff; color: #111827; }
  .icon-gemini { background: #ffffff; color: #4f46e5; }
  .icon-perplexity { background: #0f172a; color: #fff; }
  .icon-gmail, .icon-gmail_blue { background: #fff; color: #ef4444; }
  .icon-drive { background: #fff; color: #22c55e; }
  .icon-google { background: #fff; color: #2563eb; }
  .icon-facebook { background: linear-gradient(135deg, #1a73e8, #0a56c2); color: #fff; }
  .icon-zalo { background: #fff; color: #0068ff; }
  .icon-telegram { background: linear-gradient(135deg, #38bdf8, #0284c7); color: #fff; }
  .icon-youtube { background: #fff; color: #ff0033; }
  .icon-media { background: linear-gradient(135deg, #8b5cf6, #06b6d4); color: #fff; }
  .icon-upload { background: linear-gradient(135deg, #22c55e, #10b981); color: #fff; }
  .icon-image { background: linear-gradient(135deg, #fb7185, #f97316); color: #fff; }
  .icon-video { background: linear-gradient(135deg, #111827, #374151); color: #fff; }
  .icon-work { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; }
  .icon-docs { background: #fff; color: #111827; }
  .icon-finance { background: linear-gradient(135deg, #064e3b, #059669); color: #fff; }
  .icon-settings { background: linear-gradient(135deg, #1f2937, #0f172a); color: #fff; }

  .page-view {
    padding: 72px 14px 22px;
    background: #ffffff;
    color: #111827;
  }
  .media-toolbar, .simple-topbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  }
  .toolbar-actions { display: flex; align-items: center; gap: 10px; flex: 1; }
  .simple-title { font-size: 22px; font-weight: 800; color: #111827; letter-spacing: -.03em; }
  .circle-btn {
    width: 48px; height: 48px; border-radius: 999px; border: 0; display: grid; place-items: center;
    font-size: 38px; line-height: 1; box-shadow: 0 8px 18px rgba(15,23,42,.12);
  }
  .circle-btn.dark { background: #1f2937; color: #fff; }
  .tool-btn {
    width: 44px; height: 44px; border-radius: 15px; border: 0; background: #f3f4f6; color: #111827;
    display: grid; place-items: center; box-shadow: 0 8px 18px rgba(15,23,42,.08); position: relative;
  }
  .tool-btn.active::after {
    content:""; position:absolute; inset:-2px; border-radius:17px; border:2px solid #111827;
  }
  .tool-btn.upload { margin-left: auto; background: #dcfce7; }
  .tool-icon { font-size: 18px; font-weight: 900; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
  .tile-grid {
    width: 18px; height: 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px;
  }
  .tile-grid::before, .tile-grid::after { content: ""; }
  .tile-grid, .tile-grid::before, .tile-grid::after { }
  .tile-grid i { display:none; }
  .tile-grid {
    background:
      linear-gradient(#60a5fa 0 0) left top/7px 7px no-repeat,
      linear-gradient(#34d399 0 0) right top/7px 7px no-repeat,
      linear-gradient(#f59e0b 0 0) left bottom/7px 7px no-repeat,
      linear-gradient(#f472b6 0 0) right bottom/7px 7px no-repeat;
  }
  .tool-photo { color: #f97316; }
  .tool-video { color: #111827; }
  .tool-upload { color: #059669; }

  .masonry-grid {
    column-count: 3;
    column-gap: 4px;
    padding-bottom: 6px;
  }
  .media-card {
    width: 100%; display: block; border: 0; padding: 0; margin: 0 0 4px; break-inside: avoid;
    border-radius: 8px; overflow: hidden; background: #f3f4f6;
  }
  .media-thumb { width: 100%; display: block; overflow: hidden; background: #f3f4f6; }
  .media-thumb img, .media-thumb video { width: 100%; height: auto; display: block; }
  .media-card video { width: 100%; display: block; }
  .video-placeholder {
    min-height: 140px; display: grid; place-items: center; background: linear-gradient(135deg, #111827, #374151); color: #fff; font-size: 34px;
  }
  .empty-note {
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 22px; padding: 22px 16px;
    text-align: center; color: #475569; font-weight: 650; margin-top: 18px;
  }

  .white-card {
    border-radius: 28px; border: 1px solid #e5e7eb; background: #ffffff;
    box-shadow: 0 18px 42px rgba(15,23,42,.08);
  }
  .upload-card, .settings-card { padding: 18px; }
  .settings-card h2 { margin: 0 0 8px; color: #111827; }
  .settings-card p { margin: 0 0 18px; color: #475569; line-height: 1.5; }
  .field-label { display: block; font-size: 14px; font-weight: 800; margin: 0 0 8px; color: #111827; }
  .hint { margin: 8px 0 18px; font-size: 12px; font-weight: 650; }
  .hint.dark { color: #64748b; }
  .file-input, .text-input, .text-area {
    width: 100%; border: 1px solid #d1d5db; color: #111827; background: #f8fafc; border-radius: 18px; outline: none; font-size: 15px; margin-bottom: 16px;
  }
  .file-input { padding: 14px; }
  .text-input { height: 48px; padding: 0 14px; }
  .text-area { min-height: 104px; resize: vertical; padding: 14px; }
  .text-input::placeholder, .text-area::placeholder { color: #94a3b8; }
  .primary-btn { width: 100%; min-height: 48px; border: 0; border-radius: 18px; font-size: 16px; font-weight: 900; }
  .dark-btn { color: #fff; background: #111827; box-shadow: 0 10px 24px rgba(15,23,42,.16); }
  .primary-btn:disabled { opacity: .52; }
  .progress { margin-top: 16px; }
  .progress-bar { height: 10px; border-radius: 999px; overflow: hidden; background: #e5e7eb; }
  .progress-bar span { display: block; width: 0%; height: 100%; border-radius: 999px; background: #111827; transition: width .2s ease; }
  .progress p { margin: 8px 0 0; font-size: 12px; color: #475569; font-weight: 650; }

  .viewer {
    position: absolute; inset: 0; z-index: 80; background: #ffffff; border-radius: 54px; overflow: hidden;
    display: flex; align-items: center; justify-content: center; touch-action: pan-y;
  }
  .viewer-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 72px 0 24px; }
  .viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
  .viewer-back {
    position: absolute; top: 72px; left: 14px; z-index: 85; width: 46px; height: 46px; border: 0; border-radius: 999px;
    background: rgba(17,24,39,.92); color: #fff; font-size: 38px; line-height: 1; box-shadow: 0 10px 24px rgba(15,23,42,.14);
  }
  .viewer-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 85; width: 44px; height: 64px; border: 0; border-radius: 999px;
    background: rgba(17,24,39,.86); color: #fff; font-size: 48px; line-height: .8; box-shadow: 0 10px 20px rgba(15,23,42,.12);
  }
  .viewer-prev { left: 10px; }
  .viewer-next { right: 10px; }
  .viewer-counter {
    position: absolute; right: 16px; top: 78px; z-index: 86; min-width: 52px; height: 32px; padding: 0 12px; border-radius: 999px;
    background: rgba(17,24,39,.08); color: #111827; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  }

  .toast {
    position: absolute; left: 24px; right: 24px; bottom: 114px; z-index: 90; border-radius: 18px; padding: 12px 14px; text-align: center; color: #fff;
    background: rgba(17,24,39,.90); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); font-size: 13px; font-weight: 720; box-shadow: 0 12px 28px rgba(0,0,0,.18);
  }
  .home-indicator { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: 132px; height: 5px; border-radius: 999px; background: rgba(255,255,255,.74); z-index: 95; pointer-events: none; }

  @media (max-width: 520px) {
    .web-stage { padding: 10px; align-items: flex-start; }
    .iphone18-frame { width: min(100vw - 20px, 430px); height: min(100svh - 20px, 932px); min-height: 740px; border-radius: 58px; }
    .phone-screen, .viewer { border-radius: 48px; }
    .iphone18-frame::before { border-radius: 48px; }
    :root { --icon: 68px; }
    .home-view { padding-left: 24px; padding-right: 24px; }
    .app-grid { column-gap: 14px; row-gap: 18px; }
    .dock-grid { left: 16px; right: 16px; gap: 12px; }
    .dock-grid .app-icon { width: 62px; height: 62px; }
  }

  /* v7 - Gallery gần giống iPhone Photos / mẫu ảnh: ảnh sát nhau, không tên, video có thumbnail */
  .masonry-grid {
    column-count: initial;
    column-gap: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    padding: 0 0 10px;
    overflow-y: auto;
    max-height: calc(100% - 62px);
    -webkit-overflow-scrolling: touch;
  }
  .media-card {
    margin: 0;
    border-radius: 5px;
    aspect-ratio: 1 / 1;
    background: #f1f5f9;
    box-shadow: none;
  }
  .media-thumb {
    width: 100%;
    height: 100%;
    position: relative;
    background: #f1f5f9;
  }
  .media-thumb img,
  .media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .image-placeholder,
  .video-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e2e8f0, #f8fafc);
    color: #64748b;
    font-size: 26px;
    font-weight: 900;
  }
  .video-placeholder {
    background: linear-gradient(135deg, #111827, #374151);
    color: #fff;
  }
  .play-badge {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding-left: 2px;
    color: #fff;
    background: rgba(0,0,0,.58);
    font-size: 11px;
    font-weight: 900;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /* Viewer v7: nền trắng, vuốt ngang/dọc để next-prev, có filmstrip kéo ngang kiểu Photos */
  .viewer { background: #fff; touch-action: none; }
  .viewer-stage { padding: 68px 0 98px; }
  .viewer-stage img,
  .viewer-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #fff;
  }
  .viewer-back { top: 66px; }
  .viewer-counter { top: 72px; }
  .viewer-strip {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 22px;
    z-index: 86;
    display: flex;
    gap: 6px;
    padding: 8px 14px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.82) 24%, rgba(255,255,255,.96));
  }
  .viewer-strip::-webkit-scrollbar { display: none; }
  .strip-item {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    border: 2px solid transparent;
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #e5e7eb;
    position: relative;
    box-shadow: 0 8px 18px rgba(15,23,42,.10);
  }
  .strip-item.active {
    border-color: #111827;
    transform: translateY(-2px) scale(1.04);
  }
  .strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .strip-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #64748b;
    background: #f1f5f9;
    font-weight: 900;
  }
  .strip-play {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding-left: 1px;
    color: #fff;
    background: rgba(0,0,0,.62);
    font-size: 9px;
    font-weight: 900;
  }




  /* v8 - khóa viewer, ẩn status/camera, nút nhỏ đẹp hơn, video full màn hình */
  html, body, .web-stage, .phone-screen {
    overscroll-behavior: none;
  }

  .phone-screen.media-mode .status-bar,
  .phone-screen.media-mode .dynamic-island,
  .phone-screen.viewer-mode .status-bar,
  .phone-screen.viewer-mode .dynamic-island {
    display: none !important;
  }

  .phone-screen.media-mode .page-view {
    padding-top: 16px;
  }

  .media-toolbar {
    margin: 0 0 8px;
    gap: 7px;
  }

  .toolbar-actions {
    gap: 7px;
  }

  .circle-btn {
    width: 38px;
    height: 38px;
    font-size: 29px;
    box-shadow: 0 7px 14px rgba(15,23,42,.12);
  }

  .circle-btn.dark {
    background: linear-gradient(135deg, #111827, #374151);
  }

  .tool-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: 0 6px 14px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.84);
  }

  .tool-btn.active::after {
    inset: -2px;
    border-radius: 14px;
    border: 2px solid #2563eb;
  }

  .tool-btn.upload {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  }

  .tool-icon {
    font-size: 14px;
  }

  .tile-grid {
    width: 14px;
    height: 14px;
    background:
      linear-gradient(#3b82f6 0 0) left top/6px 6px no-repeat,
      linear-gradient(#22c55e 0 0) right top/6px 6px no-repeat,
      linear-gradient(#f59e0b 0 0) left bottom/6px 6px no-repeat,
      linear-gradient(#ec4899 0 0) right bottom/6px 6px no-repeat;
  }

  .masonry-grid {
    max-height: calc(100% - 46px);
    gap: 2px;
  }

  .viewer {
    z-index: 120;
    background: #fff;
    touch-action: none;
    overscroll-behavior: none;
    -webkit-user-select: none;
            user-select: none;
  }

  .viewer-stage {
    inset: 0;
    padding: 0;
    background: #fff;
  }

  .viewer-stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #fff;
  }

  .viewer-stage.is-video video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    background: #000;
  }

  .viewer-back,
  .viewer-delete {
    position: absolute;
    top: 14px;
    z-index: 135;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 18px rgba(15,23,42,.16);
  }

  .viewer-back {
    left: 14px;
    background: rgba(17,24,39,.92);
    font-size: 30px;
    line-height: 1;
  }

  .viewer-delete {
    right: 14px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    font-size: 19px;
    font-weight: 900;
  }

  .viewer-nav {
    width: 42px;
    height: 64px;
    background: rgba(17,24,39,.88);
  }

  .viewer-nav:disabled {
    opacity: 0;
    pointer-events: none;
  }

  .viewer-counter {
    top: 16px;
    right: 58px;
    background: rgba(17,24,39,.08);
  }

  .viewer-strip {
    bottom: 0;
    padding: 8px 14px 14px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,.84) 32%, rgba(255,255,255,.96));
  }

  .home-indicator {
    z-index: 130;
  }




  /* v9 - media icon 5 taps, spinner loading, iphone confirm modal, arrow-only nav */
  .tool-btn.upload {
    margin-left: 0 !important;
    order: 3;
  }
  #toolVideo { order: 4; }
  #toolAll { order: 1; }
  #toolImage { order: 2; }
  .toolbar-actions { justify-content: flex-start; }

  .loading-wrap {
    min-height: calc(100% - 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
  }
  .loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(59,130,246,.18);
    border-top-color: #3b82f6;
    border-right-color: #60a5fa;
    animation: spinV9 0.9s linear infinite;
  }
  @keyframes spinV9 { to { transform: rotate(360deg); } }

  .viewer-delete {
    width: 30px !important;
    height: 30px !important;
    right: 12px !important;
    top: 18px !important;
    border-radius: 999px;
    background: rgba(255,255,255,.88) !important;
    color: #ef4444 !important;
    font-size: 14px !important;
    box-shadow: 0 6px 14px rgba(15,23,42,.10) !important;
  }

  .viewer-nav {
    width: 34px !important;
    height: 52px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #2563eb !important;
    font-size: 48px !important;
    font-weight: 500;
    text-shadow: 0 3px 10px rgba(37,99,235,.18);
  }
  .viewer-prev { left: 4px !important; }
  .viewer-next { right: 4px !important; }
  .viewer-nav:disabled { opacity: .22 !important; }

  .confirm-modal { position: absolute; inset: 0; z-index: 210; display: flex; align-items: center; justify-content: center; }
  .confirm-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  .confirm-sheet {
    position: relative; z-index: 2; width: calc(100% - 68px); max-width: 290px;
    border-radius: 24px; background: rgba(255,255,255,.96); color: #111827; text-align: center;
    box-shadow: 0 24px 56px rgba(15,23,42,.20), inset 0 1px 0 rgba(255,255,255,.9); padding: 18px 18px 16px;
  }
  .confirm-trash { width: 42px; height: 42px; margin: 0 auto 10px; border-radius: 14px; display: grid; place-items: center; background: #fef2f2; color: #ef4444; font-size: 20px; }
  .confirm-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
  .confirm-desc { margin-top: 6px; color: #64748b; font-size: 13px; line-height: 1.45; }
  .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
  .confirm-btn { min-height: 42px; border: 0; border-radius: 15px; font-size: 15px; font-weight: 800; }
  .confirm-btn.cancel { background: #f1f5f9; color: #111827; }
  .confirm-btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
