/* DilmajPro web: additions for browsers, tablets and phones. */
.web-install {
  position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 9999;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 14px; background: #1b1d21; color: #eee;
  border: 1px solid rgba(255,255,255,.12); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 14px;
}
.web-install span { flex: 1 1 220px; }

html.is-web, html.is-web body { overscroll-behavior: none; }
html.is-standalone body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }

/* bigger touch targets on iPad / phones */
html.is-touch .pill, html.is-touch .btn { min-height: 38px; }
html.is-touch .split { touch-action: none; }
html.is-touch #stage { touch-action: none; }
/* timeline: a finger on empty space scrolls it; clips, texts, handles and the ruler still drag */
html.is-touch .tl-scroll { touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
html.is-touch .tl-scroll .clip, html.is-touch .tl-scroll [data-ov], html.is-touch .tl-scroll [data-au], html.is-touch .tl-scroll [data-handle], html.is-touch #ruler, html.is-touch .playhead { touch-action: none; }
html.is-touch * { -webkit-tap-highlight-color: transparent; }

/* ------------------------------------------------------------------ phones (portrait)
   Like the phone editors people know: preview on top, timeline in the middle, a scrolling tool
   bar at the bottom. Library and settings slide up as sheets over the timeline, so the preview
   stays in view while you change things. */
.m-tools, .m-sheet-head, .m-sheet-back, .transport .m-ur { display: none; }
@media (max-width: 760px) {
  html.is-web .app { height: 100dvh; overflow: hidden; }

  /* top bar: name, save, export */
  html.is-web .top { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); min-height: 50px; }
  html.is-web .brand-word, html.is-web #btnPremiere, html.is-web .save-state, html.is-web #session,
  html.is-web #wsNav, html.is-web #btnCmd, html.is-web #btnOpen, html.is-web #tlInfo { display: none !important; }
  html.is-web .brand-logo { width: 34px; height: auto; }
  html.is-web .top-start { gap: 8px; min-width: 0; flex: 1 1 auto; }
  html.is-web .project-name { min-width: 0; flex: 1 1 auto; }
  html.is-web .project-name input { width: 100%; min-width: 0; font-size: 14px; }
  html.is-web .top-end { gap: 6px; flex: 0 0 auto; }
  html.is-web .top-end .btn { min-height: 38px; padding: 0 14px; font-size: 14px; }

  /* preview */
  html.is-web .work { display: contents; }
  html.is-web .split { display: none !important; }
  html.is-web .preview-panel { order: 1; flex: 0 0 auto; height: 46dvh; margin: 0 6px 6px; min-height: 0; border-radius: 18px; }
  html.is-web .preview-bar { flex-wrap: nowrap; gap: 6px; padding: 6px 8px 0; justify-content: center; }
  html.is-web .preview-bar .tools, html.is-web .preview-bar .zoomctl, html.is-web #gpuChip { display: none; }
  html.is-web #aspectGroup button { min-height: 30px; padding: 0 10px; font-size: 12px; }
  html.is-web .transport { gap: 8px; padding: 4px 10px 8px; justify-content: space-between; flex-wrap: nowrap; }
  html.is-web .transport .timecode { font-size: 12px; order: 9; min-width: 0; white-space: nowrap; }
  html.is-web .transport .timecode .dim { display: none; }
  html.is-web .transport .round:not(.play) { width: 38px; height: 38px; }
  html.is-web .transport .m-ur { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card, #1b1d21); color: var(--text, #fff); font-size: 18px; }
  html.is-web .transport .m-ur:disabled { opacity: .35; }

  /* timeline fills the middle */
  html.is-web .timeline-panel { order: 2; flex: 1 1 auto !important; min-height: 0; height: auto !important; max-height: none !important; margin: 0 6px 6px; border-radius: 18px; }
  html.is-web .tl-bar { display: none; }

  /* bottom tool bar */
  .m-tools { order: 3; display: flex; flex: 0 0 auto; gap: 2px; overflow-x: auto; scrollbar-width: none; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line, #2a2c31); background: var(--bg, #0f1012); }
  .m-tools::-webkit-scrollbar { display: none; }
  .m-tools button { flex: 0 0 auto; min-width: 62px; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: var(--text, #e8e8ea); font: inherit; font-size: 11px; }
  .m-tools button i { font-style: normal; font-size: 20px; line-height: 1; }
  .m-tools button:active { background: var(--card, #1b1d21); }
  .m-tools button.m-hot { background: var(--lime, #d4ff3a); color: #111; }
  .m-tools button[hidden] { display: none; }
  .m-tools .m-sep { flex: 0 0 1px; margin: 10px 2px; background: var(--line, #2a2c31); }

  /* sheets: library and settings */
  html.is-web .media-panel, html.is-web .dock-r { display: none !important; }
  html.m-sheet-media .media-panel, html.m-sheet-details .dock-r {
    display: flex !important; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: 52dvh; width: auto !important; max-width: none !important;
    margin: 0; padding-top: 48px; border-radius: 22px 22px 0 0; box-shadow: 0 -18px 50px rgba(0,0,0,.55); flex-direction: column; overflow: hidden;
    animation: mSheetUp .18s ease-out; background: var(--panel, #151619);
  }
  html.m-sheet-details .dock-r > * { overflow-y: auto; }
  html.m-sheet-details .dock-r .lib2:empty { display: none; }
  html.m-sheet-media .m-sheet-head, html.m-sheet-details .m-sheet-head {
    display: flex; position: absolute; z-index: 2; left: 0; right: 0; top: 0; height: 48px; align-items: center; justify-content: space-between; padding: 0 14px; background: inherit;
  }
  .m-sheet-head b { font-size: 15px; }
  .m-sheet-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line2, #3a3d44); }
  .m-sheet-head button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card, #24272e); color: var(--text, #fff); font-size: 18px; }
  html.m-sheet-media .m-sheet-back, html.m-sheet-details .m-sheet-back { display: block; position: fixed; inset: 0; z-index: 44; background: transparent; }
  @keyframes mSheetUp { from { transform: translateY(40%); opacity: .4; } to { transform: none; opacity: 1; } }
  html.is-web .lib-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin: 4px 10px; }
  html.is-web .lib-tabs::-webkit-scrollbar { display: none; }
  html.is-web .lib-tabs button { flex: 0 0 auto !important; min-height: 34px; }
  html.is-web .tile-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)) !important; }

  /* dialogs come up from the bottom, full width */
  html.is-web .modal-back { align-items: flex-end; padding: 0; }
  html.is-web .modal { max-width: none; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow-y: auto; gap: 14px; }
  html.is-web .modal h2 { font-size: 19px; }
  html.is-web .dpcmd-back { padding-top: 10px !important; }

  html.is-web .gfx { grid-template-columns: 1fr; grid-auto-rows: auto; overflow-y: auto; }
  html.is-web .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 8px; right: 8px; max-width: none; }
  html.is-web input, html.is-web select, html.is-web textarea { font-size: 16px; } /* iOS: no zoom on focus */
}
