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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #fff;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

footer { margin-top: auto; }

header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1rem 1.5rem;
}

#about-btn {
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.6rem;
  color: #555;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#about-btn:hover { color: #111; background: #e4e4e4; }

#about-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

#about-modal {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 860px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#about-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: #999;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

#about-close:hover { color: #333; }

#about-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111;
  padding-right: 2rem;
}

#about-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

#about-main h3, #about-side h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #111;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
}

#about-main h3:first-child { margin-top: 0; }

#about-main p, #about-side p {
  font-size: 0.82rem;
  color: #444;
  line-height: 1.6;
  margin-bottom: 0.4rem;
}

#about-main a, #about-side a { color: #2563eb; }

#about-main code {
  font-family: monospace;
  background: #f0f0f0;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

#about-thanks {
  background: #f7f7f7;
  border-radius: 8px;
  padding: 0.9rem;
}

#about-thanks h3 { margin-top: 0; }


@media (max-width: 600px) {
  #about-body { grid-template-columns: 1fr; }
}

header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #555;
}

header h1 span { color: #7bb83f; }

#filters-btn {
  display: none;
  padding: 0.45rem 0.75rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

#filters-btn:hover { border-color: #629332; }
#filters-btn.active { border-color: #629332; color: #629332; }

.filter-sheet-handle { display: none; }

#filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 998;
}

#filter-overlay.open { display: block; }

@media (max-width: 640px) {
  #filters-btn { display: block; }

  #filter-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  #filter-panel.open { transform: translateY(0); }

  .filter-panel-inner {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    border-radius: 14px 14px 0 0;
    padding: 0.5rem 1.25rem 1.5rem;
  }

  .filter-sheet-handle {
    display: block;
    width: 2.5rem;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    margin: 0.5rem auto 0.75rem;
  }

  #filter-panel .controls-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: start;
  }

  #filter-panel .control-group[style*="margin-left:auto"] {
    grid-column: 1 / -1;
    margin-left: 0 !important;
    display: flex;
    justify-content: flex-end;
  }
}

.controls {
  background: #f7f7f7;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.controls-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.controls input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.45rem 0.75rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #222;
  font-size: 0.9rem;
}

.controls input[type="text"]:focus {
  outline: none;
  border-color: #629332;
}

.controls select {
  padding: 0.45rem 0.75rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #222;
  font-size: 0.9rem;
  cursor: pointer;
}

.controls select:focus { outline: none; border-color: #629332; }

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-group label {
  font-size: 0.72rem;
  color: #888;
  white-space: nowrap;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.range-sep {
  color: #999;
  font-size: 0.85rem;
}

.range-wrap {
  display: flex;
  align-items: center;
  height: calc(0.9rem * 1.2 + 0.9rem + 2px);
}

.controls input[type="range"] {
  accent-color: #629332;
  width: 120px;
  cursor: pointer;
}

.controls input[type="number"] {
  width: 110px;
  padding: 0.45rem 0.6rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #222;
  font-size: 0.9rem;
}

.controls input[type="number"]:focus {
  outline: none;
  border-color: #629332;
}

#reset-filters {
  background: none;
  border: none;
  color: #aaa;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

#reset-filters:hover { color: #629332; }

#reset-filters.active { color: #629332; }

#status {
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
  color: #888;
  background: #fff;
  min-height: 1.8rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#dev-badge, #category-badge, #tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 0.15rem 0.5rem 0.15rem 0.7rem;
  color: #333;
  font-size: 0.75rem;
}

#dev-badge-clear, #category-badge-clear, #tag-badge-clear {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
}

#dev-badge-clear:hover, #category-badge-clear:hover, #tag-badge-clear:hover { color: #333; }

#results {
  padding: 1rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s;
}

.card:hover { border-color: #aaa; }

.card-title {
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: #111;
  line-height: 1.3;
  cursor: pointer;
}

.card-title:hover { color: #629332; }

.card-meta {
  font-size: 0.78rem;
  color: #666;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.card-dev {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.card-dev:hover { color: #111; }

.card-category {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  color: #555;
  cursor: pointer;
}

.card-category:hover { color: #111; background: #e4e4e4; }

.modal-dev { cursor: pointer; }
.modal-dev:hover { color: #111; }
.modal-category { cursor: pointer; }
.modal-category:hover { color: #111; }

.card-desc {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.5;
}

.card-tags {
  font-size: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.card-tag {
  color: #999;
  background: #f5f5f5;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  cursor: pointer;
}

.card-tag:hover {
  background: #e4e4e4;
  color: #444;
}

.card-tag-more {
  cursor: default;
  background: none;
}

.card-tag-more:hover {
  background: none;
  color: #999;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.2rem;
}

.rating {
  color: #f0c040;
  font-size: 0.8rem;
  font-weight: 600;
}

.stars-none { color: #ccc; }

.card-dl-count {
  color: #aaa;
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 0.3rem;
}

.card-footer a {
  font-size: 0.75rem;
  color: #629332;
  text-decoration: none;
}

.card-footer a:hover { text-decoration: underline; }


#no-results {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #aaa;
  display: none;
}

#loading {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #aaa;
}

#pagination {
  padding: 1rem 1.5rem 2rem;
  display: none;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

#pagination button {
  padding: 0.4rem 0.9rem;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  color: #333;
  cursor: pointer;
  font-size: 0.85rem;
}

#pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

#pagination button:not(:disabled):hover { border-color: #629332; }

#page-info {
  color: #888;
  font-size: 0.85rem;
  min-width: 80px;
  text-align: center;
}

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

#modal {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
}

#modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: #999;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

#modal-close:hover { color: #333; }

#modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111;
  padding-right: 2rem;
  line-height: 1.3;
}

#modal-meta {
  font-size: 0.8rem;
  color: #666;
}

#modal-stats {
  font-size: 0.8rem;
  color: #f0c040;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-stats-meta {
  color: #888;
  font-size: 0.78rem;
}

#modal-info {
  font-size: 0.72rem;
  color: #aaa;
  border-top: 1px solid #eee;
  padding-top: 0.5rem;
}

#modal-desc {
  font-size: 0.85rem;
  color: #333;
  line-height: 1.6;
}

#modal-desc a { color: #2563eb; }
#modal-desc p { margin-bottom: 0.6em; }
#modal-desc strong { color: #111; }
#modal-desc u { text-decoration: underline; }
#modal-desc em { font-style: italic; }

#modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.modal-tag {
  font-size: 0.72rem;
  color: #666;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
}

.modal-tag:hover {
  background: #e4e4e4;
  color: #111;
}

#modal-dl {
  align-self: flex-end;
  font-size: 0.85rem;
  color: #629332;
  text-decoration: none;
}

#modal-dl:hover { text-decoration: underline; }

footer {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: #aaa;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid #e0e0e0;
}

footer a { color: #629332; text-decoration: none; }
footer a:hover { text-decoration: underline; }
