/* ============================================================
   Anime Sketch Gallery — mobile-first dark theme
   ============================================================ */

:root {
  --bg: #0d0f14;
  --bg-soft: #141821;
  --bg-card: #171c27;
  --bg-alt: #10141c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #ff4d5e;          /* manga-ink red */
  --accent-soft: rgba(255, 77, 94, 0.12);
  --accent-2: #7c6cff;        /* violet highlight */
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 15, 20, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.brand-mark { font-size: 1.4rem; }
.brand-text em { font-style: normal; color: var(--accent); }

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.main-nav a:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.main-nav a.active { color: var(--text); background: var(--accent-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff7a4d);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 77, 94, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(255, 77, 94, 0.5); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); }

.btn-danger { background: rgba(255, 77, 94, 0.14); color: #ff8a94; border-color: rgba(255,77,94,0.3); }
.btn-danger:hover { background: rgba(255, 77, 94, 0.25); }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 15px 34px; font-size: 1.08rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 88px 0 72px;
  text-align: center;
}

/* subtle manga halftone + speed-line glow */
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 108, 255, 0.14), transparent 45%),
    radial-gradient(circle at 80% 30%, rgba(255, 77, 94, 0.16), transparent 45%),
    radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: auto, auto, 22px 22px;
  pointer-events: none;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 55%, var(--bg));
}

.hero-inner { position: relative; z-index: 1; }
.hero-kicker {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(255,77,94,0.25);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 4.6rem);
  letter-spacing: 0.02em;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff 30%, #ffb3ba 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}
.hero-sub {
  color: var(--muted);
  font-size: clamp(1rem, 3.6vw, 1.2rem);
  font-style: italic;
  margin-bottom: 30px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-scroll { position: relative; z-index: 1; color: var(--muted); font-size: 1.6rem; margin-top: 34px; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(8px); opacity: 1; } }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}
.link-more { color: var(--accent); font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.link-more:hover { text-decoration: underline; }
.center { text-align: center; margin-top: 28px; }

/* ---------- Gallery grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(255,77,94,0.35); }
.card-media { aspect-ratio: 4 / 5; overflow: hidden; background: #0a0c10; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 12px 14px 14px; }
.card-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; line-height: 1.3; }
.card-meta { color: var(--accent); font-size: 0.82rem; font-weight: 600; margin-top: 2px; }
.card-char { color: var(--muted); font-size: 0.82rem; }
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.views { display: inline-flex; align-items: center; gap: 5px; }

.rank-wrap { position: relative; }
.rank-badge {
  position: absolute;
  top: -10px;
  left: -6px;
  z-index: 2;
  background: linear-gradient(135deg, var(--accent), #ff7a4d);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(255,77,94,0.4);
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-emoji { font-size: 2.6rem; margin-bottom: 10px; }

/* ---------- About ---------- */
.about-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 24px;
}
.about-avatar {
  font-size: 3rem;
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  border-radius: 24px;
  flex-shrink: 0;
}
.about-copy h2 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 12px; }
.about-copy p { color: var(--muted); margin-bottom: 12px; }
.about-note { font-size: 0.78rem; opacity: 0.7; }
.about-note code { background: rgba(255,255,255,0.07); padding: 2px 6px; border-radius: 6px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  margin-top: 40px;
}
.footer-inner { padding: 36px 16px; text-align: center; }
.footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-display); font-weight: 700; }
.footer-tag { color: var(--muted); font-style: italic; font-size: 0.9rem; margin: 8px 0 16px; }
.footer-nav { display: flex; gap: 20px; justify-content: center; margin-bottom: 16px; }
.footer-nav a { color: var(--muted); font-size: 0.9rem; }
.footer-nav a:hover { color: var(--text); }
.footer-copy { color: var(--muted); font-size: 0.78rem; opacity: 0.75; }

/* ---------- Page / toolbar ---------- */
.page { padding-top: 36px; padding-bottom: 24px; }
.page-head h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; }
.page-sub { color: var(--muted); margin-top: 4px; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0 8px;
}
.search-wrap {
  position: relative;
  flex: 1;
}
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); opacity: 0.6; }
.search-wrap input {
  width: 100%;
  padding: 13px 16px 13px 46px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sort-wrap { display: flex; align-items: center; gap: 10px; }
.sort-wrap label { color: var(--muted); font-size: 0.9rem; }
.sort-wrap select {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
}
.result-count { color: var(--muted); font-size: 0.85rem; margin: 12px 0; min-height: 1.2em; }

/* ---------- Artwork page ---------- */
.back-link { display: inline-block; color: var(--muted); margin-bottom: 20px; font-weight: 500; }
.back-link:hover { color: var(--text); }

.artwork { display: flex; flex-direction: column; gap: 24px; }
.artwork-media {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #0a0c10;
}
.artwork-media img { width: 100%; height: auto; }
.artwork-title { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; margin-bottom: 16px; }
.artwork-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.artwork-meta dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.artwork-meta dd { font-weight: 600; font-size: 1.02rem; }
.artwork-desc { color: var(--muted); margin-bottom: 22px; white-space: pre-wrap; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Auth pages ---------- */
.auth-page { align-items: center; justify-content: center; padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-family: var(--font-display); font-size: 1.5rem; margin: 14px 0 8px; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 24px; }
.auth-card .g_id_signin { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-error {
  background: rgba(255,77,94,0.1);
  border: 1px solid rgba(255,77,94,0.35);
  color: #ff9aa3;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin: 14px 0;
}

/* ---------- Admin dashboard ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; }
.stat-value.stat-small { font-size: 1.15rem; line-height: 1.35; }
.stat-sub { color: var(--muted); font-size: 0.82rem; }
.stat-list { list-style: none; font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.stat-list li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-list li span { opacity: 0.7; }

.dash-actions { margin: 8px 0 8px; }

.manage-list { display: flex; flex-direction: column; gap: 12px; }
.manage-row {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.manage-thumb { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: #0a0c10; }
.manage-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.manage-info strong { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manage-info span { color: var(--muted); font-size: 0.82rem; }
.manage-sub { font-size: 0.78rem !important; }
.manage-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.badge { font-size: 0.72rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.badge-on { background: rgba(52, 199, 123, 0.15); color: #5fe3a1; }
.badge-off { background: rgba(255,255,255,0.08); color: var(--muted); }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 6, 9, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 14px;
  overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  animation: pop 0.22s ease;
}
.modal-sm { max-width: 400px; text-align: center; }
.modal-sm p { color: var(--muted); margin: 10px 0; }
@keyframes pop { from { transform: scale(0.96) translateY(8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--font-display); font-size: 1.3rem; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.delete-name { font-weight: 700; color: var(--text) !important; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 7px; }
.form-group label { font-weight: 600; font-size: 0.9rem; }
.form-group input[type="text"],
.form-group textarea,
.form-group input[type="file"] {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  width: 100%;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-group textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 0.8rem; color: var(--muted); }
.form-check { flex-direction: row; align-items: center; gap: 12px; }
.form-check small { color: var(--muted); font-weight: 400; }

.img-preview { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); max-height: 260px; }
.img-preview img { width: 100%; height: 100%; max-height: 260px; object-fit: contain; background: #0a0c10; }

/* toggle switch */
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(255,255,255,0.12); border-radius: 999px; transition: 0.25s;
}
.slider::before {
  content: ''; position: absolute; height: 22px; width: 22px;
  left: 4px; top: 4px; background: #fff; border-radius: 50%; transition: 0.25s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }

.center-page { display: flex; align-items: center; justify-content: center; min-height: 50vh; }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .toolbar { flex-direction: row; align-items: center; }
  .sort-wrap { flex-shrink: 0; }
  .artwork { flex-direction: row; align-items: flex-start; }
  .artwork-media { flex: 1.4; position: sticky; top: 84px; }
  .artwork-info { flex: 1; }
  .about-inner { flex-direction: row; align-items: center; padding: 40px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 120px 0 96px; }
}
