* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f3ef;
  color: #1c1c1a;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
}

h1 {
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 600;
  margin: 0 0 4px;
}

p.sub {
  color: #66655f;
  font-size: 14px;
  margin: 0 0 20px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.type-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-toggle {
  display: flex;
  border: 1px solid #d6d4cb;
  border-radius: 8px;
  overflow: hidden;
  margin-left: auto;
}

.mode-toggle button {
  border: none;
  background: #fff;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  color: #4a4944;
}

.mode-toggle button.active {
  background: #1c1c1a;
  color: #fff;
}

label {
  font-size: 14px;
  color: #4a4944;
}

select {
  font-size: 15px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d6d4cb;
  background: #fff;
  min-width: 180px;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}

.cell {
  border-radius: 10px;
  padding: 12px 6px;
  text-align: center;
  border: 1px solid #e2e0d8;
  background: #fff;
  transition: transform 0.15s ease;
}

.cell i {
  font-size: 22px;
}

.cell .name {
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}

.cell .mult {
  font-size: 12px;
  margin-top: 2px;
  opacity: 0.85;
}

.weak {
  background: #e8f5e0;
  border-color: #5ea832;
  color: #1e4a0c;
}

.resist {
  background: #fbe9e7;
  border-color: #c0392b;
  color: #6b1e15;
}

.immune {
  background: #2b2b2b;
  border-color: #000;
  color: #f2f2f2;
}

.neutral {
  background: #fafaf7;
  border-color: #e2e0d8;
  color: #4a4944;
}

.legend {
  display: flex;
  gap: 18px;
  margin-top: 22px;
  font-size: 13px;
  color: #4a4944;
  flex-wrap: wrap;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

footer {
  margin-top: 28px;
  font-size: 12px;
  color: #9a9890;
  text-align: center;
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

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

  .cell {
    padding: 8px 4px;
  }

  .cell i {
    font-size: 18px;
  }

  .cell .name {
    font-size: 11px;
  }

  .cell .mult {
    font-size: 10px;
  }
}