.md-gallery-backdrop { position: fixed; inset: 0; z-index: 1090; background: #0008; display: flex; justify-content: flex-end; }
.md-gallery { width: min(900px, 100%); height: 100dvh; display: flex; flex-direction: column; min-width: 0; background: var(--md-bg); color: var(--md-text); box-shadow: -12px 0 40px #0004; font: 14px/1.5 Manrope, sans-serif; }
.md-gallery button, .md-gallery input, .md-gallery select { font: inherit; }
.md-gallery button { cursor: pointer; color: inherit; }
.md-gallery button:focus-visible, .md-gallery a:focus-visible, .md-gallery input:focus-visible, .md-gallery select:focus-visible { outline: 2px solid var(--md-green-400); outline-offset: 2px; }
.md-gallery-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--md-border); background: var(--md-surface-1); }
.md-gallery h2 { margin: 0; font-size: 20px; font-weight: 700; }
.md-gallery-header p { margin: 4px 0 0; color: var(--md-text-muted); overflow-wrap: anywhere; }
.md-gallery .md-gallery-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border: 0; background: transparent; }
.md-gallery-tabs { display: flex; flex-shrink: 0; overflow-x: auto; border-bottom: 1px solid var(--md-border); }
.md-gallery-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 1 0 auto; min-height: 54px; padding: 12px 16px; border: 0; border-bottom: 3px solid transparent; background: transparent; white-space: nowrap; }
.md-gallery-tabs button.is-active { color: var(--md-green-400); border-bottom-color: var(--md-green-400); background: var(--md-hover); }
.md-gallery-tabs small { font-size: 11px; color: var(--md-text-muted); }
.md-gallery-filters { display: flex; gap: 12px; padding: 16px 24px; flex-shrink: 0; border-bottom: 1px solid var(--md-border); }
.md-gallery-filters label { display: flex; flex-direction: column; gap: 5px; margin: 0; font-size: 12px; color: var(--md-text-muted); }
.md-gallery-search { flex: 1; min-width: 0; }
.md-gallery-filters select, .md-gallery-filters input { min-width: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--md-input-border); border-radius: 10px; background: var(--md-input-bg); color: var(--md-text); }
.md-gallery-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 24px; }
.md-gallery-group h3 { text-transform: capitalize; font-size: 13px; color: var(--md-text-muted); margin: 8px 0 14px; }
.md-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.md-gallery-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.md-gallery-item { min-width: 0; border: 1px solid var(--md-border); border-radius: 12px; overflow: hidden; background: var(--md-surface-1); }
.md-gallery-thumb { width: 100%; height: 150px; border: 0; padding: 0; background: var(--md-surface-3); display: flex; align-items: center; justify-content: center; }
.md-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.md-gallery-thumb > .material-symbols-outlined { font-size: 48px; color: var(--md-green-400); }
.md-gallery-file { display: flex; gap: 10px; align-items: center; padding: 14px 12px 4px; }
.md-gallery-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.md-gallery-file > span { flex-shrink: 0; color: var(--md-green-400); }
.md-gallery-item audio { width: calc(100% - 24px); margin: 8px 12px 0; height: 40px; }
.md-gallery-meta { padding: 10px 12px; color: var(--md-text-muted); font-size: 11px; overflow-wrap: anywhere; }
.md-gallery-meta time { display: block; }
.md-gallery-meta p { margin: 6px 0 0; color: var(--md-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.md-gallery-item footer { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 12px; border-top: 1px solid var(--md-border); }
.md-gallery a { color: var(--md-green-400); }
.md-gallery-item footer > :first-child { margin-right: auto; }
.md-gallery-item footer button, .md-gallery-summary button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; padding: 0; background: transparent; color: var(--md-text-muted); }
.md-gallery-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 24px; border-top: 1px solid var(--md-border); font-size: 12px; color: var(--md-text-muted); }
.md-gallery-empty { padding: 32px 12px; text-align: center; color: var(--md-text-muted); }
.md-gallery-empty button, .md-gallery-more { border: 1px solid var(--md-border-strong); border-radius: 10px; padding: 8px 16px; background: var(--md-hover); }
.md-gallery-preview { background: var(--md-surface-2); border: 1px solid var(--md-border); border-radius: 12px; padding: 12px; margin-bottom: 20px; }
.md-gallery-preview header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.md-gallery-preview strong { min-width: 0; overflow-wrap: anywhere; }
.md-gallery-preview img, .md-gallery-preview video { display: block; width: 100%; max-height: 50vh; object-fit: contain; margin-bottom: 12px; }
.md-gallery button:hover, .md-gallery a:hover { color: var(--md-green-300); }
.md-gallery-message-highlight { outline: 3px solid var(--md-green-400); outline-offset: 3px; }
@media (max-width: 500px) { .md-gallery-header, .md-gallery-content { padding: 16px; } .md-gallery-filters { padding: 12px 16px; flex-wrap: wrap; } .md-gallery-search { flex-basis: 160px; } .md-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } .md-gallery-list { grid-template-columns: 1fr; } }
