:root {
  --bg-body: #E8E8E8;
  --text-body: #333333;
  --text-h1: #333333;
  --border-tabs: #cccccc;
  --text-tab: #999999;
  --text-tab-active: #6b8e23;
  --text-h2: #6b8e23;
  --text-li: #666666;
  --bg-suggestions: #ffffff;
  --border-suggestions: #cccccc;
  --border-item: #eeeeee;
  --hover-item: #f5f5f5;
  --text-strong: #333333;
  --text-span: #666666;
  --text-label: #666666;
  --text-count: #999999;
  --text-year: #6b8e23;
  --bg-cover: #e0e0e0;
  --bg-placeholder: #d3d3d3;
  --text-placeholder: #999999;
  --bg-star: #ffffff;
  --border-star: #cccccc;
  --text-star: #e08b27;
  --text-progress: #007bff;
  --bg-tooltip: rgba(0, 0, 0, 0.9);
  --text-tooltip: #ffffff;
  --text-noresults: #999999;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-dialog: #ffffff;
  --text-close: #666666;
  --text-close-hover: #333333;
  --bg-modal-cover: #e0e0e0;
  --bg-modal-placeholder: #d3d3d3;
  --text-modal-placeholder: #999999;
  --text-creator: #666666;
  --text-meta: #666666;
  --border-meta: #eeeeee;
  --text-status: #333333;
  --text-notes: #333333;
  --theme-base: #ff6b35;
  --theme-accent: #00cc66;
  --theme-text: #ffffff;
  --theme-text-invert: #000000;
}
body.dark {
  --bg-body: #212121;
  --text-body: #e0e0e0;
  --text-h1: #e0e0e0;
  --border-tabs: #444444;
  --text-tab: #888888;
  --text-tab-active: #8ab64a;
  --text-h2: #8ab64a;
  --text-li: #bbbbbb;
  --bg-suggestions: #333333;
  --border-suggestions: #444444;
  --border-item: #555555;
  --hover-item: #444444;
  --text-strong: #e0e0e0;
  --text-span: #bbbbbb;
  --text-label: #bbbbbb;
  --text-count: #888888;
  --text-year: #8ab64a;
  --bg-cover: #444444;
  --bg-placeholder: #555555;
  --text-placeholder: #888888;
  --bg-star: #333333;
  --border-star: #444444;
  --text-star: #f0a94d;
  --text-progress: #4da6ff;
  --bg-tooltip: rgba(255, 255, 255, 0.9);
  --text-tooltip: #333333;
  --text-noresults: #888888;
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-dialog: #333333;
  --text-close: #bbbbbb;
  --text-close-hover: #e0e0e0;
  --bg-modal-cover: #444444;
  --bg-modal-placeholder: #555555;
  --text-modal-placeholder: #888888;
  --text-creator: #bbbbbb;
  --text-meta: #bbbbbb;
  --border-meta: #444444;
  --text-status: #e0e0e0;
  --text-notes: #e0e0e0;
  --theme-base: #00cc66;
  --theme-accent: #ff6b35;
  --theme-text: #000000;
  --theme-text-invert: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 40px 20px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  color: var(--text-body);
  background-color: var(--bg-body);
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}
h1 {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 48px;
  color: var(--text-h1);
}
.tabs {
  display: flex;
  gap: 32px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-tabs);
  padding-bottom: 12px;
}
.tab {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tab);
  transition: color 0.2s;
}
.tab.active { color: var(--text-tab-active); }
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  z-index: 9999;
  transition: opacity 0.4s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.wet-mayfly {
  width: 80px;
  height: 80px;
  position: relative;
}
.wet-mayfly div {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--theme-base);
  animation: wet-mayfly 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
}
.wet-mayfly div:nth-child(2) { animation-delay: -0.6s; }
.wet-mayfly div:nth-child(3) { animation-delay: -1.2s; }
@keyframes wet-mayfly {
  0%, 100% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1); opacity: 0; }
}
#personal-info {
  margin-bottom: 32px;
  text-align: center;
}
.controls-wrapper {
  margin-bottom: 40px;
  position: relative;
}
.uiverse-pixel-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  font-family: "Courier New", monospace;
  width: 100%;
  margin-bottom: 1.2em;
  position: relative;
}
.uiverse-pixel-input {
  appearance: none;
  border: none;
  padding: 0.6em 1em;
  font-size: 1em;
  font-family: "Courier New", monospace;
  color: var(--theme-text);
  background: var(--theme-base);
  image-rendering: pixelated;
  box-shadow:
    0 0 0 0.15em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.4em 0 0 #d1451e,
    0 0.4em 0 0.15em #000;
  outline: none;
  transition: all 0.15s steps(1);
  text-shadow: 1px 1px #000;
}
.uiverse-pixel-input::placeholder { color: var(--theme-text); opacity: 0.6; }
.uiverse-pixel-input:focus {
  background: color-mix(in srgb, var(--theme-base) 80%, white);
  box-shadow:
    0 0 0 0.15em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.2em 0 0 var(--theme-accent),
    0 0.2em 0 0.15em #000;
}
.uiverse-pixel-input:hover { animation: uiverse-glitch-input 0.3s steps(2) infinite; }
@keyframes uiverse-glitch-input {
  0% { transform: translate(0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(0); }
}
#search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-suggestions);
  border: 1px solid var(--border-suggestions);
  border-top: none;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-item);
  cursor: pointer;
}
.suggestion-item:hover, .suggestion-item.focused { background-color: var(--hover-item); }
.suggestion-img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  background-color: var(--bg-cover);
  margin-right: 12px;
  flex-shrink: 0;
}
.suggestion-img-square {
  width: 50px;
  height: 50px;
}
.suggestion-text { flex: 1; }
.suggestion-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}
.suggestion-text span {
  display: block;
  font-size: 12px;
  color: var(--text-span);
  margin-top: 2px;
}
.combined-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2em;
}
#statusFilters {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}
.filter-label,
.genre-label {
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 1em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--theme-text-invert);
  text-shadow: 1px 1px var(--theme-text);
  margin-right: 0.4em;
}
.genre-label { margin-left: 1em; }
.filter-button,
.filter-select {
  padding: 0.25em 1.5em 0.25em 0.8em;
  font-size: 0.8em;
  min-height: 2em;
  line-height: 1.1;
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: var(--theme-text);
  background: var(--theme-base);
  border: none;
  border-radius: 0;
  image-rendering: pixelated;
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.25em 0 0 #d1451e,
    0 0.25em 0 0.12em #000;
  outline: none;
  cursor: pointer;
  transition: all 0.15s steps(1);
  text-shadow: 1px 1px #000;
  letter-spacing: 0.04em;
  white-space: nowrap;
  appearance: none;
  position: relative;
}
.filter-button:hover,
.filter-select:hover {
  background: var(--theme-accent);
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both, uiverse-glitch-input 0.3s steps(2) infinite;
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.18em 0 0 var(--theme-base),
    0 0.18em 0 0.12em #000;
}
.filter-button:active,
.filter-select:active { transform: translateY(2px); }
.filter-button.active {
  background: var(--theme-accent);
  color: var(--theme-text-invert);
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.1em 0 0 var(--theme-base),
    0 0.1em 0 0.12em #000;
}
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}
.filter-select::after {
  content: '\25BC';
  position: absolute;
  right: 0.6em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8em;
  color: var(--theme-text);
  pointer-events: none;
}
.filter-select:focus {
  background: color-mix(in srgb, var(--theme-base) 80%, white);
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.18em 0 0 var(--theme-accent),
    0 0.18em 0 0.12em #000;
}
.count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-count);
  font-weight: 500;
}
.year_read-heading {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-year);
  margin: 48px 0 16px;
  padding: 12px 0;
  background: var(--bg-body);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-tabs);
}
.year_read-heading:first-of-type { margin-top: 5px; }
.filter-spacer {
  margin-top: 5px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border-tabs);
  margin-bottom: 16px;
}
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
.shelf-grid.records-grid {
  grid-template-columns: repeat(8, 1fr);
  gap: 20px;
}
.book-item {
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s;
}
.book-item:hover { opacity: 0.8; }
.cover {
  width: 100%;
  display: block;
  background-color: var(--bg-cover);
}
.cover-book {
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.cover-square {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.cover-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--bg-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", monospace;
  font-size: 11px;
  color: var(--text-placeholder);
  text-align: center;
  padding: 4px;
  line-height: 1.2;
}
.cover-placeholder-book {
  aspect-ratio: 2 / 3;
  font-size: 12px;
  padding: 12px;
}
.favorite-star,
.in-progress-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background-color: var(--bg-star);
  border: 1px solid var(--border-star);
}
.favorite-star { top: 4px; right: 4px; color: var(--text-star); }
.in-progress-icon { top: 4px; left: 4px; color: var(--text-progress); }
.book-tooltip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-tooltip);
  color: var(--text-tooltip);
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  max-height: 80px;
  overflow: hidden;
}
.book-item:hover .book-tooltip { opacity: 1; }
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-noresults);
  font-size: 14px;
}
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  z-index: 1000;
  animation: fadeIn 0.2s;
}
.modal-overlay.active { display: flex; align-items: center; justify-content: center; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog {
  background-color: var(--bg-dialog);
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  animation: slideUp 0.3s;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-close);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}
.modal-close:hover { color: var(--text-close-hover); }
.modal-content {
  display: flex;
  gap: 24px;
  padding: 32px;
  width: 100%;
}
.modal-cover-section { flex-shrink: 0; }
.modal-cover {
  width: 180px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background-color: var(--bg-modal-cover);
  display: block;
}
.modal-cover-nonbook {
  width: 180px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}
.modal-cover-square { aspect-ratio: 1 / 1; }
.modal-cover-placeholder {
  width: 180px;
  aspect-ratio: 2 / 3;
  background-color: var(--bg-modal-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-modal-placeholder);
  text-align: center;
  padding: 12px;
}
.modal-info { flex: 1; min-width: 0; }
.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}
.modal-creator {
  font-size: 14px;
  color: var(--text-creator);
  margin: 0 0 16px;
}
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--text-meta);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-meta);
}
.modal-meta-item { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.modal-notes {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-notes);
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}
.modal-notes::-webkit-scrollbar { width: 6px; }
.modal-notes::-webkit-scrollbar-track { background: var(--bg-dialog); }
.modal-notes::-webkit-scrollbar-thumb { background: var(--text-close); border-radius: 3px; }
.modal-notes p { margin: 0 0 12px; }
.modal-notes p:last-child { margin-bottom: 0; }
.modal-notes ul { margin: 12px 0; padding-left: 20px; }
.modal-notes li { margin-bottom: 6px; }
.modal-genre-tag,
.modal-platform-tag,
.modal-mood-tag {
  cursor: pointer;
  padding: 2px 8px;
  background: var(--theme-base);
  color: var(--theme-text);
  font-size: 0.85em;
  transition: background 0.2s, transform 0.1s;
  display: inline-block;
  margin: 2px;
}
.modal-mood-tag {
  background: var(--theme-accent);
  color: var(--theme-text-invert);
}
.modal-genre-tag:hover,
.modal-platform-tag:hover {
  background: var(--theme-accent);
  transform: scale(1.05);
}
.modal-mood-tag:hover {
  background: var(--theme-base);
  color: var(--theme-text);
  transform: scale(1.05);
}
@media (max-width: 768px) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
  .shelf-grid.records-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
  .combined-filters { flex-direction: column; align-items: stretch; gap: 0.8em; }
  #statusFilters { justify-content: center; }
  .filter-button, .filter-select { width: 100%; }
  .modal-content { flex-direction: column; gap: 16px; padding: 20px; }
  .modal-cover, .modal-cover-placeholder { width: 100%; max-width: 200px; margin: 0 auto; }
  .modal-cover-nonbook { max-width: 240px; }
}
.uiverse-pixel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 1em;
  font-family: "Courier New", monospace;
  font-size: 1em;
  font-weight: bold;
  color: #fff;
  text-shadow: 0.125em 0.125em 0 #000;
  user-select: none;
}
.uiverse-pixel-toggle-input {
  appearance: none;
  width: 3.5em;
  height: 2em;
  background: var(--theme-base);
  border: none;
  image-rendering: pixelated;
  position: relative;
  cursor: pointer;
  box-shadow:
    0 0 0 0.15em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.4em 0 0 #d1451e,
    0 0.4em 0 0.15em #000;
  transition: background 0.2s steps(2);
}
body.dark .uiverse-pixel-toggle-input {
  background: var(--theme-base);
}
.uiverse-pixel-toggle-input::before {
  content: "";
  position: absolute;
  top: 0.25em;
  left: 0.25em;
  width: 1.3em;
  height: 1.3em;
  background: #000;
  box-shadow: inset 0 0 0.125em #fff;
  transition: transform 0.2s steps(2);
}
.uiverse-pixel-toggle-input:checked { background: var(--theme-accent); }
.uiverse-pixel-toggle-input:checked::before { transform: translateX(1.5em); }
.uiverse-pixel-toggle-input:focus-visible {
  outline: 2px dashed #fff;
  outline-offset: 0.2em;
}
.uiverse-pixel-toggle-label { display: inline-block; }
body:not(.dark) .uiverse-pixel-toggle {
  color: #000;
  text-shadow: 0.125em 0.125em 0 #fff;
}
.uiverse-pixel-toggle-input:hover {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both, uiverse-glitch-input 0.3s steps(2) infinite;
}
.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em;
  margin-top: 0.8em;
}
.genre-tag {
  padding: 0.25em 0.8em;
  background: var(--theme-accent);
  color: var(--theme-text-invert);
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 0.8em;
  min-height: 2em;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 0.5em;
  border: none;
  border-radius: 0;
  image-rendering: pixelated;
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.1em 0 0 var(--theme-base),
    0 0.1em 0 0.12em #000;
  text-shadow: 1px 1px #000;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
}
.genre-tag.mood-tag {
  background: var(--theme-base);
  color: var(--theme-text);
  box-shadow:
    0 0 0 0.12em #000,
    0 0 0 0.3em #fff,
    0 0 0 0.45em #000,
    0 0.1em 0 0 var(--theme-accent),
    0 0.1em 0 0.12em #000;
}
.genre-tag-remove {
  cursor: pointer;
  font-weight: bold;
  font-size: 1.1em;
  line-height: 1;
}
.genre-tag-remove:hover {
  color: var(--theme-text);
}
