@font-face {
  font-family: "myfont";
  src: url("./font/PixelMplus12-Regular.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  background: #000;
}

body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: "myfont", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
}

.page-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 8px max(18px, env(safe-area-inset-bottom));
  background: #000;
}

.title-area {
  display: flex;
  justify-content: center;
  padding: 2px 0 8px;
}

.title-image {
  display: block;
  width: min(100%, 300px);
  height: auto;
  image-rendering: auto;
}

.intro-text {
  width: 100%;
  margin: 0 0 10px;
  padding: 0 4px;
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.intro-text p {
  margin: 0;
}

.dex-section {
  width: 100%;
}

/* 元のゲーム内の screen-title と同じデザイン */
.screen-title {
  margin: 8px 0;
  padding: 10px;
  background: #b8860b;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

.monster-dex-list {
  padding: 6px 4px 14px;
}

.monster-dex-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 6px;
  align-items: start;
  width: 100%;
}

.monster-dex-card {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.monster-dex-card:focus-visible {
  outline: 2px solid #ffeb3b;
  outline-offset: 2px;
}

.monster-dex-image-box {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto 4px;
  overflow: hidden;
  border: 3px solid #8d6e63;
  background-color: #000;
}

.monster-dex-image-box.rarity-r {
  border-color: #d8d8d8;
  background-image:
    radial-gradient(circle at center, rgba(255,255,255,.90) 0%, rgba(255,255,255,.36) 31%, rgba(255,255,255,0) 68%),
    repeating-conic-gradient(from -2deg at 50% 50%, rgba(255,220,168,.60) 0deg, rgba(255,220,168,.60) 10deg, rgba(255,255,255,0) 10deg, rgba(255,255,255,0) 45deg);
}

.monster-dex-image-box.rarity-sr {
  border-color: #ffb73b;
  background-image:
    radial-gradient(circle at center, rgba(255,255,255,.90) 0%, rgba(255,255,255,.36) 31%, rgba(255,255,255,0) 68%),
    repeating-conic-gradient(from -2deg at 50% 50%, rgba(255,220,168,.60) 0deg, rgba(255,220,168,.60) 10deg, rgba(255,255,255,0) 10deg, rgba(255,255,255,0) 20deg);
}

.monster-dex-image-box.rarity-n {
  background-image: radial-gradient(circle at center, rgba(255,255,255,.90) 0%, rgba(255,255,255,.36) 31%, rgba(255,255,255,0) 68%);
}

.monster-dex-image-box img {
  position: relative;
  z-index: 2;
  width: 86%;
  height: 86%;
  object-fit: contain;
  image-rendering: pixelated;
}

.monster-dex-no,
.monster-dex-name {
  margin: 0;
  padding: 0 1px;
  color: #fff;
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.monster-dex-like-display {
  margin: 1px 0 0;
  padding: 0;
  color: #ff5b72;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.78);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 14px;
  border: 2px solid #fff;
  background: #000;
  color: #fff;
}

.modal-title {
  margin: 0 0 10px;
  color: #fff;
  font-size: 17px;
  font-weight: normal;
  text-align: center;
}

.monster-dex-popup-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin: 0 auto 8px;
  overflow: hidden;
}

.monster-dex-popup-card img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  image-rendering: pixelated;
}

.monster-dex-popup-name-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  margin: 2px 0 6px;
}

.monster-dex-popup-name {
  min-width: 0;
  color: #fff;
  font-size: 17px;
  font-weight: bold;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.monster-like-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.monster-like-button .heart-icon {
  font-size: 26px;
  line-height: 1;
}

.monster-like-button .heart-count {
  margin-left: 4px;
  font-size: 20px;
  line-height: 1;
}

.monster-like-button.is-liked {
  color: #ff5b72;
}

.monster-like-button:disabled {
  cursor: default;
  opacity: .55;
}

.monster-like-button:not(:disabled):active .heart-icon {
  transform: scale(.85);
}


.monster-dex-popup-stats {
  margin: 0 0 5px;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.monster-dex-popup-info {
  color: #fff;
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
}

.dex-line-label {
  color: #ffeb3b;
  font-weight: bold;
}

.monster-dex-popup-skill-row {
  display: flex;
  align-items: flex-start;
}

.monster-dex-popup-skill-row .dex-line-label {
  flex: 0 0 68px;
}

.monster-dex-popup-skill-name {
  flex: 1 1 auto;
}

.monster-dex-popup-skill-desc {
  margin-left: 68px;
  line-height: 1.5;
}

.modal-close {
  display: block;
  width: auto;
  height: 40px;
  margin: 14px auto 0;
  padding: 5px;
  border: 0;
  border-radius: 0;
  background: #ff9494;
  color: #000;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}


body.modal-open {
  overflow: hidden;
}

@media (max-width: 350px) {
  .page-shell {
    padding-left: 5px;
    padding-right: 5px;
  }

  .monster-dex-list {
    padding-left: 1px;
    padding-right: 1px;
  }

  .monster-dex-grid {
    column-gap: 3px;
  }
}

.monster-description-link {
  color: #7fd7ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.monster-description-link:visited {
  color: #d9a7ff;
}
