@font-face {
  font-family: Fredoka;
  src: url("/gimme/fredoka.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("/gimme/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ground: #fbf7ee;
  --card: #fdfbf8;
  --ink: #25221e;
  --muted: #6e685f;
  --line: #eae0d2;
  --field-line: #958475;
  --peach: #ff7659;
  --peach-ink: #963d2a;
  --eyebrow: #aa3b28;
  --peach-wash: #ffe9d8;
  --mint-wash: #ecf5e9;
  --green: #216b53;
  --red: #a63b2b;
  --link-hover: #fff1e8;
  --action: #a54531;
  --action-hover: #843322;
  --action-ink: #fff;
  --total: #25221e;
  --leader-line: #ffc6af;
  --rank: #f1ebe1;
  --track: #eee9e0;
  --display: Fredoka, ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --gutter: clamp(20px, 3.5vw, 44px);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #1b1715;
    --card: #28211e;
    --ink: #fcf1e7;
    --muted: #c5b2a4;
    --line: #493a33;
    --field-line: #9b8072;
    --peach-ink: #ffab91;
    --eyebrow: var(--peach-ink);
    --peach-wash: #39241e;
    --mint-wash: #232d25;
    --green: #91d6bc;
    --red: #ffab9a;
    --link-hover: #442b24;
    --action: #f6a48a;
    --action-hover: #ffc0aa;
    --action-ink: #241713;
    --total: #3b2b25;
    --leader-line: #915442;
    --rank: #453631;
    --track: var(--rank);
  }
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at calc(100% - 52px) 28px, var(--peach-wash) 0 154px, transparent 158px),
    radial-gradient(circle at 36px 100%, var(--mint-wash) 0 120px, transparent 124px),
    var(--ground);
  color: var(--ink);
  font: 500 1rem/1.45 "DM Sans", system-ui, sans-serif;
}

.wrap {
  width: min(100%, 1160px);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.gimme-bar, .gimme-footer { border-color: var(--line); border-style: solid; border-width: 0; }
.gimme-bar { border-bottom-width: 1px; }

.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  font: 700 1.05rem/1 var(--display);
}

.brand-mark {
  display: grid;
  width: 28px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 10px;
  background: var(--peach);
  color: #fff;
  font-size: 1rem;
  transform: rotate(-5deg);
  box-shadow: 0 5px 12px #f77b5a40;
}

#page {
  flex: 1;
  padding-block: clamp(32px, 6.7vw, 64px) clamp(44px, 8.7vw, 72px);
}

.gimme-footer {
  border-top-width: 1px;
  padding-block: 20px 42px;
  font: 700 .625rem/1.25 var(--display);
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

h1 { font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.35rem, 3.5vw, 2.2rem); letter-spacing: -.02em; }
h3 { font-size: 1rem; }

.hero, .view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 20px;
}

.hero-icon {
  display: inline-block;
  margin-inline-start: .18em;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: .64em;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--eyebrow);
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(.75rem, 1.5vw, .875rem);
  overflow-wrap: anywhere;
}

.view-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 32px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 700;
  text-decoration: none;
}

.view-link:hover { border-color: #bd6e56; background: var(--link-hover); }
.admin-icon { font-size: 1rem; line-height: 1; }

.total-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 30px;
  margin-top: clamp(24px, 4.5vw, 48px);
  padding: 17px 20px;
  border-radius: 16px;
  background: var(--total);
  color: #fff;
  box-shadow: 0 16px 36px #4f2c1817;
}

.total-card::after {
  position: absolute;
  z-index: -1;
  inset: -60px -48px auto auto;
  width: 122px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #924b39;
  content: "";
}

.total { display: flex; align-items: center; gap: 12px; min-width: 0; }
.total-icon, .kid-initial {
  flex: none;
  display: grid;
  place-items: center;
  width: 39px;
  min-height: 39px;
  padding: 3px;
  border-radius: 12px;
  overflow-wrap: anywhere;
  text-align: center;
}

.total-icon { background: #ffffff20; font-size: 1.12rem; }
.total-number {
  display: block;
  font: 700 1.375rem/1 var(--display);
  overflow-wrap: anywhere;
}
.total-label { display: block; color: #f5e9de; font-size: .625rem; overflow-wrap: anywhere; }

.standings { margin-top: clamp(34px, 7.8vw, 62px); }

.standings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}

.kid {
  --initial-bg: #ffcfac;
  --initial-ink: #963d2a;
  --bar-start: #ff9c76;
  --bar-end: var(--peach);
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 9px 26px #5030190e;
}

.kid.mint {
  --initial-bg: #c4ecdb;
  --initial-ink: #216b53;
  --bar-start: #92d9bf;
  --bar-end: #3ba981;
}

.kid.leader { border-color: var(--leader-line); }
.standing-card { padding-bottom: 16px; }
.kid-heading { display: flex; align-items: center; gap: 10px; }
.kid-heading h2, .kid-heading h3 { flex: 1; min-width: 0; }
.kid-initial {
  width: 36px;
  min-height: 36px;
  background: var(--initial-bg);
  color: var(--initial-ink);
  font: 700 1rem/1 var(--display);
}

.rank {
  flex: none;
  align-self: flex-start;
  display: grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  padding-inline: 4px;
  border-radius: 99px;
  background: var(--rank);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.leader .rank { background: var(--peach); color: #271a16; }
.balances { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; }
.coin {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 5px;
  min-width: 0;
}

.standing-card .balances { margin-top: 25px; }
.coin-icon { font-size: .95rem; }
.coin-amount { font: 700 clamp(1.35rem, 4.6vw, 2.1rem)/1 var(--display); }
.coin-label { color: var(--muted); font-size: .7rem; font-weight: 700; }
.coin-amount, .coin-label { overflow-wrap: anywhere; }

.balance-bar {
  margin-top: 14px;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--track);
}

.balance-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--bar-start), var(--bar-end));
}

details { margin-top: 16px; border-top: 1px solid var(--line); }
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  list-style: none;
  cursor: pointer;
  font-size: .7rem;
  font-weight: 700;
}
summary::-webkit-details-marker { display: none; }
summary:hover { color: var(--peach-ink); }
.chevron {
  flex: none;
  width: 5px;
  height: 5px;
  margin-inline-end: 5px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

details[open] .chevron { transform: rotate(225deg); }
.history { list-style: none; padding: 0; margin: 0; display: grid; font-size: .875rem; }
.history li { padding-block: 8px; overflow-wrap: anywhere; }
.history li + li { border-top: 1px solid var(--line); }
.empty-history { margin: 0; font-size: .875rem; }

.view-heading + .kid, #page > .kid + .kid { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
input, select, button {
  min-height: 44px;
  font: inherit;
  color: inherit;
}

input, select {
  max-width: 100%;
  background: var(--ground);
  border: 1px solid var(--field-line);
  border-radius: 8px;
  padding: 7px 10px;
}

input::placeholder { color: var(--muted); }
input[name=amount] { width: 7.2em; }
input[name=icon] { width: 4em; text-align: center; }
input[name=name], input[name=note] { flex: 1; min-width: 8em; }

button {
  border: 0;
  border-radius: 8px;
  background: var(--action);
  color: var(--action-ink);
  padding: 7px 14px;
  font-weight: 700;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--action-hover); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--peach-ink); outline-offset: 3px; }

.rewards { margin-top: 16px; }
.reward {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: .875rem;
  overflow-wrap: anywhere;
}
.reward span { min-width: 0; }

.muted { color: var(--muted); }
.plus { color: var(--green); }
.minus, .error { color: var(--red); }
.error { margin: 8px 0 0; }
.error:empty { margin: 0; }
.link { padding-top: 8px; font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; }
.status { margin: 0 0 14px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 560px) {
  body {
    background:
      radial-gradient(circle at 100% 28px, var(--peach-wash) 0 100px, transparent 104px),
      radial-gradient(circle at 20px 100%, var(--mint-wash) 0 84px, transparent 88px),
      var(--ground);
  }

  .standings-grid { grid-template-columns: minmax(0, 1fr); }
  .standing-card .balances { margin-top: 18px; }
  .view-link, summary { min-height: 44px; }
  .intro, .coin-label, summary { font-size: .875rem; }
}
