:root {
  --bg: #0b0b0f;
  --bg-alt: #15151d;
  --text: #f5f5f5;
  --muted: #a0a0b8;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --card: #15151f;
  --border: #26263a;
  --shadow: 0 18px 35px rgba(0, 0, 0, 0.55);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 16px 40px;
  display: flex;
  justify-content: center;
}

.shell {
  width: 100%;
  max-width: 1200px;
}

header {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

@media (min-width: 720px) {
  header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

h1 {
  font-size: clamp(1.8rem, 2.8vw, 2.3rem);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1 span.badge {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 2px 10px;
  border: 1px solid var(--accent-soft);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 520px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 640px) {
  .controls {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 320px;
}

.search-wrapper input {
  width: 100%;
  padding: 10px 12px 10px 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(9, 9, 15, 0.7);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  box-shadow: 0 0 0 1px transparent;
  transition: border 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.08s ease;
}

.search-wrapper input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.search-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.6;
  pointer-events: none;
}

.search-wrapper .clear-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.search-wrapper.has-text .clear-btn {
  opacity: 0.8;
  pointer-events: auto;
}

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.filter-pill {
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: rgba(31, 31, 43, 0.6);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  cursor: pointer;
  transition: background 0.15s ease, border 0.15s ease, color 0.15s ease, transform 0.06s ease;
}

.filter-pill:hover {
  border-color: var(--accent);
}

.filter-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #e5e7ff;
}

main {
  background-color: var(--bg);
  border-radius: 24px;
  padding: 16px 18px 22px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }
}

.card {
  position: relative;
  background: radial-gradient(circle at bottom, rgba(172, 172, 172, 0.14) 0, var(--bg-alt) 36%);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.26);
  cursor: pointer;
  opacity: 1;
  display: flex;
  flex-direction: column;
}

.card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.60);
  border-color: rgba(129, 140, 248, 0.9);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  opacity: 0;
}

.card:hover::before {
  opacity: 1;
}

.card-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform: scale(1.02);
  transition: transform 0.3s ease;
}

.card:hover .card-image img {
  transform: scale(1.06);
}

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

.card-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
}

.card-meta {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 4px;
  opacity: 0.85;
}

.card-tag {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.status-dot-jogando {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #07b9fc;
  box-shadow: 0 0 0 4px rgba(34, 186, 197, 0.18);
  margin-right: 4px;
}

.status-dot-adquirido {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffe000;
  box-shadow: 0 0 0 4px rgba(197, 194, 34, 0.18);
  margin-right: 4px;
}

.status-dot-concluido {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #87d300;
  box-shadow: 0 0 0 4px rgba(40, 197, 34, 0.18);
  margin-right: 4px;
}

.status-dot-nao-concluido {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b07cda;
  box-shadow: 0 0 0 4px rgba(124, 34, 197, 0.18);
  margin-right: 4px;
}

.status-dot-nao-gostei {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ea0337;
  box-shadow: 0 0 0 4px rgba(197, 34, 34, 0.18);
  margin-right: 4px;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  margin-bottom: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hidden-card {
  display: none !important;
}

.fade-in {
  animation: fadeInUp 0.35s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

footer {
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  opacity: 0.8;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 20px;
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 512px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.is-open .modal-content {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close-btn:hover {
  background: var(--accent);
}

.modal-header img {
  width: 100%;
  height: 512px;
  object-fit: cover;
  display: block;
  mask-image: linear-gradient(to bottom, var(--bg-alt) 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, var(--bg-alt) 80%, transparent 100%);
}

.modal-body {
  padding: 20px;
  position: relative;
}

.modal-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.game-id-badge {
  font-family: monospace;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.modal-body h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
  color: #FFF;
  line-height: 1.2;
}

.modal-status-line {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

#modalCommentText {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #e2e2e2;
  white-space: pre-wrap;
}

.screenshots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.screenshots-grid img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s;
}

.screenshots-grid img:hover {
  transform: scale(1.1);
  z-index: 2;
}

.modal-content {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-body {
  overflow-y: auto; 
}

@media (max-width: 767px) {
  .modal-header img {
    height: auto;
    max-height: 250px;
    width: 100%;
    object-fit: cover;
  }
}

@media (min-width: 768px) {
  .modal-content.layout-wide {
    flex-direction: row;
    max-width: 900px;
    height: 500px;
  }

  .modal-content.layout-wide .modal-header {
    width: 400px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 0; 
    background: transparent;
  }

  .modal-content.layout-wide .modal-header img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    mask-image: none;
    -webkit-mask-image: none;
    border-radius: 0; 
  }

  .modal-content.layout-wide .modal-body {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
  }
}