/* FD Gallery — темна тема за мотивами hikka.io */
@font-face {
  font-family: "Geist";
  src: url("/static/vendor/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  src: url("/static/vendor/fonts/geist-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #000;
  --fg: #fafafa;
  --card: rgba(28, 28, 32, .45);       /* напівпрозора картка, як на hikka */
  --card-solid: #18181b;
  --popover: #0f0f11;
  --secondary: #27272a;
  --secondary-hover: #303034;
  --border: #1f1f23;
  --border-strong: #2c2c31;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --primary: #ef5fa3;
  --primary-bg: #1d0b14;
  --primary-bg-hover: #2a1020;
  --primary-border: #4a1b33;
  --success: #6ee7b7;
  --success-bg: #0b2219;
  --success-border: #134e3a;
  --danger: #f87171;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --container: 1150px;
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {   /* фіолетове сяйво зверху */
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 380px;
  background: linear-gradient(180deg, rgba(46, 10, 48, .85) 0%, rgba(20, 4, 22, .5) 45%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #000; }

#app { min-height: 100vh; display: flex; flex-direction: column; }
#app > main { flex: 1; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.page { padding-top: 48px; padding-bottom: 80px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }

h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.h1 { font-size: 24px; line-height: 32px; font-weight: 700; }
.h2 { font-size: 18px; line-height: 28px; font-weight: 700; }
.h3 { font-size: 14px; line-height: 20px; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ───── header ───── */
.header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(0, 0, 0, 0);
  border-bottom: 1px solid transparent;
  transition: background .2s, border-color .2s, backdrop-filter .2s;
}
.header.scrolled { background: rgba(0, 0, 0, .7); backdrop-filter: blur(14px); border-bottom-color: var(--border); }
.header-inner { height: 52px; display: flex; align-items: center; gap: 4px; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.045em; margin-right: 18px; }
.logo span { color: var(--primary); margin-left: .2em; }
.nav-link {
  display: inline-flex; align-items: center; height: 32px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 500; font-size: 14px; color: var(--fg);
  transition: background .15s, color .15s, border-color .15s;
}
.nav-link:hover { background: var(--secondary); }
.nav-link.router-link-exact-active, .nav-link.active {
  background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border);
}
.nav-sep { width: 1px; height: 16px; background: var(--border-strong); margin: 0 6px; }
@media (max-width: 640px) {
  .header-inner { overflow-x: auto; }
  .logo { margin-right: 8px; font-size: 19px; }
  .nav-link { padding: 0 8px; font-size: 13px; }
}

/* ───── buttons & inputs ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--secondary);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--secondary-hover); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 40px; padding: 0 18px; border-radius: var(--radius); }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-lg.btn-icon { width: 40px; }
.btn-primary { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border); }
.btn-primary:hover { background: var(--primary-bg-hover); }
.btn-solid { background: var(--fg); color: #000; }
.btn-solid:hover { background: #d4d4d8; }
.btn-secondary { background: var(--secondary); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: var(--secondary); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--secondary); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .35); }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.select { background: var(--card-solid); }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--muted-2); box-shadow: 0 0 0 3px rgba(255, 255, 255, .05); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field { display: flex; flex-direction: column; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }

/* картка (панель) */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 12px; }

/* чипи / бейджі */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: var(--radius-xs); font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--secondary); border: 1px solid var(--border); color: var(--fg);
}
a.chip:hover { background: var(--secondary-hover); }
.badge-primary { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* сегментований перемикач (UA / EN на hikka) */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--secondary); border-radius: var(--radius-sm); flex-wrap: wrap; }
.seg button { height: 24px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer; }
.seg button.active { background: var(--card-solid); color: var(--fg); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--secondary); border-radius: var(--radius-sm); flex-wrap: wrap; }
.tab { height: 26px; padding: 0 12px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--muted); border: 0; background: none; }
.tab.active { background: var(--card-solid); color: var(--fg); }

/* заголовок секції зі стрілкою праворуч */
.section { margin-top: 36px; }
.section:first-child { margin-top: 0; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 18px; line-height: 28px; font-weight: 700; margin-bottom: 14px; }

/* ───── page heading ───── */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .desc { color: var(--muted); margin-top: 6px; max-width: 640px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; margin-bottom: 20px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; max-width: 360px; flex: 1; min-width: 200px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.search input { border: 0; background: none; outline: none; flex: 1; height: 100%; font-size: 14px; }
.search input::placeholder { color: var(--muted-2); }
.found { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.found b { color: var(--fg); font-weight: 600; }

/* ───── сітка образів ───── */
.grid { display: grid; gap: 22px 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; } }
.card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.poster {
  position: relative; overflow: hidden; border-radius: 0;
  background: var(--card-solid); aspect-ratio: 2 / 3; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* scale-down: великі картинки зменшуються, маленькі — показуються як є, без розтягування */
.poster img {
  width: 100%; height: 100%; object-fit: scale-down;
  opacity: 0; transition: opacity .35s ease, transform .35s ease;
}
.poster img.loaded { opacity: 1; }
.poster:hover img { transform: scale(1.02); }
.poster .skeleton { position: absolute; inset: 0; }
.poster-badge { position: absolute; left: 6px; top: 6px; }
.poster-actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.card:hover .poster-actions { opacity: 1; }
.poster-actions .btn { background: rgba(0, 0, 0, .75); border-color: rgba(255, 255, 255, .1); backdrop-filter: blur(4px); }
.card-title { font-weight: 600; font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--muted); min-width: 0; margin-top: 2px; }
.nick { color: var(--primary); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow: hidden; }
.nick span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-link { color: inherit; transition: color .15s; }
.name-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
a.nick:hover { text-decoration: underline; text-underline-offset: 3px; }

.skeleton { background: linear-gradient(90deg, #121214 0%, #1c1c20 50%, #121214 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sentinel { height: 1px; }
.loader { display: flex; justify-content: center; padding: 28px; color: var(--muted); gap: 8px; align-items: center; }
.spin { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 60px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ───── список галерей ───── */
.gal-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gal-card { display: flex; flex-direction: column; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); transition: border-color .15s; }
.gal-card:hover { border-color: var(--border-strong); }
.gal-covers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 8 / 3; background: var(--card-solid); }
.gal-covers img { width: 100%; height: 100%; object-fit: cover; }
.gal-info { padding: 0 4px 2px; }

/* ───── сторінка образа: три колонки, як сторінка аніме на hikka ───── */
.detail { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; } }
.col-left, .col-right { display: flex; flex-direction: column; gap: 12px; }
.cover {
  border-radius: var(--radius); overflow: hidden; background: var(--card-solid); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; min-height: 200px; padding: 0; cursor: zoom-in;
}
.cover img { max-width: 100%; height: auto; }   /* без збільшення: натуральний розмір або менше */
.cover-actions { display: flex; gap: 8px; }
.cover-actions .btn { flex: 1; }
.cover-actions .btn-icon { flex: none; }
.desc-text { font-size: 16px; line-height: 26px; white-space: pre-wrap; color: var(--fg); }

/* інфо-картка: «підпис — значення» */
.info-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 0; display: flex; flex-direction: column; gap: 16px; }
.info-group { display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.info-group + .info-group { border-top: 1px solid var(--border); padding-top: 16px; }
.info-row { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 18px; font-weight: 500; }
.info-row .k { color: var(--muted); display: flex; align-items: center; gap: 8px; flex: none; }
.info-row .v { margin-left: auto; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* список посилань (як «Посилання» на hikka) */
.link-list { display: flex; flex-direction: column; gap: 4px; }
.link-item { display: flex; align-items: center; gap: 12px; padding: 6px; margin: 0 -6px; border-radius: var(--radius-sm); cursor: pointer; background: none; border: 0; text-align: left; width: calc(100% + 12px); }
.link-item:hover { background: var(--secondary); }
.link-item .ico { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--secondary); display: flex; align-items: center; justify-content: center; flex: none; color: var(--fg); }
.link-item:hover .ico { background: var(--card-solid); }
.link-item .t { font-weight: 600; font-size: 14px; line-height: 18px; }
.link-item .s { color: var(--muted); font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* до / після */
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .ba { grid-template-columns: 1fr; } }
.ba-item { display: flex; flex-direction: column; gap: 10px; }
.ba-frame {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; padding: 16px; min-height: 240px; cursor: zoom-in;
}
.ba-frame img { max-width: 100%; height: auto; }
.extras { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.extra { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.extra .frame { border-radius: var(--radius-sm); overflow: hidden; background: var(--card-solid); cursor: zoom-in; display: flex; align-items: center; justify-content: center; aspect-ratio: 2 / 3; }
.extra .frame img { max-width: 100%; max-height: 100%; object-fit: scale-down; }
.extra .cap { font-size: 14px; font-weight: 600; line-height: 20px; }
.sticky { position: sticky; top: 68px; }

.copy-field { display: flex; gap: 6px; }
.copy-field .input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; height: 34px; }
.copy-field .btn { height: 34px; width: 34px; }

/* ───── предпоказ у грі ───── */
.preview-wrap { display: flex; justify-content: center; padding: 20px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); }

/* ───── переглядач і модальні вікна ───── */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .8); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.viewer {
  display: grid; grid-template-columns: auto 300px; max-width: min(1000px, 100%); max-height: calc(100vh - 48px);
  background: var(--popover); border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
}
.viewer-media {
  display: flex; align-items: center; justify-content: center; padding: 24px; min-width: 280px; min-height: 340px;
  background: #050506; border-right: 1px solid var(--border); overflow: auto;
}
/* ніякого збільшення — картинка в натуральному розмірі, зменшується лише якщо не влазить */
.viewer-media img { max-width: min(640px, 60vw); max-height: calc(100vh - 100px); width: auto; height: auto; }
.viewer-side { display: flex; flex-direction: column; gap: 16px; padding: 20px; overflow: auto; }
.viewer-side .actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
@media (max-width: 720px) {
  .viewer { grid-template-columns: 1fr; overflow: auto; }
  .viewer-media { border-right: 0; border-bottom: 1px solid var(--border); min-height: 0; }
  .viewer-media img { max-width: 100%; max-height: 55vh; }
}
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lb-close { position: fixed; top: 16px; right: 16px; }
.zoom-img { max-width: 92vw; max-height: 90vh; width: auto; height: auto; border-radius: var(--radius-sm); }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--popover); border: 1px solid var(--border-strong); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; margin-bottom: 16px; }

/* ───── завантаження ───── */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 48px 20px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  background: var(--card);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: rgba(29, 11, 20, .6); }
.dropzone .big { font-size: 18px; font-weight: 700; margin: 10px 0 4px; }
.upl-list { display: flex; flex-direction: column; gap: 10px; }
.upl-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px; }
.upl-item .thumb { width: 64px; height: 96px; border-radius: 6px; object-fit: scale-down; background: var(--card-solid); }
.progress { height: 4px; border-radius: 4px; background: var(--secondary); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); transition: width .2s; }

/* ───── сповіщення ───── */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--popover); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow); animation: fade .2s; max-width: 340px; font-weight: 500; }
.toast.error { border-color: rgba(248, 113, 113, .5); color: #fecaca; }

.icon { width: 16px; height: 16px; flex: none; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 28px; height: 28px; }
.footer { border-top: 1px solid var(--border); color: var(--muted-2); font-size: 12px; padding: 20px 0; }
.thumb-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb-pick .t { position: relative; width: 72px; }
.thumb-pick .t img { width: 72px; height: 96px; object-fit: scale-down; border-radius: 6px; background: var(--card-solid); }
.thumb-pick .t .x { position: absolute; top: 3px; right: 3px; }
.thumb-pick .t input { margin-top: 4px; height: 26px; font-size: 11px; padding: 0 6px; }
.thumb-add { width: 72px; height: 96px; border: 1.5px dashed var(--border-strong); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.thumb-add:hover { border-color: var(--primary); color: var(--primary); }

/* розмітка ігрового блоку персонажа (з source/index.html) */
.game-preview table { border-spacing: 0; }
.game-preview td { padding: 0; }
.game-preview .gp-a, .game-preview .gp-ring { display: table-cell; }
.game-preview .gp-item { display: block; margin: 0 auto; border: 0; opacity: .87; transition: opacity .15s ease-in-out; cursor: pointer; max-width: none; }
.game-preview .gp-item:hover { opacity: 1; }
