/* ---------------------------
   Base + Variables
   --------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

:root{
  --bg: #120b1a;                /* deep purple */
  --bg-2: #1a0f26;              /* darker panel */
  --grid: rgba(150, 80, 200, 0.12); /* subtle purple grid */
  --text: #f2eaff;              /* light lavender text */
  --muted: #c6a8e4;             /* muted lilac */
  --accent: #d44aff;            /* neon purple/pink accent */
  --accent-2: #ff3c9e;          /* magenta secondary */
  --soft: rgba(212,74,255,.25);  /* soft inner glow */
  --shadow: 0 0 40px rgba(212,74,255,.25);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  color: var(--text);
}

body {
  margin: 0;
  font-family: "Chakra Petch", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  /* single purple gradient background */
  background: radial-gradient(1200px 700px at 70% -10%, #3a175c 0%, var(--bg) 55%);
}

/* ---------------------------
   Hero layout
   --------------------------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* subtle grid and particles */
.grid-overlay {
  position: absolute;
  inset: 0;
  background:
    /* tiny dots */
    radial-gradient(circle at 20% 30%, var(--grid) 1px, transparent 1px) 0 0/ 60px 60px,
    radial-gradient(circle at 70% 60%, var(--grid) 1px, transparent 1px) 0 0/ 80px 80px,
    /* faint grid */
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px,
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px;
  opacity: .8;
  pointer-events: none;
}

.hero-inner{
  width: min(1100px, 92vw);
  padding: 40px 0 80px;
  text-align: center;
  position: relative;
}

/* Mascot card (purple) */
.mascot{
  width: 128px;
  height: 128px;
  margin-inline: auto;
  margin-bottom: 22px;
  background: rgba(50, 20, 75, .6);
  border: 1px solid rgba(212, 74, 255, .25);
  border-radius: 20px;
  box-shadow: inset 0 0 60px var(--soft), var(--shadow);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
}
.mascot img{
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(212, 74, 255, .35));
}

/* Headline */
.headline{
  font-size: clamp(28px, 5.2vw, 64px);
  line-height: 1.1;
  letter-spacing: .02em;
  margin: 0 0 10px;
  font-weight: 700;
}
.headline span{
  display: inline-block;
  text-shadow: 0 0 24px rgba(212, 74, 255, .28);
}

/* Ticker */
.ticker{
  font: 700 clamp(26px, 4vw, 44px) "Space Mono", monospace;
  margin: 6px 0 16px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(212, 74, 255, .32);
}

/* Socials (purple) */
.social-row{
  display: inline-flex;
  gap: 12px;
  margin: 12px 0 18px;
}
.social-btn{
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(212, 74, 255, .30);
  background: rgba(40, 20, 60, .65);
  box-shadow: inset 0 0 30px rgba(212,74,255,.12);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
}
.social-btn:hover{
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow:
    0 0 22px rgba(212,74,255,.30),
    inset 0 0 40px rgba(212,74,255,.18);
}

/* Meta line */
.chainline{
  margin: 10px 0 24px;
  color: var(--muted);
  letter-spacing: .08em;
  font-size: clamp(12px, 1.5vw, 14px);
}

/* CTAs (purple) */
.cta-row{
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.btn.cta{
  --h: 48px;
  height: var(--h);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid rgba(212,74,255,.35);
  background: linear-gradient(180deg, rgba(70,30,100,.95), rgba(36,14,60,.95));
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow:
    0 0 0 1px rgba(212,74,255,.10) inset,
    inset 0 0 40px rgba(212,74,255,.15);
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn.cta.primary{
  background: linear-gradient(180deg, rgba(112,48,160,.98), rgba(54,20,88,.98));
  border-color: rgba(212,74,255,.55);
}
.btn.cta:hover{
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow:
    0 0 26px rgba(212,74,255,.35),
    inset 0 0 55px rgba(212,74,255,.20);
}

/* Contract card (purple) */
.contract-card{
  width: min(980px, 92vw);
  margin: 14px auto 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(212,74,255,.25);
  background: linear-gradient(180deg, rgba(40,20,60,.7), rgba(20,10,30,.7));
  box-shadow: inset 0 0 60px rgba(212,74,255,.15);
  text-align: left;
}
.contract-card .label{
  font: 700 12px "Space Mono", monospace;
  letter-spacing: .12em;
  color: #cfa4f5;
  margin-bottom: 8px;
}
.contract-input{
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.contract-input input{
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(20,10,30,.85);
  border: 1px solid rgba(212,74,255,.25);
  color: var(--text);
  font: 600 14px/46px "Space Mono", monospace;
  letter-spacing: .02em;
  outline: none;
}
.icon-btn{
  width: 46px; height: 46px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(30,15,45,.85);
  border: 1px solid rgba(212,74,255,.25);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.icon-btn:hover{
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212,74,255,.35);
}
.tooltip{
  position: absolute;
  right: 58px;
  top: -24px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #2a0f3d;
  border: 1px solid rgba(212,74,255,.3);
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.tooltip.show{
  opacity: 1;
  transform: translateY(0);
}
.contract-card .mini{
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .02em;
  opacity: .85;
}

/* Small tweaks for very narrow screens */
@media (max-width: 420px){
  .social-btn{ width: 42px; height: 42px; }
  .btn.cta{ --h: 46px; padding: 0 14px; }
  .mascot{ width: 112px; height: 112px; }
  .mascot img{ width: 80px; height: 80px; }
}

/* Custom image icon inside CTA button */
.btn.cta .icon-img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: inline-block;
  vertical-align: -2px;
}

/* Narrative / description box */
.desc-box {
  width: min(900px, 92vw);
  margin: 30px auto 20px;
  padding: 20px 26px;
  border-radius: 14px;
  background: rgba(40,20,60,.75);
  border: 1px solid rgba(212,74,255,.25);
  box-shadow: inset 0 0 50px rgba(212,74,255,.1);
  text-align: center;
}
.desc-box p {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-size: clamp(13px, 1.6vw, 16px);
  line-height: 1.6;
  color: var(--text);
}
.desc-box .prompt {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

/* Scroll down indicator */
.scroll-down {
  margin-top: 16px;
  font-size: 22px;
  color: var(--accent);
  animation: bounce 1.6s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ==================== SECTION 2 (Gallery) ==================== */
.library{
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 80px 0 0px;
  overflow: hidden; /* keep rain within section */
}

/* faint grid background for continuity */
.library::before{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(circle at 15% 25%, var(--grid) 1px, transparent 1px) 0 0/ 64px 64px,
    radial-gradient(circle at 75% 65%, var(--grid) 1px, transparent 1px) 0 0/ 84px 84px,
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px,
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px;
  pointer-events:none;
  opacity:.6;
}

/* rain canvas sits behind cards */
#rainCanvas{
  position:absolute; inset:0;
  width:100%; height:100%;
  pointer-events:none;
  opacity:.45;
}

/* 6 columns per row on desktop */
.kiki-grid{
  position: relative;
  width: min(1400px, 95vw);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 20px;
  z-index: 1;
}
.kiki-spacer{
  aspect-ratio: 1/1;
  visibility: hidden;
}


/* card base (image only) */
.kiki-card{
  position: relative;
  aspect-ratio: 1/1;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(35,18,52,.6);
  border: 1px solid rgba(212,74,255,.22);
  box-shadow: inset 0 0 40px rgba(212,74,255,.10);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  isolation: isolate;
}

/* image fills the card */
.kiki-card img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.02);
  transition: transform .25s ease, filter .25s ease;
}

/* subtle glow overlay for consistency with Section 1 */
.kiki-card::after{
  content:"";
  position:absolute; inset:0;
  background: radial-gradient(120% 120% at 50% 0%, rgba(212,74,255,.22), transparent 55%),
              linear-gradient(180deg, transparent 70%, rgba(0,0,0,.22));
  pointer-events:none;
  opacity:.35;
  mix-blend-mode: screen;
  transition: opacity .25s ease;
}

/* hover state */
.kiki-card:hover{
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow:
    0 10px 28px rgba(0,0,0,.35),
    0 0 26px rgba(212,74,255,.28),
    inset 0 0 60px rgba(212,74,255,.16);
}
.kiki-card:hover img{
  transform: scale(1.06);
  filter: saturate(1.05) contrast(1.04);
}
.kiki-card:hover::after{ opacity:.55; }

/* focus-visible for keyboard users */
.kiki-card:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Breakpoints: gracefully reduce columns */
@media (max-width: 1280px){
  .kiki-grid{ gap: 18px; }
}
@media (max-width: 1080px){
  .kiki-grid{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px){
  .kiki-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px){
  .kiki-grid{ grid-template-columns: repeat(2, 1fr); }
}


/* ===== Global grid overlay (fixed, continuous across sections) ===== */
.global-grid{
  position: fixed;
  inset: 0;
  z-index: 0;                   
  pointer-events: none;
  opacity: .8;

  background:
    radial-gradient(circle at 20% 30%, var(--grid) 1px, transparent 1px) 0 0/ 60px 60px,
    radial-gradient(circle at 70% 60%, var(--grid) 1px, transparent 1px) 0 0/ 80px 80px,
    linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px,
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px) 0 0/ 56px 56px;
}

.hero, .library, .desc-box, .contract-card{
  position: relative;
  z-index: 1;
}


.grid-overlay{ display: none !important; }
.library::before{ display: none !important; }


/* ===== Neon glow for the mascot card ===== */
.mascot.glow{
  position: relative;
  isolation: isolate;                    /* create stacking context so ::after can sit behind */
  border-color: rgba(212,74,255,.45);    /* slightly brighter border */
  box-shadow:
    inset 0 0 60px rgba(212,74,255,.20),
    0 0 24px rgba(212,74,255,.25);       /* subtle outer glow base */
  animation: mascotPulse 2.8s ease-in-out infinite;
}

/* inner frame (thin line inside the card) */
.mascot.glow::before{
  content:"";
  position:absolute;
  inset:10px;
  border-radius: 16px;
  border:1px solid rgba(212,74,255,.22);
  box-shadow: inset 0 0 18px rgba(212,74,255,.10);
  pointer-events:none;
  z-index: 1;
}

/* outer halo behind the card */
.mascot.glow::after{
  content:"";
  position:absolute;
  inset:-14px;                           /* extend outside to make the halo visible */
  border-radius: 28px;
  background: radial-gradient(closest-side, rgba(212,74,255,.55), rgba(212,74,255,0) 70%);
  filter: blur(14px);
  opacity:.75;
  z-index: -1;                           /* place behind the card */
  transition: opacity .25s ease, filter .25s ease;
}

/* image sits above decoration and gets a tiny lift on hover */
.mascot.glow img{
  position: relative;
  z-index: 2;
  transition: transform .25s ease, filter .25s ease;
  filter: drop-shadow(0 0 12px rgba(212,74,255,.35));
}

.mascot.glow:hover{
  animation-duration: 1.6s;
}
.mascot.glow:hover::after{
  opacity: .95;
  filter: blur(18px);
}
.mascot.glow:hover img{
  transform: scale(1.03);
}

/* breathing glow animation */
@keyframes mascotPulse{
  0%,100%{
    box-shadow:
      inset 0 0 50px rgba(212,74,255,.16),
      0 0 18px rgba(212,74,255,.22);
  }
  50%{
    box-shadow:
      inset 0 0 80px rgba(212,74,255,.26),
      0 0 40px rgba(212,74,255,.36);
  }
}


/* ===================== SECTION 3: Narrative Post ===================== */
.story{ padding-top: -24px !important; }

.story-grid{
  width: min(1200px, 94vw);
  margin: 0 auto;
  display: grid;
  margin-top: 20px;
  grid-template-columns: repeat(3, 1fr);     /* 3 panels */
  gap: 28px;
}

/* Card shell */
.story-card{
  background: linear-gradient(180deg, rgba(40,20,60,.70), rgba(20,10,30,.70));
  border: 1px solid rgba(212,74,255,.25);
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0,0,0,.35), inset 0 0 40px rgba(212,74,255,.10);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .25s ease, border-color .25s ease;
}

/* Image area with subtle halo */
.story-media{
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: rgba(35,18,52,.75);
}
.story-media::after{
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(212,74,255,.20), transparent 60%),
    linear-gradient(180deg, transparent 70%, rgba(0,0,0,.25));
  pointer-events: none;
  mix-blend-mode: screen;
}
.story-media img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.02);
  transition: transform .35s ease, filter .35s ease;
}

/* Text bubble */
.story-text{
  padding: 18px 18px 22px;
}
.story-badge{
  display: inline-block;
  font: 700 11px "Space Mono", monospace;
  letter-spacing: .12em;
  color: #cfa4f5;
  border: 1px solid rgba(212,74,255,.28);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(40,20,60,.55);
  margin-bottom: 10px;
}
.story-title{
  margin: 10px 0 8px;
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.25;
  color: var(--text);
  text-shadow: 0 0 16px rgba(212,74,255,.20);
}
.story-text p{
  margin: 0;
  color: var(--text);
  opacity: .92;
  line-height: 1.6;
}

/* Hover: lift + image zoom + brighter border */
.story-card:hover{
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow:
    0 14px 34px rgba(0,0,0,.45),
    0 0 30px rgba(212,74,255,.28),
    inset 0 0 60px rgba(212,74,255,.16);
}
.story-card:hover .story-media img{
  transform: scale(1.06);
  filter: saturate(1.05) contrast(1.05);
}

/* Reveal on scroll */
.reveal{ opacity: 0; transform: translateY(18px); }
.reveal.show{ opacity: 1; transform: translateY(0); transition: opacity .55s ease, transform .55s ease; }

/* Responsive */
@media (max-width: 1024px){
  .story-grid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px){
  .story-grid{ grid-template-columns: 1fr; }
}



/* ===== Section 3 header ===== */
.story-header{
  width: min(1200px, 94vw);
  margin: 0 auto 26px;
  text-align: center;
}
.story-heading{
  font: 700 clamp(18px, 3vw, 28px) "Space Mono", monospace;
  letter-spacing: .12em;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(212,74,255,.28);
  margin: 0 0 6px;
}
.story-sub{
  color: var(--muted);
  opacity: .9;
  margin: 0;
}

/* ===== Modal base ===== */
.modal{
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  z-index: 9999;
}
.modal.open{ display: flex; }

.modal-backdrop{
  position: absolute; inset: 0;
  background: rgba(10, 0, 16, .7);
  backdrop-filter: blur(6px);
}

.modal-dialog{
  position: relative;
  width: min(1000px, 94vw);
  max-height: 92vh;
  background: linear-gradient(180deg, rgba(40,20,60,.90), rgba(20,10,30,.92));
  border: 1px solid rgba(212,74,255,.35);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0,0,0,.55), 0 0 40px rgba(212,74,255,.25) inset;
  overflow: hidden;
  transform: translateY(8px);
  animation: modalIn .28s ease forwards;
}
@keyframes modalIn{ to{ transform: translateY(0); } }

/* Top-right controls */
.modal-close, .modal-full{
  position: absolute; top: 10px;
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(40,20,60,.7);
  color: var(--text);
  border: 1px solid rgba(212,74,255,.35);
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .1s ease;
  z-index: 2;
}
.modal-close{ right: 10px; }
.modal-full { right: 54px; }
.modal-close:hover, .modal-full:hover{
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212,74,255,.35), inset 0 0 30px rgba(212,74,255,.18);
  transform: translateY(-1px);
}

/* Media area inside modal */
.modal-media{
  position: relative;
  background: rgba(35,18,52,.9);
  aspect-ratio: 16/9;
  overflow: hidden;
}
.modal-media img{
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: #140922;
}

/* Text area inside modal */
.modal-body{
  padding: 16px 18px 22px;
  max-height: 38vh;
  overflow: auto;
}

/* Fullscreen fallback via CSS (if Fullscreen API blocked) */
.modal.fill .modal-dialog{
  width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0;
}
.modal.fill .modal-media{ height: 66vh; }
.modal.fill .modal-body{ max-height: 34vh; }

/* Prevent body scroll while modal is open */
body.no-scroll{ overflow: hidden; }


.story-grid{
}

.modal-prev, .modal-next{
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(40,20,60,.7);
  color: var(--text);
  border: 1px solid rgba(212,74,255,.35);
  cursor: pointer;
  z-index: 3;
  transition: border-color .2s ease, box-shadow .2s ease, transform .1s ease;
}
.modal-prev{ left: 10px; }
.modal-next{ right: 10px; }
.modal-prev:hover, .modal-next:hover{
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(212,74,255,.35), inset 0 0 30px rgba(212,74,255,.18);
  transform: translateY(-50%) scale(1.03);
}

.story-grid{
  row-gap: clamp(22px, 2.2vw, 32px);
  column-gap: clamp(22px, 2.2vw, 32px);
}


/* ===================== FOOTER ===================== */
.site-footer{
  position: relative;
  z-index: 1;                                  /* di atas global grid */
  margin-top: clamp(36px, 6vw, 80px);
  padding: clamp(24px, 3.5vw, 38px) 0;
  background: linear-gradient(180deg, rgba(40,20,60,.65), rgba(20,10,30,.82));
  border-top: 1px solid rgba(212,74,255,.25);
  box-shadow: 0 -10px 30px rgba(0,0,0,.35), inset 0 10px 40px rgba(212,74,255,.08);
}
.footer-inner{
  width: min(1200px, 94vw);
  margin: 0 auto;
  text-align: center;
}
.footer-sigil{
  margin: 0 0 6px;
  font: 700 clamp(16px, 2.6vw, 22px) "Space Mono", monospace;
  letter-spacing: .14em;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(212,74,255,.28);
}
.footer-heart{
  margin: 0;
  color: var(--text);
  opacity: .92;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.footer-heart i{
  filter: drop-shadow(0 0 8px rgba(212,74,255,.35));
  animation: heartbeat 1.8s ease-in-out infinite;
}
@keyframes heartbeat{
  0%,100%{ transform: scale(1); }
  14%    { transform: scale(1.25); }
  28%    { transform: scale(1); }
  42%    { transform: scale(1.18); }
  70%    { transform: scale(1); }
}
.footer-copy{
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .02em;
}


/* ===================== MARKET / DEX ===================== */
.market{
  position: relative;
  z-index: 1;
  padding: clamp(28px, 4vw, 48px) 0 clamp(32px, 5vw, 60px);
}
.market-header{
  width: min(1200px, 94vw);
  margin: 0 auto clamp(14px, 2.5vw, 22px);
  text-align: center;
}

.dex-card{
  width: min(1200px, 94vw);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(40,20,60,.70), rgba(20,10,30,.78));
  border: 1px solid rgba(212,74,255,.28);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.45), inset 0 0 40px rgba(212,74,255,.10);
  overflow: hidden;
}

/* Action bar */
.dex-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px;
  border-bottom: 1px solid rgba(212,74,255,.18);
  background: rgba(30,15,45,.55);
}
.dex-btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(212,74,255,.35);
  background: rgba(40,20,60,.75);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  box-shadow: inset 0 0 24px rgba(212,74,255,.12);
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease;
}
.dex-btn:hover{
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212,74,255,.32), inset 0 0 30px rgba(212,74,255,.18);
}

/* Frame wrapper: responsive height */
.dex-framewrap{
  position: relative;
  height: clamp(460px, 60vh, 720px); /* default height */
  background: #140922;
}
.dex-framewrap iframe{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; display: block;
}

/* Expanded mode */
.dex-card.expanded .dex-framewrap{
  height: 82vh;
}
.dex-card.expanded .dex-expand i::before{
  content: "\f145"; /* bootstrap icons 'arrows-angle-contract' */
}
.dex-card.expanded .dex-expand span{
  content: "Collapse";
}

/* Mobile tweaks */
@media (max-width: 640px){
  .dex-actions{ justify-content: center; }
  .dex-framewrap{ height: clamp(420px, 58vh, 620px); }
}

/* ===================== KIKI Custom Maker ===================== */
.maker{
  position: relative; z-index: 1;
  padding: clamp(36px, 5vw, 64px) 0;
}
.maker-header{
  width: min(1200px, 94vw);
  margin: 0 auto clamp(18px, 3vw, 28px);
  text-align: center;
}

/* Card container */
.maker-card{
  width: min(980px, 94vw);
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(40,20,60,.72), rgba(20,10,30,.82));
  border: 1px solid rgba(212,74,255,.28);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(0,0,0,.45), inset 0 0 40px rgba(212,74,255,.10);
  padding: clamp(16px, 2.2vw, 22px);
}

/* Stage / preview */
.maker-stage{
  display: grid; place-items: center;
  background: rgba(30,15,45,.55);
  border: 1px solid rgba(212,74,255,.18);
  border-radius: 16px;
  padding: clamp(14px, 2vw, 18px);
  box-shadow: inset 0 0 30px rgba(212,74,255,.08);
}
#makerCanvas{
  width: min(460px, 86vw);
  height: auto;
  aspect-ratio: 1 / 1; /* keep square on resize */
  border-radius: 14px;
  background: #000; /* won't be seen; canvas draws full */
}

/* Controls */
.maker-ctrl{
  margin-top: clamp(16px, 2vw, 22px);
  text-align: center;
}
.maker-label{
  margin: 14px 0 10px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .06em;
}

/* Swatches */
.swatches{
  display: grid;
  grid-template-columns: repeat(10, 40px);
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}
@media (max-width: 680px){
  .swatches{ grid-template-columns: repeat(5, 40px); }
}
.swatch{
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid rgba(255,255,255,.75);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
}
.swatch:hover{ transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.swatch.active{ outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

/* Buttons (align with your theme) */
.maker-actions{
  display: flex; gap: 10px; justify-content: center; margin-top: 10px;
}
.btn.maker-btn{
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px;
  border-radius: 12px; font-weight: 700; letter-spacing: .03em;
  border: 1px solid rgba(212,74,255,.35);
  color: var(--text); text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, rgba(40,20,60,.9), rgba(20,10,30,.92));
  box-shadow: inset 0 0 30px rgba(212,74,255,.12);
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn.maker-btn.primary{
  background: linear-gradient(180deg, rgba(110,40,150,.95), rgba(40,20,60,.95));
  border-color: rgba(212,74,255,.55);
}
.btn.maker-btn.ghost{
  background: transparent;
  border-color: rgba(212,74,255,.25);
}
.btn.maker-btn:hover{
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212,74,255,.32), inset 0 0 36px rgba(212,74,255,.16);
}


/* ===================== KIKI PFP Builder ===================== */
/* ===================== KIKI PFP Builder ===================== */
.pfp{
  position: relative; z-index: 1;
  padding: clamp(28px,5vw,56px) 0;
}
.pfp-header{
  width: min(1200px, 94vw);
  margin: 0 auto clamp(14px,3vw,24px);
  text-align: center;
}

/* Layout: preview + compact control panel */
.pfp-card{
  width: min(1200px, 94vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) 340px;
  gap: clamp(14px, 2vw, 22px);
}
@media (max-width: 980px){
  .pfp-card{ grid-template-columns: 1fr; }
}

/* Preview */
.pfp-stage{
  display: grid; place-items: center;
  background: rgba(30,15,45,.55);
  border: 1px solid rgba(212,74,255,.18);
  border-radius: 16px;
  padding: clamp(12px, 2vw, 16px);
  box-shadow: inset 0 0 30px rgba(212,74,255,.08);
  overflow: hidden;
}
#pfpCanvas{
  width: min(640px, 92vw);
  height: auto;
  aspect-ratio: 1/1;
  border-radius: 14px;          /* visual only; export uses same mask */
  background: #0b0712;
}

/* Controls (compact & responsive) */
.pfp-controls{
  background: linear-gradient(180deg, rgba(40,20,60,.72), rgba(20,10,30,.82));
  border: 1px solid rgba(212,74,255,.28);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0,0,0,.45), inset 0 0 40px rgba(212,74,255,.10);
  padding: 14px;
  display: grid;
  gap: 12px;
  max-width: 100%;
}
.pfp-controls label{
  font-weight: 700; color: var(--muted);
}
.ctrl{ display: grid; gap: 6px; }

.select{
  width: 100%; height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(212,74,255,.25);
  background: rgba(20,10,30,.9);
  color: var(--text);
  padding: 0 12px;
  font-weight: 600;
  min-width: 0;                 /* prevent overflow on narrow screens */
}

/* Actions */
.ctrl-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
@media (max-width: 420px){
  .ctrl-row{ grid-template-columns: 1fr; } /* stack buttons on very small screens */
}

.pfp-btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 14px;
  border-radius: 12px; font-weight: 700;
  border: 1px solid rgba(212,74,255,.35);
  color: var(--text); text-decoration: none; cursor: pointer;
  background: linear-gradient(180deg, rgba(40,20,60,.9), rgba(20,10,30,.92));
  box-shadow: inset 0 0 30px rgba(212,74,255,.12);
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s ease;
}
.pfp-btn.primary{
  background: linear-gradient(180deg, rgba(110,40,150,.95), rgba(40,20,60,.95));
  border-color: rgba(212,74,255,.55);
}
.pfp-btn:hover{
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(212,74,255,.32), inset 0 0 36px rgba(212,74,255,.16);
}
