/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --bg:          #f7f5f0;
  --surface:     #ffffff;
  --surface-2:   #fbfaf6;
  --border:      rgba(0,0,0,.1);
  --border-2:    rgba(0,0,0,.18);
  --ink:         #1a1a1a;
  --ink-2:       #8a877f;
  --ink-3:       #a3a09a;
  --kicker:      #8a7a5c;
  --danger:      #c85f52;
  --danger-bg:   rgba(200,95,82,.08);

  --p1: #d7c8f0; /* purple */
  --p2: #a8c8e8; /* blue   */
  --p3: #f3a6b8; /* pink   */
  --p4: #bcd9a8; /* green  */
  --p5: #f4d35e; /* yellow */

  --r:        2px;
  --r-md:     8px;
  --r-pill:   100px;
  --shadow:     0 10px 34px rgba(0,0,0,.10);
  --shadow-lg:  0 24px 60px rgba(0,0,0,.22);
  --t:        180ms ease;
  --font:     'Noto Sans JP', sans-serif;
}

/* ============================================================
   RESET & BASE
============================================================ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: #6a8fc9; text-decoration: underline; }
a:hover { color: #517bb8; }
button { font-family: var(--font); }

/* ============================================================
   HEADER
============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247,245,240,.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 18px 18px 0;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--ink);
}

.icon-btn {
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--ink-2);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }

/* Search */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-2);
  padding-bottom: 9px;
}
.search-icon-svg {
  position: relative;
  color: var(--ink-3);
  pointer-events: none;
  flex-shrink: 0;
  margin-right: 8px;
}
.search-input {
  width: 100%;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  -webkit-appearance: none;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input::-webkit-search-cancel-button { display: none; }

.search-clear {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 11px;
  padding: 4px;
  line-height: 1;
}
.search-clear:hover { color: var(--ink-2); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 16px;
  padding-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 6px 4px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  border: none;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition: all var(--t);
}
.filter-chip:hover { color: var(--ink); }
.filter-chip.active { padding: 6px 16px; }

/* ============================================================
   MAIN & GRID
============================================================ */
.main {
  padding: 28px 20px 120px;
  max-width: 1440px;
  margin: 0 auto;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 20px;
  row-gap: 36px;
  padding-top: 8px;
}

.masonry-item {
  cursor: pointer;
  animation: cardIn 320ms ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   CARD
============================================================ */
.card {
  background: none;
  border: none;
  overflow: visible;
  transition: transform 220ms ease;
  user-select: none;
}
.card:hover { transform: translateY(-3px); }

.card-kv-wrap { position: relative; }

.card-kv {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  display: block;
  border-radius: 0;
}
.card-kv-ph {
  width: 100%;
  aspect-ratio: 4/5;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.05) 0 8px, rgba(0,0,0,0) 8px 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ink-3);
}

.card-burst,
.detail-kv-burst {
  position: absolute;
  top: -14px;
  left: -14px;
  width: 48px;
  height: 48px;
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  box-shadow: 0 3px 8px rgba(0,0,0,.14);
  clip-path: polygon(50% 2%,61% 20%,76% 8%,79% 27%,97% 24%,88% 41%,102% 50%,88% 59%,97% 76%,79% 73%,76% 92%,61% 80%,50% 98%,39% 80%,24% 92%,21% 73%,3% 76%,12% 59%,-2% 50%,12% 41%,3% 24%,21% 27%,24% 8%,39% 20%);
}

.card-body { padding: 13px 2px 0; }
.card-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 5px;
  color: var(--ink);
}
.card-creators {
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 8px;
  font-weight: 400;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
}

/* ============================================================
   EMPTY STATE
============================================================ */
.empty-state { text-align: center; padding: 96px 20px; }
.empty-icon { font-size: 48px; display: block; margin-bottom: 18px; opacity: .4; }
.empty-msg  { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.empty-sub  { font-size: 13px; color: var(--ink-3); }

/* ============================================================
   FAB
============================================================ */
.fab {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 26px rgba(0,0,0,.28);
  transition: transform 200ms ease, box-shadow 200ms ease;
  z-index: 200;
}
.fab:hover  { transform: scale(1.07); box-shadow: 0 10px 32px rgba(0,0,0,.36); }
.fab:active { transform: scale(.95); }

/* ============================================================
   OVERLAY
============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,14,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlayIn 200ms ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   SHEET (modal)
============================================================ */
.sheet {
  background: var(--bg);
  border-radius: var(--r-md) var(--r-md) 0 0;
  width: 100%;
  max-width: 620px;
  max-height: 93dvh;
  display: flex;
  flex-direction: column;
  animation: sheetUp 300ms cubic-bezier(.34,1.36,.64,1);
}
@keyframes sheetUp {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 4px;
  flex-shrink: 0;
}
.sheet-title { font-size: 16px; font-weight: 900; letter-spacing: -.01em; }
.close-btn {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--ink-2);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
}
.close-btn:hover { border-color: var(--ink); color: var(--ink); }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
  scrollbar-width: thin;
}
.sheet-body::-webkit-scrollbar { width: 3px; }
.sheet-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

.sheet-foot {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

/* Detail screen: full-screen, KV (left) / info+media (right) */
#detailOverlay {
  align-items: stretch;
  justify-content: stretch;
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
}
#detailSheet {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  animation: overlayIn 220ms ease;
}
.detail-sheet { overflow: hidden; }
.detail-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}
.detail-left { flex-shrink: 0; }
.detail-right { padding: 8px 20px 24px; }

.detail-kv-wrap { flex-shrink: 0; }
.detail-kv-media {
  position: relative;
  background: var(--surface-2);
  min-height: 140px;
}
.detail-kv-img { width: 100%; max-height: 46vh; height: 100%; object-fit: cover; display: block; }
.detail-kv-ph {
  width: 100%;
  height: 220px;
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.05) 0 8px, rgba(0,0,0,0) 8px 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--ink-3);
}
.detail-kv-ctrl {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}
.kv-btn {
  background: rgba(255,255,255,.85);
  border: none;
  border-radius: 50%;
  color: var(--ink);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t);
}

.detail-kv-burst { bottom: -16px; left: 20px; top: auto; width: 58px; height: 58px; font-size: 10px; }

.detail-info { padding: 30px 20px 20px; }

/* ============================================================
   DETAIL VIEW CONTENT
============================================================ */
.dv-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.dv-title-row .dv-title { margin-bottom: 0; }
.dv-title { font-size: 19px; font-weight: 900; line-height: 1.4; letter-spacing: -.01em; }
.edit-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--t);
  margin-top: 2px;
}
.edit-link-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.dv-creators { font-size: 12.5px; color: var(--ink-2); margin-bottom: 16px; font-weight: 400; }
.dv-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.dv-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.dv-meta-item { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.dv-meta-label { color: var(--ink-3); flex-shrink: 0; }
.dv-meta-val { color: var(--ink); font-weight: 500; text-align: right; }
.dv-url {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #6a8fc9;
  letter-spacing: .02em;
}
.dv-url:hover { opacity: .75; }

.sec-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}
.photo-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: zoom-in;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms ease; }
.photo-item:hover img { transform: scale(1.05); }
.photo-item.is-hidden { opacity: .3; }

.hide-toggle {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 11px;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: .03em;
}
.photo-item:hover .hide-toggle,
.photo-item.is-hidden .hide-toggle { opacity: 1; }

.video-item { overflow: hidden; margin-bottom: 12px; position: relative; }
.video-item video { width: 100%; }
.video-item.is-hidden { opacity: .3; }

.video-hide-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  font-family: var(--font);
  padding: 4px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--t);
  z-index: 2;
}
.video-item:hover .video-hide-btn,
.video-item.is-hidden .video-hide-btn { opacity: 1; }

/* ============================================================
   FORM ELEMENTS
============================================================ */
.field { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.req { color: var(--danger); }
.fi {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t);
  -webkit-appearance: none;
}
.fi::placeholder { color: var(--ink-3); }
.fi:focus { border-color: var(--ink); }

/* Chip field */
.chip-field {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  cursor: text;
  transition: border-color var(--t);
  min-height: 44px;
  align-items: flex-start;
}
.chip-field:focus-within { border-color: var(--ink); }
.chip-list { display: contents; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--p2);
  border-radius: var(--r-pill) var(--r) var(--r-pill) var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.chip.chip-color { padding-left: 6px; }
.chip.chip-plain {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-pill);
  color: var(--ink);
}
.chip-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2);
  background: rgba(255,255,255,.6);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.chip-swatch:hover { border-color: rgba(0,0,0,.4); }
.chip-x {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  display: flex;
  opacity: .6;
  transition: opacity var(--t);
}
.chip-x:hover { opacity: 1; }
.chip-fi {
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  min-width: 80px;
  flex: 1;
  padding: 2px 0;
}
.chip-fi::placeholder { color: var(--ink-3); }

/* ============================================================
   TAG COLOR POPOVER (12色パレット + 自由選択)
============================================================ */
.color-popover {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 14px;
  width: 216px;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-swatch:hover { border-color: rgba(0,0,0,.25); }
.color-swatch.is-active { border-color: var(--ink); }
.color-custom-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.color-custom-label input[type="color"] {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  background: none;
}
.color-reset-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 7px 0;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 11.5px;
  cursor: pointer;
  transition: all var(--t);
}
.color-reset-btn:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.color-reset-btn:disabled { opacity: .4; cursor: default; }

/* ============================================================
   UPLOAD DROPZONE (PC: KV画像・撮影写真・撮影動画)
============================================================ */
.upload-zone {
  border: 1px dashed transparent;
  border-radius: var(--r-md);
  padding: 2px;
  transition: all var(--t);
}
.upload-zone.drag-over {
  border-color: var(--ink);
  background: var(--surface-2);
}
#detailKvMedia.drag-over {
  outline: 3px dashed var(--ink);
  outline-offset: -3px;
}
.upload-hint {
  display: none;
  font-size: 11px;
  color: var(--ink-3);
  margin: -4px 0 8px 2px;
}

/* ============================================================
   TAG AUTOCOMPLETE DROPDOWN
============================================================ */
.tag-dropdown {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
  max-height: 160px;
  overflow-y: auto;
  animation: dropdownIn 140ms ease;
}
@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tag-sugg {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}
.tag-sugg:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============================================================
   DATE RANGE PICKER
============================================================ */
.date-range-wrap { display: flex; align-items: center; gap: 6px; }
.date-range-wrap .fi { flex: 1; min-width: 0; padding-left: 8px; padding-right: 4px; }
.date-sep { color: var(--ink-3); font-size: 13px; flex-shrink: 0; user-select: none; }

/* File button */
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
  padding: 9px 14px;
  cursor: pointer;
  transition: all var(--t);
  margin-bottom: 10px;
}
.file-btn:hover { border-color: var(--ink); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.file-thumb-wrap { margin-top: 2px; }
.file-thumb-wrap img { width: 100%; max-height: 180px; object-fit: cover; border: 1px solid var(--border-2); }
.file-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.file-grid img, .file-grid video { width: 82px; height: 82px; object-fit: cover; border: 1px solid var(--border-2); }

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  flex: 1;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all var(--t);
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover  { background: #333; }
.btn.primary:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger-ghost {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(200,95,82,.28);
  width: 100%;
  margin-top: 8px;
}
.btn.danger-ghost:hover { background: rgba(200,95,82,.14); }
.btn:disabled { opacity: .5; pointer-events: none; }

.add-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  color: var(--ink-3);
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all var(--t);
  margin-top: 8px;
}
.add-media-btn:hover { border-color: var(--ink); color: var(--ink); }

/* ============================================================
   LIGHTBOX / PHOTO VIEWER  (SP: 全画面ビューア / PC: 大型ビューア+サムネイル)
============================================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: #0d0d0d;
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: overlayIn 180ms ease;
}
.lb-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
}
.lb-btn {
  background: rgba(255,255,255,.14);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-counter { font-size: 12px; color: rgba(255,255,255,.7); font-weight: 500; }
.lb-spacer { width: 34px; }

.lb-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lb-nav:hover { background: rgba(255,255,255,.22); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-caption { display: none; }

.lb-thumbs {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 14px 20px 22px;
  overflow-x: auto;
}
.lb-thumb {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border: 2px solid transparent;
  background: none;
  padding: 0;
  cursor: pointer;
  opacity: .55;
  transition: opacity var(--t), border-color var(--t);
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb:hover { opacity: .85; }
.lb-thumb.is-active { opacity: 1; border-color: var(--p5); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (min-width: 700px) and (max-width: 1099px) {
  .masonry-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1100px) {
  .header {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 22px 44px;
  }
  .header-top { display: contents; }
  .header-actions { display: contents; }
  .logo { order: 1; }
  .icon-btn { order: 4; }
  .search-wrap { order: 2; flex: 1; max-width: 400px; margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
  .filter-bar { order: 3; padding-bottom: 0; }

  .main { padding: 40px 44px 120px; }
  .masonry-grid { grid-template-columns: repeat(4, 1fr); column-gap: 28px; row-gap: 48px; }

  .overlay { align-items: center; }
  .sheet { border-radius: var(--r-md); max-height: 88dvh; }

  .detail-main { flex-direction: row; overflow: hidden; height: 100%; }
  .detail-left { width: 320px; min-width: 0; flex-shrink: 0; height: 100%; overflow-y: auto; }
  .detail-right { flex: 1; min-width: 0; overflow-y: auto; height: 100%; padding: 56px 56px 48px; }

  .detail-sheet.is-editing .detail-main { flex-direction: column; overflow-y: auto; height: auto; }
  .detail-sheet.is-editing .detail-left { width: 100%; height: auto; overflow: visible; }
  .detail-sheet.is-editing .detail-right { width: 100%; flex: none; padding: 8px 20px 24px; }

  /* PC lightbox: caption overlay + larger thumbs (10b) */
  .lb-caption {
    display: block;
    padding: 0 60px 18px;
    text-align: center;
  }
  .lb-caption-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 10px; }
  .lb-caption-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
  .lb-thumb { width: 72px; height: 72px; }

  .upload-hint { display: block; }
}

.detail-info .dv-tags .tag,
.lb-caption-tags .tag { color: var(--ink); }

/* ============================================================
   MISC UTILITIES
============================================================ */
.mt-8  { margin-top: 8px; }
.mt-20 { margin-top: 20px; }
.mb-0  { margin-bottom: 0 !important; }
.w-full { width: 100%; }
.sep { height: 1px; background: var(--border); margin: 20px 0; }
