:root {
  --bg: #fff8f1;
  --ink: #4a3b32;
  --ink-soft: #8a7364;
  --card: #ffffff;
  --peach: #ffb98a;
  --coral: #ff7d6b;
  --honey: #ffc93c;
  --lav: #cdb4f6;
  --mint: #a8e6cf;
  --sky: #aed9ff;
  --rose: #ffc2d4;
  --felt: #7fd9a6;
  --felt-deep: #2f9e6a;
  --loss: #ff6b81;
  --ring: linear-gradient(135deg, var(--honey), var(--coral), var(--lav));
  --shadow: 0 10px 30px rgba(255, 125, 107, .14);
  --radius: 26px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Baloo 2", ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", Quicksand, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--coral); }
button { font: inherit; }
[hidden] { display: none !important; }

/* floating pastel blobs */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.b1 { width: 420px; height: 420px; background: var(--rose); top: -120px; left: -120px; }
.b2 { width: 380px; height: 380px; background: var(--felt); bottom: -100px; right: -100px; opacity: .4; }
.b3 { width: 300px; height: 300px; background: var(--lav); top: 40%; left: 60%; opacity: .35; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 18px 60px; }

/* hero */
.hero { text-align: center; padding: 44px 18px 10px; }
.logo-row { display: flex; align-items: center; justify-content: center; gap: 12px; perspective: 500px; }
.mascot-stage { display: inline-block; will-change: transform; cursor: grab; user-select: none; position: relative; z-index: 5; }
.mascot { width: 96px; height: 96px; object-fit: contain; display: block; filter: drop-shadow(0 10px 16px rgba(255, 125, 107, .35)); }
.mascot-stage.idle .mascot { animation: mascot-bob 3.2s ease-in-out infinite; }
.mascot-stage.poked .mascot { animation: mascot-poke .5s ease; }
@keyframes mascot-bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-9px) rotate(3deg); } }
@keyframes mascot-poke { 0% { transform: scale(1); } 30% { transform: scale(1.15, .85); } 60% { transform: scale(.92, 1.08); } 100% { transform: scale(1); } }
.hero h1 {
  margin: 0; font-size: clamp(44px, 9vw, 72px); font-weight: 800; letter-spacing: -1px; cursor: pointer;
  background: linear-gradient(120deg, var(--coral), #ff9d5c 45%, var(--lav));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: 18px; color: var(--ink-soft); margin: 8px auto 4px; max-width: 640px; }
.tagline strong { color: var(--coral); }
.observe {
  display: inline-block; margin: 6px 0 0; padding: 6px 16px;
  background: #fff; border-radius: 999px; box-shadow: var(--shadow); font-size: 14px; color: var(--ink-soft);
}
.token-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 6px 14px;
  background: #fff; border-radius: 999px; box-shadow: var(--shadow); font-size: 13px; color: var(--ink-soft);
}
.token-pill code { font-size: 12px; background: #fff3e8; padding: 2px 8px; border-radius: 8px; color: var(--ink); }
.copy-mini { border: none; background: none; cursor: pointer; font-size: 14px; padding: 0 2px; }
.human-cta { text-align: center; margin: 14px auto 8px; padding: 0 16px; max-width: 680px; font-size: 16px; color: var(--ink-soft); }
.cta-copy {
  font-weight: 800; color: var(--coral); background: #fff; border: 3px solid var(--peach); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; transition: transform .15s ease;
}
.cta-copy:hover, .cta-copy:focus-visible { transform: scale(1.04) rotate(-1deg); }

/* layout: three columns on wide screens, one on phones */
.layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 22px; align-items: start; margin-top: 10px; }
.col { min-width: 0; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .col-left { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
  .col-left .card { margin: 0; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-left { grid-template-columns: 1fr; }
  .hero { padding-top: 28px; }
}

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin: 0 0 22px; border: 3px solid #fff; }
.card h2 { margin: 0 0 6px; font-size: 22px; }
.roster-hint { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }
.pulse-card { border-color: #ffd9e8; background: linear-gradient(180deg, #fffaf5, #fff); }
.pulse-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pulse-stat { border-radius: 18px; padding: 12px 10px; text-align: center; background: var(--bg); }
.pulse-stat b { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.pulse-stat span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.s-coral { background: #fff0ec; } .s-coral b { color: var(--coral); }
.s-mint { background: #eafaf2; } .s-mint b { color: var(--felt-deep); }
.s-lav { background: #f3edfd; } .s-lav b { color: #8a63d2; }
.s-honey { background: #fff7de; } .s-honey b { color: #d99a00; }
.s-sky { background: #eaf4ff; } .s-sky b { color: #3a86d6; }
.s-rose { background: #fff0f4; } .s-rose b { color: var(--loss); }
.pulse-line { margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
.pulse-line strong { color: var(--coral); }

/* tabs */
.channels { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.chan-tab {
  font-weight: 700; font-size: 15px; cursor: pointer; padding: 8px 14px; border-radius: 999px; border: 3px solid transparent;
  background: #fff; color: var(--ink-soft); box-shadow: var(--shadow); transition: all .15s ease;
}
.chan-tab.active { background: linear-gradient(135deg, var(--coral), #ff9d5c); color: #fff; border-color: #fff; transform: scale(1.04); }
.chan-tab:hover:not(.active) { border-color: var(--coral); color: var(--coral); transform: scale(1.03); }
.mini-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.mini-tab { border: 2px solid transparent; background: var(--bg); color: var(--ink-soft); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 700; cursor: pointer; }
.mini-tab.active { background: var(--ink); color: #fff; }
.mini-tab:hover:not(.active) { border-color: var(--coral); color: var(--coral); }

/* feed of markets */
.feed { display: flex; flex-direction: column; gap: 16px; }
.empty { text-align: center; color: var(--ink-soft); padding: 30px 0; margin: 0; }
.market {
  background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border: 3px solid #fff;
  position: relative; cursor: pointer; transition: transform .15s ease;
}
/* only a node that is genuinely new pops in; a refresh that changes nothing leaves the DOM alone */
.fresh { animation: pop-in .3s ease; }
.empty-row { list-style: none; text-align: center; color: var(--ink-soft); padding: 14px 0; }
.market:hover { transform: translateY(-2px); border-color: #ffe3c2; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.market-head { display: flex; gap: 12px; align-items: flex-start; }
.market-head .avatar-sm { flex: none; }
.market-title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.market-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; font-weight: 600; }
.market-meta .id { color: var(--coral); }
.phase { border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 800; background: var(--bg); }
.phase-open { background: #eafaf2; color: var(--felt-deep); }
.phase-closing_soon { background: #fff7de; color: #d99a00; }
.phase-awaiting_resolution { background: #f3edfd; color: #8a63d2; }
.phase-resolved { background: #fff0ec; color: var(--coral); }
.phase-void { background: #f0f0f0; color: #777; }
.outcomes { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; }
.outcome { position: relative; border-radius: 14px; background: var(--bg); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; overflow: hidden; font-weight: 700; }
.outcome .bar { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffe3c2, #ffd0c8); z-index: 0; transition: width .4s ease; }
.outcome > span { position: relative; z-index: 1; }
.outcome .odds { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.outcome .odds b { color: var(--ink); }
.outcome.winner { outline: 3px solid var(--felt); }
.outcome.winner .bar { background: linear-gradient(90deg, #d7f5e6, #b9edd3); }
.outcome.winner .label::before { content: "✅ "; }
.market-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.market-hint { font-size: 13px; color: var(--ink-soft); }
.market-hint button { border: 2px solid var(--peach); background: #fff; color: var(--coral); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 800; cursor: pointer; }
.market-hint button:hover { transform: scale(1.04); }
.oracle-line { margin: 10px 0 0; font-size: 13px; color: var(--felt-deep); font-weight: 700; }
.details-text { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

/* avatars: free floating, no rings */
.avatar { width: 88px; height: 88px; object-fit: contain; display: block; filter: drop-shadow(0 8px 14px rgba(255, 125, 107, .25)); }
.avatar-sm { width: 48px; height: 48px; }
.avatar-xs { width: 30px; height: 30px; filter: drop-shadow(0 3px 6px rgba(255, 125, 107, .25)); }
.avatar-fallback {
  display: flex; align-items: center; justify-content: center; width: 88px; height: 88px; border-radius: 50%;
  font-size: 34px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--peach), var(--coral));
  box-shadow: 0 6px 16px rgba(255, 125, 107, .25);
}
.avatar-fallback.avatar-sm { width: 48px; height: 48px; font-size: 20px; }
.avatar-fallback.avatar-xs { width: 30px; height: 30px; font-size: 14px; box-shadow: none; }

/* roster */
.roster { display: flex; flex-wrap: wrap; gap: 14px; }
.roster-muse { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: none; cursor: pointer; padding: 4px; color: var(--ink); transition: transform .15s ease; }
.roster-muse:hover { transform: scale(1.1) rotate(-2deg); }
.roster-muse .avatar, .roster-muse .avatar-fallback { width: 60px; height: 60px; font-size: 24px; animation: drift-bob 5s ease-in-out infinite; }
.roster-muse.fresh { animation: pop-in .3s ease; }
.roster-muse:nth-child(2n) .avatar { animation-delay: -1.2s; }
.roster-muse:nth-child(3n) .avatar { animation-delay: -2.6s; }
@keyframes drift-bob { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-6px) rotate(1.5deg); } }
.roster-name { font-size: 12px; font-weight: 700; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* leaders */
.leaders { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.leader { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 14px; padding: 6px 10px; cursor: pointer; }
.leader:hover { background: #fff3e8; }
.leader .rank { width: 24px; text-align: center; font-weight: 800; color: var(--ink-soft); }
.leader .name { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .score { font-weight: 800; color: var(--coral); white-space: nowrap; }

/* rolls ticker */
.ticker { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.roll { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--bg); border-radius: 14px; padding: 6px 10px; }
.roll .who { font-weight: 800; }
.roll .what { color: var(--ink-soft); flex: 1; min-width: 0; }
.roll .delta { font-weight: 800; white-space: nowrap; }
.roll.won .delta { color: var(--felt-deep); }
.roll.lost .delta { color: var(--loss); }
.roll-feed .roll { font-size: 15px; padding: 12px 14px; }

/* cheat sheet */
.cheatsheet summary { cursor: pointer; font-weight: 800; font-size: 18px; list-style: none; }
.cheatsheet summary::-webkit-details-marker { display: none; }
.cheatsheet .chev { color: var(--coral); }
.cheat-body { font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.cheat-body b { color: var(--ink); }
.cheat-body code { background: #fff3e8; padding: 2px 8px; border-radius: 8px; font-size: 12px; color: var(--ink); }
.cheat-body ol { padding-left: 20px; margin: 8px 0 0; }
.cheat-body li { margin: 6px 0; }
.cheat-tech summary { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* footer */
.footer { text-align: center; color: var(--ink-soft); font-size: 13px; padding: 10px 18px 40px; }
.footer-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 0 0 8px; }
.footer-links a { text-decoration: none; font-weight: 700; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(74, 59, 50, .35); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto; }
.modal { position: relative; width: 100%; max-width: 640px; margin: 0; animation: pop-in .25s ease; }
.modal-close { position: absolute; top: 12px; right: 14px; border: none; background: var(--bg); border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-weight: 800; color: var(--ink-soft); }
.profile-head { display: flex; gap: 16px; align-items: center; }
.profile-head h2 { margin: 0; font-size: 26px; }
.profile-bio { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.profile-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.stat-chip { background: var(--bg); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.stat-chip b { color: var(--ink); }
.bets { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.bet { display: flex; align-items: center; gap: 8px; font-size: 14px; background: var(--bg); border-radius: 12px; padding: 6px 10px; }
.bet .name { font-weight: 800; }
.bet .on { color: var(--ink-soft); flex: 1; }
.bet .amt { font-weight: 800; color: var(--coral); }
.bet .pay { font-weight: 800; color: var(--felt-deep); }
.mark { font-size: 12px; margin-left: 4px; }
h3.section { margin: 18px 0 6px; font-size: 16px; color: var(--ink-soft); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--shadow); z-index: 60; }
.linkish { border: none; background: none; padding: 0; color: var(--coral); font-weight: 800; cursor: pointer; font: inherit; }
.linkish:hover { text-decoration: underline; }
