/* 365 for Kids Community Showcase — Standard CSS */

:root {
    --brand-teal: #0f766e;
    --brand-teal-dark: #0b5f59;
    --brand-teal-soft: #e6f6f4;
    --brand-sky: #38bdf8;
    --brand-yellow: #f4c430;
    --brand-red: #e11d48;
    --text: #1f2937;
    --muted: #64748b;
    --bg: #f7fafb;
    --card: #ffffff;
    --border: #e2e8f0;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

.container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0 16px;
}

/* Admin workspace — nearly full screen */
.admin-body .container {
    max-width: min(1800px, 98vw);
    padding-left: 20px;
    padding-right: 20px;
}

.admin-body .admin-main {
    max-width: min(1800px, 98vw);
}

/* Header */
.site-header, .admin-header {
    background: var(--brand-teal);
    color: #fff;
    padding: 12px 0;
}

.site-header .container, .admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.site-header .site-header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px 20px;
}

.site-header-inner .logo {
    justify-self: start;
}

.site-header-center {
    justify-self: center;
    text-align: center;
}

.site-header-inner nav {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 42px;
    width: auto;
    display: block;
}

.logo-text {
    line-height: 1.15;
}

.logo-text small {
    display: block;
    font-weight: 500;
    font-size: 0.72rem;
    opacity: 0.9;
}

.site-header nav a, .admin-header nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 16px;
    font-size: 0.9rem;
}

.site-header nav a:first-child {
    margin-left: 0;
}

.site-header nav a:hover, .admin-header nav a:hover {
    text-decoration: underline;
}

.site-header .nav-visit-btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 4px;
    background: #fff;
    color: var(--brand-teal);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
}

.site-header .nav-visit-btn:hover {
    background: var(--brand-teal-soft);
    text-decoration: none;
}

.admin-mode-bar {
    background: var(--brand-teal-dark);
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 6px 0;
    font-size: 0.85rem;
}

.admin-mode-bar strong {
    color: #fff;
    font-weight: 600;
}

.admin-body .admin-mode-bar a,
.admin-body .admin-mode-bar a:visited {
    color: #ffffff !important;
    text-decoration: underline;
}

.admin-body .admin-mode-bar a:hover {
    color: #ffffff !important;
    opacity: 0.9;
}

/* Footer */
.site-footer {
    background: #eef6f5;
    padding: 24px 0;
    margin-top: 40px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    border-top: 3px solid var(--brand-teal);
}

.site-footer .footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.site-footer .footer-logo {
    height: 48px;
    width: auto;
}

.site-footer a {
    color: var(--brand-teal);
}

/* Main */
main.container {
    padding-top: 24px;
    padding-bottom: 40px;
}

.admin-main {
    padding-top: 24px;
    padding-bottom: 40px;
}

h1 { font-size: 1.6rem; margin-bottom: 16px; color: var(--brand-teal); }
h2 { font-size: 1.25rem; margin: 24px 0 12px; color: var(--brand-teal); }
h3 { font-size: 1.05rem; margin: 16px 0 8px; }

p { margin-bottom: 12px; }

/* Cards */
.card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 16px;
}

.card-select {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.card-select:hover {
    border-color: var(--brand-teal);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-select h2 { margin-top: 0; }

.card-select--with-icon {
    display: flex;
    align-items: center;
    gap: 16px;
}

.card-select-icon {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-teal-soft);
    color: var(--brand-teal);
}

.card-select-icon svg {
    width: 28px;
    height: 28px;
    display: block;
}

.card-select-body {
    flex: 1;
    min-width: 0;
}

.card-select-body h2 {
    margin: 0 0 4px;
}

.card-select-body p {
    margin-bottom: 0;
    color: var(--muted);
}

/* Forms */
.form-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.form-group .hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 2px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

.form-group input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 2px rgba(44,82,130,0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-group label,
.radio-group label {
    font-weight: normal;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.checkbox-group input,
.radio-group input {
    margin-top: 4px;
}

.required::after {
    content: " *";
    color: #c53030;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--brand-teal);
    color: #fff;
}

.btn-primary:hover { background: var(--brand-teal-dark); }

.btn-mint {
    background: #9ee8db;
    color: #0b5f59;
}

.btn-mint:hover {
    background: #7fd9ca;
    color: #064e48;
}

.btn-secondary {
    background: #e9ecef;
    color: #333;
}

.btn-secondary:hover { background: #dee2e6; }

.btn-danger {
    background: #c53030;
    color: #fff;
}

.btn-danger:hover { background: #9b2c2c; }

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9rem;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

th {
    background: #f1f3f5;
    font-weight: 600;
    white-space: nowrap;
}

tr:hover { background: #f8f9fa; }

/* Gallery */
.gallery-submit-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.gallery-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: flex-end;
}

.gallery-filters .form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.gallery-search-group {
    min-width: 200px;
    flex: 1 1 220px;
    max-width: 320px;
}

.gallery-search-group input[type="search"] {
    min-width: 0;
}

.gallery-section {
    margin-bottom: 32px;
}

.gallery-section h2 {
    border-bottom: 2px solid var(--brand-teal);
    padding-bottom: 6px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--gallery-artwork-cols, 4), minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.gallery-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.gallery-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: #f1f3f5;
    cursor: zoom-in;
}

.gallery-item img,
.gallery-thumb img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.gallery-item .gallery-info {
    padding: 10px;
    font-size: 0.85rem;
}

.gallery-info-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.gallery-item .gallery-info .title {
    font-weight: 600;
    margin-bottom: 4px;
    flex: 1 1 auto;
    min-width: 0;
}

.gallery-item .gallery-info .meta {
    color: #666;
    font-size: 0.8rem;
}

.gallery-like {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    margin: 0;
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #9b2c4a;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.gallery-like:hover {
    background: #fff5f7;
    border-color: #f3c2ce;
}

.gallery-like.is-liked {
    background: #fff0f3;
    border-color: #f0a8ba;
    color: #c22545;
    cursor: default;
}

.gallery-like:disabled {
    opacity: 0.7;
    cursor: wait;
}

.gallery-like-heart {
    display: inline-flex;
    align-items: center;
}

.gallery-like-count {
    min-width: 1ch;
    font-variant-numeric: tabular-nums;
    color: #555;
}

.gallery-like.is-liked .gallery-like-count {
    color: #c22545;
    font-weight: 600;
}

.gallery-audio-list,
.gallery-text-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.gallery-audio-list {
    grid-template-columns: repeat(var(--gallery-audio-cols, 2), minmax(0, 1fr));
}

.gallery-text-list {
    grid-template-columns: repeat(var(--gallery-text-cols, 2), minmax(0, 1fr));
}

.gallery-audio {
    padding: 14px;
}

.gallery-audio audio {
    width: 100%;
    margin-top: 10px;
    min-height: 40px;
}

.gallery-text {
    padding: 14px;
}

.gallery-excerpt {
    margin: 10px 0;
    color: #333;
    line-height: 1.45;
    font-size: 0.9rem;
}

.gallery-excerpt-empty {
    color: #888;
    font-style: italic;
}

.gallery-read-more {
    margin-top: 4px;
}

/* Lightbox */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.gallery-lightbox[hidden] {
    display: none !important;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    cursor: pointer;
}

.gallery-lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: min(90vh, 920px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 10px;
    padding: 20px 20px 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f1f3f5;
    color: #222;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-lightbox-title {
    margin: 0 36px 6px 0;
    font-size: 1.2rem;
}

.gallery-lightbox-meta {
    margin: 0 0 14px;
    color: #666;
    font-size: 0.9rem;
}

.gallery-lightbox-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    margin: 0 auto;
    background: #111;
}

.gallery-lightbox-text {
    white-space: normal;
    line-height: 1.55;
    font-size: 1rem;
    color: #222;
    margin-bottom: 14px;
}

.gallery-lightbox-embed {
    width: 100%;
    height: min(65vh, 640px);
    margin: 10px 0 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.gallery-lightbox-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.gallery-lightbox-actions {
    margin: 0;
}

.gallery-lightbox-loading {
    color: #666;
}

.gallery-lightbox-audio {
    width: 100%;
    margin: 12px 0;
    display: block;
}

.gallery-open-share {
    margin-top: 10px;
}

.gallery-lightbox-share {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e9ecef;
}

.gallery-lightbox-share.is-static {
    margin-top: 24px;
}

.gallery-share-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    margin-bottom: 8px;
}

.gallery-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f1f3f5;
    color: #fff;
    font: inherit;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.gallery-share-btn svg {
    display: block;
    flex-shrink: 0;
}

.gallery-share-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
    color: #fff;
}

.gallery-share-btn:focus-visible {
    outline: 2px solid var(--brand-teal);
    outline-offset: 2px;
}

.gallery-share-btn[hidden] {
    display: none !important;
}

.gallery-share-native { background: #0f766e; }
.gallery-share-facebook { background: #1877f2; }
.gallery-share-x { background: #111111; }
.gallery-share-whatsapp { background: #25d366; }
.gallery-share-linkedin { background: #0a66c2; }
.gallery-share-pinterest { background: #e60023; }
.gallery-share-viber { background: #7360f2; }
.gallery-share-email { background: #64748b; }
.gallery-share-sms { background: #0ea5e9; }
.gallery-share-instagram {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}
.gallery-share-copy { background: #475569; }

.gallery-share-native:hover { background: #0b5e57; }
.gallery-share-facebook:hover { background: #166fe5; }
.gallery-share-x:hover { background: #000; }
.gallery-share-whatsapp:hover { background: #1ebe57; }
.gallery-share-linkedin:hover { background: #0958a8; }
.gallery-share-pinterest:hover { background: #cc001f; }
.gallery-share-viber:hover { background: #6149ef; }
.gallery-share-email:hover { background: #556278; }
.gallery-share-sms:hover { background: #0284c7; }
.gallery-share-copy:hover { background: #334155; }

.gallery-share-status {
    margin: 10px 0 0;
    font-size: 0.85rem;
    color: #0b5e57;
}

.gallery-item-share {
    max-width: 820px;
    margin: 0 auto 40px;
}

.gallery-item-kicker {
    margin: 0 0 6px;
    color: #0f766e;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.gallery-item-share h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.gallery-item-meta {
    margin: 0 0 18px;
    color: #666;
}

.gallery-item-media {
    margin-bottom: 8px;
}

.gallery-item-media img {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    background: #111;
    border-radius: 8px;
}

.gallery-item-back {
    margin-top: 28px;
    color: #666;
}

.gallery-item-back a {
    color: #0f766e;
}

body.lightbox-open {
    overflow: hidden !important;
}

/* Block interaction with page content while popup is open (lightbox lives inside main) */
body.lightbox-open main > *:not(#gallery-lightbox),
body.lightbox-open .gallery-layout,
body.lightbox-open .gallery-layout * {
    pointer-events: none !important;
    user-select: none;
}

body.lightbox-open #gallery-lightbox,
body.lightbox-open #gallery-lightbox * {
    pointer-events: auto !important;
    user-select: auto;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed #ced4da;
    border-radius: 6px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 12px;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--brand-teal);
    background: #f0f4f8;
}

.upload-zone p {
    color: #666;
    margin-bottom: 8px;
}

.file-list {
    list-style: none;
    margin-top: 12px;
}

.file-list li {
    padding: 6px 10px;
    background: #f1f3f5;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.file-list .remove-file {
    color: #c53030;
    cursor: pointer;
    font-weight: 600;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
}

.pagination a:hover { background: #e9ecef; }
.pagination .active { background: var(--brand-teal); color: #fff; border-color: var(--brand-teal); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-teal);
}

.stat-card .label {
    font-size: 0.85rem;
    color: #666;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending { background: #fff3cd; color: #856404; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-hidden { background: #e9ecef; color: #666; }

/* Organization details */
.org-details {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.org-details th,
.org-details td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.org-details th {
    width: 180px;
    color: #555;
    font-weight: 600;
    background: transparent;
}

.date-en {
    max-width: 220px;
}

/* Embed info */
.embed-url {
    background: #f1f3f5;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin: 8px 0;
}

/* Hidden sections */
.hidden { display: none !important; }

/* Settings tabs */
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.settings-tab {
    border: 1px solid #ced4da;
    background: #fff;
    color: #333;
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
}

.settings-tab.active {
    background: var(--brand-teal);
    border-color: var(--brand-teal);
    color: #fff;
}

.rich-wrap {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.rich-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.rich-toolbar button {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.rich-toolbar button:hover {
    background: var(--brand-teal-soft);
}

.rich-editor {
    min-height: 120px;
    padding: 10px 12px;
    outline: none;
}

.rich-editor a {
    color: var(--brand-teal);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.settings-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.settings-card h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.settings-card .hint {
    margin-bottom: 16px;
}

#gallery-embed-code {
    width: 100%;
    font-family: monospace;
    font-size: 13px;
}

/* Mobile */
@media (max-width: 900px) {
    .site-header .site-header-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .site-header-inner .logo,
    .site-header-center,
    .site-header-inner nav {
        justify-self: center;
        text-align: center;
    }

    .site-header-inner nav {
        white-space: normal;
    }

    .site-header nav a {
        margin-left: 10px;
        margin-right: 10px;
    }
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .site-header nav a, .admin-header nav a { margin-left: 10px; font-size: 0.8rem; }
    .site-header .nav-visit-btn { font-size: 0.85rem; padding: 6px 12px; }
    .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .gallery-audio-list,
    .gallery-text-list { grid-template-columns: 1fr; }
    .gallery-item img,
    .gallery-thumb img { height: 140px; }
    .gallery-lightbox {
        padding: 12px;
        align-items: center;
        justify-content: center;
    }
    .gallery-lightbox-dialog {
        width: 100%;
        max-height: min(88vh, 920px);
        border-radius: 12px;
        padding: 16px;
    }
    .gallery-lightbox-image { max-height: 50vh; }
    .gallery-lightbox-embed { height: 42vh; }
    .gallery-audio audio { height: 44px; }
    .settings-tab { flex: 1 1 calc(50% - 8px); text-align: center; }
    h1 { font-size: 1.3rem; }
}

/* ALTCHA — single frame like Chrome; no extra borders that double in Firefox */
.captcha-wrap {
    display: block;
    max-width: 360px;
    margin: 8px 0 16px;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.captcha-wrap altcha-widget {
    display: block;
    width: 100%;
    --altcha-border-width: 1px;
    --altcha-border-color: #cbd5e1;
    --altcha-border-radius: 4px;
    --altcha-checkbox-border-width: 1px;
    --altcha-checkbox-border-color: #94a3b8;
    --altcha-checkbox-size: 20px;
    --altcha-color-base: #ffffff;
    --altcha-color-base-content: #1f2937;
    --altcha-max-width: 100%;
    --altcha-padding: 8px;
    --altcha-shadow: none;
}

.captcha-wrap .altcha,
.captcha-wrap .altcha-main,
.altcha,
.altcha-main {
    max-width: 100% !important;
}

/* Never put a second border on the checkbox wrapper — Firefox shows input + wrapper as double lines */
.captcha-wrap .altcha-checkbox,
.altcha-checkbox {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Iframe mode */
body.iframe-mode .site-header,
body.iframe-mode .site-footer { display: none; }

html:has(body.iframe-mode),
body.iframe-mode {
    background: #fff !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

body.iframe-mode main.container {
    padding-top: 8px;
    padding-bottom: 12px;
    max-width: 100%;
    overflow: visible;
}

body.iframe-mode .pagination {
    margin-top: 16px;
    margin-bottom: 4px;
    padding-bottom: 4px;
}

@media (max-width: 700px) {
    body.iframe-mode main.container {
        padding-top: 6px;
        padding-bottom: 8px;
        padding-left: 8px;
        padding-right: 8px;
    }

    body.iframe-mode h1 {
        font-size: 1.15rem;
        margin-bottom: 6px;
    }

    body.iframe-mode .gallery-section {
        margin-top: 14px;
    }

    body.iframe-mode .gallery-page-meta {
        margin-bottom: 4px;
    }
}

/* Lightbox: default fixed fullscreen (works for direct /gallery/parent/ view).
   When truly embedded, JS adds .lightbox-frame-pinned and sizes the overlay. */
body.iframe-mode.lightbox-open {
    overflow: hidden !important;
}

body.iframe-mode #gallery-lightbox.gallery-lightbox {
    /* Keep fixed fullscreen when opened outside a parent iframe */
    position: fixed;
    inset: 0;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: hidden;
    overscroll-behavior: contain;
    align-items: center;
    justify-content: center;
}

/* Only when JS pins the lightbox inside a tall embedded iframe */
body.iframe-mode #gallery-lightbox.gallery-lightbox.lightbox-frame-pinned {
    position: absolute !important;
    inset: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    align-items: center !important;
    justify-content: center !important;
}

body.iframe-mode .gallery-lightbox-dialog {
    max-height: min(90vh, 920px);
    overflow: auto !important;
    margin: 0 auto;
}

body.iframe-mode #gallery-lightbox.lightbox-frame-pinned .gallery-lightbox-dialog {
    max-height: calc(100% - 24px) !important;
}

body.iframe-mode .gallery-lightbox-image {
    max-height: min(60vh, 520px);
    width: auto !important;
    max-width: 100% !important;
    margin: 0 auto;
    object-fit: contain;
}

body.iframe-mode #gallery-lightbox.lightbox-frame-pinned .gallery-lightbox-image {
    max-height: min(52vh, 420px) !important;
}

body.iframe-mode .gallery-lightbox-embed {
    height: min(50vh, 420px);
    max-height: min(50vh, 420px);
}

body.iframe-mode #gallery-lightbox.lightbox-frame-pinned .gallery-lightbox-embed {
    height: 360px !important;
    max-height: 360px !important;
}

@media (max-width: 600px) {
    body.iframe-mode .gallery-lightbox-dialog {
        max-height: min(88vh, 920px);
    }

    body.iframe-mode #gallery-lightbox.lightbox-frame-pinned .gallery-lightbox-dialog {
        max-height: calc(100% - 16px) !important;
    }

    body.iframe-mode .gallery-lightbox-image {
        max-height: 45vh;
    }

    body.iframe-mode .gallery-lightbox-embed {
        height: 38vh;
        max-height: 38vh;
    }
}

.gallery-page-meta {
    text-align: center;
    color: var(--muted, #666);
    font-size: 0.85rem;
    margin: 0 0 12px;
}
