:root {
  --bg: #ead9bd;
  --panel: #f7eddb;
  --text: #3b2b1e;
  --muted: #7f6a50;
  --line: rgba(90, 62, 34, .18);
  --accent: #a56f34;
  --accent2: #d69b42;
  --shadow: 0 18px 60px rgba(74, 48, 25, .20);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(111, 127, 63, .24), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(193, 123, 63, .20), transparent 32%),
    linear-gradient(180deg, #f4e8d2 0%, var(--bg) 52%, #d8bd94 100%);
  color: var(--text);
  min-height: 100svh;
  padding-top: calc(env(safe-area-inset-top, 20px) + 8px);
}

button,
select {
  font: inherit;
}

.app {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 18px 14px 34px;
}

.shell {
  background: linear-gradient(180deg, rgba(255, 250, 238, .92), rgba(235, 216, 182, .86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.collectionSwitcher {
  padding: 14px 18px 4px;
}

.collectionSwitcherInner {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 239, .62);
  box-shadow: 0 8px 26px rgba(74, 48, 25, .07);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.collectionLabel {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 950;
  white-space: nowrap;
}

.collectionSelect {
  width: 100%;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 13px;
  background: rgba(255, 250, 239, .82);
  color: var(--text);
  font-weight: 850;
  padding: 10px 12px;
  min-width: 0;
}

.collectionOpenButton {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 13px;
  background: rgba(255, 250, 239, .82);
  color: var(--text);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  font-weight: 850;
}

.collectionOpenButton span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collectionOpenButton span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.collectionModalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 16px;
  background: rgba(43, 31, 22, .58);
  backdrop-filter: blur(5px);
}

.collectionModalBackdrop.show {
  display: grid;
}

.collectionModal {
  width: min(780px, 100%);
  max-height: min(88svh, 860px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff7ea;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .34);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.collectionModalHeader {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.collectionModalHeader h2 {
  margin: 2px 0 0;
  font-size: 25px;
  letter-spacing: 0;
}

.collectionModalKicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.collectionCloseButton {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 250, 239, .82);
  color: var(--text);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.collectionTableHeader,
.collectionRow {
  display: grid;
  grid-template-columns: minmax(145px, 1.05fr) minmax(150px, 1.3fr) minmax(90px, .8fr);
  gap: 12px;
  align-items: center;
}

.collectionTableHeader {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.collectionList {
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.collectionColorGroup + .collectionColorGroup {
  margin-top: 12px;
}

.collectionColorHeading {
  position: sticky;
  top: -10px;
  z-index: 2;
  padding: 10px 8px;
  background: #fff7ea;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.collectionSwatch {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .88);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(90, 62, 34, .24);
}

.collectionRow {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 11px 8px;
  cursor: pointer;
  text-align: left;
}

.collectionRow:hover,
.collectionRow.active {
  border-color: rgba(111, 127, 63, .34);
  background: rgba(111, 127, 63, .1);
}

.collectionColorCell {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.collectionTypeCell {
  font-size: 14px;
  font-weight: 800;
}

.collectionNameCell {
  font-size: 15px;
  font-weight: 950;
}

.hero {
  padding: 4px 20px 16px;
}

.heroTop {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 246px;
  margin-bottom: 34px;
}

.heroImageWrap {
  width: 310px;
  height: 248px;
  background: transparent;
  display: grid;
  place-items: end center;
  flex: 0 0 auto;
  overflow: visible;
}

.heroImageWrap img {
  width: 310px;
  height: 310px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 15px 18px rgba(74, 48, 25, .24));
}

.collectibleBadge {
  width: 94px;
  height: 94px;
  border-radius: 999px;
  background: url("/assets/collectible-badge.webp") center / contain no-repeat;
  display: block;
  position: absolute;
  right: 18px;
  bottom: -16px;
  text-align: center;
  flex: 0 0 auto;
  filter: drop-shadow(0 16px 22px rgba(126, 83, 33, .20));
}

.collectibleBadge .num {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0;
  color: #6f4425;
  text-shadow: 0 1px 0 rgba(255, 238, 194, .48);
}

.heroTitleBlock {
  margin-top: 0;
  text-align: center;
  position: relative;
  z-index: 10;
}

h1 {
  font-size: 34px;
  line-height: 1;
  margin: 0 0 8px;
  letter-spacing: 0;
  text-align: center;
}

.sub {
  color: var(--muted);
  font-size: 22px;
  line-height: 1.15;
  margin: 0 auto;
  font-weight: 850;
  letter-spacing: 0;
  text-align: left;
  width: max-content;
  max-width: 100%;
}

.sub span {
  display: block;
}

.content {
  padding: 0 16px 18px;
}

.specimenCard,
.detailCard {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 239, .54);
  box-shadow: 0 12px 34px rgba(74, 48, 25, .10);
}

.specimenCard {
  padding: 16px;
}

.specimenTitle {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 950;
  margin-bottom: 8px;
}

.specimenText {
  font-size: 17px;
  line-height: 1.42;
  font-weight: 720;
}

.modeGrid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.modeBtn,
.buyBtn {
  border: 1px solid var(--line);
  background: rgba(255, 250, 239, .58);
  color: var(--text);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 8px 26px rgba(74, 48, 25, .07);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  width: 100%;
}

.modeBtn:active,
.buyBtn:active {
  transform: scale(.985);
}

.modeBtn.active {
  border-color: rgba(111, 127, 63, .38);
  background: linear-gradient(135deg, rgba(111, 127, 63, .18), rgba(193, 123, 63, .14));
}

.modeBtn.locked .arrow {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.modeLeft {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  overflow: visible;
}

.icon img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 7px 8px rgba(74, 48, 25, .16));
}

.modeTitle {
  font-size: 17px;
  line-height: 1.1;
  margin: 0 0 3px;
  font-weight: 950;
  letter-spacing: 0;
}

.modeDesc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.28;
}

.arrow {
  font-size: 24px;
  color: var(--muted);
  font-weight: 900;
}

.detailCard {
  margin-top: 14px;
  padding: 18px;
  transform: scale(1);
  transition: transform .20s ease, box-shadow .20s ease;
}

.detailHeader {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 10px;
}

.detailIcon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(111, 127, 63, .12), rgba(193, 123, 63, .08));
  border: 1px solid rgba(126, 91, 52, .14);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: visible;
}

.detailIcon img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 9px rgba(74, 48, 25, .16));
}

.kicker {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
  margin-bottom: 5px;
}

.detailTitle {
  font-size: 31px;
  line-height: 1.02;
  margin: 0;
  letter-spacing: 0;
}

.detailText {
  font-size: 17px;
  line-height: 1.5;
  color: #4d3826;
}

.detailText p {
  margin: 0 0 12px;
}

.detailText ul,
.detailText ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.detailText li {
  margin: 7px 0;
}

.answerBox {
  margin-top: 8px;
}

.answerBox summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 999px;
  background: rgba(255, 250, 239, .72);
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

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

.answer {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid rgba(111, 127, 63, .38);
  background: rgba(255, 250, 239, .44);
  border-radius: 12px;
}

.videoGrid {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.videoEmbed {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(90, 62, 34, .18);
  background: #000;
  box-shadow: 0 10px 30px rgba(74, 48, 25, .12);
}

.videoEmbed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
}

.gameGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.gameCard {
  border: 1px solid rgba(90, 62, 34, .16);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 250, 239, .72);
  box-shadow: 0 12px 30px rgba(74, 48, 25, .10);
}

.gameCard img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: rgba(90, 62, 34, .08);
}

.gameInfo {
  padding: 14px;
}

.gameName {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 10px;
  line-height: 1.15;
}

.gameBtn,
.aiBtn,
.modalPrimary {
  display: inline-block;
  text-align: center;
  text-decoration: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #c17822, #e39a27);
  color: #fff7ea;
  padding: 12px 10px;
  font-weight: 950;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(193, 120, 34, .18);
  border: 0;
  cursor: pointer;
}

.aiSteps {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.aiStep {
  border: 1px solid rgba(90, 62, 34, .16);
  border-radius: 20px;
  background: rgba(255, 250, 239, .62);
  padding: 14px;
  box-shadow: 0 10px 26px rgba(74, 48, 25, .08);
}

.aiStepFeatured {
  border-color: rgba(193, 120, 34, .30);
  background: linear-gradient(135deg, rgba(255, 250, 239, .78), rgba(227, 154, 39, .16));
}


.aiStepTitle {
  font-size: 15px;
  font-weight: 950;
  margin-bottom: 6px;
}

.aiStepText {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.38;
}

.aiButtonRow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.aiBtn.secondary,
.modalSecondary {
  background: rgba(255, 250, 239, .78);
  color: var(--text);
  border: 1px solid rgba(90, 62, 34, .18);
}

.aiPrompt {
  margin-top: 10px;
  border: 1px dashed rgba(90, 62, 34, .22);
  border-radius: 14px;
  background: rgba(255, 250, 239, .48);
  padding: 10px 12px;
  color: #4d3826;
  font-size: 14px;
  font-weight: 800;
}

.statusBar {
  margin: 0 16px 14px;
  border: 1px solid rgba(90, 62, 34, .16);
  border-radius: 18px;
  background: rgba(255, 250, 239, .48);
  color: var(--muted);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.35;
}

.statusPill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 999px;
  background: rgba(255, 250, 239, .72);
  color: var(--text);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  margin-right: 6px;
}

.footer {
  padding: 14px 18px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  border-top: 1px solid var(--line);
}

.footerVerifyBtn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 14px;
  background: rgba(255, 250, 239, .48);
  color: var(--text);
  padding: 9px 11px;
  margin-bottom: 8px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.footerVerifyData {
  font-size: 11px;
  color: var(--muted);
  font-weight: 750;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 31, 22, .35);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  padding: 18px;
  z-index: 20;
}

.modalBackdrop.show {
  display: grid;
}

.modal {
  width: min(420px, 100%);
  background: #fff7ea;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .28);
  padding: 18px;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 25px;
  letter-spacing: 0;
}

.modal p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.4;
}

.modalActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modalActions button {
  border: 0;
  cursor: pointer;
}

.formShell {
  padding: 18px;
}

.formGrid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 950;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(90, 62, 34, .18);
  border-radius: 14px;
  background: rgba(255, 250, 239, .82);
  color: var(--text);
  padding: 12px;
  font: inherit;
}

.field textarea {
  min-height: 180px;
  resize: vertical;
}

.primaryButton {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff7ea;
  padding: 12px 14px;
  font-weight: 950;
  cursor: pointer;
}

.secondaryLink {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
  border-bottom: 1px dashed rgba(90, 62, 34, .28);
}

.moduleGrid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.moduleCard {
  border: 1px solid rgba(90, 62, 34, .16);
  border-radius: 18px;
  background: rgba(255, 250, 239, .56);
  padding: 14px;
}

.moduleTitle {
  font-size: 17px;
  line-height: 1.15;
  font-weight: 950;
  margin-bottom: 5px;
}

.moduleText {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.38;
}

.loadError {
  padding: 18px;
}

@media (min-width: 860px) {
  .app {
    width: min(1120px, 100%);
    padding: 24px 18px 38px;
  }

  .shell {
    display: grid;
    grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
    grid-template-areas:
      "collection collection"
      "hero detail"
      "status detail"
      "nav detail"
      "nav footer";
    gap: 0;
    align-items: start;
  }

  .collectionSwitcher {
    grid-area: collection;
  }

  .hero {
    grid-area: hero;
    padding: 10px 20px;
  }

  .statusBar {
    grid-area: status;
  }

  .content {
    display: contents;
    padding: 0;
  }

  .specimenCard {
    grid-area: nav;
    margin: 0 16px 18px;
  }

  .detailCard {
    grid-area: detail;
    margin: 20px 20px 16px 0;
    min-height: 620px;
    max-height: calc(100vh - 92px);
    overflow: auto;
  }

  .footer {
    grid-area: footer;
    margin: 0 20px 18px 0;
    border-radius: 18px;
    background: rgba(255, 250, 239, .32);
  }

  .heroTop {
    min-height: 220px;
    margin-bottom: 22px;
  }

  .heroImageWrap {
    width: 270px;
    height: 218px;
  }

  .heroImageWrap img {
    width: 285px;
    height: 285px;
  }

  .collectibleBadge {
    right: 24px;
    bottom: -10px;
    width: 86px;
    height: 86px;
  }
}

@media (max-width: 440px) {
  .collectionSwitcherInner {
    align-items: stretch;
    flex-direction: column;
  }

  .collectionTableHeader {
    display: none;
  }

  .collectionModal {
    max-height: 92svh;
  }

  .collectionRow {
    grid-template-columns: 1fr auto;
    gap: 5px 10px;
  }

  .collectionColorCell {
    grid-column: 1;
    grid-row: 2;
  }

  .collectionTypeCell {
    grid-column: 1;
    grid-row: 1;
  }

  .collectionNameCell {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  h1 {
    font-size: 30px;
  }

  .detailTitle {
    font-size: 27px;
  }

  .detailText {
    font-size: 16px;
  }

  .detailIcon {
    width: 62px;
    height: 62px;
  }

  .detailIcon img {
    width: 78px;
    height: 78px;
  }
}
