@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=DM+Mono:wght@400;500&display=swap');

/* ── VARIABLES ───────────────────────────── */
:root {
  --bg:        #0a0a0f;
  --bg2:       #111118;
  --bg3:       #1a1a24;
  --surface:   #1e1e2e;
  --border:    #2e2e4a;
  --border2:   #3d3d60;
  --accent:    #c084fc;
  --accent2:   #22d3ee;
  --accent3:   #ff6b9d;
  --green:     #4ade80;
  --yellow:    #fbbf24;
  --red:       #f87171;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #475569;
  --pixel-font: 'DM Mono', monospace;
  --vt-font:   'Outfit', sans-serif;
  --shadow:    0 0 20px rgba(192, 132, 252, 0.15);
  --glow:      0 0 8px rgba(192, 132, 252, 0.6);
}

/* ── RESET ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--vt-font);
  font-size: 1.1rem;
  line-height: 1.6;
  min-height: 100vh;
  image-rendering: pixelated;
}
img { display: block; max-width: 100%; image-rendering: pixelated; }
a { color: var(--accent); text-decoration: none; }

/* ── CRT EFFECTS ─────────────────────────── */
.scanlines {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
}
.crt-flicker {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 998;
  animation: flicker 8s infinite;
  background: transparent;
}
@keyframes flicker {
  0%,95%,100% { opacity: 1; }
  96% { opacity: 0.97; }
  97% { opacity: 1; }
  98% { opacity: 0.95; }
}

/* ── PIXEL BORDER UTIL ───────────────────── */
.px-border {
  border: 3px solid var(--border);
  box-shadow: 3px 3px 0 var(--border2);
}

/* ── BUTTONS ─────────────────────────────── */
.btn-pixel {
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--accent);
  background: var(--surface);
  border: 2px solid var(--accent);
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: all 0.1s;
  display: inline-block;
  box-shadow: 3px 3px 0 rgba(192,132,252,0.3);
}
.btn-pixel:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 12px rgba(192,132,252,0.5), 3px 3px 0 rgba(192,132,252,0.5);
  transform: translate(-1px,-1px);
}
.btn-pixel:active { transform: translate(1px,1px); box-shadow: none; }
.btn-sm { font-size: 0.68rem; padding: 7px 12px; }
.btn-block { width: 100%; text-align: center; margin-top: 20px; font-size: 0.8rem; padding: 14px; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--bg); }
.btn-save { color: var(--green); border-color: var(--green); }
.btn-save:hover { background: var(--green); color: var(--bg); }
.btn-upload { color: var(--accent2); border-color: var(--accent2); margin-top: 24px; }
.btn-upload:hover { background: var(--accent2); color: var(--bg); }
.btn-full { width: 100%; text-align: center; }

/* ── INPUTS ──────────────────────────────── */
.pixel-input {
  font-family: var(--vt-font);
  font-size: 1rem;
  color: var(--text);
  background: var(--bg2);
  border: 2px solid var(--border);
  border-left: 3px solid var(--border2);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
.pixel-input:focus {
  border-color: var(--accent);
  border-left-color: var(--accent);
  box-shadow: 0 0 10px rgba(192,132,252,0.2);
}
.pixel-input::placeholder { color: var(--text3); }
.pixel-textarea { min-height: 84px; resize: vertical; }
.pixel-input-sm { font-size: 0.9rem; padding: 6px 10px; }
.pixel-textarea-sm { min-height: 58px; resize: vertical; font-size: 0.9rem; padding: 6px 10px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.field-hint { color: var(--text3); font-family: var(--vt-font); font-size: 0.9rem; }

/* ── ALERTS ──────────────────────────────── */
.alert {
  font-family: var(--vt-font);
  font-size: 1.2rem;
  padding: 12px 18px;
  border: 2px solid;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-icon { font-family: var(--pixel-font); font-size: 0.75rem; }
.alert-success { border-color: var(--green); color: var(--green); background: rgba(74,222,128,0.07); }
.alert-error { border-color: var(--red); color: var(--red); background: rgba(248,113,113,0.07); }

/* ── SITE HEADER ─────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo-block { display: flex; align-items: center; gap: 16px; }
.pixel-avatar { flex-shrink: 0; }
.pa-grid {
  width: 48px; height: 48px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  image-rendering: pixelated;
}
.pa-cell { width: 100%; aspect-ratio: 1; }
.header-text {}
.site-title {
  font-family: var(--pixel-font);
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-shadow: var(--glow);
}
.site-bio {
  font-family: var(--vt-font);
  font-size: 1rem;
  color: var(--text2);
  margin-top: 4px;
}
.header-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.header-border {
  height: 2px;
  background: linear-gradient(90deg, var(--accent3), var(--accent), var(--accent2), transparent);
}

/* ── MAIN CONTENT ────────────────────────── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── GALLERY GRID ────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.art-card {
  background: var(--surface);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  animation: cardIn 0.4s ease both;
  box-shadow: 4px 4px 0 var(--border);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.art-card:hover {
  transform: translate(-3px,-3px);
  border-color: var(--accent);
  box-shadow: 6px 6px 0 var(--accent), 0 0 20px rgba(192,132,252,0.2);
}
.art-card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg2);
}
.art-card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}
.art-card:hover .art-card-img-wrap img { transform: scale(1.03); }
.art-card-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,10,15,0.6);
  opacity: 0; transition: opacity 0.15s;
  font-family: var(--pixel-font);
  font-size: 1.4rem;
  color: var(--accent);
}
.art-card:hover .art-card-overlay { opacity: 1; }
.art-card-info { padding: 12px 14px; border-top: 2px solid var(--border); }
.art-title {
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 6px;
}
.art-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tag {
  font-family: var(--vt-font);
  font-size: 0.95rem;
  color: var(--accent2);
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.3);
  padding: 1px 7px;
}
.art-date {
  font-family: var(--vt-font);
  font-size: 0.9rem;
  color: var(--text3);
}

/* ── EMPTY STATE ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.empty-text {
  font-family: var(--pixel-font);
  font-size: 0.85rem;
  color: var(--text3);
}
.empty-sub {
  font-family: var(--vt-font);
  font-size: 1.2rem;
  color: var(--text3);
}

/* ── LIGHTBOX ────────────────────────────── */
.lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.88);
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }
.lightbox-inner {
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0 rgba(192,132,252,0.4), 0 0 40px rgba(192,132,252,0.2);
  max-width: 1600px; width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: lbIn 0.15s ease;
}
@keyframes lbIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.lightbox-close {
  position: absolute; top: 12px; right: 14px; z-index: 10;
  font-family: var(--pixel-font);
  font-size: 0.7rem;
  background: none; border: 2px solid var(--border2);
  color: var(--text2); cursor: pointer; padding: 6px 10px;
  transition: all 0.1s;
}
.lightbox-close:hover { border-color: var(--red); color: var(--red); }
.lightbox-img-wrap {
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90vh;
  width: 100%;
}
.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* ВАЖНО */
}
.lightbox-info { padding: 20px 24px; border-top: 2px solid var(--border); }
.lightbox-info h2 {
  font-family: var(--pixel-font);
  font-size: 0.9rem; color: var(--accent);
  margin-bottom: 8px;
}
.lightbox-info p {
  font-family: var(--vt-font);
  font-size: 1.1rem; color: var(--text2);
  margin-bottom: 8px;
}
.lightbox-tags { color: var(--accent2) !important; }

/* ── FOOTER ──────────────────────────────── */
.site-footer {
  border-top: 2px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  font-family: var(--vt-font);
  font-size: 1rem;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.footer-blink { animation: blink 1s step-end infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ── LOGIN PAGE ──────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 420px; padding: 24px; }
.login-box {
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0 rgba(192,132,252,0.3), 0 0 40px rgba(192,132,252,0.1);
  padding: 36px 32px;
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { margin-bottom: 16px; display: flex; justify-content: center; }
.login-title {
  font-family: var(--pixel-font);
  font-size: 0.95rem;
  color: var(--accent);
  text-shadow: var(--glow);
  margin-bottom: 6px;
}
.login-sub { font-family: var(--vt-font); font-size: 1.1rem; color: var(--text3); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-back {
  display: block; text-align: center;
  font-family: var(--vt-font); font-size: 1rem; color: var(--text3);
  margin-top: 20px;
  transition: color 0.1s;
}
.login-back:hover { color: var(--accent); }

/* ── ADMIN PAGE ──────────────────────────── */
.admin-body { background: var(--bg); }
.admin-header {
  background: var(--bg2);
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.admin-header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.admin-title-block { display: flex; align-items: center; gap: 12px; }
.admin-badge {
  font-family: var(--pixel-font); font-size: 0.6rem;
  color: var(--bg); background: var(--accent3);
  padding: 5px 8px;
}
.admin-title { font-family: var(--pixel-font); font-size: 0.9rem; color: var(--accent); }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-main { max-width: 1400px; margin: 0 auto; padding: 32px 24px 80px; display: flex; flex-direction: column; gap: 40px; }
.admin-section {}
.section-title {
  font-family: var(--pixel-font); font-size: 0.8rem;
  color: var(--accent2); margin-bottom: 24px;
  display: flex; align-items: center; gap: 12px;
}
.count-badge {
  font-family: var(--vt-font); font-size: 1.1rem;
  color: var(--bg); background: var(--accent2);
  padding: 2px 8px;
}

/* Upload form */
.upload-zone {
  border: 3px dashed var(--border2);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 24px;
  min-height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent2);
  background: rgba(34,211,238,0.04);
}
.upload-icon { font-size: 2.5rem; color: var(--text3); margin-bottom: 10px; }
.upload-prompt p { font-family: var(--pixel-font); font-size: 0.7rem; color: var(--text2); margin-bottom: 6px; }
.upload-hint { color: var(--text3) !important; font-size: 0.62rem !important; }
.upload-preview { position: relative; display: inline-block; }
.upload-preview img { max-height: 140px; border: 2px solid var(--accent2); }
.preview-clear {
  position: absolute; top: -8px; right: -8px;
  font-family: var(--pixel-font); font-size: 0.6rem;
  background: var(--red); color: white; border: none;
  padding: 4px 6px; cursor: pointer;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-full { grid-column: 1 / -1; }

/* Admin grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.admin-card {
  background: var(--surface);
  border: 2px solid var(--border);
  overflow: hidden;
}
.admin-card-img { aspect-ratio: 1; background: var(--bg2); overflow: hidden; position: relative; }
.admin-card-img img { width: 100%; height: 100%; object-fit: contain; }
.admin-card-body { padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.edit-form { display: flex; flex-direction: column; gap: 7px; }
.admin-card-date { font-family: var(--vt-font); font-size: 0.85rem; color: var(--text3); text-align: right; }
.empty-admin { font-family: var(--vt-font); font-size: 1.2rem; color: var(--text3); }

/* ── GIF BADGE ───────────────────────────── */
.gif-badge {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  font-family: var(--pixel-font);
  font-size: 0.6rem;
  color: var(--bg);
  background: var(--accent3);
  padding: 4px 7px;
  letter-spacing: 0.05em;
  animation: gifPulse 2s ease-in-out infinite;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}
.gif-badge-lg {
  position: static;
  display: inline-block;
  font-size: 0.65rem;
  margin-bottom: 8px;
  animation: gifPulse 2s ease-in-out infinite;
}
@keyframes gifPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}


@media (max-width: 600px) {
  .site-title { font-size: 0.85rem; }
  .header-inner { padding: 12px 16px; }
  .main-content { padding: 24px 16px 60px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-box { padding: 24px 20px; }
  .feedback-modal-inner { padding: 24px 20px; }
}

/* ── FEEDBACK MODAL ──────────────────────── */
.feedback-modal {
  display: none;
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.88);
  align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.feedback-modal.open { display: flex; }
.feedback-modal-inner {
  background: var(--surface);
  border: 3px solid var(--accent);
  box-shadow: 6px 6px 0 rgba(192,132,252,0.4), 0 0 40px rgba(192,132,252,0.2);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 32px 28px;
  position: relative;
  animation: lbIn 0.15s ease;
}
.feedback-close {
  position: absolute; top: 12px; right: 14px;
  font-family: var(--pixel-font);
  font-size: 0.65rem;
  background: none; border: 2px solid var(--border2);
  color: var(--text2); cursor: pointer; padding: 7px 12px;
  transition: all 0.1s;
  letter-spacing: 0.05em;
}
.feedback-close:hover { border-color: var(--red); color: var(--red); }
.feedback-title {
  font-family: var(--pixel-font);
  font-size: 0.85rem;
  color: var(--accent2);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.feedback-sub {
  font-family: var(--vt-font);
  font-size: 1.05rem;
  color: var(--text2);
  margin-bottom: 24px;
}
.feedback-form { display: flex; flex-direction: column; gap: 18px; }
.feedback-form .form-grid { gap: 14px; }
.hp-field {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important; height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.feedback-status {
  font-family: var(--pixel-font);
  font-size: 0.75rem;
  min-height: 1.2em;
  letter-spacing: 0.04em;
}
.feedback-status.fb-success { color: var(--green); }
.feedback-status.fb-error { color: var(--red); }
#fbSubmit[disabled] { opacity: 0.55; cursor: wait; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  cursor: pointer;
  padding: 10px 15px;
  z-index: 10;
}

.lightbox-nav.prev {
  left: 20px;
}

.lightbox-nav.next {
  right: 20px;
}

.lightbox-fullscreen {
  position: absolute;
  top: 20px;
  right: 60px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 1.2rem;
  padding: 8px 10px;
  cursor: pointer;
}

/* ── LIGHTBOX ZOOM ───────────────────────── */
 
/* Image uses transform instead of wrap, so wrap stays overflow:hidden */
.lightbox-img-wrap {
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 65vh;
  width: 100%;
  overflow: hidden;
  position: relative;
  user-select: none;
}
 
.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  cursor: zoom-in;
  will-change: transform;
  /* prevent blue highlight on touch drag */
  -webkit-tap-highlight-color: transparent;
}
 
/* Zoom control bar */
.lightbox-zoom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 2px solid var(--border);
  background: var(--bg2);
  flex-wrap: wrap;
}
 
.zoom-pct {
  font-family: var(--pixel-font);
  font-size: 0.72rem;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
  letter-spacing: 0.04em;
}
 
.zoom-hint {
  font-family: var(--vt-font);
  font-size: 0.85rem;
  color: var(--text3);
  margin-left: auto;
}
 
.lightbox-zoom-bar .btn-pixel:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
 
/* Keep close button readable */
.lightbox-close {
  font-size: 0.65rem;
  padding: 7px 12px;
  top: 10px;
  right: 12px;
}
 
@media (max-width: 600px) {
  .lightbox-img-wrap { height: 52vh; }
  .zoom-hint { display: none; }
}
 
