/**
 * Sichtflow – Galerie-Styles
 * Nutzt CSS-Variablen. Theme pro Galerie (.theme-light / .theme-dark).
 */
:root {
    --sf-accent: #8bc34a;
    --sf-com-blue: #3498db;
    --sf-font-main: sans-serif;
    --sf-bg: #f5f7f9;
    --sf-surface: #f6f7f8;
    --sf-text: #2d3436;
    --sf-muted: #6b7280;
    --sf-border: #dee2e6;
}
body.theme-light,
body.light-mode {
    --sf-bg: #f5f7f9;
    --sf-text: #2d3436;
    --sf-muted: #6b7280;
    --sf-card: #ffffff;
    --sf-ui: #ffffff;
    --sf-border: #dee2e6;
}
body.theme-dark,
body.dark-mode {
    --sf-bg: #121212;
    --sf-text: #ffffff;
    --sf-card: #1e1e1e;
    --sf-ui: #1e1e1e;
    --sf-border: #333;
}

/* FontAwesome Firefox-Fix: explizite Regel gegen Rendering-Fehler in Firefox */
.fa, .fas, .far, .fa-solid, .fa-regular {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
  display: inline-block !important;
  font-style: normal !important;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.far, .fa-regular {
  font-weight: 400 !important;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: var(--sf-font-main); background: var(--sf-bg); color: var(--sf-text); overflow-x: hidden; }

header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; background: var(--sf-ui); border-bottom: 1px solid var(--sf-border);
    position: sticky; top: 0; z-index: 1000;
}

.sf-gal-brand {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin-right: 14px;
  text-decoration: none;
}
.sf-gal-brand img {
  height: 22px;
  width: auto;
  display: block;
}

.filter-nav { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.sf-filter-btn {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    background: transparent; border: 1px solid var(--sf-border);
    cursor: pointer; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #777;
    white-space: nowrap; font-family: inherit;
}
.sf-filter-btn .sf-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.sf-filter-btn .sf-dot.f-yes { background: #4caf50; }
.sf-filter-btn .sf-dot.f-no { background: #f44336; }
.sf-filter-btn .sf-dot.f-maybe { background: #ff9800; }
.sf-filter-btn .sf-dot.f-final { background: #2196f3; }

.download-dropdown {
    background: #000; color: white; border: 1px solid var(--sf-border);
    padding: 6px; font-size: 10px; text-transform: uppercase;
}

.password-screen {
    background: #000; color: #fff; display: flex; align-items: center; justify-content: center;
    height: 100vh; font-family: sans-serif;
}
.password-form { text-align: center; }
.password-input { padding: 10px; border: 1px solid #333; background: #111; color: #fff; outline: none; }
.password-submit { padding: 10px 20px; background: #fff; border: none; cursor: pointer; margin-left: 5px; }

.hero-section { width: 100%; display: flex; flex-direction: column; align-items: center; padding-bottom: 40px; }
.hero-bg {
    width: 100%; height: 50vh; background-size: cover; background-position: center;
    margin-bottom: 20px; background-image: var(--hero-bg);
}
.hero-content h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: 4px; text-align: center; }
.hero-content p { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: #555; margin-top: 8px; text-align: center; }

.main-grid {
    column-count: 3;
    column-gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: block;
    padding: 20px;
}
.main-grid .img-card,
.main-grid .thumb-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    position: relative;
    background: #000;
    cursor: pointer;
}
.main-grid .img-card img,
.main-grid .thumb-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

@media (max-width: 1000px) {
    .main-grid { column-count: 2; }
}
@media (max-width: 600px) {
    .main-grid { column-count: 1; padding: 10px; }
}

#viewer {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100dvh;
    background: #000; z-index: 2000; overflow: hidden; overscroll-behavior: none; touch-action: auto;
}
.v-wrap { display: flex; width: 100%; height: 100%; overflow: hidden; }
.v-stage {
    flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 10px; background: #000; cursor: grab; touch-action: none;
}
body.scribble-on .v-stage { cursor: crosshair; }
.v-stage:active { cursor: grabbing; }
.v-stage { overflow: hidden; }

#stage-box { width: 100%; height: 100%; overflow: visible; display: grid; place-items: center; position: relative; }
#media-stage { overflow: visible; }
.v-aside {
    overflow: auto; height: 100vh; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    width: 340px; background: #000; border-left: 1px solid var(--sf-border); display: flex; flex-direction: column;
}
.stage-box { display: grid; place-items: center; width: 100%; height: 100%; overflow: visible; transition: transform 0.1s ease-out; position: relative; }
.pan-stage { display: inline-block; will-change: transform; -webkit-backface-visibility: hidden; backface-visibility: hidden; }

body.scribble-lock { overflow: hidden; overscroll-behavior: none; touch-action: none; }
body.scribble-lock #viewer { overflow: hidden !important; overscroll-behavior: none; touch-action: none; }
body.scribble-lock #stage-box { touch-action: none; }

.media-stage {
    position: relative; display: inline-block; line-height: 0; max-width: 100%; max-height: 90vh;
    transform-origin: center center; will-change: transform; overflow: visible;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
#v-img {
    display: block; position: relative; z-index: 1; max-width: 100%; max-height: 90vh;
    width: auto; height: auto; object-fit: contain; pointer-events: none; user-select: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
/* Zoom-Slider: auf Touch-Geräten ausblenden, auf Maus sichtbar */
@media (pointer: coarse) {
    .v-controls { display: none !important; }
}
@media (pointer: fine) {
    .v-controls { display: flex; }
}
#svg-overlay { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }
body.scribble-on #svg-overlay { pointer-events: auto; touch-action: none; }
#canvas-scribble { position: absolute; inset: 0; width: 100%; height: 100%; display: none !important; pointer-events: none !important; }

.v-close-btn {
    position: absolute; top: 0; right: 0; width: 60px; height: 60px;
    background: #000; color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 30px; cursor: pointer; z-index: 2200;
}
.v-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 2100; background: #000; padding: 10px 15px; border: 1px solid var(--sf-border);
}
#zoom-range { width: 120px; cursor: pointer; accent-color: var(--sf-accent); }

.aside-header { padding: 15px; border-bottom: 1px solid var(--sf-border); display: flex; justify-content: space-between; align-items: center; }
.aside-header h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #444; margin: 0; }
.aside-comments { flex: 1; overflow-y: auto; padding: 15px; }
.comment-box { position: relative; margin-bottom: 12px; padding: 12px; font-size: 13px; }
.comment-box.type-scribble { border-left: 4px solid var(--sf-accent); background: rgba(139, 195, 74, 0.07); }
.comment-box.type-comment { border-left: 4px solid var(--sf-com-blue); background: rgba(52, 152, 219, 0.07); }
.comment-type-label { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.com-del-btn { position: absolute; top: 5px; right: 8px; color: #555; cursor: pointer; font-size: 18px; }

.comment-input-area { padding: 15px; border-top: 1px solid var(--sf-border); display: flex; gap: 5px; }
.comment-input-area input { flex: 1; background: #000; border: 1px solid #333; color: #fff; padding: 10px; font-size: 13px; outline: none; }
.comment-input-area button { background: #fff; border: none; padding: 0 12px; cursor: pointer; color: #000; }

.aside-footer { padding: 10px; border-top: 1px solid var(--sf-border); display: flex; gap: 5px; position: relative; background: #000; }
.v-btn { flex: 1; background: transparent; border: 1px solid #333; color: #fff; padding: 12px 2px; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; }
.v-btn.active { background: #fff; color: #000; border-color: #fff; }

.status-yes { border-color: #4caf50 !important; color: #4caf50 !important; }
.status-no { border-color: #f44336 !important; color: #f44336 !important; }
.status-maybe { border-color: #ff9800 !important; color: #ff9800 !important; }
.status-final { border-color: #2196f3 !important; color: #2196f3 !important; }

#pop-flags { display: none; position: absolute; bottom: 70px; left: 10px; right: 10px; background: #000; border: 1px solid #333; flex-direction: column; z-index: 2200; }
.flag-item { padding: 15px; display: flex; align-items: center; gap: 10px; font-size: 10px; text-transform: uppercase; border-bottom: 1px solid #222; cursor: pointer; color: #fff; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.f-yes { background: #4caf50; }
.f-no { background: #f44336; }
.f-maybe { background: #ff9800; }
.f-final { background: #2196f3; }

.status-bar-left { display: flex; align-items: center; gap: 12px; }

/* Thumbnail overlay icons: no bar, no glass, no gradient */
.main-grid .gallery-thumb-actions {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 11;
    pointer-events: none;
}
.main-grid .img-card::after,
.main-grid .thumb-item::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 50px;
    background: rgba(8, 10, 14, 0.22);
    pointer-events: none;
    z-index: 10;
}
.main-grid .thumbnail-icon {
    color: #fff;
    border: none;
    background: transparent;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
    -webkit-filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
}
.main-grid .gallery-thumb-icon {
    width: 22px;
    height: 22px;
    color: #fff;
    fill: none;
}
.main-grid .thumbnail-comment {
    color: rgba(255, 255, 255, 0.92);
}
.main-grid .gallery-thumb-icon path {
    stroke: currentColor;
    stroke-width: 1.6;
}
.main-grid .heart-icon {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 11;
    pointer-events: auto;
    width: 36px;
    height: 36px;
    padding: 7px;
    margin: -7px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.main-grid .heart-icon.active,
.main-grid .img-card[data-fav="1"] .heart-icon,
.main-grid .img-card.is-favorite .heart-icon {
    transform: scale(1.05);
}
.main-grid .heart-icon.active .thumbnail-heart,
.main-grid .img-card[data-fav="1"] .heart-icon .thumbnail-heart,
.main-grid .img-card.is-favorite .heart-icon .thumbnail-heart {
    color: #fff;
}
.main-grid .thumbnail-flag.flag-green { color: #4CAF50; }
.main-grid .thumbnail-flag.flag-red { color: #E53935; }
.main-grid .thumbnail-flag.flag-yellow { color: #F9A825; }
.main-grid .thumbnail-flag.flag-blue { color: #1E88E5; }
.main-grid .heart-icon.active .thumbnail-heart path,
.main-grid .img-card[data-fav="1"] .heart-icon .thumbnail-heart path,
.main-grid .img-card.is-favorite .heart-icon .thumbnail-heart path {
    fill: #fff;
    stroke: #fff;
}

@media (hover: hover) and (pointer: fine) {
    .main-grid .img-card:hover .thumbnail-icon,
    .main-grid .thumb-item:hover .thumbnail-icon {
        background: rgba(0, 0, 0, 0.35);
        border-radius: 8px;
        padding: 4px 6px;
    }
}

/* Keep viewer status bar styling intact */
#viewer .status-bar {
    position: absolute; bottom: 0; left: 0; width: 100%;
    height: 28px; display: flex; align-items: center; gap: 12px;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    z-index: 10;
}
#viewer .status-bar .sb-icon {
    color: #ffffff;
    font-size: 13px;
    -webkit-filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
    opacity: 0.9;
}
#viewer .status-bar .flag-final { color: #2196f3; }
#viewer .status-bar .flag-maybe { color: #ff9800; }
#viewer .status-bar .flag-no { color: #f44336; }
#viewer .status-bar .flag-yes { color: #4caf50; }
#viewer .status-bar .thumb-fav-btn {
    pointer-events: auto;
    margin-left: auto;
    width: 28px; height: 28px;
    min-width: 28px; min-height: 28px;
    padding: 0; font-size: 13px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #ffffff;
    -webkit-filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
    opacity: 0.9;
}
#viewer .status-bar .thumb-fav-btn:hover { opacity: 1; }
body.theme-light #viewer .status-bar,
body.light-mode #viewer .status-bar {
    background: rgba(255, 255, 255, 0.75);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
body.theme-light #viewer .status-bar .sb-icon,
body.light-mode #viewer .status-bar .sb-icon {
    color: #2d3436;
    -webkit-filter: drop-shadow(0 1px 2px rgba(255,255,255,0.9));
    filter: drop-shadow(0 1px 2px rgba(255,255,255,0.9));
}
body.theme-light #viewer .status-bar .thumb-fav-btn,
body.light-mode #viewer .status-bar .thumb-fav-btn { color: #2d3436; }
.img-card[data-fav="1"] .heart-icon,
.img-card.is-favorite .heart-icon,
#viewer .status-bar .thumb-fav-btn.is-favorite { color: #f44336; }
.img-card { display: block; }

@media (max-width: 900px) {
    .v-wrap { flex-direction: column; }
    .v-stage { height: 50vh; width: 100%; }
    .v-aside { width: 100%; height: 50vh; border-left: none; border-top: 1px solid var(--sf-border); }
}

/* --- MINIMAL FIX: Active filter must NOT hide label/border --- */
.gallery-filters button.active,
.gallery-filters button.is-active,
.gallery-filters button[aria-pressed="true"]{
  width: auto !important;
  min-width: initial !important;
  padding: 6px 10px !important;
  border-style: solid !important;
  border-width: 1px !important;
  border-color: var(--sf-border) !important;
  background: transparent !important;
  color: #777 !important;
}

.gallery-filters button.active *,
.gallery-filters button.is-active *,
.gallery-filters button[aria-pressed="true"] *{
  opacity: 1 !important;
  visibility: visible !important;
  display: initial !important;
  font-size: inherit !important;
  color: inherit !important;
}

.gallery-filters button.active,
.gallery-filters button.is-active,
.gallery-filters button[aria-pressed="true"]{
  font-size: inherit !important;
  line-height: inherit !important;
}

/* --- Light theme: Viewer (Detail) uses same theme as gallery --- */
body.light-mode #viewer,
body.sf-theme-light #viewer { background: var(--sf-bg); }
body.light-mode .v-stage,
body.sf-theme-light .v-stage { background: var(--sf-bg); }
body.light-mode .v-aside,
body.sf-theme-light .v-aside { background: var(--sf-ui); }
body.light-mode .v-close-btn,
body.sf-theme-light .v-close-btn {
  background: var(--sf-ui);
  color: var(--sf-text);
  border: 1px solid var(--sf-border);
}
body.light-mode .v-controls,
body.sf-theme-light .v-controls {
  background: var(--sf-ui);
  border-color: var(--sf-border);
}
body.light-mode .comment-input-area input,
body.sf-theme-light .comment-input-area input {
  background: var(--sf-ui);
  border-color: var(--sf-border);
  color: var(--sf-text);
}
body.light-mode .comment-input-area button,
body.sf-theme-light .comment-input-area button {
  background: var(--sf-text);
  color: var(--sf-ui);
}
body.light-mode .aside-footer,
body.sf-theme-light .aside-footer { background: var(--sf-ui); }
body.light-mode .v-btn,
body.sf-theme-light .v-btn {
  border-color: var(--sf-border);
  color: var(--sf-text);
}
body.light-mode .v-btn.active,
body.sf-theme-light .v-btn.active {
  background: var(--sf-text);
  color: var(--sf-ui);
  border-color: var(--sf-text);
}
body.light-mode #pop-flags,
body.sf-theme-light #pop-flags {
  background: var(--sf-ui);
  border-color: var(--sf-border);
}
body.light-mode .flag-item,
body.sf-theme-light .flag-item {
  border-bottom-color: var(--sf-border);
  color: var(--sf-text);
}
body.light-mode .aside-header h3,
body.sf-theme-light .aside-header h3 { color: var(--sf-muted); }
body.light-mode #viewer .status-bar,
body.sf-theme-light #viewer .status-bar {
  background: rgba(255, 255, 255, 0.85);
  border-top-color: rgba(0, 0, 0, 0.08);
}
body.light-mode #viewer .status-bar .thumb-fav-btn,
body.sf-theme-light #viewer .status-bar .thumb-fav-btn { color: var(--sf-text); }

/* Scribble <-> Kommentar Highlight */
.sf-scribble {
  stroke: var(--sf-accent, #16a34a);
  stroke-width: 3;
  opacity: .75;
  transition: stroke-width .12s ease, opacity .12s ease, filter .12s ease;
}
.sf-scribble.is-active {
  stroke-width: 5;
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(22, 163, 74, .35));
}
.sf-comment {
  border: 1px solid transparent;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.sf-comment.is-active {
  border-color: var(--sf-accent);
  background: rgba(139, 195, 74, 0.12);
  box-shadow: 0 0 0 2px rgba(139, 195, 74, 0.25);
}

/* iPhone Detailansicht: lesbarer + bessere Tap-Targets */
@media (max-width: 520px) {
  #viewer { font-size: 16px; }

  .v-wrap { flex-direction: column; }
  .v-stage { height: 48vh; padding: 8px; }
  .v-aside { width: 100%; height: 52vh; }

  .aside-header { padding: 12px 14px; }
  .aside-header h3 { font-size: 12px; }
  .aside-comments { padding: 14px; }
  .comment-box {
    padding: 14px;
    font-size: 15px;
    line-height: 1.45;
    margin-bottom: 14px;
  }
  .comment-type-label { font-size: 10px; margin-bottom: 8px; }
  .comment-box p { margin: 0; }

  #viewer .sf-btn,
  #viewer .v-btn,
  #viewer .icon-btn,
  #viewer button {
    min-height: 44px;
    padding: 10px 12px;
  }
  .comment-input-area {
    gap: 8px;
    padding: 12px 14px;
  }
  .comment-input-area input {
    min-height: 44px;
    font-size: 16px;
    padding: 10px 12px;
  }

  #viewer input,
  #viewer textarea {
    font-size: 16px;
  }

  .aside-footer {
    gap: 8px;
    padding: 10px;
  }
  .flag-item {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 11px;
  }
  .v-close-btn {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }
}

.sf-viewerOverlay,
.sf-dockRow,
#sfCommentPanel,
#sfToolsPanel {
  display: none !important;
}

@media all {
  #viewer.sf-mobile-open .sf-viewerOverlay {
    position: absolute;
    inset: 0;
    z-index: 2300;
    display: block !important;
    pointer-events: none;
  }
  #viewer.sf-mobile-open .sf-viewerOverlay.has-open-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(12, 16, 22, 0.10);
    pointer-events: none;
  }
  #viewer.sf-mobile-open .v-stage {
    width: 100%;
    height: 100dvh;
    padding: 0;
    background: #0b0f14;
  }
  #viewer.sf-mobile-open .v-aside,
  #viewer.sf-mobile-open .v-close-btn,
  #viewer.sf-mobile-open .v-controls,
  #viewer.sf-mobile-open #viewer-status-bar {
    display: none;
  }
  #viewer.sf-mobile-open #v-img {
    max-height: 99dvh;
    max-width: 100%;
  }
  #viewer.sf-mobile-open .sf-ui-dim .sf-viewerTopClose,
  #viewer.sf-mobile-open .sf-ui-dim .sf-sheet {
    opacity: .28;
  }

  #viewer.sf-mobile-open .sf-viewerTopClose,
  #viewer.sf-mobile-open .sf-close {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 16px);
    left: 16px;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    color: rgba(255, 255, 255, 0.95);
    box-shadow: none;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    transition: opacity .16s ease-out;
  }

  #viewer.sf-mobile-open .sf-dock {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom) + 16px);
    display: flex !important;
    align-items: center;
    gap: 24px;
    padding: 6px 14px;
    border-radius: 24px;
    background: rgba(20, 20, 20, 0.75);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    pointer-events: auto;
    z-index: 2500;
    transition: transform .16s ease-out;
  }
  #viewer.sf-mobile-open .sf-dock.is-peek {
    transform: translateX(-50%) scale(1.08);
  }
  #viewer.sf-mobile-open .sf-dockBtn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.94);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    transition: transform .16s ease-out, opacity .16s ease-out, background-color .16s ease-out;
  }
  #viewer.sf-mobile-open .sf-dockBtn.is-active {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-sizing: border-box;
    color: #fff;
    border-radius: 8px;
    opacity: 1;
    transform: scale(0.98);
  }
  #viewer.sf-mobile-open .sf-dockBtn.is-active .sf-dockIcon path {
    stroke: #fff;
  }
  #viewer.sf-mobile-open .sf-dockBtn.is-pop {
    transform: scale(1.12);
  }
  #viewer.sf-mobile-open .sf-dockBtn.dock-scribble-btn.is-armed {
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-sizing: border-box;
    color: #fff;
    border-radius: 8px;
  }
  #viewer.sf-mobile-open .sf-dockBtn[data-action="favorite"].is-active .sf-dockIcon path {
    fill: currentColor;
    stroke: currentColor;
  }
  #viewer.sf-mobile-open .sf-dockBtn[data-action="favorite"].is-active {
    color: #fff;
  }
  #viewer.sf-mobile-open .sf-dockBtn#sfDockMore.flag-green { color: #4CAF50; }
  #viewer.sf-mobile-open .sf-dockBtn#sfDockMore.flag-red { color: #E53935; }
  #viewer.sf-mobile-open .sf-dockBtn#sfDockMore.flag-yellow { color: #F9A825; }
  #viewer.sf-mobile-open .sf-dockBtn#sfDockMore.flag-blue { color: #1E88E5; }
  #viewer.sf-mobile-open .sf-dockIcon {
    width: 18px;
    height: 18px;
    display: block;
  }
  #viewer.sf-mobile-open .sf-flag-dropdown {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom) + 88px);
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 180px;
    max-width: 75vw;
    border-radius: 12px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 12px 14px;
    display: none;
    flex-direction: column;
    gap: 6px;
    z-index: 2550;
    pointer-events: auto;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  #viewer.sf-mobile-open .sf-flag-dropdown.is-open {
    display: flex;
  }
  #viewer.sf-mobile-open .sf-flag-dropdown button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 15px;
    white-space: nowrap;
  }
  #viewer.sf-mobile-open .sf-flag-dropdown button:hover,
  #viewer.sf-mobile-open .sf-flag-dropdown button.is-active,
  #viewer.sf-mobile-open .sf-flag-dropdown button.active {
    background: rgba(255, 255, 255, 0.1);
  }
  #viewer.sf-mobile-open .sf-flag-dropdown .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
  }
  #viewer.sf-mobile-open .sf-flag-dropdown .dot.green { background: #4CAF50; }
  #viewer.sf-mobile-open .sf-flag-dropdown .dot.red { background: #E53935; }
  #viewer.sf-mobile-open .sf-flag-dropdown .dot.yellow { background: #F9A825; }
  #viewer.sf-mobile-open .sf-flag-dropdown .dot.blue { background: #1E88E5; }

  #viewer.sf-mobile-open .sf-sheet {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom) + 68px);
    border: 1px solid rgba(217, 217, 217, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.90);
    box-shadow: 0 10px 26px rgba(10, 14, 20, 0.16);
    max-height: 60dvh;
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .16s ease-out, transform .16s ease-out;
    pointer-events: none;
    z-index: 2450;
    color: #202a36;
  }
  #viewer.sf-mobile-open #sfCommentPanel,
  #viewer.sf-mobile-open #sfToolsPanel {
    display: block !important;
  }
  #viewer.sf-mobile-open .sf-sheet.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  #viewer.sf-mobile-open .sf-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(120, 130, 145, 0.2);
  }
  #viewer.sf-mobile-open .sf-sheet-head h4 {
    margin: 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
  }
  #viewer.sf-mobile-open .sf-sheet-close {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(120, 130, 145, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.75);
    color: #253243;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 0;
    font-size: 21px;
  }
  #viewer.sf-mobile-open .sf-sheet-close > * {
    margin: 0;
    padding: 0;
  }
  #viewer.sf-mobile-open .sf-sheet-content {
    max-height: calc(60dvh - 52px);
    overflow: auto;
    padding: 10px 12px;
  }
  #viewer.sf-mobile-open .sf-mobile-comments {
    max-height: 28dvh;
    padding: 0 0 8px;
  }
  #viewer.sf-mobile-open .sf-mobile-comment-input {
    padding: 8px 0 0;
    border-top: 0;
  }
  #viewer.sf-mobile-open .sf-mobile-comment-input input {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(120, 130, 145, 0.3);
    color: #243042;
  }
  #viewer.sf-mobile-open .sf-mobile-comment-input button {
    background: rgba(248, 250, 253, 0.95);
    color: #243042;
    border: 1px solid rgba(120, 130, 145, 0.3);
    border-radius: 6px;
  }
  #viewer.sf-mobile-open .sf-more-grid {
    display: grid;
    gap: 8px;
  }
  #viewer.sf-mobile-open .sf-more-status {
    display: grid;
    gap: 8px;
  }
  #viewer.sf-mobile-open .sf-more-item {
    width: 100%;
    min-height: 38px;
    border: 1px solid rgba(120, 130, 145, 0.28);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    color: #253243;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  #viewer.sf-mobile-open .sf-flag-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 9px;
  }
  #viewer.sf-mobile-open .sf-flag-dot.yes { background: #2ecc71; }
  #viewer.sf-mobile-open .sf-flag-dot.no { background: #e74c3c; }
  #viewer.sf-mobile-open .sf-flag-dot.maybe { background: #f39c12; }
  #viewer.sf-mobile-open .sf-flag-dot.final { background: #3498db; }
  #viewer.sf-mobile-open .sf-more-status .sf-more-item {
    justify-content: flex-start;
    padding: 0 12px;
  }
  #viewer.sf-mobile-open .sf-more-status .sf-more-item.is-active {
    border-color: rgba(33, 44, 61, 0.55);
    background: rgba(255, 255, 255, 0.96);
  }

  /* Mobile Tools Panel Rework (visual only) */
  #viewer.sf-mobile-open #sfToolsPanel,
  #viewer.sf-mobile-open #sfCommentPanel,
  #viewer.sf-mobile-open .sf-tools-panel {
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom) + 88px);
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.72);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.96);
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-sheet-head,
  #viewer.sf-mobile-open #sfCommentPanel .sf-sheet-head,
  #viewer.sf-mobile-open .sf-comment-header,
  #viewer.sf-mobile-open .sf-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0;
    border-bottom: none;
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-sheet-head h4,
  #viewer.sf-mobile-open #sfCommentPanel .sf-sheet-head h4,
  #viewer.sf-mobile-open .sf-tools-header h3,
  #viewer.sf-mobile-open .sf-comment-header h3 {
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.85;
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-sheet-close,
  #viewer.sf-mobile-open #sfCommentPanel .sf-sheet-close,
  #viewer.sf-mobile-open .sf-tools-close,
  #viewer.sf-mobile-open .sf-comment-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.92);
    line-height: 0;
    box-shadow: none;
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-sheet-content,
  #viewer.sf-mobile-open #sfCommentPanel .sf-sheet-content {
    max-height: calc(60dvh - 72px);
    padding: 0;
    overflow: auto;
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-more-item,
  #viewer.sf-mobile-open .sf-status-option {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.96);
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-more-status .sf-more-item {
    justify-content: flex-start;
    gap: 10px;
  }
  #viewer.sf-mobile-open #sfToolsPanel .sf-more-status .sf-more-item.is-active,
  #viewer.sf-mobile-open .sf-status-option.active {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.12);
  }
  #viewer.sf-mobile-open #sfToolsPanel {
    display: none !important;
  }
}

body.is-mobile.is-landscape #viewer {
  display: flex;
  align-items: center;
  justify-content: center;
}
body.is-mobile.is-landscape #viewer #v-img {
  max-height: 85vh;
}
body.is-mobile.is-landscape #viewer.sf-mobile-open .sf-dock {
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  padding: 4px 12px;
  gap: 18px;
}
body.is-mobile.is-landscape #viewer.sf-mobile-open .sf-dockBtn {
  width: 30px;
  height: 30px;
}
body.is-mobile.is-landscape #viewer.sf-mobile-open .sf-flag-dropdown.is-open {
  pointer-events: auto;
}
