/* ============================================================
   THE PIÑATAS — token system
   Colors pulled straight from the king/logo art:
   teal bg, hot pink, gold, deep maroon, black outline, white
   ============================================================ */
:root{
  --teal-900: #1c4a49;
  --teal-700: #2d6b69;
  --teal-500: #4fa8a6;
  --teal-300: #7ec9c6;
  --pink-600: #d81b5e;
  --pink-500: #e63970;
  --maroon-700: #7a1734;
  --gold-500: #f2b705;
  --gold-300: #ffd93d;
  --ink: #14100f;
  --paper: #f7efe0;

  --font-display: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;

  --radius-0: 0px;
  --border-thick: 4px;
  --shadow-hard: 6px 6px 0 var(--ink);
  --shadow-hard-sm: 4px 4px 0 var(--ink);
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }

body{
  background: var(--teal-500);
  background-image:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.06) 0, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(0,0,0,0.10) 0, transparent 45%);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  image-rendering: pixelated;
}

img{ image-rendering: pixelated; }

.visually-hidden{
  position:absolute; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap;
}

/* faint scanline texture for the pixel/CRT feel, kept subtle */
.crt-overlay{
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.05) 0px,
    rgba(0,0,0,0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.35;
}

#fx-canvas{
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  pointer-events: none; z-index: 50; display: none;
}

#app{
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 20px 56px;
  min-height: 100vh;
}

/* ---------------- progress pips ---------------- */
.pips{
  display:flex; gap:10px; justify-content:center;
  margin: 4px 0 18px;
}
.pip{
  width: 14px; height: 14px;
  background: var(--teal-900);
  border: 2px solid var(--ink);
  opacity: .45;
}
.pip.active{ background: var(--gold-500); opacity: 1; }
.pip.done{ background: var(--pink-500); opacity: 1; }

/* ---------------- persistent X-style profile header ---------------- */
.site-header{
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  border-bottom: var(--border-thick) solid var(--ink);
}
.banner-wrap{
  width: 100%;
  aspect-ratio: 1000 / 399;
  max-height: 260px;
  overflow: hidden;
  border-bottom: var(--border-thick) solid var(--ink);
  background: var(--teal-700);
}
.banner-img{
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.header-row{
  display:flex; align-items:flex-end; gap: 14px;
  padding: 0 18px 14px;
  margin-top: -46px;
}
.avatar-frame{
  width: 92px; height: 92px;
  flex: 0 0 auto;
  border: 4px solid var(--ink);
  background: var(--gold-300);
  box-shadow: var(--shadow-hard-sm);
  overflow: hidden;
}
.avatar-img{
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  display: block;
}
.header-meta{ padding-bottom: 2px; }
.header-handle{
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--paper);
  text-shadow: 2px 2px 0 var(--ink);
}
.header-tag{
  margin: 4px 0 0;
  font-size: 17px;
  color: var(--teal-900);
  background: var(--paper);
  display: inline-block;
  padding: 1px 6px;
  border: 2px solid var(--ink);
}
.live-glow{
  position: relative;
  color: var(--maroon-700);
  font-weight: bold;
  animation: live-pulse 1.6s ease-in-out infinite;
}
.live-glow::before{
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--pink-500);
  box-shadow: 0 0 0 0 rgba(230,57,112,0.6);
  animation: live-dot 1.6s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes live-pulse{
  0%, 100%{ text-shadow: 0 0 2px var(--gold-300), 0 0 0 transparent; }
  50%{ text-shadow: 0 0 8px var(--gold-500), 0 0 14px var(--pink-500); }
}
@keyframes live-dot{
  0%{ box-shadow: 0 0 0 0 rgba(230,57,112,0.55); }
  70%{ box-shadow: 0 0 0 7px rgba(230,57,112,0); }
  100%{ box-shadow: 0 0 0 0 rgba(230,57,112,0); }
}
@media (prefers-reduced-motion: reduce){
  .live-glow, .live-glow::before{ animation: none; }
}

@media (min-width: 760px){
  .banner-wrap{ max-height: 300px; }
  .avatar-frame{ width: 112px; height: 112px; }
  .header-row{ margin-top: -56px; padding: 0 28px 16px; }
}

/* ---------------- top bars (per-screen step labels) ---------------- */
.topbar{
  display:flex; flex-direction:column; align-items:center; gap:10px;
  margin: 18px 0 22px;
}
.topbar-compact{ margin: 14px 0 16px; }
.step-label{
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--maroon-700);
  background: var(--gold-300);
  border: 3px solid var(--ink);
  padding: 6px 10px;
  box-shadow: var(--shadow-hard-sm);
}

/* ---------------- shared pixel panel ---------------- */
.pixel-panel{
  background: var(--paper);
  border: var(--border-thick) solid var(--ink);
  box-shadow: var(--shadow-hard);
  padding: 26px 24px 30px;
  position: relative;
}
.pixel-panel::before{
  /* pixel-notch corners for a piñata-paper-craft feel */
  content:"";
  position:absolute; inset:8px;
  border: 2px dashed rgba(20,16,15,0.18);
  pointer-events:none;
}

.eyebrow{
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--pink-600);
  margin: 0 0 10px;
}

.section-title, .lore-title{
  font-family: var(--font-display);
  font-size: clamp(20px, 6vw, 30px);
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 14px;
}
.lore-title{ color: var(--maroon-700); }
.section-sub{
  font-size: 20px;
  line-height: 1.35;
  color: var(--teal-900);
  margin: 0 0 20px;
}

.highlight{ color: var(--pink-600); font-weight: bold; }

/* ---------------- screens ---------------- */
.screen{ display:none; }
.screen[data-active="true"]{ display:block; animation: screen-in .5s steps(6) both; }

@keyframes screen-in{
  from{ opacity:0; transform: translateY(14px); }
  to{ opacity:1; transform: translateY(0); }
}

/* ---------------- lore screen ---------------- */
.lore-layout{
  display:grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
@media (min-width: 760px){
  .lore-layout{ grid-template-columns: 0.9fr 1.1fr; align-items:center; }
}

.king-stage{
  position: relative;
  display:flex; align-items:center; justify-content:center;
}
.king-img{
  width: min(72vw, 360px);
  filter: drop-shadow(8px 10px 0 rgba(0,0,0,0.25));
  animation: king-float 3.4s ease-in-out infinite;
  position: relative; z-index: 2;
}
.king-ground-glow{
  position:absolute; bottom: 6%; width: 60%; height: 24px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.35), transparent 70%);
  z-index: 1;
}
@keyframes king-float{
  0%,100%{ transform: translateY(0) rotate(-0.6deg); }
  50%{ transform: translateY(-10px) rotate(0.6deg); }
}
.king-img.is-cracked{ animation: none; }

.lore-scroll p{
  font-size: 22px;
  line-height: 1.4;
  margin: 0 0 12px;
  color: var(--ink);
}
.lore-signoff{ color: var(--teal-900); }

.hint{
  font-size: 16px;
  text-align:center;
  color: var(--teal-900);
  opacity: .8;
  margin: 10px 0 0;
}

/* ---------------- buttons ---------------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  width: 100%;
  font-family: var(--font-display);
  text-decoration:none;
  cursor: pointer;
  border: var(--border-thick) solid var(--ink);
  padding: 16px 18px;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: var(--shadow-hard);
  transition: transform .08s ease, box-shadow .08s ease;
  user-select:none;
}
.btn-primary{
  background: var(--pink-500);
  color: var(--paper);
}
.btn:active{
  transform: translate(4px,4px);
  box-shadow: 2px 2px 0 var(--ink);
}
.btn:disabled{
  background: #a9b8b7; color: #5a6968; cursor: not-allowed;
  box-shadow: var(--shadow-hard-sm);
}
.btn:disabled:active{ transform:none; box-shadow: var(--shadow-hard-sm); }

.btn-smash.shaking{ animation: shake .5s ease; }
@keyframes shake{
  0%,100%{ transform: translate(0,0); }
  20%{ transform: translate(-3px,2px); }
  40%{ transform: translate(3px,-2px); }
  60%{ transform: translate(-3px,-1px); }
  80%{ transform: translate(3px,1px); }
}

/* ---------------- quests screen ---------------- */
.quest-list{
  list-style:none; margin: 0 0 22px; padding: 0;
  display:flex; flex-direction:column; gap: 12px;
}
.quest-card{
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow-hard-sm);
}
.quest-toggle{
  width:100%;
  display:grid;
  grid-template-columns: 30px 1fr auto;
  align-items:center;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 14px;
  cursor: pointer;
  text-align:left;
  font-family: var(--font-body);
}
.quest-check{
  width: 22px; height: 22px;
  border: 3px solid var(--ink);
  background: var(--paper);
  display:inline-block;
  position: relative;
}
.quest-card[data-done="true"] .quest-check{
  background: var(--gold-500);
}
.quest-card[data-done="true"] .quest-check::after{
  content:"✓";
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  font-size: 15px; font-weight:bold; color: var(--ink);
}
.quest-card[data-done="true"]{ background: #fff8e6; }

.quest-title{
  display:block; font-size: 20px; color: var(--ink); line-height:1.2;
}
.quest-desc{
  display:block; font-size: 16px; color: var(--teal-900);
}
.quest-desc a{ color: var(--pink-600); }
.quest-go{
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--maroon-700);
  white-space: nowrap;
}

/* ---------------- form screen ---------------- */
.field{ display:block; margin-bottom: 18px; }
.field-label{
  display:block;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--maroon-700);
  margin-bottom: 8px;
}
.field-input-wrap{
  display:flex; align-items:stretch;
  border: 3px solid var(--ink);
  background: #fff;
}
.field-prefix{
  display:flex; align-items:center;
  padding: 0 10px;
  background: var(--gold-300);
  font-family: var(--font-display);
  font-size: 14px;
  border-right: 3px solid var(--ink);
}
input[type="text"]{
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 20px;
  padding: 12px 10px;
  outline: none;
}
.field-input-wrap input{ border:none; }
input.field-mono{
  border: 3px solid var(--ink);
  background:#fff;
}
input:focus-visible{ outline: 3px solid var(--pink-600); outline-offset: 2px; }

#form-error{ color: var(--pink-600); min-height: 20px; }

/* ---------------- success screen ---------------- */
.success-layout{ text-align:center; }
.success-badge{
  width: 64px; height: 64px;
  margin: 6px auto 14px;
  background: var(--gold-500);
  border: 4px solid var(--ink);
  display:flex; align-items:center; justify-content:center;
  font-size: 30px; font-weight:bold;
  box-shadow: var(--shadow-hard-sm);
}
.success-badge-miss{
  background: var(--paper);
  color: var(--pink-600);
}

/* ---------------- claim page ---------------- */
.claim-layout{ text-align:left; }
.claim-layout .field{ margin-top: 4px; }
.claim-layout .btn{ margin-top: 4px; }

.card-canvas{
  width: 100%;
  max-width: 480px;
  height: auto;
  display: block;
  margin: 10px auto 16px;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-hard);
  background: var(--teal-900);
}

.btn-secondary{
  background: var(--paper);
  color: var(--ink);
  margin-top: 12px;
}
.btn-secondary:active{
  transform: translate(4px,4px);
  box-shadow: 2px 2px 0 var(--ink);
}

#screen-found .btn-secondary,
#screen-notfound .btn-secondary{ margin-top: 10px; }

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce){
  .king-img{ animation:none; }
  .screen[data-active="true"]{ animation:none; }
  .btn-smash.shaking{ animation:none; }
}

/* ---------------- responsive tightening ---------------- */
@media (max-width: 480px){
  .pixel-panel{ padding: 20px 16px 24px; }
  .lore-scroll p, .section-sub{ font-size: 19px; }
}
