/* "Who's that token?" — a Who's-That-Pokémon-style homage theme. */
:root {
  --yellow: #ffcb05;
  --yellow-deep: #f2a900;
  --blue: #2a75bb;
  --blue-deep: #1b4f8a;
  --blue-abyss: #0e2f52;
  --navy: #0a2540;
  --red: #ee1515;
  --red-2: #ff5a5a;
  --card: #ffffff;
  --cream: #fff8e6;
  --line: rgba(10, 37, 64, 0.16);
  --radius: 18px;
  --shadow: 0 10px 0 rgba(10, 37, 64, 0.18), 0 18px 40px rgba(10, 37, 64, 0.22);
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: "Trebuchet MS", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--navy);
  line-height: 1.5;
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #ffe86b 0%, var(--yellow) 34%, var(--yellow-deep) 52%, var(--blue) 82%, var(--blue-deep) 100%)
    fixed;
}

/* mode banner */
.banner {
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-bottom: 3px solid var(--navy);
}
.banner.demo {
  background: var(--yellow);
  color: var(--navy);
}
.banner.live {
  background: #16c76a;
  color: #04371f;
}

/* hero */
.hero {
  padding: 46px 20px 20px;
}
.hero-inner {
  max-width: 900px;
  margin: 0 auto;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 800;
  color: var(--blue-deep);
  margin: 0 0 10px;
}
h1 {
  margin: 0;
  font-size: clamp(44px, 9vw, 92px);
  line-height: 0.95;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.01em;
}
h1 .whos {
  color: #fff;
  -webkit-text-stroke: 2px var(--navy);
  text-shadow: 4px 4px 0 var(--navy);
}
h1 .token-word {
  color: var(--red);
  -webkit-text-stroke: 2px var(--navy);
  text-shadow: 4px 4px 0 var(--navy);
}
.sub {
  color: var(--navy);
  font-weight: 600;
  max-width: 560px;
  font-size: 17px;
  margin: 18px 0 26px;
}

/* the reveal card */
.token-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  background: var(--card);
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
@media (max-width: 640px) {
  .token-card {
    grid-template-columns: auto 1fr;
  }
  .price-block {
    grid-column: 1 / -1;
    text-align: left !important;
    border-top: 2px dashed var(--line);
    padding-top: 12px;
  }
}

.reveal-stage {
  position: relative;
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
/* the sunburst behind the silhouette */
.burst {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--yellow) 0deg 12deg, var(--yellow-deep) 12deg 24deg);
  filter: drop-shadow(0 0 0 var(--navy));
  animation: spin 14s linear infinite;
  z-index: 0;
}
.token-card.revealed .burst {
  background: repeating-conic-gradient(from 0deg, #7fd0ff 0deg 12deg, var(--blue) 12deg 24deg);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .burst {
    animation: none;
  }
}

.silhouette {
  position: relative;
  z-index: 1;
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.02em;
  overflow: hidden;
  padding: 0 6px;
  text-align: center;
  /* unrevealed: pure black silhouette */
  background: #08111f;
  color: transparent;
  border: 3px solid var(--navy);
  transition: background 0.25s, color 0.2s;
}
.silhouette::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 900;
  color: #1b2b44;
}
.token-card.revealed .silhouette {
  background: linear-gradient(150deg, #7fd0ff, var(--blue) 60%, var(--blue-deep));
  color: #fff;
}
.token-card.revealed .silhouette::after {
  display: none;
}

.reveal-info {
  min-width: 0;
}
.token-name {
  position: relative;
  font-size: clamp(22px, 4.4vw, 34px);
  font-weight: 900;
  font-style: italic;
  line-height: 1.05;
  color: var(--navy);
  word-break: break-word;
}
/* mystery state */
.token-card:not(.revealed) .token-name {
  color: transparent;
}
.token-card:not(.revealed) .token-name::before {
  content: "? ? ?";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--navy);
  letter-spacing: 0.1em;
}
/* revealed → "It's NAME!" */
.token-card.revealed .token-name::before {
  content: "It's ";
  color: var(--red);
}
.token-card.revealed .token-name::after {
  content: "!";
  color: var(--red);
}
.token-meta {
  color: var(--blue-deep);
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}
.reveal-btn {
  margin-top: 12px;
  border: 3px solid var(--navy);
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--navy);
  transition: transform 0.05s, box-shadow 0.05s;
}
.reveal-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--navy);
}
.token-card.revealed .reveal-btn {
  background: var(--blue);
}

.price-block {
  text-align: right;
}
.price-label {
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.price-value {
  font-size: 34px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}
.price-value .unit {
  font-size: 15px;
  color: var(--blue-deep);
}
.price-after {
  color: var(--blue-deep);
  font-weight: 600;
  font-size: 13px;
}

/* main */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 20px 40px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  main {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 900;
  font-style: italic;
}

/* form */
form label {
  display: block;
  position: relative;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--blue-deep);
  font-weight: 800;
}
.optional {
  font-weight: 600;
  color: var(--blue);
  opacity: 0.9;
}
#new-name,
#new-symbol,
#memo {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  background: #fbfdff;
  border: 2px solid var(--navy);
  border-radius: 10px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: box-shadow 0.15s;
}
#new-name:focus,
#new-symbol:focus,
#memo:focus {
  box-shadow: 0 0 0 4px rgba(255, 203, 5, 0.55);
}
.counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11px;
  color: var(--blue-deep);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.pay-methods {
  border: 2px solid var(--navy);
  border-radius: 12px;
  padding: 8px 12px 12px;
  margin: 4px 0 18px;
}
.pay-methods legend {
  padding: 0 6px;
  font-size: 12px;
  color: var(--blue-deep);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pay-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  margin: 0;
  color: var(--navy);
  font-weight: 500;
}
.pay-option:hover {
  background: #fff6cf;
}
.pay-option input {
  margin-top: 3px;
  accent-color: var(--red);
}
.pay-option strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
}
.pay-option small {
  color: var(--blue-deep);
  font-size: 13px;
}
.pay-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button {
  font: inherit;
  cursor: pointer;
}
#submit-btn {
  width: 100%;
  padding: 14px;
  border: 3px solid var(--navy);
  border-radius: 12px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 5px 0 var(--navy);
  transition: transform 0.05s, box-shadow 0.05s, filter 0.15s;
}
#submit-btn:hover {
  filter: brightness(1.05);
}
#submit-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--navy);
}
#submit-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form-error {
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  margin: 12px 0 0;
}

/* history */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}
.history li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 10px 12px;
  background: #fff6cf;
  border: 2px solid var(--navy);
  border-radius: 10px;
  font-size: 14px;
}
.history .h-name {
  font-weight: 800;
  position: relative;
}
.history .h-sym {
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 700;
}
.history .h-price {
  color: var(--blue-deep);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.history .h-memo {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-style: italic;
  margin-top: 2px;
}

/* each entry is its own mini "who's that token?" — masked until hover/click */
.history li.mystery {
  cursor: pointer;
}
.history li.mystery .h-name {
  color: transparent;
}
.history li.mystery .h-name::after {
  content: "? ? ?";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--navy);
  letter-spacing: 0.14em;
  font-weight: 900;
}
.history li.mystery .h-sym {
  opacity: 0; /* keep width, hide the spoiler */
}
.history li.mystery:hover .h-name,
.history li.mystery.revealed .h-name {
  color: var(--navy);
}
.history li.mystery:hover .h-name::after,
.history li.mystery.revealed .h-name::after {
  display: none;
}
.history li.mystery:hover .h-sym,
.history li.mystery.revealed .h-sym {
  opacity: 1;
}
.history-empty {
  color: var(--blue-deep);
  font-weight: 700;
  justify-content: center !important;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-box {
  position: relative;
  width: min(460px, 100%);
  background: var(--card);
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--navy);
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
}
.modal h3 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 900;
  font-style: italic;
}
.modal .modal-sub {
  color: var(--blue-deep);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 18px;
}
.summary {
  background: #fff6cf;
  border: 2px solid var(--navy);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
}
.summary .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.summary .row span:first-child {
  color: var(--blue-deep);
  font-weight: 700;
}
.summary .row .big {
  font-size: 18px;
  font-weight: 900;
  color: var(--red);
}
.addr {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fbfdff;
  border: 2px dashed var(--blue);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 14px;
}
.addr button {
  margin-left: auto;
  flex: none;
  background: var(--blue);
  color: #fff;
  border: 2px solid var(--navy);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.modal-actions button {
  width: 100%;
  padding: 13px;
  border: 3px solid var(--navy);
  border-radius: 11px;
  font-weight: 900;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 8px;
  box-shadow: 0 4px 0 var(--navy);
}
.modal-actions button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--navy);
}
.btn-primary {
  background: var(--red);
  color: #fff;
}
.btn-ghost {
  background: #fff;
  color: var(--navy);
}
.note {
  font-size: 12.5px;
  color: var(--blue-deep);
  font-weight: 600;
  margin-top: 14px;
}
.status-ok {
  color: var(--blue-deep);
  font-weight: 900;
  text-align: center;
  font-size: 16px;
}
.status-err {
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
  margin-top: 10px;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #ffe9a8;
  border-top-color: var(--red);
  border-radius: 50%;
  margin: 8px auto;
  animation: spin 0.8s linear infinite;
}

footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  color: #eaf3ff;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
footer strong {
  color: #fff;
}
#footer-mode {
  font-weight: 900;
}

/* =====================================================================
   Top-tier animation layer
   ===================================================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.55); }
  60%  { opacity: 1; transform: scale(1.1); }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@keyframes flashPop {
  0%   { opacity: 0; transform: scale(0.5); }
  22%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.4); }
}
@keyframes burstPulse {
  0%   { filter: brightness(1) saturate(1); }
  28%  { filter: brightness(1.7) saturate(1.35); }
  100% { filter: brightness(1) saturate(1); }
}
@keyframes bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.16); color: var(--red); }
  100% { transform: scale(1); }
}
@keyframes titlePop {
  0%   { transform: scale(0.9) rotate(-1deg); opacity: 0; }
  60%  { transform: scale(1.03) rotate(0.5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

/* --- entrance stagger --- */
.hero-inner .eyebrow { animation: fadeUp 0.6s 0.02s both cubic-bezier(0.2, 0.7, 0.2, 1); }
h1                    { animation: titlePop 0.75s 0.1s both cubic-bezier(0.2, 0.8, 0.2, 1.1); }
.sub                  { animation: fadeUp 0.7s 0.24s both cubic-bezier(0.2, 0.7, 0.2, 1); }
.token-card           { animation: fadeUp 0.75s 0.34s both cubic-bezier(0.2, 0.7, 0.2, 1); }
main > .card:nth-of-type(1) { animation: fadeUp 0.7s 0.46s both cubic-bezier(0.2, 0.7, 0.2, 1); }
main > .card:nth-of-type(2) { animation: fadeUp 0.7s 0.56s both cubic-bezier(0.2, 0.7, 0.2, 1); }
footer                { animation: fadeUp 0.7s 0.66s both ease-out; }

/* --- token idle float --- */
.reveal-stage { animation: float 3.4s ease-in-out infinite; }
.silhouette { transition: background 0.25s, color 0.2s, transform 0.2s; }
.silhouette.pop { animation: popIn 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.25) both; }

/* --- the reveal flash --- */
.flash {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #fff 52%, rgba(255, 255, 255, 0) 74%);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.reveal-stage.flashing .flash { animation: flashPop 0.55s ease-out; }
.reveal-stage.flashing .burst { animation: spin 14s linear infinite, burstPulse 0.6s ease-out; }

/* --- price change pulse --- */
.price-value.bump { animation: bump 0.5s cubic-bezier(0.2, 0.9, 0.2, 1.4); }

/* --- button hover lift --- */
#submit-btn, .reveal-btn, .modal-actions button {
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1.2), box-shadow 0.12s, filter 0.15s;
}
#submit-btn:hover, .reveal-btn:hover, .modal-actions button:hover {
  transform: translateY(-2px);
}
#submit-btn:hover { box-shadow: 0 7px 0 var(--navy); }

/* --- history entrance stagger (re-runs whenever the list changes) --- */
.history li { animation: fadeUp 0.5s both cubic-bezier(0.2, 0.7, 0.2, 1); }
.history li:nth-child(1) { animation-delay: 0.03s; }
.history li:nth-child(2) { animation-delay: 0.09s; }
.history li:nth-child(3) { animation-delay: 0.15s; }
.history li:nth-child(4) { animation-delay: 0.21s; }
.history li:nth-child(5) { animation-delay: 0.27s; }
.history li:nth-child(6) { animation-delay: 0.33s; }
.history li:nth-child(n + 7) { animation-delay: 0.39s; }
.history li .h-name,
.history li .h-sym { transition: color 0.25s, opacity 0.25s; }

/* --- confetti overlay --- */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* --- modal entrance --- */
.modal { animation: fadeUp 0.2s ease-out; }
.modal-box { animation: popIn 0.42s cubic-bezier(0.2, 0.9, 0.2, 1.2) both; }

@media (prefers-reduced-motion: reduce) {
  *,
  .reveal-stage,
  .burst,
  .flash { animation: none !important; transition: none !important; }
}

/* hall of names */
.hall-count {
  display: inline-block;
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--navy);
  border-radius: 999px;
  padding: 0 9px;
  vertical-align: middle;
  margin-left: 4px;
}
.hall-count:empty { display: none; }
.hall-hint {
  margin: -8px 0 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-deep);
}
