:root {
  --paper: #fdf8f1;
  --card: #ffffff;
  --ink: #271515;
  --muted: #76625c;
  --faint: #aa9288;
  --line: #ead7ce;
  --red: #aa171c;
  --red-deep: #841116;
  --green: #487a52;
  --gold: #c88c2f;
  --shadow: 0 14px 34px rgba(87, 35, 23, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    ui-serif, "Noto Serif SC", "Songti SC", SimSun, Georgia, "Times New Roman",
    serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

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

.background-danmaku::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(253, 248, 241, 0.28) 46%, rgba(255, 255, 255, 0.54)),
    var(--paper);
}

.background-danmaku span {
  position: absolute;
  left: 100%;
  max-width: min(32em, 76vw);
  overflow: hidden;
  color: rgba(132, 17, 22, 0.28);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--size, 1.1rem);
  font-weight: 680;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: danmaku 28s linear infinite;
}

.background-danmaku span:nth-child(1) {
  top: 14%;
  --size: 1.16rem;
  animation-delay: -4s;
}

.background-danmaku span:nth-child(2) {
  top: 28%;
  --size: 1.3rem;
  animation-delay: -13s;
}

.background-danmaku span:nth-child(3) {
  top: 44%;
  --size: 1.05rem;
  animation-delay: -7s;
}

.background-danmaku span:nth-child(4) {
  top: 60%;
  --size: 1.22rem;
  animation-delay: -20s;
}

.background-danmaku span:nth-child(5) {
  top: 75%;
  --size: 0.98rem;
  animation-delay: -1s;
}

.background-danmaku span:nth-child(6) {
  top: 86%;
  --size: 1.18rem;
  animation-delay: -16s;
}

@keyframes danmaku {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100vw - 36em));
  }
}

.site-watermark {
  position: fixed;
  top: 22px;
  left: 24px;
  z-index: 8;
  max-width: calc(100vw - 220px);
  overflow: hidden;
  color: rgba(132, 17, 22, 0.48);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 680;
  line-height: 1;
  opacity: 0.78;
  pointer-events: none;
  user-select: none;
}

.top-actions {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  color: rgba(132, 17, 22, 0.68);
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(234, 215, 206, 0.66);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(87, 35, 23, 0.06);
  backdrop-filter: blur(10px);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.top-pill:hover,
.top-pill:focus-visible,
.top-pill.is-active {
  color: var(--red-deep);
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(170, 23, 28, 0.24);
  outline: none;
  transform: translateY(-1px);
}

.top-pill.is-strong {
  color: #fff;
  background: var(--red-deep);
  border-color: var(--red-deep);
}

.paper-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  background: linear-gradient(180deg, rgba(253, 248, 241, 0.28), rgba(253, 248, 241, 0.58));
}

.hero {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  isolation: isolate;
  min-height: 70vh;
  overflow: hidden;
  padding: 82px 18px 64px;
  text-align: center;
}

.total-stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  max-width: 100%;
}

.total-receipt {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  color: var(--red-deep);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.currency {
  font-size: clamp(4.6rem, 6vw, 8.4rem);
  font-weight: 900;
  line-height: 1;
}

.total-window {
  display: inline-block;
  overflow: visible;
}

.total-number {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  color: var(--red-deep);
  font-size: clamp(7.4rem, 13vw, 18rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.total-meta {
  margin-top: 12px;
  color: rgba(118, 98, 92, 0.86);
  font-size: 0.88rem;
  font-weight: 700;
}

.intake-notice {
  position: relative;
  z-index: 2;
  width: min(860px, calc(100vw - 54px));
  margin: clamp(26px, 5vh, 46px) 0 0;
  color: rgba(39, 21, 21, 0.66);
  font-size: 0.98rem;
  font-weight: 620;
  line-height: 1.96;
  text-wrap: balance;
}

.hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(30px, 6vh, 54px);
}

.primary-action,
.submit-button,
.review-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 26px;
  color: #fff;
  background: var(--red-deep);
  border: 1px solid var(--red-deep);
  border-radius: 999px;
  box-shadow: 0 12px 24px rgba(132, 17, 22, 0.14);
  font-size: 0.94rem;
  font-weight: 760;
  line-height: 1;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-action {
  gap: 9px;
}

.primary-action svg,
.upload-pick svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-action:hover,
.submit-button:hover,
.review-button:hover {
  background: #701015;
  box-shadow: 0 16px 28px rgba(132, 17, 22, 0.18);
  transform: translateY(-2px);
}

.upload-section,
.cards-section,
.records-section,
.admin-layout {
  padding-inline: clamp(16px, 5vw, 76px);
}

.upload-section {
  padding-block: 10px 42px;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(310px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  align-items: start;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.upload-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.wide,
.security-note,
.form-state {
  grid-column: 1 / -1;
}

.security-note {
  margin: 0 0 2px;
  padding: 12px 14px;
  color: rgba(118, 98, 92, 0.9);
  background: rgba(253, 248, 241, 0.72);
  border: 1px solid rgba(234, 215, 206, 0.82);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 680;
  line-height: 1.65;
}

.field input:not(.file-input),
.field select,
.field textarea,
.login-card input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.field input:not(.file-input),
.field select,
.login-card input {
  min-height: 46px;
  padding: 0 11px;
}

.field textarea {
  min-height: 132px;
  padding: 11px;
  resize: vertical;
}

.field input:not(.file-input):focus,
.field select:focus,
.field textarea:focus,
.login-card input:focus {
  border-color: rgba(170, 23, 28, 0.48);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.08);
}

.file-field {
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  min-width: 0;
}

.upload-dropzone {
  display: grid;
  align-content: center;
  gap: 12px;
  height: 100%;
  min-height: clamp(280px, 38vh, 440px);
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(170, 23, 28, 0.34);
  border-radius: 8px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-pick {
  display: grid;
  min-height: 126px;
  place-items: center;
  gap: 6px;
  padding: 18px;
  color: var(--red-deep);
  text-align: center;
  background: rgba(255, 250, 246, 0.86);
  border: 1px solid rgba(234, 215, 206, 0.92);
  border-radius: 8px;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.upload-pick:hover {
  border-color: rgba(170, 23, 28, 0.48);
  box-shadow: 0 12px 22px rgba(132, 17, 22, 0.1);
  transform: translateY(-1px);
}

.upload-pick span {
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 850;
}

.upload-pick small {
  color: var(--faint);
  font-size: 0.76rem;
  font-weight: 650;
}

.receipt-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 9px;
  max-height: 286px;
  overflow: auto;
}

.receipt-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: top center;
  background: #fff;
  border: 1px solid rgba(234, 215, 206, 0.88);
  border-radius: 7px;
}

.submit-button {
  justify-self: start;
}

.form-state {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.cards-section {
  width: min(2140px, 100%);
  margin: 0 auto;
  padding-block: 24px 76px;
}

.cards-toolbar {
  display: flex;
  justify-content: flex-end;
  min-height: 34px;
  margin-bottom: 18px;
}

.queue-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  color: rgba(118, 98, 92, 0.88);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(234, 215, 206, 0.72);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(87, 35, 23, 0.05);
  font-size: 0.82rem;
  font-weight: 720;
}

.receipt-masonry {
  columns: 4 250px;
  column-gap: 28px;
}

.receipt-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 28px;
  padding: 18px 18px 22px;
  overflow: visible;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(248, 238, 233, 0.96);
  border-radius: 4px;
  box-shadow:
    0 22px 54px rgba(87, 35, 23, 0.1),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
  break-inside: avoid;
  transform: rotate(var(--tilt, 0deg));
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.receipt-card:hover {
  box-shadow:
    0 28px 62px rgba(87, 35, 23, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.95) inset;
  transform: rotate(0deg) translateY(-3px);
}

.receipt-card img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  object-position: top center;
  background: transparent;
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 18px 4px 0;
}

.card-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.amount {
  color: var(--red);
  font-size: 2.7rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.card-message {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta-line {
  padding-top: 8px;
  color: var(--faint);
  border-top: 1px solid rgba(234, 215, 206, 0.78);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  color: #fff;
  background: var(--muted);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 760;
}

.status.pending {
  color: var(--ink);
  background: #eed08a;
}

.status.approved {
  background: var(--green);
}

.status.rejected {
  background: var(--red-deep);
}

.records-section,
.admin-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-block: 100px 76px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 760;
  line-height: 1;
  text-transform: uppercase;
}

.section-heading h1,
.admin-summary h1,
.login-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.75rem, 3.6vw, 2.6rem);
  line-height: 1.1;
}

.record-list,
.review-queue {
  display: grid;
  gap: 16px;
}

.record-card,
.review-card,
.admin-summary,
.login-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.record-card,
.review-card {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr;
  overflow: hidden;
}

.record-card img,
.review-card img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
  object-position: top center;
  background: #f5eee8;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-button {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.review-button.reject {
  background: var(--red);
  border-color: var(--red);
}

.review-button.neutral {
  color: var(--red-deep);
  background: rgba(170, 23, 28, 0.08);
  border-color: rgba(170, 23, 28, 0.18);
  box-shadow: none;
}

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
}

.admin-summary {
  align-self: start;
  padding: 20px;
}

.admin-summary dl {
  display: grid;
  gap: 0;
  margin: 20px 0 0;
}

.admin-summary dl div {
  display: flex;
  justify-content: space-between;
  padding: 13px 0;
  border-top: 1px solid rgba(234, 215, 206, 0.9);
}

.admin-summary dt {
  color: var(--muted);
}

.admin-summary dd {
  margin: 0;
  color: var(--red-deep);
  font-weight: 900;
}

.empty-state {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.7;
}

.login-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.login-dialog::backdrop {
  background: rgba(32, 18, 14, 0.42);
  backdrop-filter: blur(4px);
}

.login-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 26px;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .upload-panel {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-watermark {
    top: 18px;
    left: 14px;
    max-width: calc(100vw - 164px);
    font-size: 0.66rem;
  }

  .top-actions {
    top: 12px;
    right: 12px;
    gap: 4px;
    max-width: calc(100vw - 100px);
    overflow-x: auto;
  }

  .top-pill {
    flex: none;
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.68rem;
  }

  .hero {
    min-height: 64vh;
    padding: 74px 16px 48px;
  }

  .currency {
    font-size: 2.9rem;
  }

  .total-number {
    font-size: clamp(4.1rem, 22vw, 6.4rem);
  }

  .intake-notice {
    width: min(100%, calc(100vw - 32px));
    font-size: 0.92rem;
    line-height: 1.86;
  }

  .upload-section,
  .cards-section,
  .records-section,
  .admin-layout {
    padding-inline: 14px;
  }

  .upload-fields {
    grid-template-columns: 1fr;
  }

  .upload-panel {
    padding: 16px;
  }

  .receipt-masonry {
    columns: 1;
  }

  .amount {
    font-size: 2.3rem;
  }

  .record-card,
  .review-card {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
