/* The Blueprint look. Colors come from public/trevor/theme.js. */

:root {
  /* These are backups. theme.js sets the real colors when the page loads. */
  --blueprint: #1d4f91;
  --blueprintDark: #143a6b;
  --gridLine: rgba(255, 255, 255, 0.1);
  --line: #ffffff;
  --button: #ff7a1a;
  --buttonText: #1b1b1b;
  --stamp: #e53935;
  --good: #43d17a;
  --waiting: #fdd835;
  --spent: #ff9e80;
  --chartEarned: #1fa99a;
  --chartSpent: #e0683a;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --corner: 0.75rem;
  --tap-size: 3rem; /* 48px: big enough for fingers */

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", system-ui, sans-serif;
  font-size: 1.125rem;
  color: var(--line);
  background-color: var(--blueprint);
  /* Graph paper: small squares, with a bolder line every 5 squares */
  background-image:
    linear-gradient(var(--gridLine) 2px, transparent 2px),
    linear-gradient(90deg, var(--gridLine) 2px, transparent 2px),
    linear-gradient(var(--gridLine) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridLine) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0 0 var(--space-3);
  letter-spacing: 0.02em;
}

/* ---------- Buttons ---------- */

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-height: var(--tap-size);
  min-width: var(--tap-size);
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--waiting);
  outline-offset: 2px;
}

/* A chunky brick button with studs on top */
.big-button {
  position: relative;
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--corner);
  background: var(--button);
  color: var(--buttonText);
  font-weight: bold;
  font-size: 1.25rem;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  margin-top: var(--space-3);
}

.big-button::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 44px;
  height: 8px;
  transform: translateX(-50%);
  background: radial-gradient(circle at 8px 50%, var(--button) 7px, transparent 8px) 0 0 / 28px 8px repeat-x;
}

.big-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.small-button {
  padding: var(--space-1) var(--space-3);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: transparent;
}

.link-button {
  border: none;
  background: none;
  text-decoration: underline;
}

/* ---------- Sign-in screens ---------- */

.center-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--space-4) + env(safe-area-inset-top)) var(--space-4) var(--space-4);
  text-align: center;
}

.app-title {
  font-size: 2.25rem;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.panel {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  border: 2px dashed var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

input,
textarea,
select {
  font: inherit;
  min-height: var(--tap-size);
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: #fff;
  color: #1b1b1b;
}

.error-message {
  min-height: 1.5em;
  margin: 0;
  color: var(--waiting);
  font-weight: bold;
}

.people-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
}

.person-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  width: 9rem;
  padding: var(--space-6) var(--space-4);
  border: 3px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
  font-size: 1.5rem;
  font-weight: bold;
}

.person-button:active {
  background: var(--button);
  color: var(--buttonText);
}

.person-emoji {
  font-size: 3.5rem;
}

.pin-dots {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: 0.3em;
  min-height: 2.5rem;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.pin-key {
  min-height: 4rem;
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: transparent;
  font-size: 1.5rem;
  font-weight: bold;
}

.pin-key:active {
  background: var(--line);
  color: var(--blueprint);
}

.pin-ok {
  background: var(--button);
  border-color: var(--button);
  color: var(--buttonText);
}

.checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.checkbox-label input {
  min-height: auto;
  width: 1.5rem;
  height: 1.5rem;
}

/* ---------- The app ---------- */

/* The app's name and the bar under it stay at the top while you scroll */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--blueprintDark);
  border-bottom: 2px solid var(--line);
}

/* The name in the middle, with the sound and reload buttons on each side */
.title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  /* When installed, the page goes under the iPad/phone status bar, so leave room for it */
  padding: calc(var(--space-2) + env(safe-area-inset-top)) var(--space-3) 0;
}

.app-name {
  flex: 1;
  margin: 0;
  font-size: 1.75rem;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.icon-button {
  flex: none;
  font-size: 1.25rem;
}

/* The reload button spins while it's working */
.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sign-out-button {
  margin-top: var(--space-8);
}

.top-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
}

.who-badge {
  font-weight: bold;
  margin-right: auto;
}

.badge {
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  font-weight: bold;
  white-space: nowrap;
}

.page {
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--space-4);
}

/* Which version is running. The bottom padding keeps it above the tab bar. */
.version-footer {
  padding: var(--space-4) var(--space-4) calc(6rem + env(safe-area-inset-bottom));
  font-size: 0.875rem;
  text-align: center;
  opacity: 0.7;
}

.new-version-banner {
  position: fixed;
  top: calc(var(--space-2) + env(safe-area-inset-top));
  left: 50%;
  z-index: 40;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  border: 3px solid var(--line);
  border-radius: var(--corner);
  background: var(--good);
  color: #1b1b1b;
  font-weight: bold;
  white-space: nowrap;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  background: var(--blueprintDark);
  border-top: 2px solid var(--line);
}

.tab {
  flex: 1;
  max-width: 10rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid transparent;
  border-radius: var(--corner);
  background: transparent;
  font-size: 1.5rem;
}

.tab span {
  font-size: 0.875rem;
  font-weight: bold;
}

.tab.active {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.12);
}

/* ---------- Messages ---------- */

.message {
  position: fixed;
  left: 50%;
  bottom: 6.5rem;
  z-index: 20;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--corner);
  background: var(--waiting);
  color: #1b1b1b;
  font-weight: bold;
  text-align: center;
}

.empty-message {
  padding: var(--space-6);
  border: 2px dashed var(--line);
  border-radius: var(--corner);
  text-align: center;
}

/* ---------- Build tickets ---------- */

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ticket {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.ticket-inspection {
  border-color: var(--waiting);
  border-style: dashed;
}

.ticket-approved {
  border-color: var(--good);
}

.ticket-body {
  flex: 1;
  min-width: 0;
}

.ticket-title {
  margin: 0;
  font-size: 1.25rem;
}

.ticket-description {
  margin: var(--space-1) 0 0;
  opacity: 0.85;
}

.ticket-points {
  margin: var(--space-1) 0 0;
  font-weight: bold;
}

.ticket-state {
  font-weight: bold;
  text-align: right;
}

.ticket-inspection .ticket-state {
  color: var(--waiting);
}

.ticket-approved .ticket-state {
  color: var(--good);
}

/* The big checkbox Trevor taps */
.check-button,
.check-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 3px solid var(--line);
  border-radius: var(--corner);
  background: transparent;
  font-size: 2rem;
  font-weight: bold;
  color: transparent;
}

.check-button:active {
  background: var(--button);
  color: var(--buttonText);
}

.check-inspection {
  border-color: var(--waiting);
  color: var(--waiting);
}

.check-approved {
  border-color: var(--good);
  background: var(--good);
  color: var(--blueprintDark);
}

/* ---------- Needs you (parents) ---------- */

.needs-you {
  margin-bottom: var(--space-8);
  padding: var(--space-4);
  border: 3px solid var(--waiting);
  border-radius: var(--corner);
}

.needs-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--gridLine);
}

.needs-text {
  flex: 1;
  min-width: 12rem;
}

.needs-buttons {
  display: flex;
  gap: var(--space-2);
}

.approve-button {
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--corner);
  background: var(--good);
  color: #1b1b1b;
  font-weight: bold;
}

/* Weekly goals: a box for each time */
.week-counter {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
}

.week-box {
  flex: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line);
  border-radius: 0.2rem;
}

.week-box-waiting {
  border-color: var(--waiting);
  background: var(--waiting);
  opacity: 0.6;
}

.week-box-done {
  border-color: var(--good);
  background: var(--good);
}

.ticket-goalReached {
  border-color: var(--good);
}

.ticket-goalReached .ticket-state {
  color: var(--good);
}

.check-goalReached {
  border-color: var(--good);
  background: var(--good);
  color: var(--blueprintDark);
}

/* ---------- Forms and pop-ups ---------- */

.add-button {
  display: block;
  margin: var(--space-6) auto 0;
}

.dialog {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 3px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
  color: var(--line);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-3);
}

.dialog-buttons .big-button {
  margin-top: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field-label {
  font-weight: bold;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.field-row .field {
  flex: 1;
  min-width: 8rem;
}

/* ---------- Waiting for points OK ---------- */

.waiting-section {
  margin-top: var(--space-8);
}

.waiting-section .ticket {
  margin-bottom: var(--space-3);
}

.ticket-waiting {
  border-color: var(--waiting);
  border-style: dashed;
}

.ticket-rejected {
  border-color: var(--stamp);
  border-style: dashed;
}

.ticket-note {
  margin: var(--space-1) 0 0;
  color: var(--waiting);
  font-weight: bold;
}

.ticket-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.suggest-row,
.needs-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.suggest-row input,
.needs-buttons input {
  width: 6rem;
}

.remove-button {
  min-width: var(--tap-size);
}

/* ---------- Reward Shop ---------- */

.shop-balance {
  font-size: 1.25rem;
  font-weight: bold;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: var(--space-4);
}

.reward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
  text-align: center;
}

.reward-emoji {
  font-size: 3rem;
  line-height: 1.2;
}

.reward-name {
  margin: 0;
  font-size: 1.125rem;
}

.reward-price,
.reward-once,
.reward-short {
  margin: 0;
  font-weight: bold;
}

.reward-once {
  color: var(--waiting);
  font-size: 0.875rem;
}

.reward-short {
  opacity: 0.75;
}

.buy-button {
  margin-top: var(--space-3);
}

.boxes {
  margin-bottom: var(--space-6);
}

.box-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 11rem;
  padding: var(--space-4);
  border: 3px dashed var(--waiting);
  border-radius: var(--corner);
  background: var(--blueprintDark);
  text-align: center;
  font-weight: bold;
}

.box-closed .reward-emoji {
  font-size: 4rem;
}

.box-open {
  border-style: solid;
  border-color: var(--good);
}

/* ---------- Idea Inbox ---------- */

.idea-button {
  display: block;
  width: 100%;
  margin: var(--space-3) 0 var(--space-6);
  background: var(--waiting);
}

.idea-button::before {
  background: radial-gradient(circle at 8px 50%, var(--waiting) 7px, transparent 8px) 0 0 / 28px 8px repeat-x;
}

.idea-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.idea {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.idea-built {
  border-style: solid;
  border-color: var(--good);
}

.idea-text {
  flex: 1 1 16rem;
  margin: 0;
  white-space: pre-wrap;
}

.idea-date {
  margin: 0;
  opacity: 0.7;
  font-size: 0.875rem;
}

.idea-badge {
  color: var(--good);
  font-weight: bold;
}

/* ---------- Small screens (phones) ---------- */

@media (max-width: 34rem) {
  .ticket {
    flex-wrap: wrap;
  }

  /* The status moves under the ticket, lined up with the text */
  .ticket-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-left: calc(3.5rem + var(--space-4));
  }

  .ticket-state {
    text-align: left;
  }

  .top-bar {
    gap: var(--space-1);
    padding: var(--space-2);
  }

  .top-bar .badge {
    padding: var(--space-1) var(--space-2);
  }

  .top-bar .small-button {
    padding: var(--space-1) var(--space-2);
  }

  .who-badge {
    white-space: nowrap;
  }
}

/* ---------- The build ---------- */

.build-panel {
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--corner);
  background: rgba(0, 0, 0, 0.12);
}

.build-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.build-heading h2 {
  margin: 0;
}

.build-count,
.build-finished {
  margin: 0;
  font-weight: bold;
}

.build-finished {
  margin-top: var(--space-3);
  text-align: center;
}

.build-grid {
  --brick-size: min(3.25rem, calc((100vw - 6rem) / var(--columns)));
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--brick-size));
  grid-auto-rows: var(--brick-size);
  justify-content: center;
  gap: 4px;
  margin-top: var(--space-6);
}

/* A real brick, with a stud on top */
.brick {
  position: relative;
  border-radius: 4px;
  background: var(--brick-color);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

.brick::before {
  content: "";
  position: absolute;
  top: -18%;
  left: 30%;
  width: 40%;
  height: 22%;
  border-radius: 3px 3px 0 0;
  background: var(--brick-color);
  filter: brightness(1.1);
}

/* A brick that isn't built yet: just the blueprint outline */
.brick-outline {
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 4px;
}

.brick-next {
  border-color: var(--waiting);
  border-style: solid;
}

/* ---------- Confetti ---------- */

.confetti {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -1rem;
  width: 0.6rem;
  height: 1rem;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

.build-complete {
  border-style: solid;
  border-color: var(--good);
}

/* ---------- The APPROVED stamp ---------- */

.ticket {
  position: relative;
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: var(--space-1) var(--space-4);
  border: 4px solid var(--stamp);
  border-radius: 6px;
  color: var(--stamp);
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-12deg);
  animation: stamp-slam 2.6s ease-out forwards;
}

@keyframes stamp-slam {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-12deg) scale(3);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-12deg) scale(0.9);
  }
  18% {
    transform: translate(-50%, -50%) rotate(-12deg) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-12deg) scale(1);
  }
}

/* A new brick drops in and bounces */
.brick-drop {
  animation: brick-drop 0.6s 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes brick-drop {
  from {
    opacity: 0;
    transform: translateY(-250%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- The sidekick ---------- */

.sidekick {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.sidekick-emoji {
  flex: none;
  font-size: 3.5rem;
  line-height: 1;
}

.sidekick-bubble {
  position: relative;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--corner);
  background: var(--line);
  color: #1b1b1b;
}

/* The little tail on the speech bubble */
.sidekick-bubble::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -10px;
  border: 8px solid transparent;
  border-right: 10px solid var(--line);
  border-left: 0;
  transform: translateY(-50%);
}

.mood-cheering .sidekick-emoji {
  animation: bounce 0.5s ease-in-out 3;
}

.mood-dancing .sidekick-emoji {
  animation: dance 0.8s ease-in-out infinite;
}

.mood-nervous .sidekick-emoji {
  animation: shiver 0.4s linear infinite;
}

@keyframes bounce {
  50% {
    transform: translateY(-30%);
  }
}

@keyframes dance {
  25% {
    transform: rotate(-15deg) translateY(-10%);
  }
  75% {
    transform: rotate(15deg) translateY(-10%);
  }
}

@keyframes shiver {
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

/* ---------- Less motion (when the device asks for it) ---------- */

@media (prefers-reduced-motion: reduce) {
  .stamp {
    animation: fade-in-out 2.6s forwards;
  }

  .brick-drop {
    animation: fade-in 0.6s both;
  }

  .sidekick-emoji,
  .mood-cheering .sidekick-emoji,
  .mood-dancing .sidekick-emoji,
  .mood-nervous .sidekick-emoji {
    animation: none;
  }

  .big-button:active {
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-in-out {
  0%,
  100% {
    opacity: 0;
  }
  15%,
  80% {
    opacity: 1;
  }
}

/* Edit ✏️ and remove 🗑 buttons side by side */
.item-buttons {
  display: flex;
  gap: var(--space-2);
}

/* ---------- Help ---------- */

.help-intro {
  margin-top: 0;
  opacity: 0.85;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.help-section {
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.help-section summary {
  min-height: var(--tap-size);
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  font-weight: bold;
  font-size: 1.125rem;
  cursor: pointer;
}

.help-section[open] summary {
  border-bottom: 1px solid var(--gridLine);
}

.help-section ul {
  margin: 0;
  padding: var(--space-3) var(--space-4) var(--space-4) var(--space-8);
}

.help-section li + li {
  margin-top: var(--space-2);
}

/* ---------- Reports ---------- */

.reports {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.reports .earned {
  color: var(--good);
  font-weight: bold;
}

.reports .spent {
  color: var(--spent);
  font-weight: bold;
}

.time-frames {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.time-frame {
  min-height: var(--tap-size);
  padding: var(--space-2);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
  font-weight: bold;
}

.time-frame.active {
  background: var(--button);
  border-color: var(--button);
  color: var(--buttonText);
}

.report-totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.report-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-2);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.report-total strong {
  font-size: 1.5rem;
}

.report-total.earned strong {
  color: var(--good);
}

.report-total.spent strong {
  color: var(--spent);
}

.report-total-label {
  font-size: 0.875rem;
  color: var(--line);
}

.report-days {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.report-day {
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.report-day-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
}

.report-day-header h3 {
  flex: 1 1 auto;
  margin: 0;
}

.report-lines {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.report-lines li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-top: 1px dashed var(--gridLine);
}

.report-line-name {
  overflow-wrap: anywhere;
}

/* The calendar: a month grid on phones, side by side on bigger screens */
.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--space-3);
}

.calendar-month {
  padding: var(--space-3);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.calendar-month h3 {
  margin-bottom: var(--space-2);
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: bold;
  opacity: 0.7;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: var(--tap-size);
  padding: 2px 0;
  border: 2px solid transparent;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.7rem;
  line-height: 1.2;
}

.calendar-day.has-points {
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.calendar-day.outside {
  background: transparent;
  opacity: 0.3;
}

.calendar-day.today {
  border-color: var(--waiting);
}

.calendar-number {
  font-size: 0.8rem;
  opacity: 0.85;
}

.report-day.picked {
  animation: picked-glow 1.5s ease-out;
}

@keyframes picked-glow {
  from {
    border-color: var(--waiting);
    box-shadow: 0 0 0 4px var(--waiting);
  }
}

@media (prefers-reduced-motion: reduce) {
  .report-day.picked {
    animation: none;
    border-color: var(--waiting);
  }
}

/* The line chart */
.points-chart {
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--line);
  border-radius: var(--corner);
  background: var(--blueprintDark);
}

.points-chart h3 {
  margin-bottom: var(--space-2);
}

.chart-legend,
.chart-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  font-size: 0.9rem;
}

.chart-readout {
  min-height: 1.5rem;
  margin-top: var(--space-2);
}

.chart-key,
.chart-readout > span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-key-line {
  display: inline-block;
  width: 1rem;
  height: 3px;
  border-radius: 2px;
}

.chart-box {
  margin-top: var(--space-2);
}

.chart-svg {
  display: block;
  touch-action: pan-y; /* sideways drags pick points, up and down still scrolls */
}

.chart-grid {
  stroke: var(--line);
  stroke-opacity: 0.15;
  stroke-width: 1;
}

.chart-axis,
.chart-end-label {
  fill: var(--line);
  font-size: 12px;
}

.chart-axis {
  fill-opacity: 0.75;
}

.chart-end-label {
  font-weight: bold;
}

.chart-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot {
  stroke: var(--blueprintDark);
  stroke-width: 2;
}

.chart-crosshair {
  stroke: var(--line);
  stroke-opacity: 0.6;
  stroke-width: 1;
}
