* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== Header ==================== */
header {
    background: linear-gradient(135deg, #16213e, #0f3460);
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 1.8rem;
    color: #e94560;
}

header nav a {
    color: #eee;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

header nav a:hover,
header nav a.active {
    background-color: #e94560;
}

/* ==================== Main ==================== */
main {
    flex: 1;
    padding: 1rem;
    width: 100%;
}

/* ==================== Gallery ==================== */
.gallery-container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: #16213e;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    align-items: center;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #e94560;
}

.filter-label {
    color: #ccc;
    transition: color 0.3s;
}

.filter-option:hover .filter-label {
    color: #fff;
}

.filter-option input[type="radio"]:checked + .filter-label {
    color: #e94560;
    font-weight: 600;
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.2rem;
}

.photo-card {
    background: #16213e;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.photo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(233, 69, 96, 0.2);
}

.photo-card.selected {
    outline: 2px solid #66bfff;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #fff, 0 8px 25px rgba(102, 191, 255, 0.25);
    z-index: 3;
}

.photo-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.matched-face-box {
    position: absolute;
    border: 3px solid #2ecc71;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 0 12px rgba(46, 204, 113, 0.75);
    pointer-events: none;
    z-index: 2;
}

.photo-card-info {
    padding: 0.7rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-text {
    background-color: #0f3460;
    color: #7ec8e3;
}

.badge-audio {
    background-color: #533483;
    color: #d4a5ff;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 2rem;
}

.loading-spinner.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #16213e;
    border-top-color: #e94560;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #999;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 1.5rem;
    background: #c0392b;
    border-radius: 10px;
    margin-top: 1rem;
}

.error-message.hidden {
    display: none;
}

/* No More Photos */
.no-more-photos {
    text-align: center;
    padding: 1.5rem;
    color: #666;
    font-style: italic;
}

.no-more-photos.hidden {
    display: none;
}

/* ==================== Viewer ==================== */
.viewer-container {
    max-width: 1000px;
    margin: 0 auto;
}

body.viewer-page {
    overflow-x: hidden;
    overflow-y: auto;
    background: #000;
}

body.viewer-page main {
    width: 100vw;
    min-height: 100vh;
    padding: 0;
}

body.viewer-page .viewer-container {
    position: relative;
    max-width: none;
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    overflow: visible;
    background: #000;
}

body.viewer-page .back-button,
body.viewer-page .viewer-navigation,
body.viewer-page .comment-controls,
body.viewer-page .loading-spinner {
    transition: opacity 0.22s ease, transform 0.22s ease;
}

body.viewer-page .viewer-controls-hidden .back-button,
body.viewer-page .viewer-controls-hidden .viewer-navigation,
body.viewer-page .viewer-controls-hidden .comment-controls,
body.viewer-page .viewer-controls-hidden .loading-spinner {
    opacity: 0;
    pointer-events: none;
}

.back-button {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

body.viewer-page .back-button {
    position: fixed;
    top: 1rem;
    right: 0.35rem;
    left: 1rem;
    z-index: 70;
    margin: 0;
    padding: 0;
    pointer-events: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

body.viewer-page .viewer-controls-hidden .back-button {
    transform: translateY(-12px);
}

.back-button a {
    color: #e94560;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e94560;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

body.viewer-page .back-button a {
    pointer-events: auto;
    width: fit-content;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
}

.back-button a:hover {
    background-color: #e94560;
    color: #fff;
}

.viewer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

body.viewer-page .viewer-actions {
    pointer-events: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    justify-self: end;
}

.viewer-face-control {
    min-height: 44px;
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
    border-radius: 6px;
    background: #16213e;
}

body.viewer-page .viewer-face-control {
    min-height: 38px;
    max-width: 195px;
    padding: 0.28rem 0.55rem;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    font-size: 0.82rem;
    gap: 0.35rem;
}

.viewer-face-control input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: #66bfff;
}

body.viewer-page .viewer-face-control input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.viewer-face-control input:disabled + .filter-label {
    color: #888;
}

/* Photo Display */
.photo-display {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

body.viewer-page .photo-display {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: #000;
}

.photo-display img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 5px;
    transition: box-shadow 0.3s;
}

.photo-display.recording img {
    box-shadow: 0 0 0 4px #ff0000, 0 0 30px rgba(255, 0, 0, 0.5);
    animation: recording-pulse 1.5s ease-in-out infinite;
}

.audio-recording-status {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 142px;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9px;
    color: #fff;
    background: rgba(116, 8, 17, 0.9);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(7px);
    pointer-events: none;
}

body.viewer-page .audio-recording-status {
    position: fixed;
    right: 1rem;
    bottom: 4.5rem;
}

.audio-recording-meter {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 32px;
}

.audio-recording-meter span {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    background: #fff;
    opacity: 0.92;
    transform: scaleY(var(--level, 0.12));
    transform-origin: center;
    transition: transform 70ms linear;
}

.audio-recording-timer {
    min-width: 3.8rem;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1;
    text-align: right;
}

body.viewer-page .photo-display img {
    max-width: 100vw;
    max-height: 100vh;
    width: auto;
    height: auto;
    border-radius: 0;
    object-fit: contain;
}

body.viewer-page .photo-description {
    position: relative;
    z-index: 2;
    width: min(900px, calc(100vw - 2rem));
    margin: 1rem auto 6rem;
    padding: 1.1rem 1.25rem;
    color: #e8eef6;
    background: #16213e;
    border: 1px solid #2ecc71;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    scroll-margin-block: 6rem;
}

.photo-description h2 {
    margin: 0 0 0.65rem;
    color: #2ecc71;
    font-size: 1rem;
}

.photo-description-text {
    max-height: min(45vh, 420px);
    margin: 0;
    overflow-y: auto;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.viewer-navigation {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

body.viewer-page .viewer-navigation {
    position: fixed;
    right: 1.25rem;
    bottom: 1rem;
    left: 1.25rem;
    z-index: 70;
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
    grid-template-columns: auto 1fr auto;
}

body.viewer-page .viewer-controls-hidden .viewer-navigation {
    transform: translateY(12px);
}

.viewer-nav-btn {
    background: #2980b9;
    color: white;
}

body.viewer-page .viewer-nav-btn {
    pointer-events: auto;
    width: fit-content;
    min-width: 96px;
    padding: 0.55rem 0.85rem;
    background: rgba(41, 128, 185, 0.82);
    backdrop-filter: blur(6px);
}

body.viewer-page #viewer-next-btn {
    justify-self: end;
}

.viewer-nav-btn:hover:not(:disabled) {
    background: #3498db;
}

.viewer-nav-btn:disabled,
.viewer-nav-btn:disabled:hover {
    background: #6c757d;
    color: #cfd3d6;
    opacity: 1;
}

.viewer-photo-counter {
    min-width: 120px;
    padding: 0.55rem 0.9rem;
    color: #eee;
    text-align: center;
    background: #0f3460;
    border: 1px solid #294b73;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
}

body.viewer-page .viewer-photo-counter {
    position: fixed;
    top: 4.25rem;
    left: 1rem;
    z-index: 70;
    min-width: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.face-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 2;
}

.photo-grid.hide-matched-faces .matched-face-box {
    display: none;
}

.face-overlay.hidden {
    display: none;
}

.face-box {
    position: absolute;
    border: 3px solid #8e44ad;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
    cursor: pointer;
    pointer-events: auto;
    transition: border-width 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.face-box:hover {
    border-width: 5px;
}

.face-box.selected {
    border-color: #2ecc71;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75), 0 0 12px rgba(46, 204, 113, 0.7);
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 4px #ff0000, 0 0 20px rgba(255, 0, 0, 0.3); }
    50% { box-shadow: 0 0 0 6px #ff0000, 0 0 40px rgba(255, 0, 0, 0.6); }
}

/* Comment Controls */
.comment-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #e94560, #c23152);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff5a78, #e94560);
}

.btn-secondary {
    background: linear-gradient(135deg, #533483, #3f2070);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #6b44a0, #533483);
}

body.viewer-page .comment-controls {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 70;
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
    justify-content: center;
    gap: 0.6rem;
}

body.viewer-page .comment-controls .btn {
    pointer-events: auto;
    padding: 0.55rem 0.9rem;
    border-radius: 6px;
    font-size: 0.88rem;
    background-color: rgba(108, 117, 125, 0.82);
    backdrop-filter: blur(6px);
}

body.viewer-page .comment-controls .btn-audio-comment {
    background-color: rgba(192, 57, 43, 0.9);
}

body.viewer-page .viewer-controls-hidden .comment-controls {
    transform: translateY(12px);
}

.btn-text-comment {
    background: #6c757d;
    color: white;
}

.btn-text-comment:hover {
    background: #818992;
}

.btn-audio-comment {
    background: #c0392b;
    color: white;
}

.btn-audio-comment:hover {
    background: #e74c3c;
}

.rotate-photo-btn {
    background: #2980b9;
    color: white;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.rotate-photo-btn:hover {
    background: #3498db;
}

.rotate-photo-btn:disabled,
.rotate-photo-btn:disabled:hover {
    background: #6c757d;
    color: #cfd3d6;
    opacity: 0.75;
    box-shadow: none;
}

.description-photo-btn {
    color: #fff;
    background: #533483;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.description-photo-btn:hover:not(:disabled) {
    background: #6b44a0;
}

.description-photo-btn[aria-expanded="true"] {
    color: #0d2b1b;
    background: #2ecc71;
}

.description-photo-btn[aria-expanded="true"]:hover:not(:disabled) {
    background: #27ae60;
}

.description-photo-btn:disabled,
.description-photo-btn:disabled:hover {
    color: #cfd3d6;
    background: #6c757d;
    opacity: 0.75;
    box-shadow: none;
}

/* ==================== Comments ==================== */
.comments-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.viewer-page .comments-container {
    position: relative;
    z-index: 2;
    width: min(900px, calc(100vw - 2rem));
    margin: 1rem auto 2rem;
    padding: 0;
    background: transparent;
}

body.viewer-page .comments-container:empty {
    display: none;
}

body.viewer-page .loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 75;
    transform: translate(-50%, -50%);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
}

/* Text Comment Panel */
.comment-panel {
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
    border: 2px solid transparent;
    transition: border-color 0.3s;
    position: relative;
}

.comment-panel.selected {
    border-color: #2ecc71;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.7rem;
    gap: 0.75rem;
}

.comment-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-id {
    font-size: 0.85rem;
    color: #888;
    background: #0f3460;
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
}

.comment-timestamp {
    font-size: 0.85rem;
    color: #c9d6e5;
    background: #0f3460;
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-btn {
    padding: 0.35rem 0.8rem;
    border: none;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.comment-btn-save {
    background: #27ae60;
    color: white;
}

.comment-btn-save:hover {
    background: #2ecc71;
}

.comment-btn-delete {
    background: #c0392b;
    color: white;
}

.comment-btn-delete:hover {
    background: #e74c3c;
}

.comment-btn-edit {
    background: #2980b9;
    color: white;
}

.comment-btn-edit:hover {
    background: #3498db;
}

.comment-btn-cancel {
    background: #7f8c8d;
    color: white;
}

.comment-btn-cancel:hover {
    background: #95a5a6;
}

.comment-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.7rem;
    border: 1px solid #0f3460;
    border-radius: 5px;
    background: #1a1a2e;
    color: #eee;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.comment-textarea:focus {
    outline: none;
    border-color: #e94560;
}

.comment-textarea[readonly] {
    background: #121220;
    color: #ccc;
    cursor: default;
}

.comment-content-display {
    padding: 0.7rem;
    background: #1a1a2e;
    border-radius: 5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Audio Comment Panel */
.audio-comment-panel {
    background: #16213e;
    border-radius: 10px;
    padding: 1rem;
    border: 2px solid transparent;
    transition: border-color 0.3s;
}

.audio-comment-panel.selected {
    border-color: #2ecc71;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.audio-btn {
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 40px;
    text-align: center;
}

.audio-btn-play {
    background: #27ae60;
    color: white;
}

.audio-btn-play:hover {
    background: #2ecc71;
}

.audio-btn-stop {
    background: #e67e22;
    color: white;
}

.audio-btn-stop:hover {
    background: #f39c12;
}

/* Progress Bar */
.progress-bar-container {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #0f3460;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #e94560;
    border-radius: 50%;
    cursor: pointer;
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #e94560;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.time-display {
    font-size: 0.8rem;
    color: #aaa;
    white-space: nowrap;
    font-family: monospace;
    min-width: 100px;
    text-align: right;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* ==================== Footer ==================== */
footer {
    background: #16213e;
    padding: 1rem;
    text-align: center;
    color: #666;
    margin-top: auto;
}

/* Gallery navigation */
.gallery-toolbar {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gallery-toolbar .filter-bar {
    margin-bottom: 0;
    flex-wrap: wrap;
}

.gallery-toolbar .photo-search {
    margin-left: auto;
    flex: 0 1 340px;
}

.gallery-options {
    display: flex;
    align-items: end;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #16213e;
    border-radius: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.gallery-options label,
.page-jump {
    display: grid;
    gap: 0.35rem;
    color: #ccc;
    font-size: 0.85rem;
}

.gallery-options select,
.gallery-options input,
.page-jump input {
    min-height: 36px;
    padding: 0.4rem 0.6rem;
    color: #eee;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 5px;
    font: inherit;
}

.photo-search {
    position: relative;
    min-width: min(100%, 280px);
    flex: 1;
}

.photo-search input {
    width: 100%;
}

.search-suggestions {
    position: absolute;
    z-index: 10;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow: auto;
    padding: 0.35rem;
    background: #0f3460;
    border: 1px solid #533483;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.search-suggestions button {
    width: 100%;
    padding: 0.55rem 0.65rem;
    color: #eee;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.search-suggestions button:hover {
    background: #533483;
}

.photo-grid {
    grid-template-columns: repeat(var(--gallery-columns, 4), minmax(0, 1fr));
    grid-template-rows: repeat(var(--gallery-rows, 1), minmax(0, 1fr));
    min-height: 0;
}

.photo-grid.scroll-mode {
    grid-template-rows: none;
    grid-auto-rows: var(--gallery-scroll-row-height, 140px);
}

.photo-grid.scroll-mode .photo-card {
    height: 100%;
}

.photo-grid.scroll-mode .photo-card img {
    height: 100%;
}

.photo-card {
    width: 100%;
    padding: 0;
    color: inherit;
    text-align: inherit;
    font: inherit;
    border: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.photo-card img {
    height: auto;
    min-height: 0;
    flex: 1;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    padding: 0.35rem;
    background: #0f3460;
}

.photo-card-info {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0.25rem 0.35rem;
    gap: 0.25rem;
    background: linear-gradient(transparent, rgba(15, 52, 96, 0.96) 38%);
}

.photo-name {
    width: auto;
    flex: 1;
    overflow: hidden;
    color: #fff;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-card-info .badge {
    flex: 0 0 auto;
    padding: 0.16rem 0.4rem;
    font-size: 0.7rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    margin: 0;
    flex: 1 0 auto;
    flex-wrap: nowrap;
    min-width: max-content;
}

.page-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: nowrap;
}

.page-button {
    min-width: 36px;
    min-height: 36px;
    padding: 0.35rem 0.6rem;
    color: #eee;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 5px;
    cursor: pointer;
    font: inherit;
}

.page-button:hover:not(:disabled),
.page-button.active {
    background: #e94560;
    border-color: #e94560;
}

.page-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.face-search-actions {
    display: grid;
    flex: 0 0 auto;
    gap: 0.35rem;
}

.face-search-actions .page-button {
    width: 100%;
    white-space: nowrap;
}

.reset-face-search {
    background: #6c757d;
}

.page-button.export-face-photos {
    color: #0d2b1b;
    background: #2ecc71;
    border-color: #2ecc71;
    font-weight: 600;
}

.page-button.export-face-photos:hover:not(:disabled) {
    color: #0d2b1b;
    background: #27ae60;
    border-color: #27ae60;
}

.hide-matched-face-control {
    min-height: 36px;
    margin-left: auto;
    padding: 0 0.4rem;
    white-space: nowrap;
}

.reset-face-search:hover:not(:disabled) {
    background: #818992;
    border-color: #818992;
}

.page-ellipsis,
.page-counter {
    color: #aaa;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.page-jump input {
    width: 68px;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.3rem;
    }

    .filter-bar {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }

    .photo-grid {
        gap: 0.8rem;
    }

    .photo-card img {
        min-height: 0;
    }

    .comment-controls {
        flex-direction: column;
    }

    .viewer-navigation {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .btn {
        width: 100%;
    }

    .audio-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .progress-bar-container {
        width: 100%;
    }

    body.viewer-page .audio-recording-status {
        right: 0.75rem;
        bottom: 8.5rem;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0.8rem;
    }

    .photo-grid {
        gap: 0.45rem;
    }
}
