/* 모바일 셸(M1-T03·T15): 앱처럼 보이는 틀 — 홈·위 막대·재생 막대·타임라인·아래 탭. 시트는 mobile-sheet.css.
   모든 규칙은 .m-shell 아래에만 둔다(데스크톱 셸 영향 없음). 터치 타깃 ≥ 44 CSS px, 안전 영역은 env(), 간격은 4·8·12·16 단위,
   글자 크기는 모두 em(아이폰 글자 크기 설정을 따름). */
.m-shell {
  --m-gap: 12px; --m-edge: 16px; --m-radius: 14px; --m-hair: rgba(255, 255, 255, 0.10);
  --m-fill: rgba(255, 255, 255, 0.07); --m-fill-hi: rgba(255, 255, 255, 0.12); --m-bar: rgba(34, 34, 38, 0.92);
  --m-tabs-h: calc(61px + env(safe-area-inset-bottom));
  position: fixed; inset: 0; display: flex; flex-direction: column;
  background: var(--pane-bg-alt); color: var(--text-primary);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  font: 16px/1.35 -apple-system, system-ui, sans-serif; -webkit-tap-highlight-color: transparent;
}
@supports (font: -apple-system-body) { .m-shell { font: -apple-system-body; line-height: 1.35; } }
.m-shell[data-booting] > :not(.m-notifications) { visibility: hidden; }
.m-shell [hidden] { display: none !important; }
.m-notifications { flex: none; }
.m-shell .icon { flex: none; }
.m-shell .m-icon { width: 22px; height: 22px; }
.m-tab .m-icon { width: 26px; height: 26px; }
.m-play .m-icon { width: 30px; height: 30px; }
.m-project .m-icon { width: 18px; height: 18px; }

/* 단추 공통: 모양은 채움·큰 모서리·눌림 반응으로 버튼임을 보인다 */
.m-shell button { font: inherit; font-weight: 600; color: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; min-width: 44px; padding: 0 16px; border: 0; border-radius: var(--m-radius); background: var(--m-fill-hi);
  transition: transform 0.08s ease, opacity 0.08s ease; }
.m-shell button:active:not(:disabled) { transform: scale(0.96); opacity: 0.85; }
.m-shell button:disabled { opacity: 0.38; }
.m-shell button:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.m-shell .m-primary, .m-shell .m-add-media { background: var(--accent-fill); color: #fff; }
@media (prefers-reduced-motion: reduce) { .m-shell button { transition: none; } }

/* 홈 */
.m-home { flex: 1; overflow-y: auto; padding: 28px var(--m-edge) calc(24px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.m-home-title { margin: 0 0 20px; font-size: 2.1em; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.m-home-actions { display: grid; grid-template-columns: 1fr; gap: var(--m-gap); margin-bottom: 28px; }
.m-home-actions .m-primary { min-height: 52px; font-size: 1.0625em; }
.m-home-actions button:only-child { grid-column: 1 / -1; }
.m-home-actions button:not(.m-primary) { min-height: 52px; }
.m-home-heading { margin: 0 0 12px; font-size: 0.8125em; color: var(--text-secondary); font-weight: 700; letter-spacing: 0.04em; }
.m-project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.m-project-list li { display: flex; gap: 10px; align-items: stretch; }
.m-project { flex: 1; min-width: 0; justify-content: space-between !important; min-height: 60px; font-weight: 500; text-align: left; background: var(--pane-bg) !important; border: 1px solid var(--m-hair) !important; }
.m-project-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-project .m-icon { color: var(--text-secondary); }
.m-project-backup { flex: none; min-height: 60px !important; padding: 0 14px !important; font-size: 0.8125em; flex-direction: column; gap: 2px !important; }
.m-home-empty { margin: 32px 0; text-align: center; color: var(--text-secondary); }

/* 편집 화면 */
.m-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.m-bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 52px; padding: 4px 8px; background: var(--m-bar); border-bottom: 1px solid var(--m-hair); }
.m-bar-home { justify-self: start; background: transparent !important; color: var(--selection); padding: 0 10px; }
.m-bar-home .m-icon { width: 26px; height: 26px; }
.m-bar-title { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-weight: 700; }
.m-bar-save { justify-self: end; min-width: 24px; padding-right: 8px; text-align: right; color: var(--skimmer); font-weight: 800; }
.m-preview { flex: 0 0 auto; height: 36vh; min-height: 160px; display: flex; flex-direction: column; background: #000; }
.m-preview .pane-header, .m-preview .viewer-bottom { display: none; }
.m-preview .viewer-body { flex: 1; min-height: 0; }
.m-transport { flex: none; display: flex; align-items: center; gap: var(--m-gap); padding: 10px var(--m-edge); background: var(--pane-bg); border-top: 1px solid var(--m-hair); }
.m-play { width: 52px; height: 52px; padding: 0 !important; border-radius: 50% !important; background: var(--accent-fill) !important; color: #fff; }
.m-play .m-icon { margin: 0; }
.m-timecode { font-size: 1.1em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--timecode-bright); }
.m-add-media { margin-left: auto; min-width: 0 !important; flex: 0 1 auto; min-height: 44px; border-radius: 22px !important; padding: 0 16px !important; }
.m-add-media .m-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-timecode { white-space: nowrap; }
.m-progress-host { flex: none; }
.m-timeline { flex: 1; min-height: 120px; display: flex; flex-direction: column; background: var(--pane-bg-alt); border-top: 1px solid var(--m-hair); }
.m-timeline .timeline-header, .m-timeline .timeline-ruler { display: none; }
.m-timeline .timeline-body { flex: 1; min-height: 0; position: relative; overflow: hidden; touch-action: none; }
.m-timeline-empty { margin: 0; padding: 32px 24px; text-align: center; color: var(--text-secondary); }
.m-timeline:has(.m-timeline-empty:not([hidden])) .m-tl-playhead { display: none; }

/* 아래 탭: 아이콘 위, 글자 아래 */
.m-tabs { flex: none; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--m-bar); border-top: 1px solid var(--m-hair); padding: 4px 4px env(safe-area-inset-bottom); }
.m-tab { flex-direction: column; gap: 3px !important; min-width: 0 !important; min-height: 56px !important; padding: 6px 2px !important; background: transparent !important; color: var(--text-secondary); border-radius: 12px !important;
  font-size: min(0.6875em, 12px); line-height: 1.15; overflow-wrap: anywhere; text-align: center; }
.m-tab .m-label { display: block; max-width: 100%; }
.m-tab[aria-pressed="true"] { color: var(--selection); }

/* 한 줄 타임라인 */
.m-tl-host { position: relative; }
.m-tl-track { position: absolute; top: 12px; left: 0; height: 160px; will-change: transform; }
.m-tl-clip { position: absolute; top: 0; height: 64px; box-sizing: border-box; border-radius: 10px; padding: 6px 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 0.75em; font-weight: 600; background: var(--accent-fill); color: #fff; border: 2px solid transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.m-tl-clip[data-selected="true"] { border-color: var(--selection); box-shadow: 0 0 0 2px rgba(255, 219, 49, 0.25); }
.m-tl-gap { background: var(--m-fill-hi); }
.m-tl-clip[data-lane="over"] { top: 72px; height: 40px; background: #3a3a40; color: var(--text-primary); }
.m-tl-title { background: var(--accent) !important; }
.m-tl-clip[data-lane="music"] { top: 116px; height: 36px; background: var(--line-favorite); color: #0a0a0a; }
.m-tl-clip[data-readonly="true"] { background: repeating-linear-gradient(45deg, var(--m-fill-hi), var(--m-fill-hi) 6px, var(--pane-bg) 6px, var(--pane-bg) 12px); color: var(--text-secondary); }
.m-tl-playhead { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--playhead); pointer-events: none; }
.m-compat-note { color: var(--selection); }
/* 가장자리 다듬기 손잡이(선택한 주 클립) — 눈에 보이는 폭은 좁아도 터치 폭은 넓게 */
.m-tl-handle { position: absolute; top: 0; bottom: 0; width: 22px; touch-action: none; }
.m-tl-handle::after { content: ''; position: absolute; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--selection); }
.m-tl-handle[data-side="start"] { left: -8px; }
.m-tl-handle[data-side="start"]::after { right: 6px; }
.m-tl-handle[data-side="end"] { right: -8px; }
.m-tl-handle[data-side="end"]::after { left: 6px; }
.m-tl-host[data-moving="true"] .m-tl-clip[data-selected="true"] { opacity: 0.8; border-style: dashed; }

/* 가져오기 진행 */
.m-progress { display: flex; align-items: center; gap: 12px; padding: 6px var(--m-edge) 8px; background: var(--pane-bg); }
.m-progress-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--m-fill-hi); overflow: hidden; }
.m-progress-fill { height: 100%; background: var(--accent); transition: width 0.2s; }
.m-progress-bar[data-indeterminate="true"] .m-progress-fill { animation: m-slide 1.1s ease-in-out infinite alternate; }
@keyframes m-slide { from { margin-left: 0; } to { margin-left: 70%; } }
.m-progress-cancel { min-height: 36px !important; font-size: 0.8125em; }

/* 음성 녹음(M1-T17): 미리보기 위에 덮는 카운트다운·녹음 중 화면. 타임라인은 가리지 않아 지나가는 게 보인다 */
.m-rec { position: absolute; left: 0; right: 0; top: 53px; height: max(36vh, 190px); z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 12px var(--m-edge); background: rgba(10, 10, 12, 0.86); text-align: center; }
.m-rec-count { font-size: 4.5em; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; animation: m-rec-pop 1s ease-out infinite; }
.m-rec-count:empty { display: none; }
.m-rec[data-mode="prepare"] .m-rec-count { font-size: 1.125em; font-weight: 600; animation: none; color: var(--text-secondary); }
@keyframes m-rec-pop { from { transform: scale(1.35); opacity: 0.3; } to { transform: scale(1); opacity: 1; } }
.m-rec-live { display: flex; align-items: center; gap: 10px; font-size: 1.125em; font-weight: 700; }
.m-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ff453a; animation: m-rec-blink 1s ease-in-out infinite; }
@keyframes m-rec-blink { 50% { opacity: 0.25; } }
.m-rec-time { font-variant-numeric: tabular-nums; }
.m-rec-meter { width: min(260px, 70%); height: 8px; border-radius: 4px; background: var(--m-fill-hi); overflow: hidden; }
.m-rec[data-mode="prepare"] .m-rec-meter, .m-rec[data-mode="count"] .m-rec-meter { display: none; }
.m-rec-meter-fill { display: block; height: 100%; background: #30d158; transform: scaleX(0); transform-origin: left; transition: transform 0.08s linear; }
.m-rec-hint { margin: 0; max-width: 28em; color: var(--text-secondary); font-size: 0.8125em; }
.m-rec-actions { display: flex; gap: var(--m-gap); width: 100%; max-width: 360px; }
.m-rec-actions button { flex: 1; min-height: 48px; }
.m-rec-stop { background: #ff453a !important; }
@media (prefers-reduced-motion: reduce) { .m-rec-count, .m-rec-dot { animation: none; } }
