/* mobile.css — loaded ONLY at max-width: 640px via <link media="(max-width:640px)">
   No @media blocks needed. Never imported from style.css.
   New class namespaces: .msh-* .acc-* .rw-* .ctx-sheet-* .up-btn */

/* -----------------------------------------------------------------------
   Reset: allow page to scroll on mobile
   ----------------------------------------------------------------------- */
html, body {
  height: auto;
  overflow: auto;
  overflow-x: hidden;
}
body {
  padding: 0;
}

/* -----------------------------------------------------------------------
   Desktop layout — collapse or hide pieces we replace
   ----------------------------------------------------------------------- */
.app {
  height: auto;
  max-width: 100%;
  display: block;
  padding: 0;
}
.header {
  display: none;
}
.selectors {
  display: none;
  /* Session & recording selection handled by ctx-sheet bottom sheet on mobile */
}
.msh-context {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.msh-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
  color: var(--ink-faint);
}
.msh-context:active .msh-chevron {
  opacity: 0.6;
}
.layout {
  display: block;
}
/* Hide desktop glass panels; show mobile accordion instead */
.glass.video-panel,
.glass.legend,
.glass.detail-card {
  display: none;
}
.glass:not(.video-panel):not(.legend):not(.detail-card) {
  display: none;
}
.list-footer {
  display: none;
}

/* -----------------------------------------------------------------------
   Phase 1 — Sticky compact header
   ----------------------------------------------------------------------- */
#mobile-sticky-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(8, 9, 13, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  gap: 10px;
}
.msh-context {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-dim);
  overflow: hidden;
}
.msh-context span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msh-sep {
  flex-shrink: 0;
  color: var(--ink-faint);
}
.msh-hamburger {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
}

/* -----------------------------------------------------------------------
   Phase 2 — Accordion event list
   ----------------------------------------------------------------------- */
#mobile-event-list {
  padding: 8px 0 16px;
}

.acc-item {
  display: block;
  border-bottom: 1px solid var(--border);
}
.acc-item:first-child {
  border-top: 1px solid var(--border);
}

.acc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  min-height: 52px; /* 44px tap target */
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s;
}
.acc-header:active {
  background: var(--panel);
}
.acc-item.open .acc-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.acc-item .ev-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.acc-item .ev-time {
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.acc-item .ev-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.acc-item .ev-conf {
  font-size: 12px;
  color: var(--ink-dim);
}
.acc-item .ev-status {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  white-space: nowrap;
}
.acc-item .ev-status.confirmed {
  background: rgba(95,170,157,0.12);
  color: var(--c-evp);
  border-color: rgba(95,170,157,0.3);
}
.acc-item .ev-status.dismissed {
  background: rgba(209,104,92,0.10);
  color: var(--c-visual);
  border-color: rgba(209,104,92,0.25);
}
.acc-chevron {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--ink-faint);
  transition: transform 0.2s;
}
.acc-item.open .acc-chevron {
  transform: rotate(180deg);
}

.acc-body {
  padding: 14px 14px 18px;
  display: none;
}
.acc-item.open .acc-body {
  display: block;
}

/* Canvas snapshot area */
.acc-canvas-slot {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  margin-bottom: 14px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-canvas-slot img {
  width: 100%;
  display: block;
  border-radius: 8px;
}
.acc-canvas-slot .acc-frame-hint {
  color: var(--ink-faint);
  font-size: 12px;
  padding: 16px;
  text-align: center;
}

/* Review button inside acc-header */
.acc-review-btn {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-hi);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  min-height: 32px;
}
.acc-review-btn:active {
  background: rgba(255,255,255,0.1);
}

/* Detail content inside accordion */
.acc-detail-content {
  font-size: 13px;
}
.acc-detail-content .ai-note {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-dim);
}
.acc-detail-content .notes-section h5 {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-top: 12px;
  margin-bottom: 6px;
}
.acc-detail-content .context-row {
  font-size: 12px;
  color: var(--ink-dim);
  padding: 4px 0;
}

/* Phase 4 sentinel — zero-height, triggers next-item hint */
.acc-item-sentinel {
  height: 1px;
}
/* Next-item ready pulse */
.acc-item.next-ready > .acc-header {
  border-left: 3px solid var(--border-hi);
  animation: acc-pulse 1.5s ease infinite;
}
@keyframes acc-pulse {
  0%, 100% { border-left-color: var(--border-hi); }
  50%       { border-left-color: var(--ink-dim); }
}

/* -----------------------------------------------------------------------
   Phase 3 — Wizard review overlay
   ----------------------------------------------------------------------- */
/* Use #id selector to match style.css specificity — later in cascade wins */
#review-wizard {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
#review-wizard.hidden {
  display: none;
}
.rw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rw-back, .rw-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
}
.rw-back:active, .rw-close:active {
  background: var(--panel);
}
.rw-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}
.rw-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-hi);
  transition: background 0.2s;
}
.rw-dot.active {
  background: var(--ink);
  width: 8px;
  height: 8px;
}
.rw-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 16px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}
.rw-body h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.rw-meta {
  font-size: 12px;
  color: var(--ink-dim);
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
}
.rw-hint {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-faint);
  text-align: center;
}
.rw-body img {
  border-radius: 8px;
}
.rw-decision {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}
.rw-decision-btn {
  min-height: 64px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.rw-decision-btn:active { opacity: 0.75; }
.rw-decision-btn.btn-confirm {
  background: rgba(95,170,157,0.15);
  color: var(--c-evp);
  border: 1px solid rgba(95,170,157,0.35);
}
.rw-decision-btn.btn-dismiss {
  background: rgba(209,104,92,0.12);
  color: var(--c-visual);
  border: 1px solid rgba(209,104,92,0.3);
}
.rw-body select {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}
.rw-body textarea {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
.rw-body .btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--panel-hi);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.rw-body .btn-confirm {
  background: rgba(95,170,157,0.15);
  color: var(--c-evp);
  border-color: rgba(95,170,157,0.35);
}

/* -----------------------------------------------------------------------
   Phase 5 — Back-to-top button
   ----------------------------------------------------------------------- */
.up-btn {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: 16px;
  z-index: 25;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-hi);
  border: 1px solid var(--border-hi);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.up-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* -----------------------------------------------------------------------
   Safe-area padding for fixed overlays
   ----------------------------------------------------------------------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .floating-btn-group {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}
