:root {
  --bg: #0a0e18;
  --bg-spot-a: rgba(91, 117, 255, 0.22);
  --bg-spot-b: rgba(35, 208, 181, 0.16);
  --surface: rgba(16, 24, 40, 0.86);
  --surface-soft: rgba(11, 18, 34, 0.96);
  --text: #ecf2ff;
  --muted: #afbbd9;
  --soft-text: #d8e4ff;
  --line: rgba(255, 255, 255, 0.12);
  --placeholder: #d8e2fb;
  --status-ok: #8ff7d1;
  --status-warn: #ffd45d;
  --status-err: #ff8ca9;
  --xp-track-bg: rgba(6, 16, 34, 0.72);
  --xp-track-line: rgba(157, 224, 255, 0.24);
  --xp-text: #bfe7ff;
  --toast-text: #eaf1ff;
  --adopt-green-memory-bg: rgba(52, 211, 153, 0.28);
  --adopt-green-memory-border: rgba(52, 211, 153, 0.58);
  --adopt-disabled-bg: rgba(160, 175, 202, 0.2);
  --adopt-disabled-border: rgba(187, 202, 230, 0.34);
  --adopt-disabled-text: #cbd6ed;
}

:root[data-theme="light"] {
  --bg: #f1f5ff;
  --bg-spot-a: rgba(81, 114, 255, 0.22);
  --bg-spot-b: rgba(31, 185, 159, 0.2);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(246, 250, 255, 0.96);
  --text: #1b2a49;
  --muted: #5c6f93;
  --soft-text: #32486e;
  --line: rgba(33, 56, 99, 0.14);
  --placeholder: #6177a3;
  --status-ok: #0a9b72;
  --status-warn: #b18200;
  --status-err: #c23557;
  --xp-track-bg: rgba(218, 229, 247, 0.95);
  --xp-track-line: rgba(76, 123, 185, 0.28);
  --xp-text: #2c5f97;
  --toast-text: #1b2a49;
  --adopt-green-memory-bg: rgba(52, 211, 153, 0.28);
  --adopt-green-memory-border: rgba(52, 211, 153, 0.58);
  --adopt-disabled-bg: rgba(196, 206, 224, 0.42);
  --adopt-disabled-border: rgba(122, 138, 173, 0.36);
  --adopt-disabled-text: #617297;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1000px 500px at 15% 0%, var(--bg-spot-a), transparent 60%),
    radial-gradient(900px 500px at 85% 0%, var(--bg-spot-b), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

.page {
  width: min(980px, 100% - 24px);
  margin: 18px auto 42px;
}

.topActions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.themeCard,
.shopCard {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  padding: 0;
  text-decoration: none;
  border-radius: 14px;
}

.themeCard {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 23px;
  box-shadow: 0 8px 18px rgba(4, 9, 20, 0.28);
}

.themeCard:hover {
  filter: brightness(1.06);
}

:root[data-theme="light"] .themeCard {
  box-shadow: 0 8px 18px rgba(75, 97, 146, 0.18);
}

.shopCard {
  border: 1px solid rgba(255, 244, 226, 0.95);
  background: linear-gradient(145deg, #fff9f0, #f5ecde 62%, #ece1d1);
  box-shadow: 0 8px 18px rgba(41, 28, 12, 0.35);
}

.shopCard .emoji {
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(83, 65, 45, 0.32));
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(
    155deg,
    var(--hero-bg-start, rgba(16, 24, 40, 0.7)),
    var(--hero-bg-end, rgba(13, 21, 41, 0.7)) 70%
  );
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -120px auto auto -120px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: var(--type-color);
  opacity: 0.18;
  filter: blur(22px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -45px -65px auto;
  width: 210px;
  height: 210px;
  border-radius: 999px;
  background: var(--type-color);
  opacity: 0.25;
  filter: blur(8px);
}

.heroMedia {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: min(100%, 520px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  padding: 10px;
}

.heroMedia img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: top center;
  border-radius: 0;
  -webkit-user-drag: none;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 4px 0;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 12px;
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.05;
}

.heroType {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--soft-text);
  font-size: 24px;
  font-weight: 600;
}

.status {
  min-height: 24px;
  margin: 14px 4px 0;
  color: var(--muted);
  font-weight: 600;
}

.status.ok { color: var(--status-ok); }
.status.warn { color: var(--status-warn); }
.status.err { color: var(--status-err); }

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

.infoCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
}

.label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}

.value {
  font-size: 17px;
  font-weight: 700;
  word-break: break-word;
}

.value.placeholder {
  font-weight: 500;
  color: var(--placeholder);
}

.xpCard .label {
  margin-bottom: 8px;
}

.xpBarTrack {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--xp-track-line);
  background: var(--xp-track-bg);
  overflow: hidden;
}

.xpBarFill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f8bff, #24c7b4);
  box-shadow: 0 0 12px rgba(50, 210, 194, 0.35);
}

.xpText {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--xp-text);
}

.infoCard.tiny .label,
.infoCard.tiny .value {
  font-size: 11px;
  font-weight: 600;
}

.infoCard.transfer .value {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-align: center;
}

.infoCard.action .label {
  margin-bottom: 8px;
}

.actionBtn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  background: rgba(85, 140, 255, 0.24);
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}

.actionBtn:active {
  transform: translateY(1px);
}

.actionBtn:hover {
  filter: brightness(1.05);
}

.actionBtn.adopt {
  background: var(--adopt-disabled-bg);
  border-color: var(--adopt-disabled-border);
  color: var(--adopt-disabled-text);
  cursor: not-allowed;
}

.actionBtn.embark {
  background: rgba(85, 140, 255, 0.24);
  border-color: var(--line);
}

.actionHint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--soft-text);
}

.accessories {
  display: block;
}

.accessories > summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.accessories > summary::-webkit-details-marker {
  display: none;
}

.summaryValue {
  font-size: 14px;
  color: var(--soft-text);
  font-weight: 700;
}

.summaryRight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.summaryArrow {
  display: inline-block;
  color: var(--soft-text);
  font-size: 14px;
  transform: translateY(-1px);
  transition: transform 160ms ease;
}

.accessories[open] .summaryArrow {
  transform: rotate(180deg) translateY(1px);
}

.accessories ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.accessories li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  background: var(--surface-soft);
}

.accessories li span {
  font-size: 12px;
  color: var(--muted);
}

.accessories li strong {
  font-size: 13px;
  color: var(--text);
}

.infoCard.transfer.pending .value {
  background: rgba(246, 188, 53, 0.15);
  border-color: rgba(246, 188, 53, 0.5);
}

.infoCard.transfer.confirmed .value {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.48);
}

.actionToast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  width: min(92vw, 420px);
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--toast-text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
  transition: opacity 180ms ease, transform 180ms ease;
}

.actionToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 14px, 560px);
    margin: 10px auto 24px;
  }

  .topActions {
    margin-bottom: 8px;
  }

  .themeCard,
  .shopCard {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .themeCard {
    font-size: 21px;
  }

  .shopCard .emoji {
    font-size: 22px;
  }

  .hero {
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .heroMedia {
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    padding: 8px;
  }

  .hero h1 {
    font-size: clamp(30px, 10vw, 44px);
  }

  .heroType {
    margin-top: 6px;
    font-size: 21px;
  }

  .status {
    margin: 10px 2px 0;
    font-size: 14px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .infoCard {
    border-radius: 12px;
    padding: 10px;
  }

  .label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .value {
    font-size: 16px;
  }

  .xpBarTrack {
    height: 10px;
  }

  .xpText {
    font-size: 12px;
    margin-top: 6px;
  }

  .actionBtn {
    font-size: 15px;
    padding: 9px 10px;
  }

  .actionHint {
    margin-top: 7px;
    font-size: 11px;
  }

  .summaryValue {
    font-size: 13px;
  }

  .actionToast {
    bottom: 12px;
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 10px;
  }
}
