:root {
  color-scheme: light;
  --bg: #f5f2ed;
  --card: rgba(255, 255, 255, 0.88);
  --ink: #252826;
  --muted: #747b77;
  --accent: #577f70;
  --accent-dark: #3f6658;
  --line: #e5e0d8;
  --shadow: 0 16px 38px rgba(69, 76, 71, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, #dcebe4 0, transparent 38%),
    linear-gradient(180deg, #f8f5f0, var(--bg));
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 14px max(30px, env(safe-area-inset-bottom));
}

.hero { padding: 14px 6px 18px; }
.hero h1 { margin: 7px 0 6px; font-size: clamp(28px, 8vw, 42px); line-height: 1.04; letter-spacing: -0.04em; }
.hero p, .muted, .note { color: var(--muted); }
.eyebrow, .section-label { color: var(--accent-dark); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.card {
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.link-value {
  margin: 9px 0 15px;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #faf9f6;
  font-size: 13px;
}

.actions, .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats { grid-template-columns: repeat(3, 1fr); margin-bottom: 12px; }
.stats .card { margin: 0; padding: 15px 9px; }
.metric { min-width: 0; text-align: center; }
.metric-value { display: block; font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.metric-label { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }

.button {
  min-height: 46px;
  padding: 10px 15px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.button:disabled { cursor: default; opacity: .48; }
.primary { background: var(--accent); color: white; }
.primary:active { background: var(--accent-dark); }
.secondary { background: #edf3ef; color: var(--accent-dark); }
.wide { width: 100%; margin-top: 16px; }

.balance-card { background: linear-gradient(145deg, #fff, #eaf3ee); }
.balance { display: block; margin: 3px 0 0; font-size: 38px; letter-spacing: -.05em; }
.muted { display: block; font-size: 13px; }
.note { margin: 10px 0 0; font-size: 13px; text-align: center; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; }
.section-heading h2, .terms h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--muted); font-size: 12px; }
.events { margin-top: 8px; }
.event { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event:last-child { border-bottom: 0; }
.event-user { font-weight: 700; overflow-wrap: anywhere; }
.event-status, .event-date { color: var(--muted); font-size: 12px; }
.event-reward { grid-row: span 2; align-self: center; color: var(--accent-dark); font-weight: 800; }
.empty { margin: 18px 0 4px; color: var(--muted); text-align: center; }
.terms ul { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.terms li + li { margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 5;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 11px 16px;
  transform: translate(-50%, 30px);
  border-radius: 14px;
  background: #252826;
  color: white;
  opacity: 0;
  transition: .2s ease;
  pointer-events: none;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 350px) {
  .stats { grid-template-columns: 1fr; }
  .stats .card { display: flex; align-items: center; justify-content: space-between; text-align: left; }
  .metric-label { text-align: right; }
}
