/* SoloTracker web — complementos do styles.css (PC e celular). */

/* ---------- player na página (YouTube IFrame API / <video> local) ---------- */
.web-player { position: absolute; inset: 0; }
.web-player:empty { display: none; }
.web-player iframe, .web-player video, .web-player > div {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000;
}
.web-player video { object-fit: contain; }
.web-player.audio-only video { opacity: 0; }
.web-player.audio-only::after {
  content: "🎵 " attr(data-name);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: var(--muted); font-size: 16px; pointer-events: none;
}
/* Antes do 1º play do YouTube em tela de toque: o toque precisa chegar ao player. */
.jog-overlay.pass { pointer-events: none; }

.lib-thumb {
  width: 112px; height: 63px; border-radius: 6px; flex: none; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.lib-item .missing-tag { color: #ff9a9d; }

.web-select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 6px; width: 100%; font-size: 13px;
}
.form-grid:has(.web-select) { grid-template-columns: 1fr 110px; }

/* ---------- celular ---------- */
html.mobile body {
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
/* 16px evita o zoom automático do iOS ao focar um campo. */
html.mobile input[type=text], html.mobile input[type=number], html.mobile select { font-size: 16px !important; }
html.mobile .btn { padding: 8px 12px; font-size: 14px; }
html.mobile .btn.small { padding: 6px 10px; }
html.mobile .btn.tiny { padding: 5px 9px; font-size: 13px; }
html.mobile .btn:hover { border-color: var(--border); }
html.mobile .btn.primary:hover { background: var(--accent); }
html.mobile kbd { display: none; }

html.mobile .topbar { gap: 6px; padding: 4px 8px; }
html.mobile .brand,
html.mobile #urlForm,
html.mobile #saveState,
html.mobile #btnExport { display: none; }
html.mobile .project-box { flex: 1; gap: 6px; }
html.mobile #projectName { width: auto; flex: 1; min-width: 60px; padding: 4px 6px; }
html.mobile #btnLibrary { padding: 6px 10px; font-size: 16px; }
html.mobile .mode-btn { min-width: 0; }
html.mobile .m-fs { font-size: 16px; }

/* palco: vídeo ocupa o espaço que sobra, linha do tempo embaixo */
html.mobile .stage { padding: 6px 8px; gap: 4px; overflow: hidden; }
html.mobile .video-wrap { flex: 1 1 auto; min-height: 120px; max-height: none; aspect-ratio: auto; }
html.mobile .time-row { gap: 6px; }
html.mobile .time-now { font-size: 18px; }
html.mobile .video-title { margin-left: 4px; font-size: 12px; }
html.mobile .timeline { height: 44px; }
html.mobile .timeline.zoom { height: 46px; }
html.mobile .zoom-wrap { padding: 2px 8px 0; }
html.mobile .zoom-label { display: none; }
html.mobile .tl-handle { width: 36px; margin-left: -18px; }
html.mobile .tl-handle::before { left: 17px; }
html.mobile .tl-hover { display: none; }
html.mobile .capture-banner { white-space: normal; max-width: 92%; text-align: center; }

/* barra lateral com abas */
html.mobile .sidebar { width: 300px; padding: 0 6px 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
html.mobile .sidebar [data-pane] { display: none; }
html.mobile .sidebar [data-pane].m-show { display: block; }
html.mobile .sidebar .panel > summary { pointer-events: none; list-style: none; padding: 8px 0 4px; }
html.mobile .sidebar .panel > summary::-webkit-details-marker { display: none; }
html.mobile .m-tabs {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px;
  background: var(--panel); padding: 6px 0;
}
html.mobile .m-tab {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 2px; font-size: 11px; white-space: nowrap; overflow: hidden; touch-action: manipulation;
}
html.mobile .m-tab.on { color: #111; background: var(--accent); border-color: var(--accent); font-weight: 600; }
html.mobile .m-tab.ping { animation: m-ping .4s 3; }
@keyframes m-ping { 50% { border-color: var(--accent); color: var(--accent-2); } }

/* controles empilhados na aba Controles */
html.mobile .m-controls { padding: 6px; }
html.mobile .m-controls .controls { flex-direction: column; gap: 6px; }
html.mobile .m-controls .group { padding: 6px; gap: 5px; justify-content: center; }
html.mobile .m-controls .transport .btn.icon { width: 48px; height: 44px; }
html.mobile .m-controls .transport .btn.icon.big { width: 58px; }
html.mobile .m-controls .volume { margin-left: 0; width: 100%; justify-content: center; }
html.mobile .m-controls .volume input { width: 70%; }
html.mobile .m-controls .speed > label { width: 100%; margin: 0; }
html.mobile .m-controls .speed input[type=range] { flex: 1; width: auto; min-width: 100px; }
html.mobile .m-controls .presets { width: 100%; justify-content: center; }
html.mobile .m-controls .loop { justify-content: space-between; }
html.mobile .m-controls #btnNewSection { width: 100%; padding: 10px; font-size: 15px; }
html.mobile .m-controls .loop-point { width: 100%; justify-content: space-between; }
html.mobile .m-controls .loop-point > .btn:first-child { flex: 1; }
html.mobile .m-controls #btnLoop, html.mobile .m-controls #btnClearLoop { flex: 1; }
html.mobile .loop-item { padding: 8px; }
html.mobile .form-grid { grid-template-columns: 1fr 84px; }
html.mobile .form-grid:has(.web-select) { grid-template-columns: 1fr 120px; }

/* biblioteca em tela cheia */
html.mobile .modal { padding: 0; align-items: stretch; }
html.mobile .modal-card {
  width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; padding: 8px 10px;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  gap: 8px;
}
html.mobile .modal-head { gap: 6px; }
html.mobile .modal-head h2 { font-size: 16px; }
html.mobile .modal-head input { min-width: 0; }
html.mobile .new-project { padding: 6px; gap: 6px; }
html.mobile .lib-item img, html.mobile .lib-thumb { width: 88px; height: 50px; }
html.mobile .lib-item .info > span:not(.name) { font-size: 12px; }

/* celular em pé: empilha (o app foi pensado para usar deitado) */
@media (orientation: portrait) {
  html.mobile .layout { flex-direction: column; overflow-y: auto; }
  html.mobile .stage { flex: none; overflow: visible; }
  html.mobile .video-wrap { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
  html.mobile .sidebar { width: auto; border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  html.mobile .modal-head { flex-wrap: wrap; }
  html.mobile .modal-head input { order: 5; flex-basis: 100%; }
  html.mobile .new-project { flex-wrap: wrap; }
  html.mobile .new-project input { flex-basis: 100%; }
}
.m-rotate { display: none; }
@media (orientation: portrait) {
  html.mobile .m-rotate {
    display: flex; position: fixed; inset: 0; z-index: 100; background: rgba(10, 11, 13, .96);
    align-items: center; justify-content: center; text-align: center; padding: 24px;
  }
}
.m-rotate-card { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 16px; }
.m-rotate-icon { font-size: 54px; animation: m-rot 2s ease-in-out infinite; }
@keyframes m-rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
