/* Stan Media — gallery overlay. Mirrors the full-screen tool panes
   (pi-monitor / terminal) using the app's design tokens. */
#stan-media {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg, #08080c);
  color: var(--text-primary, #E8EAF0);
  font-family: var(--font-ui, system-ui);
}
#stan-media.hidden { display: none; }

.sm-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top, 0px) + 10px) 12px 10px;
  border-bottom: 1px solid var(--border, rgba(124,92,255,0.14));
  background: var(--bg-secondary, #0d0d12);
}
.sm-title { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.sm-title > span:first-child { font-weight: 700; font-size: 17px; }
.sm-sub { font-size: 12px; color: var(--text-dim, #6B7B8D); }
.sm-head .icon-btn {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; background: transparent;
  color: var(--text-secondary, #C7CBD6); cursor: pointer;
}
.sm-head .icon-btn:active { background: var(--accent-dim, rgba(124,92,255,0.14)); }
.sm-head .icon-btn svg { width: 22px; height: 22px; }

.sm-body {
  flex: 1; overflow-y: auto;
  padding: 8px 10px calc(var(--safe-bottom, 0px) + 24px);
  -webkit-overflow-scrolling: touch;
}

.sm-day {
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-dim, #6B7B8D);
  padding: 14px 4px 8px; text-transform: uppercase;
}
.sm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px;
}
.sm-cell {
  position: relative; aspect-ratio: 1; padding: 0; border: none; cursor: pointer;
  border-radius: 10px; overflow: hidden; background: var(--bg-input, rgba(255,255,255,0.05));
}
.sm-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-cell:active { transform: scale(.97); }
.sm-badge {
  position: absolute; right: 6px; bottom: 6px;
  font-size: 11px; color: #fff; background: rgba(0,0,0,.55);
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.sm-empty {
  text-align: center; color: var(--text-dim, #6B7B8D);
  padding: 64px 28px; line-height: 1.7; font-size: 14px;
}
.sm-empty-ic { font-size: 44px; margin-bottom: 10px; }
.sm-empty small { color: var(--text-dim, #6B7B8D); font-size: 12.5px; }
.sm-empty b { color: var(--accent-soft, #B18CFF); }

.sm-toast {
  position: absolute; top: calc(var(--safe-top, 0px) + 62px); left: 50%;
  transform: translate(-50%, -8px); opacity: 0; pointer-events: none;
  background: var(--accent, #7C5CFF); color: #fff;
  padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 6px 20px var(--glow-accent, rgba(124,92,255,0.42));
  transition: opacity .2s, transform .2s; z-index: 62;
}
.sm-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* lightbox */
.sm-lightbox {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.92); display: flex; flex-direction: column;
}
.sm-lightbox.hidden { display: none; }
.sm-lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 40px 8px 8px; }
.sm-lb-stage img, .sm-lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.sm-lb-close {
  position: absolute; top: calc(var(--safe-top, 0px) + 8px); right: 12px; z-index: 71;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.sm-lb-bar {
  display: flex; gap: 10px; padding: 12px 14px calc(var(--safe-bottom, 0px) + 14px);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.5));
}
.sm-lb-btn {
  flex: 1; padding: 13px; border: none; border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: inherit;
  background: var(--accent, #7C5CFF); color: #fff;
}
.sm-lb-btn:active { background: var(--accent-press, #6A4CE0); }
.sm-lb-btn.danger { background: var(--red-bg, rgba(255,68,85,0.12)); color: var(--red, #FF4455); }
