:root {
  color-scheme: light;
  --background: #f4f1ea;
  --panel: #ffffff;
  --text: #171717;
  --muted: #626262;
  --line: #d6d0c5;
  --accent: #0f6b65;
  --accent-strong: #0a4b47;
  --gold: #b36b00;
  --blue: #2d5f9a;
  --shadow: 0 14px 36px rgba(34, 30, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  background: rgba(244, 241, 234, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.meta,
.resultDate,
#resultCount {
  color: var(--muted);
  font-size: 0.88rem;
}

.search {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.searchLabel {
  color: var(--muted);
  font-size: 0.92rem;
}

.searchHint {
  grid-column: 2 / -1;
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

input[type="search"],
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

input[type="search"] {
  width: 100%;
  padding: 0 12px;
}

button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: var(--accent-strong);
}

.filters {
  display: flex;
  min-width: 260px;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  white-space: nowrap;
}

.filters input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 0 16px;
}

.resultTools {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.limit {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.limit select {
  min-height: 34px;
  padding: 0 8px;
}

.pagination {
  display: none;
  gap: 5px;
  align-items: center;
}

.pagination.visible {
  display: inline-flex;
}

.paginationBottom {
  justify-content: center;
  padding: 0 16px 32px;
}

.pageButton {
  min-width: 34px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.pageButton:hover,
.pageButton:focus-visible {
  border-color: var(--accent);
  background: var(--panel);
  color: var(--accent-strong);
}

.pageButton[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.pageButton:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.48;
}

.pageGap {
  min-width: 20px;
  color: var(--muted);
  text-align: center;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  padding: 0 16px 32px;
}

.result {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 8px;
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(30, 25, 18, 0.05);
}

.result:hover,
.result:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  outline: 0;
}

.result img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #e8e1d5;
}

.resultText {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.resultTitle {
  overflow: hidden;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 23px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.comicText {
  background: var(--accent);
}

.badge.metadata {
  background: #55524d;
}

.badge.hoverText {
  background: var(--gold);
}

.badge.voteyText {
  background: var(--blue);
}

.badge.descriptionText {
  background: #7a4f96;
}

.empty {
  grid-column: 1 / -1;
  padding: 34px 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 880px) {
  .shell {
    padding: 0;
  }

  .toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 14px;
  }

  .search {
    grid-template-columns: 1fr auto;
  }

  .searchLabel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .searchHint {
    grid-column: 1 / -1;
  }

  .filters {
    min-width: 0;
    overflow-x: auto;
  }

  .statusbar {
    padding: 0 14px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .resultTools {
    width: 100%;
    justify-content: space-between;
  }

  .pagination {
    overflow-x: auto;
    max-width: 100%;
  }

  .results {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    padding: 0 14px 24px;
  }
}
