/* PUDDLE INDEX — playful-brutalist, cig-index energy. simple front, theatrics after. */
:root {
  --paper: #F7F2E7;
  --ink: #14212B;
  --water: #3FA7E8;
  --water-deep: #0E5AA7;
  --doom: #D64B33;
  --shadow: 6px 6px 0 var(--ink);
  --border: 3px solid var(--ink);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Space Mono", ui-monospace, monospace;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, .big-number, .flood-mult, .logo {
  font-family: "Archivo Black", sans-serif;
  text-transform: uppercase;
  line-height: 1.05;
}

.hidden { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  justify-content: center;
  padding: 14px 20px;
  border-bottom: var(--border);
}
.logo { font-size: 20px; letter-spacing: 0.5px; }

/* ---------- hero (the whole front screen) ---------- */
.hero {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 20px 56px;
  text-align: center;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero h1 { font-size: clamp(36px, 7vw, 64px); }
.hero-sub {
  margin: 18px 0 40px;
  font-size: clamp(15px, 2.6vw, 19px);
  font-weight: 700;
  color: var(--water-deep);
}

.input-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
#tokenInput {
  font-family: inherit;
  font-size: 18px;
  padding: 14px 16px;
  border: var(--border);
  background: #fff;
  width: min(340px, 100%);
  box-shadow: var(--shadow);
  outline: none;
}
#tokenInput:focus { border-color: var(--water-deep); }

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
  padding: 14px 22px;
  border: var(--border);
  background: var(--water);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-transform: uppercase;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn-ghost { background: transparent; }
.btn-light { background: #fff; }

.input-hint { margin-top: 12px; font-size: 12px; opacity: 0.55; }

.presets { margin-top: 44px; }
.presets-label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 12px; opacity: 0.7; }
.preset-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: #fff;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}
.chip:hover { background: var(--water); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.link-btn {
  margin-top: 22px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--water-deep);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- result ---------- */
.result {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 56px;
  text-align: center;
  border-top: var(--border);
}

/* glass stage — one universal vessel: a glass of water */
.glass-stage {
  position: relative;
  margin: 12px auto 0;
  width: 320px;
  height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.drop-zone {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 160px; height: 80px;
  pointer-events: none;
  z-index: 2;
}
.drop {
  position: absolute;
  top: -12px;
  width: 10px; height: 14px;
  background: var(--water-deep);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: fall 0.55s cubic-bezier(0.5, 0, 1, 1) forwards;
}
@keyframes fall {
  to { transform: translateY(260px) scaleY(1.2); opacity: 0.15; }
}
/* THE puddle — the site's official unit, spreading on the ground */
.ground {
  position: absolute;
  bottom: 46px;
  left: 6px; right: 6px;
  border-top: 3px solid var(--ink);
  z-index: 0;
}
.puddle {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translate(-50%, 50%);
  width: 0px;
  height: 8px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--water) 0%, var(--water-deep) 100%);
  z-index: 1;
}
/* front half of the water — overlaps floating props so they sit IN it */
.puddle-front {
  z-index: 3;
  clip-path: inset(50% 0 0 0);
}
.doomer .puddle { background: linear-gradient(180deg, #E08A5B 0%, var(--doom) 100%); }

/* scale-dependent set dressing: pond, lake, inland sea (little flat SVGs) */
.props { position: absolute; inset: 0; pointer-events: none; }
.prop {
  position: absolute;
  line-height: 0;
  transform: scale(0);
  animation: popin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.prop svg { display: block; width: 100%; height: auto; }
.prop.bank { z-index: 0; }
.prop.float {
  z-index: 2;
  animation: popin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, bob 3s ease-in-out 0.6s infinite;
}
@keyframes popin { to { transform: scale(1); } }
@keyframes bob { 0%, 100% { margin-bottom: 0; } 50% { margin-bottom: 5px; } }

.glass-caption { margin-top: 16px; font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }


.big-number { font-size: clamp(40px, 9vw, 72px); margin-top: 24px; }
.headline { font-size: clamp(15px, 2.8vw, 19px); font-weight: 700; margin-top: 12px; }

.mode-toggle {
  display: inline-flex;
  border: var(--border);
  box-shadow: var(--shadow);
  margin-top: 30px;
}
.mode-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 16px;
  border: none;
  background: #fff;
  cursor: pointer;
}
.mode-btn + .mode-btn { border-left: var(--border); }
.mode-btn.active { background: var(--water); }
#modeDoomer.active { background: var(--doom); color: #fff; }
.mode-note { font-size: 11px; opacity: 0.6; margin-top: 10px; max-width: 440px; margin-inline: auto; }

.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }

/* ---------- equivalents ---------- */
.equivalents {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 20px 56px;
  text-align: center;
  border-top: var(--border);
}
.equivalents h2 { font-size: clamp(22px, 4.5vw, 34px); }
.equiv-sub { margin: 10px 0 28px; font-size: 13px; opacity: 0.65; }
/* the chart — one series (water), you highlighted in ink */
.chart-wrap {
  overflow-x: auto;
  padding: 8px 4px 4px;
  -webkit-overflow-scrolling: touch;
}
.chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 360px;
  min-width: 800px;
  padding: 24px 8px 0 48px;
}
.gridline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed rgba(20, 33, 43, 0.18);
  pointer-events: none;
}
.gridline span {
  position: absolute;
  left: 0;
  top: -14px;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.5;
  background: var(--paper);
  padding-right: 4px;
}
.bar-col {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.bar-value {
  font-size: 9px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  opacity: 0.75;
}
.bar {
  width: 100%;
  max-width: 44px;
  height: 0%;
  border: 2px solid var(--ink);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--water) 0%, var(--water-deep) 100%);
  transition: height 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-col:hover .bar { filter: brightness(1.12); }
.bar-col:active .bar { filter: brightness(0.92); }
.bar-col.you .bar { background: var(--ink); }
.bar-col.you .bar-value { opacity: 1; font-size: 11px; }
.bar-you-tag {
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}
.doomer .bar-col.you .bar { background: var(--doom); }
.bar-emoji { font-size: 18px; margin-top: 6px; line-height: 1; }
.bar-name {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 3px;
  opacity: 0.6;
  white-space: nowrap;
}
.chart-baseline { border-top: var(--border); margin: 0 4px; min-width: 640px; }
.chart-tip {
  position: fixed;
  z-index: 40;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 10px;
  pointer-events: none;
  max-width: 220px;
  text-align: left;
  line-height: 1.4;
}
.chart-tip .tip-mult { color: #7FD4FF; }

/* ---------- find your number ---------- */
.find { max-width: 720px; margin: 0 auto; padding: 32px 20px; }
.find details {
  border: var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}
.find summary {
  font-weight: 700;
  font-size: 15px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  text-transform: uppercase;
}
.find summary::after { content: " +"; float: right; }
.find details[open] summary::after { content: " –"; }
.find-body { padding: 0 20px 20px; font-size: 13px; }
.find-hero { font-weight: 700; margin-bottom: 8px; }
.code {
  background: var(--ink);
  color: #7FD4FF;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 15px;
  margin: 8px 0 12px;
  overflow-x: auto;
}
.find-table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.find-table td { border-top: 1px solid rgba(20, 33, 43, 0.2); padding: 8px 6px; font-size: 12px; vertical-align: top; }
.find-table td:first-child { font-weight: 700; white-space: nowrap; padding-right: 14px; }
.find-table code { background: rgba(63, 167, 232, 0.18); padding: 1px 5px; }

/* ---------- footer (small, collapsed) ---------- */
.footer {
  border-top: var(--border);
  padding: 28px 20px 32px;
  max-width: 720px;
  margin: 0 auto;
}
.footer details { font-size: 12px; }
.footer summary {
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
  text-transform: uppercase;
  opacity: 0.7;
  text-align: center;
}
.footer summary::after { content: " +"; }
.footer details[open] summary::after { content: " –"; }
.method-body { margin-top: 16px; opacity: 0.85; }
.method-body p { margin-bottom: 10px; }
.sources { margin: 10px 0 0 18px; }
.sources li { margin-bottom: 4px; }
.sources a { color: var(--water-deep); }
.footnote { margin-top: 12px; font-size: 11px; opacity: 0.7; }
.credit { margin-top: 20px; text-align: center; font-size: 13px; font-weight: 700; }
.credit a { color: var(--water-deep); }

/* ---------- share card overlay ---------- */
.share {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 33, 43, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.share-content {
  background: var(--paper);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
}
.share-title { font-weight: 700; font-size: 14px; letter-spacing: 1px; margin-bottom: 14px; }
.share-img { display: block; width: 100%; border: 2px solid var(--ink); }
.share-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.share-actions .btn { font-size: 13px; padding: 10px 16px; }
a.btn { text-decoration: none; display: inline-block; }
.share-close { margin-top: 14px; opacity: 0.7; }

/* ---------- flood overlay ---------- */
.flood {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 33, 43, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.flood-big {
  position: absolute;
  left: 50%; top: 58%;
  width: 130px; height: 48px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, var(--water) 0%, var(--water-deep) 85%);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 2.2s cubic-bezier(0.55, 0, 0.45, 1);
}
.doomer .flood-big { background: radial-gradient(ellipse at center, #E08A5B 0%, var(--doom) 85%); }
.flood-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #fff;
  padding: 24px;
  text-shadow: 2px 2px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.puddle-mini {
  width: 0px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--water) 0%, var(--water-deep) 100%);
  margin: 16px 0 10px;
  transition: width 0.6s ease-out;
}
.flood-item { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.flood-mult { font-size: clamp(48px, 12vw, 104px); margin: 4px 0; }
.flood-note { font-size: 14px; font-weight: 700; margin-bottom: 22px; max-width: 420px; }
.flood .btn { text-shadow: none; }

@media (max-width: 480px) {
  .btn { width: 100%; }
  .input-row { flex-direction: column; align-items: stretch; }
}
