:root {
  color-scheme: light dark;
  --bg: #f4f4f5;
  --card-bg: #ffffff;
  --text: #1b1b1f;
  --muted: #6b6b73;
  --accent: #1a9fff;
  --border: #e2e2e6;
}

* {
  box-sizing: border-box;
}

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

header {
  padding: 24px 32px 8px;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 32px 0;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#filters[hidden] {
  display: none;
}

#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  padding: 16px 32px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  position: relative;
}

.tag-field {
  min-width: 320px;
  flex: 1;
}

label {
  font-size: 0.8rem;
  color: var(--muted);
}

input, select, button {
  font-size: 0.95rem;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tag-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
}

.tag-suggestions button:hover {
  background: var(--bg);
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e6f4ff;
  color: #0b5da8;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.tag-chip button {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}

button#refreshBtn {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 10px 20px;
}

button#refreshBtn:hover {
  filter: brightness(1.05);
}

button#refreshBtn:disabled {
  opacity: 0.6;
  cursor: default;
}

#status {
  padding: 8px 32px;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
}

#results {
  padding: 8px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
}

.game-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-carousel {
  position: relative;
  background: #000;
}

.carousel-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.carousel-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-slide[hidden] {
  display: none;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.carousel-nav:hover {
  background: rgba(0, 0, 0, 0.75);
}

.carousel-nav.prev {
  left: 8px;
}

.carousel-nav.next {
  right: 8px;
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: none;
  padding: 0;
  cursor: pointer;
}

.carousel-dot.active {
  background: white;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.title-row .name {
  font-weight: 700;
  font-size: 1.15rem;
  color: inherit;
  text-decoration: none;
}

.title-row .name:hover {
  text-decoration: underline;
}

.first-seen {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.devpub {
  font-size: 0.85rem;
  color: var(--muted);
}

.description {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.tag-chips.readonly .tag-chip {
  background: #eee;
  color: #444;
}

.meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  align-items: center;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-badge.shortlisted { background: #e6f4ff; color: #0b5da8; }
.status-badge.dismissed { background: #eee; color: #666; }

.price {
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.actions button, .actions a {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.actions .shortlist-btn {
  background: #0b5da8;
  color: white;
  border-color: #0b5da8;
}

.actions .dismiss-btn {
  background: transparent;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
