*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink: #111;
  --muted: #555;
  --line: #111;
  --bill-width: 167px;
  --bill-height: 75px;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: #fff;
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}

.back-bar {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #eee;
  font-family: Arial, Helvetica, sans-serif;
}

.back-link {
  color: #64748b;
  font-size: 0.82rem;
  text-decoration: none;
}

.back-link:hover {
  color: #111;
}

.hero {
  padding: 5.3rem 1.5rem 7.2rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(3.7rem, 9vw, 5.8rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.95;
}

.hero p {
  max-width: 520px;
  margin: 1.4rem auto 0;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.money-page,
.stream-list {
  width: 100%;
}

.money-row {
  --row-height: 205px;
  position: relative;
  min-height: var(--row-height);
  padding: 0;
  border-top: 2px solid var(--line);
  overflow: hidden;
}

.stream-label {
  position: relative;
  z-index: 2;
  min-height: 40px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  padding: 0 1rem;
  background: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.25rem, 3.6vw, 2rem);
  line-height: 1.2;
  text-align: center;
}

.per-hour-count {
  color: #444;
  font-size: 0.82em;
  white-space: nowrap;
}

.bill-track {
  position: absolute;
  inset: 52px 0 38px -16px;
  z-index: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0 0;
  pointer-events: none;
  will-change: transform;
  width: max-content;
  min-width: 100%;
}

.bill-track--scrolling {
  animation: scrollBills var(--scroll-duration, 10s) linear infinite;
}

/* Translate by -50%: bills are duplicated 2× so the loop seam lands on
   identical content, producing a seamless infinite horizontal scroll. */
@keyframes scrollBills {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

.bill-track--empty::before {
  content: '';
  width: var(--bill-width);
  height: var(--bill-height);
  background-image: url('assets/thousand-dollar.png');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.28;
  filter: grayscale(0.25);
}

.bill-img {
  position: relative;
  width: var(--bill-width);
  height: var(--bill-height);
  flex: 0 0 auto;
  object-fit: contain;
  user-select: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.1));
}

.bill-img[data-multiplier]:not([data-multiplier='']) {
  border-radius: 3px;
  box-shadow:
    4px 4px 0 rgba(40, 95, 50, 0.24),
    8px 8px 0 rgba(40, 95, 50, 0.13);
  position: relative;
}

.bill-img[data-multiplier]:not([data-multiplier=''])::after {
  content: attr(data-multiplier);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #1a3a1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  letter-spacing: 0.02em;
}

.stream-total {
  position: absolute;
  right: 1rem;
  bottom: 0.65rem;
  z-index: 2;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #666;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.hour-input {
  width: 70px;
  height: 40px;
  border: 1px solid #999;
  border-radius: 2px;
  padding: 0 0.35rem;
  background: #fff;
  color: #111;
  font: inherit;
  text-align: center;
}

.hour-input:focus {
  outline: 2px solid rgba(36, 107, 55, 0.22);
}

.legend-row {
  min-height: var(--row-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.legend-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.bill-img--legend {
  width: var(--bill-width);
  height: var(--bill-height);
}

.legend-equals {
  white-space: nowrap;
}

@media (max-width: 760px) {
  :root {
    --bill-width: 126px;
    --bill-height: 57px;
  }

  .hero {
    padding: 4rem 1rem 5.4rem;
  }

  .money-row {
    min-height: max(140px, calc(var(--row-height) * 0.85));
  }

  .bill-track {
    inset: 50px 0 32px -10px;
    gap: 7px;
  }

  .stream-total {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bill-track--scrolling {
    animation: none;
  }
}

.page-footer {
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  color: #999;
  font-size: 0.82rem;
  border-top: 2px solid var(--line);
}
