/* Tokens taken straight from the Snazzle logo artwork */
:root {
  --choc: #5B1518;
  --choc-2: #7A2A1E;
  --caramel: #A53C20;
  --caramel-2: #C8602A;
  --milk: #9E7068;
  --rasp: #C42A55;
  --cream: #FBF3C8;
  --cream-2: #FAE9B7;
  --sand: #F7D694;
  --gold: #E9A21E;
  --white: #fff;
  --ink: #3A0E10;
  --ink-2: #6E4A44;
  --line: #EAD9B8;
  --ok: #1F7A3D;
  --ok-bg: #E2F5E6;
  --bad: #B3261E;
  --bad-bg: #FBE6E3;
  --r: 18px;
  --r-lg: 28px;
  --shadow-clay: 0 10px 24px rgba(91, 21, 24, .14), inset 0 2px 0 rgba(255, 255, 255, .8), inset 0 -3px 0 rgba(91, 21, 24, .05);
  --spring: cubic-bezier(.2, 1.3, .4, 1);
  --head: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 600 16px/1.5 var(--body); color: var(--ink); background: var(--cream); -webkit-tap-highlight-color: transparent; overflow-x: hidden; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; margin: 0; color: var(--choc); }
p { margin: 0; }
a { color: var(--caramel); }
img { max-width: 100%; }
.i3d { display: inline-block; flex: none; object-fit: contain; filter: drop-shadow(0 5px 6px rgba(91, 21, 24, .24)); vertical-align: middle; }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--caramel); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-weight: 700; letter-spacing: .03em; overflow-wrap: anywhere; }

/* Buttons feel physical: a raised lip that presses down */
.btn {
  --lip: #3C0D0F; --bg: var(--choc); --fg: #fff;
  appearance: none; border: 0; cursor: pointer; font: 600 16px/1.2 var(--head);
  min-height: 48px; padding: 12px 20px; border-radius: 16px; color: var(--fg); background: var(--bg);
  box-shadow: 0 4px 0 var(--lip), 0 10px 18px rgba(91, 21, 24, .22);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s; touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--lip), 0 12px 20px rgba(91, 21, 24, .24); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip), 0 3px 6px rgba(91, 21, 24, .2); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.busy { position: relative; color: transparent; }
.btn.busy::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.ghost { --bg: #fff; --fg: var(--choc); --lip: var(--line); }
.btn.ghost.busy::after { border-color: rgba(91, 21, 24, .2); border-top-color: var(--choc); }
.btn.caramel { --bg: var(--caramel); --lip: #6F2612; }
.btn.good { --bg: var(--ok); --lip: #12532A; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 800; font-size: 14px; color: var(--choc); margin-bottom: 6px; }
.field small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 4px; }
input, textarea, select {
  width: 100%; font: 600 16px/1.4 var(--body); color: var(--ink); background: #fff; min-height: 48px;
  border: 2px solid var(--line); border-radius: 14px; padding: 11px 14px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(165, 60, 32, .18); }
.form-error { color: var(--bad); font-weight: 700; font-size: 14px; min-height: 0; margin: 0 0 10px; }
.form-error:empty { display: none; }

.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 420px); display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--choc); color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 700; box-shadow: 0 10px 24px rgba(58, 14, 16, .35); animation: rise .3s var(--spring); transition: opacity .3s, transform .3s; text-align: center; }
.toast.bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.96); } }

.dialog { border: 0; border-radius: var(--r-lg); padding: 24px; width: min(92vw, 420px); box-shadow: 0 30px 70px rgba(58, 14, 16, .4); color: var(--ink); }
.dialog::backdrop { background: rgba(58, 14, 16, .45); backdrop-filter: blur(3px); }
.dialog h2 { font-size: 22px; margin-bottom: 8px; }
.dialog p { margin-bottom: 18px; color: var(--ink-2); }

.burst { position: fixed; inset: 0; z-index: 80; pointer-events: none; perspective: 700px; display: grid; place-items: center; overflow: hidden; }
.burst img { grid-area: 1 / 1; width: 46px; height: 46px; opacity: 0; animation: fling 1.6s cubic-bezier(.12, .7, .3, 1) forwards; }
@keyframes fling {
  0% { opacity: 1; transform: translate3d(0, 0, 0) scale(.3); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--x), calc(var(--y) + 180px), var(--z)) rotate3d(1, 1, .3, var(--r)) scale(var(--s)); }
}
.skeleton { background: linear-gradient(100deg, rgba(255,255,255,.4) 30%, rgba(255,255,255,.85) 50%, rgba(255,255,255,.4) 70%); background-size: 240% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -240% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
