/*  The "Hot Potato" Cousin
 *  One stylesheet for the whole page. The old React build's CSS is no longer
 *  loaded - everything the page needs is here.
 */

:root {
  --bg: #4b3ca3;
  --bg-deep: #413291;
  --card: #ffffff;
  --ink: #333333;
  --ink-soft: #8b8b9a;
  --violet: #5546ff;
  --green: #00c087;
  --gold: #fcdf5c;
  --pill: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.14);
  --measure: 540px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;

  /* The footer belongs at the bottom of the page, under everything else. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 36px 20px 0;
}

/* ---------- the cousin himself ---------- */

.hero {
  text-align: center;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

@keyframes shake {
  0%, 100% { transform: translate(1px, 1px) rotate(0deg); }
  20% { transform: translate(-3px, 0) rotate(1deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
}

.potato {
  width: 150px;
  height: auto;
  display: block;
  margin: 0 auto 10px;
  animation: float 3s ease-in-out infinite;
  transition: transform 0.2s;
}

.potato:hover {
  transform: scale(1.12);
  animation: shake 0.5s infinite;
  filter: drop-shadow(0 10px 15px rgba(255, 100, 0, 0.4));
  cursor: grab;
}

@media (prefers-reduced-motion: reduce) {
  .potato,
  .potato:hover {
    animation: none;
  }
}

h1 {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 12px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tagline {
  opacity: 0.85;
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 24em;
}

.wallet-pill {
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  margin: 18px auto 0;
  width: fit-content;
  font-size: 0.85rem;
}

.wallet-pill[data-connected="true"] {
  display: inline-flex;
}

.dot {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

.wallet-address {
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.link-button {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
}

.link-button:hover {
  color: #fff;
  text-decoration: underline;
}

/* ---------- the offer ---------- */

.deal {
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  padding: 32px 28px;
  margin: 32px 0 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 800;
  color: #9d9daa;
}

.price {
  font-size: 3.4rem;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--violet);
  line-height: 1.1;
  margin: 6px 0 0;
}

.price .unit {
  font-size: 1.4rem;
  letter-spacing: 0;
  margin-left: 4px;
}

.usd {
  color: #b3b3c0;
  font-size: 1rem;
  font-weight: 500;
  min-height: 1.2em;
}

.pitch {
  color: #6f6f80;
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 18px auto 24px;
  max-width: 30em;
}

.action {
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 16px 28px;
  font-size: 1.05rem;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(85, 70, 255, 0.3);
  transition: transform 0.1s, background 0.2s;
}

.action:hover:not(:disabled) {
  background: #4436e0;
}

.action:active:not(:disabled) {
  transform: scale(0.985);
}

.action:disabled {
  background: #ececf3;
  color: #9d9daa;
  box-shadow: none;
  cursor: default;
}

.hint {
  color: #a5a5b4;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 14px 0 0;
  min-height: 1.2em;
}

.hint a {
  color: var(--violet);
  font-weight: 700;
}

.hint.is-warning {
  color: #7a5c00;
  background: #fff6d8;
  border-radius: 12px;
  padding: 12px 14px;
}

/* ---------- wallet chooser ----------
 * Stands in for @stacks/connect's own dialog, which cannot render when the
 * library is loaded from a CDN. Same wallets, same install links.
 */

.chooser {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 14, 60, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.chooser-card {
  position: relative;
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  padding: 26px 24px 22px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.chooser-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: #c3c3ce;
  cursor: pointer;
  padding: 4px;
}

.chooser-close:hover {
  color: var(--ink);
}

.chooser-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
}

.chooser-sub {
  margin: 0 0 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.chooser-list {
  display: grid;
  gap: 10px;
}

.chooser-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #f5f5fa;
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.chooser-wallet:hover,
.chooser-wallet:focus-visible {
  border-color: var(--violet);
  background: #fff;
  outline: none;
}

.chooser-wallet.is-missing {
  opacity: 0.72;
}

.chooser-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.chooser-name {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
}

.chooser-state {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a5a5b4;
  white-space: nowrap;
}

.chooser-state.is-ready {
  color: #00875f;
}

/* ---------- who has been stuck with him ---------- */

.custody {
  margin: 54px 0 0;
}

.custody h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 8px;
  text-align: center;
}

.custody-sub {
  opacity: 0.8;
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
  margin: 0 auto 16px;
  max-width: 28em;
}

.summary {
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 auto 22px;
  width: fit-content;
  max-width: 100%;
  text-align: center;
}

.summary:empty {
  display: none;
}

.custody-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.caretaker {
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 2px solid transparent;
}

.caretaker.is-current {
  border-color: var(--violet);
  box-shadow: 0 12px 28px rgba(85, 70, 255, 0.35);
}

.caretaker.is-you {
  border-color: var(--green);
  box-shadow: 0 12px 28px rgba(0, 192, 135, 0.3);
}

.avatar {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.caretaker-body {
  flex: 1;
  min-width: 0;
}

.caretaker-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.address {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dotted #c3c3ce;
}

.address:hover {
  color: var(--violet);
  border-bottom-color: currentColor;
}

.tag {
  background: #f0f0f5;
  color: #8b8b9a;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.tag.is-gold {
  background: #fff4d1;
  color: #9a6b00;
}

.tag.is-fast {
  background: rgba(85, 70, 255, 0.1);
  color: var(--violet);
}

.tag.is-you {
  background: rgba(0, 192, 135, 0.12);
  color: #00875f;
}

.held {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--violet);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 6px;
}

/* Tabular figures keep the running clock from wobbling every second. */
.clock {
  font-family: "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.still-counting {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #b9b9c6;
}

.caretaker-meta {
  font-size: 0.78rem;
  color: #9d9daa;
  line-height: 1.5;
}

.notice {
  background: var(--pill);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ---------- footer, at the bottom where it belongs ---------- */

footer {
  flex-shrink: 0;
  margin-top: 60px;
  padding: 22px 20px 28px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
}

footer a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 700;
  text-decoration: none;
}

footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-sep {
  opacity: 0.4;
  margin: 0 8px;
}

@media (max-width: 480px) {
  main {
    padding-top: 26px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .potato {
    width: 118px;
  }

  .deal {
    padding: 26px 20px;
  }

  .price {
    font-size: 2.8rem;
  }

  .caretaker {
    padding: 16px;
    gap: 12px;
  }

  .held {
    font-size: 1.25rem;
  }

  .footer-sep {
    display: block;
    height: 0;
    overflow: hidden;
  }
}

.chooser-icon--letter {
  display: grid;
  place-items: center;
  background: #e7e7f0;
  color: #7a7a8c;
  font-weight: 800;
  font-size: 0.95rem;
}

.chooser-help {
  margin: 16px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

.chooser-diagnostics {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--violet);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- streak ---------- */

.streak {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0 0 20px;
  text-align: left;
}

.streak:empty {
  display: none;
}

.streak-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.streak-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.75;
}

.streak-clock {
  font-family: "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold);
}

.streak-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  margin: 12px 0 10px;
}

.streak-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7a6bff, var(--gold));
  transition: width 0.6s ease-out;
}

.streak-fill.is-record {
  background: linear-gradient(90deg, var(--gold), #ff9f43);
}

.streak-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
  opacity: 0.8;
}

/* ---------- stat chips ---------- */

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 18px;
  width: auto;
}

.chip {
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- per-turn ledger ---------- */

.caretaker-money {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.72rem;
  color: #a5a5b4;
}

.net {
  font-weight: 800;
  border-radius: 6px;
  padding: 3px 7px;
}

.net.is-up {
  background: rgba(0, 192, 135, 0.12);
  color: #00875f;
}

.net.is-down {
  background: rgba(255, 59, 92, 0.1);
  color: #d32f4b;
}

.net.is-waiting {
  background: #f0f0f5;
  color: #8b8b9a;
}

.tag.is-repeat {
  background: #ede9ff;
  color: #5a43c9;
}
