* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #eef2f7;
  color: #1f2937;
}

body.no-scroll {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.d-none {
  display: none !important;
}

.content-limit {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 0 24px;
}

.main-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #dbe4ee;
  border-bottom: 1px solid #cbd5e1;
}

.header-content {
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
}

.brand-overline {
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.pokemon-id {
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.28);
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

.search-box {
  display: flex;
  gap: 12px;
  width: min(100%, 420px);
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #d3dce6;
  border-radius: 999px;
  background: #ffffff;
}

.search-box input:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.search-box button,
.load-more-button,
.overlay-action-button {
  padding: 14px 18px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-weight: 700;
  transition: opacity 120ms ease, transform 120ms ease, background-color 120ms ease;
}

.load-more-button {
  min-width: 168px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.search-box button:hover:not(:disabled),
.load-more-button:hover:not(:disabled),
.overlay-action-button:hover:not(:disabled),
.pokemon-card:hover,
.close-button:hover {
  transform: translateY(-2px);
}

.search-box button:hover:not(:disabled),
.load-more-button:hover:not(:disabled),
.overlay-action-button:hover:not(:disabled) {
  background: #dc2626;
}

.search-box button:disabled,
.load-more-button:disabled,
.overlay-action-button:disabled {
  background: #f3b1b1;
  opacity: 1;
  cursor: not-allowed;
}

.button-spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.main-content {
  padding-top: 24px;
  padding-bottom: 56px;
}

.card-section {
  min-height: 220px;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.pokemon-card {
  padding: 20px;
  border-radius: 28px;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.pokemon-card:hover {
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
}

.card-name,
.overlay-name {
  margin-bottom: 12px;
  font-size: 28px;
  text-transform: capitalize;
}

.card-image,
.overlay-image {
  width: 140px;
  height: 140px;
  margin: 0 auto 16px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.18));
}

.overlay-image {
  width: min(100%, 300px);
  height: 300px;
  margin-bottom: 24px;
}

.type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.type-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
}

.empty-state {
  padding: 32px 24px;
  border-radius: 28px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.button-row {
  display: flex;
  justify-content: center;
  padding-top: 32px;
}

.spinner-box,
.overlay-spinner {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner,
.overlay-spinner::before {
  width: 56px;
  height: 56px;
  border: 6px solid rgba(148, 163, 184, 0.3);
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.overlay-card {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 32px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

#overlayContent {
  overflow-y: auto;
}

.overlay-content {
  min-height: 560px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

.overlay-image-box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  color: #ffffff;
}

.overlay-info {
  padding: 32px;
  background: #ffffff;
}

.overlay-info h3 {
  margin-bottom: 24px;
}

.stat-list {
  display: grid;
  gap: 16px;
}

.stat-row {
  display: grid;
  gap: 8px;
}

.stat-bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #1f2937;
}

.stat-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  font-size: 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.overlay-actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px 24px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.overlay-action-button {
  flex: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 960px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .overlay-content {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .overlay-image {
    width: min(100%, 240px);
    height: 240px;
    margin-bottom: 0;
  }
}

@media (max-width: 640px) {
  body {
    padding-top: 8px;
  }

  .content-limit {
    padding: 0 16px;
  }

  .main-header {
    position: static;
  }

  .search-box {
    flex-direction: column;
    width: 100%;
    margin-bottom: 12px;
  }

  .main-content {
    padding-top: 20px;
    padding-bottom: 32px;
  }

  .card-container {
    grid-template-columns: 1fr;
  }

  .button-row {
    padding-top: 24px;
    padding-bottom: 16px;
  }

  .overlay {
    padding: 8px;
    align-items: flex-start;
  }

  .overlay-card {
    max-height: calc(100vh - 16px);
    border-radius: 24px;
  }

  .overlay-image-box,
  .overlay-info {
    padding: 24px 20px;
  }

  .overlay-actions {
    position: sticky;
    bottom: 0;
    padding: 12px 16px 16px;
  }

  .overlay-action-button {
    padding: 12px 14px;
  }

  .close-button {
    top: 12px;
    right: 12px;
  }
}