/* Cookie Crumbs — tip jar cApp on Cookie Chain */
:root {
  --bg: #14100b;
  --bg2: #1c160e;
  --card: #221a10;
  --card-edge: #3a2d1a;
  --ink: #f6ecd9;
  --muted: #b9a888;
  --dim: #857355;
  --crumb: #ffb347;
  --crumb2: #ff8c42;
  --choc: #6b4423;
  --ok: #7dd87d;
  --err: #ff7b6b;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.hidden { display: none !important; }
.muted { color: var(--dim); font-size: 0.85em; }
a { color: var(--crumb); }

.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -5%, rgba(255, 140, 66, 0.16), transparent 65%),
    radial-gradient(500px 350px at -5% 25%, rgba(255, 179, 71, 0.10), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(107, 68, 35, 0.25), transparent 70%);
}

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px;
  background: rgba(20, 16, 11, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-edge);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-cookie { font-size: 30px; filter: drop-shadow(0 0 12px rgba(255, 179, 71, 0.45)); }
.brand-name { font-weight: 900; font-size: 17px; letter-spacing: 0.3px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.net-badge {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--card-edge); border-radius: 999px; padding: 6px 12px;
  background: var(--bg2);
}

/* buttons */
.btn {
  font-family: inherit; font-weight: 700; cursor: pointer;
  border-radius: 12px; border: 1px solid transparent;
  padding: 10px 18px; font-size: 14px;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--crumb), var(--crumb2));
  color: #2a1706;
  box-shadow: 0 4px 22px rgba(255, 140, 66, 0.35);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { filter: grayscale(0.6) brightness(0.7); cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--card-edge); }
.btn-ghost:hover { color: var(--ink); background: var(--bg2); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-big { width: 100%; padding: 14px; font-size: 16px; border-radius: 14px; }

/* layout */
.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 30px 22px 60px; }
.hero { margin: 12px 0 26px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; margin: 0 0 12px; font-weight: 900; }
.accent {
  background: linear-gradient(135deg, var(--crumb), var(--crumb2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); max-width: 720px; line-height: 1.55; font-size: 15px; }
.hero-sub strong { color: var(--ink); }

.grid { display: grid; grid-template-columns: 460px 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.card h2 { margin: 0 0 6px; font-size: 20px; }
.card h3 { margin: 18px 0 10px; font-size: 16px; }

/* banners */
.banner {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  background: rgba(255, 179, 71, 0.08);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 14px; padding: 14px 16px; margin: 0 0 18px;
  color: var(--ink); font-size: 14px; line-height: 1.45;
}
.banner-fund { background: rgba(125, 216, 125, 0.07); border-color: rgba(125, 216, 125, 0.3); }
.banner code { background: var(--bg2); border: 1px solid var(--card-edge); border-radius: 6px; padding: 1px 6px; font-size: 12px; }

/* sponsor banner (rented slot) */
.sponsor-banner {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.14), rgba(255, 140, 66, 0.07) 60%, transparent);
  border: 1px solid var(--card-edge);
  border-radius: 14px;
  padding: 10px 16px;
  margin: 0 0 18px;
  font-size: 14px;
}
.sponsor-tag {
  flex: none;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; letter-spacing: 1.5px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--crumb), var(--crumb2));
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 700;
}
.sponsor-when { margin-left: auto; font-size: 12px; color: var(--dim); white-space: nowrap; }

/* jar */
.jar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.jar-addr { color: var(--muted); font-size: 12px; text-decoration: none; border-bottom: 1px dashed var(--dim); }
.jar-addr:hover { color: var(--crumb); }
.jar-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 6px;
}
.stat {
  background: var(--bg2); border: 1px solid var(--card-edge); border-radius: 12px;
  padding: 10px 12px; min-width: 0;
}
.stat-label { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value { font-family: "JetBrains Mono", monospace; font-weight: 800; font-size: 18px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chart { width: 100%; margin-top: 8px; }
.chart-caption { color: var(--dim); font-size: 11px; margin-top: 4px; }

/* tip goal (mechanism #9) */
.goal-section { margin-top: 14px; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.goal-label { font-weight: 700; font-size: 13px; }
.goal-amounts { color: var(--dim); font-size: 12px; }
.goal-bar { height: 10px; border-radius: 6px; background: #2a2318; overflow: hidden; }
.goal-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ffb347, #ff8a3d); transition: width 0.6s ease; }
.goal-status { color: var(--dim); font-size: 11px; margin-top: 5px; }
.goal-set { margin-top: 14px; padding-top: 14px; border-top: 1px solid #2a2a2a; }
.goal-form { display: flex; gap: 8px; margin: 8px 0; }
.goal-form input {
  flex: 1; min-width: 0; padding: 9px 10px; border-radius: 8px; font-size: 13px;
  border: 1px solid #333; background: #0d0d0d; color: var(--fg);
  font-family: "JetBrains Mono", monospace;
}
html.cc-embed .goal-set { display: none !important; }
.sep { border: none; border-top: 1px solid var(--card-edge); margin: 18px 0; }

/* form */
.tip-form { display: flex; flex-direction: column; gap: 8px; }
.tip-form label { color: var(--muted); font-size: 13px; font-weight: 500; }
.tip-form input, .tip-form textarea {
  font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg2); border: 1px solid var(--card-edge); border-radius: 12px;
  padding: 12px 14px; outline: none; resize: vertical;
}
.tip-form input:focus, .tip-form textarea:focus { border-color: var(--crumb); }
.amount-chips { display: inline-flex; gap: 6px; margin-left: auto; }
.chip {
  font-family: "JetBrains Mono", monospace; font-size: 12px; cursor: pointer;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--card-edge);
  border-radius: 999px; padding: 4px 10px;
}
.chip:hover { color: var(--crumb); border-color: var(--crumb); }
.chip-boost {
  background: linear-gradient(90deg, #ff8c42, #ffb347);
  color: #1a1208; border-color: #ff8c42; font-weight: 800;
}
.chip-boost:hover { color: #1a1208; filter: brightness(1.08); }
.chip-sponsor {
  background: linear-gradient(90deg, #b388ff, #d2b4ff);
  color: #14081a; border-color: #b388ff; font-weight: 800;
}
.chip-sponsor:hover { color: #14081a; filter: brightness(1.08); }
.fineprint { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }

/* status */
.status { border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.5; border: 1px solid; }
.status.ok { background: rgba(125, 216, 125, 0.09); border-color: rgba(125, 216, 125, 0.4); }
.status.err { background: rgba(255, 123, 107, 0.09); border-color: rgba(255, 123, 107, 0.4); }
.status.info { background: rgba(255, 179, 71, 0.08); border-color: rgba(255, 179, 71, 0.35); }
.status a { word-break: break-all; }

/* feed */
.feed-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; padding-right: 4px; }
.feed-empty { color: var(--dim); font-size: 14px; padding: 18px 4px; }
.crumbs { display: flex; align-items: center; gap: 12px; }
.crumbs.down .crumb-emoji { transform: rotate(180deg); }
.crumb-emoji { font-size: 22px; }
.crumb-line { flex: 1; min-width: 0; }
.crumb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.crumb-amount { font-family: "JetBrains Mono", monospace; font-weight: 800; color: var(--crumb); white-space: nowrap; }
.crumb-from { color: var(--muted); font-size: 12px; text-decoration: none; }
.crumb-from:hover { color: var(--crumb); }
.crumb-msg { color: var(--ink); font-size: 13px; margin-top: 3px; opacity: 0.9; word-break: break-word; }
.crumb-time { color: var(--dim); font-size: 11px; white-space: nowrap; }
.crumb-ref { font-size: 11px; cursor: help; opacity: 0.85; }
.crumb-boost {
  font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ff8c42, #ffb347);
  color: #1a1208; border-radius: 999px; padding: 2px 8px; white-space: nowrap;
  cursor: help;
}
.crumb-boosted {
  background: rgba(255, 179, 71, 0.07);
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 12px; padding: 8px 10px; margin: 0 -10px;
}
.feed-note { color: var(--dim); font-size: 11px; margin-top: 12px; line-height: 1.5; }
.feed-note code { background: var(--bg2); border-radius: 5px; padding: 1px 5px; }

/* how */
.how-card { margin-top: 20px; }
.how { color: var(--muted); line-height: 1.8; padding-left: 20px; font-size: 14px; }
.how strong { color: var(--ink); }

/* footer */
.footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 18px 22px 30px;
  color: var(--dim); font-size: 12px;
}

/* toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--card); border: 1px solid var(--card-edge); border-left: 3px solid var(--crumb);
  color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: slidein 0.25s ease;
  max-width: 340px;
}
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }


/* ---------- make-your-own tip page ---------- */
.own-card { margin-top: 26px; }
.own-blurb { margin: 8px 0 16px; }
.own-form { display: flex; flex-direction: column; gap: 12px; }
.own-input {
  width: 100%;
  background: var(--card, #1c1613);
  border: 1px solid rgba(255, 179, 71, 0.25);
  border-radius: 12px;
  color: inherit;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  padding: 12px 14px;
}
.own-input:focus { outline: none; border-color: #ffb347; }
.own-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.own-preview {
  word-break: break-all;
  font-size: 0.8rem;
  color: var(--dim, #857355);
  min-height: 1em;
}
@media (max-width: 640px) {
  .own-actions .btn { width: 100%; }
}


/* ---------- embed this jar ---------- */
.embed-card { margin-top: 26px; }
.embed-blurb { margin: 8px 0 14px; }
.embed-snippet {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 179, 71, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  margin: 0 0 12px;
  user-select: all;
}
.embed-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .embed-actions .btn { width: 100%; }
}


/* ---------- tip splits (mechanism #11) ---------- */
/* A jar with an owner-registered split advertises it to every visitor, so a
   shared tip jar pays its collaborators automatically. */
.split-note {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  border-radius: 10px;
  background: rgba(255, 179, 71, 0.07);
  color: #ffd9a0;
  font-size: 0.85rem;
  text-align: center;
}
.split-set { margin: 14px 0 0; }
.split-form { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.split-form input {
  width: 100%;
  background: var(--card, #1c1613);
  border: 1px solid rgba(255, 179, 71, 0.25);
  border-radius: 12px;
  color: inherit;
  font-size: 0.92rem;
  padding: 12px 14px;
}
.split-form input:focus { outline: none; border-color: #ffb347; }

/* ---------- embed mode (?embed=1, loaded inside the widget iframe) ---------- */
/* Strip the app down to the tipping flow: no topbar chrome, no promo/footer,
   no flows that only make sense on a full page. */
html.cc-embed body { padding: 0; }
html.cc-embed .topbar,
html.cc-embed .hero,
html.cc-embed .banner,
html.cc-embed .sponsor-banner,
html.cc-embed .sponsor-card,
html.cc-embed .own-card,
html.cc-embed .embed-card,
html.cc-embed .how-card,
html.cc-embed .footer { display: none !important; }
html.cc-embed .wrap { padding: 16px 14px; max-width: 560px; margin: 0 auto; }
