:root {
  --white: #FFFFFF;
  --white-1-0: #EEEEEE;
  --white-1-1: #DBDBDB;
  --white-1-2: #C7C7C7;
  --dark-gray: #636466;
  --ink: #1e1f22;
  --ggx-accent: #4f46e5;
  --ggx-soft: #eef2ff;
  --rtx-accent: #059669;
  --rtx-soft: #ecfdf5;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--white-1-0);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Sticky Search Bar Only */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(238, 238, 238, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 14px 16px;
  border-bottom: 1px solid var(--white-1-1);
}

.search-container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dark-gray);
  font-size: 0.9rem;
}

.search-box input {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--white-1-1);
  color: var(--ink);
  padding: 11px 14px 11px 40px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.search-box input::placeholder {
  color: var(--dark-gray);
}

.search-box input:focus {
  border-color: var(--dark-gray);
  box-shadow: 0 0 0 3px rgba(99, 100, 102, 0.12);
}

.count-badge {
  font-size: 0.76rem;
  background: var(--white);
  border: 1px solid var(--white-1-1);
  color: var(--dark-gray);
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* Grid Layout */
.container {
  padding: 16px 14px 48px;
  max-width: 720px;
  margin: 0 auto;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 540px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

.game-card {
  background: var(--white);
  border: 1px solid var(--white-1-1);
  border-radius: 18px;
  padding: 16px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  position: relative;
  overflow: hidden;
}

.game-card:active {
  transform: scale(0.96);
  border-color: var(--white-1-2);
  background: #fafafa;
}

.game-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--white-1-0);
  border: 1px solid var(--white-1-1);
  margin-bottom: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.game-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.game-pkg {
  font-size: 0.7rem;
  color: var(--dark-gray);
  font-family: monospace;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  width: 100%;
}

.mini-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.15px;
}

.mini-badge.ggx {
  background: var(--ggx-soft);
  color: var(--ggx-accent);
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.mini-badge.rtx {
  background: var(--rtx-soft);
  color: var(--rtx-accent);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

/* Bottom Sheet Popup */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 31, 34, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  border-top: 1px solid var(--white-1-1);
  border-radius: 26px 26px 0 0;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.2, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.14);
}

.bottom-sheet.active {
  transform: translateY(0);
}

.sheet-pill {
  width: 42px;
  height: 4px;
  background: var(--white-1-2);
  border-radius: 10px;
  margin: 12px auto 6px;
  flex-shrink: 0;
}

.sheet-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px 14px;
  border-bottom: 1px solid var(--white-1-1);
  flex-shrink: 0;
}

.sheet-top-bar span {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark-gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.close-btn {
  background: var(--white-1-0);
  border: 1px solid var(--white-1-1);
  color: var(--dark-gray);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
}

.sheet-body {
  padding: 24px 20px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.modal-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--white-1-0);
  border: 2px solid var(--white-1-1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 4px;
}

.modal-pkg {
  font-size: 0.78rem;
  color: var(--dark-gray);
  font-family: monospace;
  background: var(--white-1-0);
  border: 1px solid var(--white-1-1);
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.modal-type-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  width: 100%;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.type-pill.ggx {
  background: var(--ggx-soft);
  color: var(--ggx-accent);
  border: 1px solid rgba(79, 70, 229, 0.25);
}

.type-pill.rtx {
  background: var(--rtx-soft);
  color: var(--rtx-accent);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.features-container {
  width: 100%;
  background: var(--white-1-0);
  border: 1px solid var(--white-1-1);
  border-radius: 16px;
  padding: 16px;
  text-align: left;
}

.features-header {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--dark-gray);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.features-list li {
  background: var(--white);
  border: 1px solid var(--white-1-1);
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.4;
}

.features-list li i {
  color: var(--rtx-accent);
  margin-top: 2px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Loading & Empty States */
.state-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--dark-gray);
  font-weight: 600;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--white-1-1);
  border-top-color: var(--dark-gray);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}