* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
}

.header h1 {
  font-size: 6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.stat-label {
  padding-top: 1rem;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.search-section {
  margin-bottom: 2rem;
}

.search-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 1rem;
  transition: border-color 0.2s;
}

.search-wrapper:focus-within {
  border-color: var(--primary);
}

.search-icon {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.search-icon svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box {
  width: 100%;
  padding: 1rem 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-box:focus {
  outline: none;
}

.search-box::placeholder {
  color: rgb(70 95 105);
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.platform-select {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-weight: 900;
  font-size: 1.2rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.platform-select:focus {
  outline: none;
  border-color: var(--primary);
}

.platform-select option {
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem;
}

.platform-section {
  margin-bottom: 4rem;
}

.platform-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.game-card {
  max-width: 250px;
  background: transparent;
  border: none;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.not-purchase-color {
  opacity: 0.6;
  filter: grayscale(100%);
}

.game-image-wrapper {
  width: 250px;
  height: 150px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.game-image {
  width: 250px;
  object-fit: contain;
}

.game-content {
  margin: 0.5rem 0px 1rem 0px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.game-title {
  overflow: hidden;
  white-space: nowrap;
  line-height: 1.4;
  text-overflow: ellipsis;
  padding: 10px 0px;
}

.game-date {
  color: var(--text-muted);
}

.game-tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.5rem;
  font-weight: 500;
}

.tag svg {
  width: 12px;
  height: 12px;
}

.tag.package {
  background-color: #fb923c4d;
  color: rgb(254 215 170);
}

.tag.download {
  color: rgb(186 230 253);
  background-color: #38bdf84d;
}

.game-rank-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  font-weight: 500;
  font-size: 1.75rem;
}

.game-rank.SS {
  font-weight: 900;
  color: black;
  background: white;
}

.game-rank.S {
  font-weight: 900;
  color: black;
  background: #fbbf24;
}

.game-rank.A {
  background: #ef4444;
}

.game-rank.B {
  background: rgb(79 70 229);
}

.game-rank.C {
  background: rgb(249 115 22);
}

.game-rank.D {
  background: rgb(219 39 119);
}

.game-rank.E {
  background: gray;
}

.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 70px;
  height: 60px;
  background: var(--primary);
  border: none;
  border-radius: 3px;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 100;
}

.scroll-to-top.visible {
  opacity: 1;
}

.scroll-to-top:hover {
  background: var(--primary-dark);
}

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 4rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.125rem;
}

.rank-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rank-radio-wrapper {
  display: flex;
  align-items: center;
}

.rank-radio-wrapper input[type="radio"] {
  display: none;
}

.rank-radio-wrapper label {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.rank-radio-wrapper label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.rank-radio-wrapper input[type="radio"]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.purchase-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.purchase-radio-wrapper {
  display: flex;
  align-items: center;
}

.purchase-radio-wrapper input[type="radio"] {
  display: none;
}

.purchase-radio-wrapper label {
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  font-weight: 500;
}

.purchase-radio-wrapper label:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.purchase-radio-wrapper input[type="radio"]:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.toast {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}

@media (max-width: 1000px) {
  header h1 {
    font-size: 4rem !important;
  }

  .game-card {
    max-width: 230px;
    margin: auto;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .games-grid.square {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}
