/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #17171a;
  --surface: #1f1f23;
  --surface-2: #2a2a2f;
  --border: #38383e;
  --text: #e6e3de;
  --muted: #9e9a94;
  --primary: #b04e56;
  --primary-hover: #bf5d64;
  --accent: #8fb0d4;
  --ring: #8fb0d4;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

button {
  font-family: inherit;
}

/* Header */
.header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  background: rgba(23, 23, 26, 0.88);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
}

.logo {
  flex-shrink: 0;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.logo:hover {
  background: var(--primary-hover);
}

.search {
  position: relative;
  flex: 1 1;
  max-width: 760px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  transition: border-color 120ms ease, background 120ms ease;
}
.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 30;
}
.suggestions li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.suggestions li.active {
  background: var(--surface-2);
}
.suggestions .count {
  color: var(--muted);
  font-size: 12px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.cat-artist { color: #d9a08a; }
.cat-character { color: #9cc49c; }
.cat-copyright { color: #b9a3d6; }
.cat-metadata { color: #d6c08a; }

.icon-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* Chips (tags, starters, active query) */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease;
}
button.chip:hover {
  background: var(--border);
}

.query-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 4px 20px 8px;
}
.query-bar .chip {
  cursor: default;
}
.save-toggle {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.save-toggle:hover,
.save-toggle[aria-pressed="true"] {
  color: var(--text);
}

.saved-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 4px 20px 8px;
}
.saved {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
}
.saved.current {
  box-shadow: inset 0 0 0 1px var(--muted);
}
.saved .chip {
  padding-right: 6px;
  background: none;
}
.saved-remove {
  padding: 4px 10px 4px 4px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.saved-remove:hover {
  color: var(--text);
}

.hero {
  text-align: center;
  padding: 72px 20px 24px;
}
.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hero p {
  margin: 0 0 24px;
  color: var(--muted);
}
.starters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.starters .chip {
  padding: 10px 18px;
  font-size: 14px;
}

/* Masonry */
.masonry {
  display: flex;
  gap: 16px;
  padding: 8px 20px 20px;
  align-items: flex-start;
}
.masonry-col {
  flex: 1 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.card img {
  width: 100%;
  display: block;
  object-fit: cover;
  transition: transform 300ms ease;
}
.card:hover img {
  transform: scale(1.03);
}

.card-meta {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 12px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  opacity: 0;
  transition: opacity 160ms ease;
}
.card:hover .card-meta,
.card:focus-visible .card-meta {
  opacity: 1;
}

.rating {
  text-transform: capitalize;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}
.rating-questionable { background: rgba(214, 170, 90, 0.6); }
.rating-explicit { background: rgba(201, 90, 94, 0.8); }

.card .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
}

.status {
  text-align: center;
  color: var(--muted);
  padding: 40px 24px;
  font-size: 14px;
}
.status.error {
  color: #e0a0a0;
}

.spinner {
  width: 32px;
  height: 32px;
  margin: 32px auto;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.sentinel {
  height: 1px;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 12, 14, 0.9);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  display: flex;
  overflow-y: auto;
}

.lightbox {
  margin: auto;
  display: flex;
  max-width: 96vw;
  max-height: 94vh;
  width: 1400px;
  background: var(--surface);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.lightbox .media {
  flex: 1 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.lightbox .media img,
.lightbox .media video {
  max-width: 100%;
  max-height: 94vh;
  object-fit: contain;
}

.details {
  width: 340px;
  flex-shrink: 0;
  padding: 24px;
  overflow-y: auto;
}
.details h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-gap: 8px 16px;
  gap: 8px 16px;
  margin: 0 0 20px;
  font-size: 13px;
}
.details dt,
.details .label {
  color: var(--muted);
}
.details dd {
  margin: 0;
  text-transform: none;
  word-break: break-word;
}

.tags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}
.copy-tags {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.copy-tags:hover {
  background: var(--primary-hover);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tags .chip {
  padding: 5px 12px;
  font-size: 12px;
}

.close {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 60;
  background: var(--surface-2);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
}
.close:hover {
  background: var(--primary);
}

/* Settings */
.settings {
  margin: auto;
  width: 420px;
  max-width: 94vw;
  background: var(--surface);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.settings h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}
.settings .hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.settings input {
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}
.settings input:focus {
  outline: none;
  border-color: var(--accent);
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.settings-actions button {
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.settings-actions .ghost {
  background: var(--surface-2);
  color: var(--text);
}

@media (max-width: 720px) {
  .header {
    padding: 10px 12px;
    gap: 8px;
  }
  .logo {
    font-size: 15px;
    padding: 7px 11px;
  }
  .masonry {
    gap: 8px;
    padding: 4px 8px 16px;
  }
  .masonry-col {
    gap: 8px;
  }
  .card {
    border-radius: 12px;
  }
  .lightbox {
    flex-direction: column;
    max-height: none;
    margin: 64px auto 16px;
    border-radius: 20px;
  }
  .lightbox .media img,
  .lightbox .media video {
    max-height: 70vh;
  }
  .details {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card img,
  .card-meta {
    transition: none;
  }
  .card:hover img {
    transform: none;
  }
}

/* Lightbox tag groups (Gelbooru order) */
.tag-group h3 {
  margin: 16px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.tag-count {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.tag-type-1 { color: #d9a08a; }
.tag-type-4 { color: #9cc49c; }
.tag-type-3 { color: #b9a3d6; }
.tag-type-5 { color: #d6c08a; }
.tag-type-6 { color: var(--muted); text-decoration: line-through; }

/* Rating toggles */
.ratings {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}
.rating-toggle {
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: line-through;
  transition: background 120ms ease, color 120ms ease;
}
.rating-toggle:hover {
  color: var(--text);
}
.rating-toggle[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.rating-toggle.rating-questionable[aria-pressed="true"] { color: #d6c08a; }
.rating-toggle.rating-explicit[aria-pressed="true"] { color: #e0a0a0; }

@media (max-width: 1000px) {
  .rating-full {
    display: none;
  }
}
@media (max-width: 720px) {
  .header {
    flex-wrap: wrap;
  }
  .ratings {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

/* Lightbox prev/next */
.nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}
.nav:hover {
  opacity: 1;
  background: var(--primary);
}
.nav-prev { left: 12px; }
.nav-next { right: 12px; }
@media (max-width: 720px) {
  .nav { top: auto; bottom: 16px; transform: none; }
}

/* Left tag bar */
.layout {
  display: flex;
  align-items: flex-start;
}
.content {
  flex: 1 1;
  min-width: 0;
}
.sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 72px;
  width: 220px;
  flex-shrink: 0;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 8px 8px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}
.side-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: 100%;
    max-height: none;
    padding: 4px 12px 8px;
  }
  .side-tags {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.batch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.batch input {
  width: 64px;
}

