:root {
  --font-title: "M PLUS Rounded 1c", "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  --font-body: "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  --font-number: "M PLUS 1p", "BIZ UDPGothic", "Yu Gothic", sans-serif;
  --font-scientific: Georgia, "Times New Roman", serif;
  --sea-japan: #123a77;
  --sea-east-china: #247c63;
  --sea-south-china: #008c99;
  --sea-pacific: #245ab7;
  --sea-indian: #7541a5;
  --sea-red-sea: #b82e3f;
  --sea-mediterranean: #b8860b;
  --sea-atlantic: #3f6b35;
  --sea-antarctic: #72b7dd;
  --sea-deep: #352052;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: #17213a;
  background:
    radial-gradient(circle at 10% 0, rgba(130,216,236,.35), transparent 34%),
    linear-gradient(#e9f7fc, #f8fbff 42%, #eef5fb);
  font-family: var(--font-body);
}

button, input, select { font: inherit; }

.collection-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 28px clamp(16px, 5vw, 64px);
  color: #fff;
  background:
    radial-gradient(circle at 85% 0, rgba(100,210,230,.55), transparent 30%),
    linear-gradient(135deg, #07366b, #086d9b);
  box-shadow: 0 8px 26px rgba(5, 43, 81, .2);
}

.collection-kicker,
.collection-intro { margin: 0; }

.collection-kicker {
  color: #bfefff;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.collection-header h1 {
  margin: 4px 0 6px;
  font-family: var(--font-title);
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.1;
}

.collection-intro { color: #d7f5ff; }

.collection-progress {
  min-width: 170px;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 18px;
  background: rgba(0,20,50,.28);
  backdrop-filter: blur(8px);
}

.collection-progress strong {
  display: block;
  font-family: var(--font-number);
  font-size: 1.5rem;
}

.collection-progress span { font-size: .78rem; }

.collection-progress__bar {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.25);
}

.collection-progress__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #ffd453;
  transition: width .35s ease;
}

.collection-main {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.collection-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(130px, .75fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid #c7ddeb;
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 10px 28px rgba(15,55,90,.08);
}

.collection-tools label {
  display: grid;
  gap: 5px;
  color: #23466c;
  font-size: .78rem;
  font-weight: 700;
}

.collection-tools input,
.collection-tools select {
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border: 1px solid #a9bfd1;
  border-radius: 10px;
  color: #17213a;
  background: #fff;
}

.collection-tools input:focus,
.collection-tools select:focus {
  outline: 3px solid rgba(45,147,194,.22);
  border-color: #268ab9;
}

.collection-reset {
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #315d87;
  font-weight: 700;
  cursor: pointer;
}

.collection-status {
  margin: 18px 3px 12px;
  color: #52657b;
  font-size: .88rem;
}

.collection-status.is-error {
  color: #b62319;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: clamp(12px, 2.5vw, 22px);
}

.collection-card {
  --sea-color: var(--sea-japan);
  min-width: 0;
}

.collection-card.sea-japan { --sea-color: var(--sea-japan); }
.collection-card.sea-east-china { --sea-color: var(--sea-east-china); }
.collection-card.sea-south-china { --sea-color: var(--sea-south-china); }
.collection-card.sea-pacific { --sea-color: var(--sea-pacific); }
.collection-card.sea-indian { --sea-color: var(--sea-indian); }
.collection-card.sea-red-sea { --sea-color: var(--sea-red-sea); }
.collection-card.sea-mediterranean { --sea-color: var(--sea-mediterranean); }
.collection-card.sea-atlantic { --sea-color: var(--sea-atlantic); }
.collection-card.sea-antarctic { --sea-color: var(--sea-antarctic); }
.collection-card.sea-deep { --sea-color: var(--sea-deep); }

.collection-card__button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 4px solid var(--sea-color);
  border-radius: 16px;
  color: inherit;
  background: #fff;
  box-shadow: 0 12px 25px rgba(12,45,76,.14);
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.collection-card__button:hover,
.collection-card__button:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(12,45,76,.22);
}

.collection-card__button:focus-visible {
  outline: 4px solid #ffb000;
  outline-offset: 3px;
}

.collection-card__image-wrap {
  position: relative;
  display: block;
  aspect-ratio: 1.22;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0, rgba(110,220,240,.75), transparent 50%),
    linear-gradient(145deg, #1395c1, #093f74);
}

.collection-card__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8%;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,.28));
}

.collection-card__image.is-missing {
  display: none;
}

.collection-card__number,
.collection-card__rarity,
.collection-card__lock {
  position: absolute;
  z-index: 2;
}

.collection-card__number {
  top: 7px;
  left: 7px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #fff;
  background: var(--sea-color);
  font-family: var(--font-number);
  font-size: .72rem;
}

.collection-card__rarity {
  top: 8px;
  right: 8px;
  color: #ffbd24;
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: -.1em;
  text-shadow: 0 1px 1px #fff;
}

.collection-card__lock {
  display: none;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
}

.collection-card__body {
  display: grid;
  min-height: 112px;
  align-content: start;
  gap: 5px;
  padding: 11px 12px 13px;
}

.collection-card__name {
  color: #123a77;
  font-family: var(--font-title);
  font-size: 1.05rem;
  line-height: 1.15;
}

.collection-card__scientific {
  overflow: hidden;
  color: #58697c;
  font-family: var(--font-scientific);
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-card__area {
  width: max-content;
  max-width: 100%;
  margin-top: 3px;
  padding: 4px 8px;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background: var(--sea-color);
  font-size: .68rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-card.is-locked .collection-card__button {
  border-color: #85909b;
  cursor: default;
  filter: grayscale(.75);
}

.collection-card.is-locked .collection-card__image {
  opacity: .18;
  filter: blur(3px) grayscale(1);
}

.collection-card.is-locked .collection-card__image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(15,27,45,.15), rgba(15,27,45,.58));
}

.collection-card.is-locked .collection-card__lock { display: block; }
.collection-card.is-locked .collection-card__number { background: #66717c; }
.collection-card.is-locked .collection-card__rarity { opacity: .3; }
.collection-card.is-locked .collection-card__name { color: #4f5963; letter-spacing: .08em; }
.collection-card.is-locked .collection-card__area { background: #6c7782; }

.card-dialog {
  width: min(92vw, 720px);
  max-height: 90vh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: #f9fcff;
  box-shadow: 0 28px 80px rgba(0,20,50,.42);
}

.card-dialog::backdrop {
  background: rgba(2,20,40,.72);
  backdrop-filter: blur(4px);
}

.card-dialog__close {
  position: sticky;
  z-index: 8;
  float: right;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  margin: 10px 10px -52px 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(5,30,60,.82);
  font-size: 1.55rem;
  cursor: pointer;
}

.card-dialog__content { padding-bottom: 22px; }

.dialog-card-visual {
  --sea-color: var(--sea-japan);
  position: relative;
  display: grid;
  place-items: center;
  min-height: 290px;
  overflow: hidden;
  border-bottom: 7px solid var(--sea-color);
  background-size: cover;
  background-position: center;
}

.dialog-card-visual.sea-japan { --sea-color: var(--sea-japan); }
.dialog-card-visual.sea-pacific { --sea-color: var(--sea-pacific); }
.dialog-card-visual.sea-indian { --sea-color: var(--sea-indian); }
.dialog-card-visual.sea-atlantic { --sea-color: var(--sea-atlantic); }
.dialog-card-visual.sea-antarctic { --sea-color: var(--sea-antarctic); }
.dialog-card-visual.sea-deep { --sea-color: var(--sea-deep); }

.dialog-card-visual img {
  width: min(58%, 360px);
  max-height: 240px;
  object-fit: contain;
  filter: drop-shadow(0 15px 18px rgba(0,0,0,.38));
}

.dialog-card-number,
.dialog-card-rarity {
  position: absolute;
  top: 16px;
}

.dialog-card-number {
  left: 16px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #fff;
  background: var(--sea-color);
  font-family: var(--font-number);
}

.dialog-card-rarity {
  right: 60px;
  color: #ffbb1c;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -.08em;
  text-shadow: 0 1px 1px #fff;
}

.dialog-heading,
.dialog-facts,
.dialog-details,
.dialog-kanji {
  margin-left: clamp(16px, 4vw, 30px);
  margin-right: clamp(16px, 4vw, 30px);
}

.dialog-heading {
  display: grid;
  gap: 4px;
  margin-top: 20px;
}

.dialog-heading h2 {
  margin: 0;
  color: #123a77;
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 6vw, 2.5rem);
}

.dialog-heading em {
  font-family: var(--font-scientific);
  color: #506073;
}

.dialog-heading > span {
  width: max-content;
  margin-top: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  background: #315d87;
  font-size: .76rem;
  font-weight: 700;
}

.dialog-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 16px;
}

.dialog-fact {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #c8dbe8;
  border-radius: 10px;
  background: #fff;
  font-size: .82rem;
  font-weight: 700;
}

.dialog-details {
  display: grid;
  gap: 10px;
  margin-top: 15px;
}

.dialog-info {
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 12px;
}

.dialog-info strong {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: .82rem;
}

.dialog-info p {
  margin: 8px 0 0;
  color: #222;
  line-height: 1.55;
}

.dialog-info.is-feature { border-color: #7ab28c; background: #f0faf2; }
.dialog-info.is-feature strong { background: #247a3d; }
.dialog-info.is-surprise { border-color: #e39a91; background: #fff4f2; }
.dialog-info.is-surprise strong { background: #d72820; }
.dialog-info.is-memo { border-color: #c092cb; background: #fbf3fd; }
.dialog-info.is-memo strong { background: #75328a; }

.dialog-kanji {
  margin-top: 15px;
  padding: 13px 14px;
  border: 1px solid #d9ae55;
  border-radius: 12px;
  background: #fff9e9;
}

.dialog-kanji > strong { color: #173d78; }

.dialog-kanji-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.dialog-kanji-grid > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
}

.dialog-kanji-grid b {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #fff;
  background: #123a77;
  font-size: 1.35rem;
}

.dialog-kanji-grid span {
  font-size: .78rem;
  line-height: 1.4;
}

@media (max-width: 850px) {
  .collection-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collection-search { grid-column: 1 / -1; }
  .collection-reset { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .collection-header {
    grid-template-columns: 1fr;
    padding: 22px 16px;
  }

  .collection-progress { min-width: 0; }

  .collection-tools {
    grid-template-columns: 1fr;
  }

  .collection-search,
  .collection-reset { grid-column: auto; }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .collection-card__body {
    min-height: 101px;
    padding: 9px;
  }

  .collection-card__name { font-size: .9rem; }
  .collection-card__scientific { font-size: .61rem; }

  .dialog-card-visual { min-height: 230px; }
  .dialog-facts { grid-template-columns: 1fr; }
  .dialog-kanji-grid { grid-template-columns: 1fr; }
}

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

@media (prefers-reduced-motion: reduce) {
  .collection-card__button,
  .collection-progress__bar span { transition: none; }
}


.collection-gacha-link {
  display: inline-flex;
  margin-top: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(0,25,55,.28);
  font-weight: 700;
  text-decoration: none;
}
