/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --flame: #E8453C;
  --flame-light: #FF6B63;
  --sky: #4DB8E8;
  --sky-light: #7DD3F5;
  --field: #5BBD6B;
  --field-light: #7DD68A;
  --gold: #F5B942;
  --gold-dark: #D49A20;

  --slate: #2D3436;
  --slate-600: #4A5568;
  --slate-400: #8896A1;
  --slate-300: #B0BEC5;
  --slate-200: #D5DDE2;
  --slate-100: #EDF1F4;
  --slate-50: #F7F9FA;
  --white: #FFFFFF;

  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(45,52,54,0.06);
  --shadow-md: 0 4px 12px rgba(45,52,54,0.08);
  --shadow-lg: 0 8px 30px rgba(45,52,54,0.10);
}

html, body {
  height: 100%;
  background: var(--slate-50);
  color: var(--slate);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* === Logo === */
.logo {
  font-family: var(--font-display);
  line-height: 1;
  white-space: nowrap;
}
.logo-our { font-weight: 300; color: var(--slate); }
.logo-game { font-weight: 700; color: var(--flame); }
.logo-vault { font-weight: 500; color: var(--slate); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--flame); color: white; }
.btn-primary:hover { background: var(--flame-light); box-shadow: 0 4px 15px rgba(232,69,60,0.25); }
.btn-secondary { background: var(--sky); color: white; }
.btn-secondary:hover { background: var(--sky-light); }
.btn-ghost { background: transparent; color: var(--slate-600); border: 2px solid var(--slate-200); }
.btn-ghost:hover { border-color: var(--slate-300); color: var(--slate); }
.btn-lg { padding: 0.85rem 2rem; font-size: 0.95rem; border-radius: var(--radius-md); }
.btn-md { padding: 0.6rem 1.25rem; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-icon {
  background: var(--slate-100);
  border: none;
  color: var(--slate-400);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover { background: #fee2e2; color: var(--flame); }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}
.badge-players { background: #ecfdf5; color: var(--field); }
.badge-controller { background: #f3f0ff; color: #7c3aed; }
.badge-keyboard { background: #eff6ff; color: #2B8BBF; }
.badge-featured { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: white; }
.badge-coming { background: var(--slate-200); color: var(--slate-600); }

/* === Login === */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8f4fd 0%, var(--slate-50) 50%, #fef3ef 100%);
}

.login-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  margin-bottom: 0.5rem;
}

.login-logo .logo {
  font-size: 2rem;
}

.login-sub {
  color: var(--slate-400);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.login-input-group {
  display: flex;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s;
}

.login-input-group:focus-within {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(77,184,232,0.12);
}

.login-input-group input {
  flex: 1;
  border: none;
  padding: 0.8rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--slate);
  outline: none;
  background: transparent;
  min-width: 0;
}

.login-input-group input::placeholder {
  color: var(--slate-300);
  font-weight: 400;
}

.btn-unlock {
  border-radius: 0;
  padding: 0.8rem 1.4rem;
  flex-shrink: 0;
}

.login-error {
  color: var(--flame);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* === Header === */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo { font-size: 1.3rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--slate-400);
  background: var(--slate-100);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
}

/* === Main === */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  margin-bottom: 2rem;
}

.section-header {
  padding-top: 1.5rem;
  margin-bottom: 1.25rem;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--slate-400);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* === Featured === */
.featured-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  background: var(--white);
  box-shadow: var(--shadow-md);
  transition: all 0.25s;
  margin-top: 1.5rem;
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.featured-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.featured-gradient {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, #4FC3F7 0%, #81D4FA 50%, #B3E5FC 100%);
}

.featured-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 1.5rem 1.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
}

.featured-badge-wrap {
  margin-bottom: 0.4rem;
}

.featured-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.featured-desc {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  margin-bottom: 0.5rem;
  max-width: 500px;
}

.featured-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.featured-meta-tag {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
}

.featured-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.25s;
  box-shadow: var(--shadow-md);
}

.featured-card:hover .featured-play-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
}

.featured-play-btn svg {
  fill: var(--flame);
  width: 24px;
  height: 24px;
  margin-left: 2px;
}

/* === Grid === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}

/* === Game Card === */
.game-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.04);
  transition: all 0.25s;
}

.game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-cover-wrap {
  position: relative;
  width: 100%;
  padding-top: 65%;
  overflow: hidden;
}

.card-cover-placeholder {
  position: absolute;
  inset: 0;
}

.card-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.game-card:hover .card-cover { transform: scale(1.04); }

.card-play-hover {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.game-card:hover .card-play-hover { opacity: 1; }

.card-play-circle {
  width: 42px;
  height: 42px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.card-play-circle svg {
  fill: var(--flame);
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.card-body {
  padding: 0.9rem 1rem;
}

.card-title {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--slate);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--slate-600);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* === Empty === */
.empty {
  text-align: center;
  padding: 4rem 2rem;
}
.empty-title { font-size: 1rem; font-weight: 700; color: var(--slate-600); }
.empty-sub { font-size: 0.85rem; color: var(--slate-400); margin-top: 0.3rem; font-weight: 500; }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0,0,0,0.15);
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(255,255,255,0.85);
  border: none;
  color: var(--slate-400);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.modal-close:hover { background: #fee2e2; color: var(--flame); }

.detail-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.detail-inner {
  padding: 1.25rem 1.5rem 1.5rem;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.4rem;
}

.detail-desc {
  font-size: 0.88rem;
  color: var(--slate-600);
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.detail-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.detail-badges .badge {
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
}

.btn-play-full {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.9rem;
  background: var(--flame);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-play-full:hover { background: var(--flame-light); box-shadow: 0 6px 20px rgba(232,69,60,0.25); }
.btn-play-full:active { transform: scale(0.98); }
.btn-play-full:disabled { background: var(--slate-200); color: var(--slate-400); cursor: not-allowed; box-shadow: none; }
.btn-play-full svg { fill: white; width: 18px; height: 18px; }

/* === Play Mode === */
#play-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
}

.play-bar {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 310;
}

.play-bar .btn-ghost {
  background: rgba(0,0,0,0.45);
  color: #fff;
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.15);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.play-bar .btn-ghost:hover {
  opacity: 1;
}

.play-bar .btn-ghost svg {
  stroke: #fff;
}

.play-title {
  display: none;
}

.play-frame {
  position: absolute;
  inset: 0;
  border: none;
  width: 100%;
  height: 100%;
  background: #000;
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--slate-200);
  margin-top: 1rem;
}

.footer-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-300);
  letter-spacing: 1px;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 3px; }

/* === Animations === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.game-card { animation: fadeUp 0.35s ease backwards; }
.game-card:nth-child(1) { animation-delay: 0.03s; }
.game-card:nth-child(2) { animation-delay: 0.06s; }
.game-card:nth-child(3) { animation-delay: 0.09s; }
.game-card:nth-child(4) { animation-delay: 0.12s; }
.game-card:nth-child(5) { animation-delay: 0.15s; }
.game-card:nth-child(6) { animation-delay: 0.18s; }
.featured-card { animation: fadeUp 0.4s ease; }
.modal-panel { animation: scaleIn 0.2s ease; }

/* === Mobile === */
@media (max-width: 640px) {
  .login-logo .logo { font-size: 1.6rem; }
  .login-card { padding: 2rem 1.5rem; }
  .header { padding: 0.6rem 1rem; }
  .header-logo { font-size: 1.1rem; }
  .main { padding: 0 1rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .card-body { padding: 0.7rem 0.75rem; }
  .card-title { font-size: 0.8rem; }
  .card-desc { font-size: 0.7rem; }
  .badge { font-size: 0.6rem; padding: 0.15rem 0.4rem; }
  .featured-img, .featured-gradient { height: 200px; }
  .featured-title { font-size: 1.2rem; }
  .featured-desc { display: none; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
}
