:root {
  --paper: #fdf8f1;
  --card: #ffffff;
  --ink: #271515;
  --muted: #76625c;
  --faint: #aa9288;
  --line: #ead7ce;
  --red: #aa171c;
  --red-deep: #841116;
  --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;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

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

.language-toggle {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 10px;
  color: rgba(132, 17, 22, 0.58);
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(234, 215, 206, 0.56);
  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;
  opacity: 0.72;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.language-toggle:hover,
.language-toggle:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(170, 23, 28, 0.24);
  outline: none;
  transform: translateY(-1px);
}

html[data-lang="zh"] [data-lang-zh],
html[data-lang="en"] [data-lang-en] {
  color: var(--red-deep);
}

.background-danmaku {
  position: fixed;
  inset: 0;
  height: 100vh;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.52;
}

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

.danmaku-line {
  position: absolute;
  display: inline-block;
  left: 100%;
  max-width: min(32em, 72vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(132, 17, 22, 0.68);
  font-size: var(--size, 1.2rem);
  font-weight: 680;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.58);
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity, top;
}

.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 72px;
  text-align: center;
}

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

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

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

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

.total-number {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  color: var(--red-deep);
  font-size: clamp(13.4rem, 11.2vw, 19rem);
  font-weight: 900;
  line-height: 1;
}

.total-char {
  position: relative;
  display: inline-block;
  height: 1em;
  overflow: hidden;
  vertical-align: baseline;
}

.total-char.is-digit {
  width: 0.58em;
}

.total-char.is-mark {
  width: 0.28em;
  overflow: visible;
}

.digit-window {
  display: block;
  height: 1em;
  overflow: hidden;
}

.digit-strip {
  display: grid;
  grid-auto-rows: 1em;
  transform: translateY(0);
  will-change: transform;
}

.digit-cell {
  display: block;
  height: 1em;
  line-height: 1;
}

.total-char.is-rolling .digit-strip {
  animation: digitWheelRoll var(--roll-duration, 720ms) cubic-bezier(0.16, 0.88, 0.2, 1) both;
}

.primary-action,
.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 28px;
  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.96rem;
  font-weight: 760;
  line-height: 1;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-action {
  position: relative;
  z-index: 2;
  gap: 9px;
  margin-top: clamp(108px, 15vh, 150px);
}

.intake-notice {
  display: none;
}

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

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

.submit-button:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

.submit-button:disabled:hover {
  background: var(--red-deep);
  transform: none;
  box-shadow: none;
}

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

.upload-section {
  padding-block: 10px 34px;
  overflow: hidden;
  opacity: 1;
  transition:
    max-height 260ms ease,
    opacity 180ms ease,
    padding 260ms ease;
}

.upload-section.is-collapsed {
  max-height: 0;
  padding-block: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-section:not(.is-collapsed) {
  max-height: 2200px;
}

.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-column: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  min-width: 0;
}

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

.security-note {
  grid-column: 1 / -1;
  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;
}

.upload-fields .security-note,
.upload-fields .source-note-field,
.upload-fields .amount-field,
.upload-fields .wide-field,
.upload-fields .form-state {
  grid-column: 1 / -1;
}

.upload-panel input:not(.file-input),
.upload-panel textarea {
  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;
}

.upload-panel input:not(.file-input) {
  min-height: 46px;
  padding: 0 11px;
}

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

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

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

.amount-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(116px, 0.38fr);
  gap: 8px;
}

.amount-converted {
  min-height: 1.2em;
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 650;
}

.source-select,
.currency-select {
  position: relative;
}

.source-select-button,
.currency-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
  font-weight: 760;
}

.source-select-button svg,
.currency-select-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.source-select.is-open .source-select-button,
.currency-select.is-open .currency-select-button {
  border-color: rgba(170, 23, 28, 0.48);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.08);
}

.source-select.is-open .source-select-button svg,
.currency-select.is-open .currency-select-button svg {
  transform: rotate(180deg);
}

.source-options,
.currency-options {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  z-index: 5;
  display: grid;
  gap: 4px;
  padding: 6px;
  background: #fff;
  border: 1px solid rgba(234, 215, 206, 0.96);
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(87, 35, 23, 0.14);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.source-select.is-open .source-options,
.currency-select.is-open .currency-options {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.currency-options {
  max-height: min(390px, 58vh);
  overflow: hidden;
}

.currency-search {
  display: grid;
  gap: 5px;
  padding: 4px;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 720;
}

.currency-search input {
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  border: 1px solid rgba(234, 215, 206, 0.96);
  border-radius: 6px;
}

.currency-option-list {
  display: grid;
  gap: 4px;
  max-height: 286px;
  overflow: auto;
  padding-right: 2px;
}

.source-options button,
.currency-options button {
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 720;
}

.currency-empty {
  margin: 0;
  padding: 10px;
  color: var(--faint);
  font-size: 0.78rem;
}

.source-options button:hover,
.source-options button[aria-selected="true"],
.currency-options button:hover,
.currency-options button[aria-selected="true"] {
  color: var(--red-deep);
  background: rgba(170, 23, 28, 0.08);
}

.upload-dropzone {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 214px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(170, 23, 28, 0.34);
  border-radius: 8px;
  outline: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.file-field .upload-dropzone {
  height: 100%;
  min-height: clamp(280px, 38vh, 440px);
}

.upload-dropzone:has(.receipt-preview:empty) {
  align-content: center;
}

.upload-dropzone:focus-visible,
.upload-dropzone.is-dragging {
  background: rgba(255, 247, 243, 0.92);
  border-color: rgba(170, 23, 28, 0.58);
  box-shadow:
    0 0 0 3px rgba(170, 23, 28, 0.08),
    0 16px 34px rgba(132, 17, 22, 0.08);
}

.upload-dropzone.is-dragging .upload-pick {
  border-color: rgba(170, 23, 28, 0.58);
  box-shadow: 0 12px 22px rgba(132, 17, 22, 0.12);
  transform: translateY(-1px);
}

.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 svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.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(190px, 1fr));
  gap: 9px;
  max-height: min(440px, 48vh);
  overflow: auto;
  padding-right: 2px;
}

.upload-thumb {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 30px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(234, 215, 206, 0.88);
  border-radius: 7px;
}

.upload-thumb img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  object-position: top center;
  border-radius: 5px;
}

.upload-thumb div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.upload-thumb strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.upload-thumb span {
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.76rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-thumb button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--muted);
  background: rgba(170, 23, 28, 0.06);
  border: 0;
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
}

.upload-thumb button:hover {
  color: var(--red-deep);
  background: rgba(170, 23, 28, 0.12);
}

.submit-button {
  grid-column: 1;
  align-self: end;
  justify-self: start;
}

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

.share-card {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  width: auto;
  margin: 0;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  color: var(--ink);
  background: rgba(248, 241, 234, 0.82);
}

.share-card-dialog {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(430px, calc(100vw - 48px));
  max-height: none;
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: shareCardRise 220ms cubic-bezier(0.16, 0.88, 0.2, 1) both;
}

.share-card-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  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;
}

.share-card-close:hover {
  color: var(--red-deep);
  background: rgba(255, 247, 243, 0.96);
}

.share-card-art {
  display: grid;
  gap: 16px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 420px;
  padding: 34px 32px 30px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(255, 248, 241, 0.96)),
    #fffaf6;
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 6px;
  box-shadow:
    0 22px 54px rgba(87, 35, 23, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.share-card[hidden] {
  display: none;
}

.share-card-title {
  margin: 0;
  color: rgba(118, 98, 92, 0.78);
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1.5;
}

.share-card-message {
  align-self: center;
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.2rem, 3vw, 1.52rem);
  font-weight: 760;
  line-height: 1.78;
  text-wrap: pretty;
}

.share-card-domain {
  align-self: end;
  justify-self: end;
  width: max-content;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
}

.share-card-domain:hover {
  color: var(--red-deep);
}

.share-card-hint {
  max-width: 34em;
  margin: 0;
  color: rgba(118, 98, 92, 0.86);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 680;
  line-height: 1.6;
}

.share-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.share-card-action {
  min-height: 36px;
  padding: 0 14px;
  color: rgba(132, 17, 22, 0.9);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(234, 215, 206, 0.92);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(87, 35, 23, 0.07);
  font-size: 0.82rem;
  font-weight: 760;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.share-card-action.is-primary {
  color: #fff;
  background: var(--red-deep);
  border-color: var(--red-deep);
  box-shadow: 0 12px 24px rgba(132, 17, 22, 0.16);
}

.share-card-action:hover {
  background: rgba(255, 247, 243, 0.94);
  border-color: rgba(170, 23, 28, 0.28);
  transform: translateY(-1px);
}

.share-card-action.is-primary:hover {
  background: #701015;
  box-shadow: 0 16px 28px rgba(132, 17, 22, 0.2);
}

.share-card-state {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.share-card-state[data-tone="error"] {
  color: var(--red-deep);
}

.share-card-copy-fallback {
  display: grid;
  gap: 6px;
  margin: -4px 0 0;
  color: rgba(118, 98, 92, 0.82);
  font-size: 0.76rem;
  font-weight: 680;
  line-height: 1.5;
}

.share-card-copy-fallback[hidden] {
  display: none;
}

.share-card-copy-fallback textarea {
  width: 100%;
  min-height: 86px;
  padding: 9px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(234, 215, 206, 0.88);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.55;
}

.share-card-copy-fallback textarea:focus {
  border-color: rgba(170, 23, 28, 0.38);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.08);
}

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

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

.receipt-search {
  position: relative;
  z-index: 2;
}

.receipt-search label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.receipt-search-box {
  display: flex;
  align-items: center;
  width: min(320px, 46vw);
  min-height: 32px;
  padding: 0 8px 0 11px;
  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);
}

.receipt-search-box svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-right: 7px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0.68;
}

.receipt-search-box input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 0.82rem;
  font-weight: 680;
}

.receipt-search-box input::placeholder {
  color: rgba(118, 98, 92, 0.62);
}

.receipt-search-box input::-webkit-search-cancel-button {
  display: none;
  appearance: none;
}

.receipt-search-box:focus-within {
  border-color: rgba(170, 23, 28, 0.34);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.08);
}

.receipt-search-clear {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  color: rgba(132, 17, 22, 0.62);
  background: rgba(255, 240, 239, 0.88);
  border: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 720;
  line-height: 1;
}

.receipt-search-clear[hidden] {
  display: none;
}

.sort-control {
  position: relative;
  z-index: 3;
}

.sort-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  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;
  line-height: 1;
}

.sort-trigger svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 160ms ease;
}

.sort-control.is-open .sort-trigger svg {
  transform: rotate(180deg);
}

.sort-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  min-width: 118px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(87, 35, 23, 0.13);
}

.sort-menu[hidden] {
  display: none;
}

.sort-option {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 680;
}

.sort-option:hover,
.sort-option[aria-selected="true"] {
  color: var(--red-deep);
  background: #fff0ef;
}

.receipt-masonry {
  display: grid;
  grid-template-columns: repeat(var(--masonry-columns, 1), minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

.load-more-receipts {
  display: block;
  min-height: 42px;
  margin: 28px auto 0;
  padding: 0 18px;
  color: rgba(132, 17, 22, 0.82);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(234, 215, 206, 0.92);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(87, 35, 23, 0.08);
  font-weight: 760;
}

.load-more-receipts[hidden] {
  display: none;
}

.load-more-receipts:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.receipt-load-state {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.receipt-scroll-sentinel {
  height: 1px;
}

.masonry-column {
  display: grid;
  gap: 28px;
  align-content: start;
}

.masonry-column:nth-child(4n + 2) {
  padding-top: 18px;
}

.masonry-column:nth-child(4n + 4) {
  padding-top: 12px;
}

.masonry-column:nth-child(5n) {
  padding-top: 28px;
}

.receipt-card {
  display: block;
  width: 100%;
  margin: 0;
  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;
  transform: rotate(var(--tilt, 0deg));
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

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

.card-image {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
  max-height: var(--image-limit, 620px);
  background: transparent;
  border: 0;
  border-radius: 0;
}

.card-image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: var(--image-limit, 620px);
  object-fit: contain;
  object-position: top center;
}

.card-image::after {
  display: none;
}

.multi-count {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 1;
  min-width: 30px;
  height: 26px;
  padding: 0 9px;
  color: #fff;
  background: rgba(39, 21, 21, 0.72);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 26px;
  text-align: center;
}

.card-meta {
  display: grid;
  gap: 14px;
  padding: 20px 4px 0;
}

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

.player-name {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date,
.source-row {
  color: var(--faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

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

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

.source-row {
  padding-top: 8px;
  border-top: 1px solid rgba(234, 215, 206, 0.78);
}

.source-value {
  color: var(--muted);
  font-weight: 760;
}

.receipt-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.receipt-dialog.is-open {
  display: grid;
  place-items: center;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 18, 14, 0.52);
  border: 0;
}

.dialog-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  background: #fffaf6;
  border: 1px solid rgba(234, 215, 206, 0.94);
  border-radius: 8px;
  box-shadow: 0 26px 78px rgba(0, 0, 0, 0.28);
  outline: none;
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.dialog-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.detail-media {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: calc(100vh - 36px);
  min-height: min(760px, calc(100vh - 36px));
  min-width: 0;
  background: #f5eee8;
}

.detail-toolbar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(234, 215, 206, 0.88);
}

.image-nav {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.image-nav:disabled {
  cursor: default;
  opacity: 0.38;
}

.image-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

#detail-image-select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.detail-image-frame {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 18px;
}

.detail-image-frame img {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  border: 1px solid rgba(234, 215, 206, 0.94);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(87, 35, 23, 0.1);
}

.detail-images {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(234, 215, 206, 0.88);
}

.thumb-button {
  flex: 0 0 72px;
  height: 86px;
  padding: 3px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(234, 215, 206, 0.9);
  border-radius: 6px;
}

.thumb-button.is-active {
  border-color: rgba(170, 23, 28, 0.62);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.1);
}

.thumb-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.detail-body {
  display: grid;
  align-content: start;
  gap: 20px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 72px 26px 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(253, 248, 241, 0.96)),
    #fffaf6;
  border-left: 1px solid rgba(234, 215, 206, 0.9);
}

.detail-main {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 14px;
}

.detail-amount {
  color: var(--red);
  font-size: 3.4rem;
  font-weight: 900;
  line-height: 1;
}

.detail-blessing {
  margin: 0;
  padding: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(234, 215, 206, 0.86);
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.85;
}

.detail-data {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(234, 215, 206, 0.86);
  border-radius: 8px;
  overflow: hidden;
}

.detail-data dt {
  padding: 12px 16px 3px;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 760;
}

.detail-data dd {
  margin: 0;
  min-width: 0;
  padding: 0 16px 12px;
  overflow-wrap: anywhere;
  color: var(--ink);
  border-bottom: 1px solid rgba(234, 215, 206, 0.58);
  font-weight: 720;
}

.detail-data dd:last-child {
  border-bottom: 0;
}

.report-actions {
  display: grid;
  gap: 10px;
  padding: 22px 0 4px;
}

.report-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(234, 215, 206, 0.86);
  border-radius: 8px;
}

.report-panel[hidden] {
  display: none;
}

.report-reason-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.report-reason-field textarea {
  width: 100%;
  min-height: 78px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 215, 206, 0.86);
  border-radius: 7px;
  outline: none;
  resize: vertical;
  line-height: 1.5;
}

.report-reason-field textarea:focus {
  border-color: rgba(170, 23, 28, 0.42);
  box-shadow: 0 0 0 3px rgba(170, 23, 28, 0.08);
}

.report-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-width: 94px;
  min-height: 40px;
  padding: 0 22px;
  color: #fff;
  background: var(--red-deep);
  border: 1px solid var(--red-deep);
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(132, 17, 22, 0.12);
  font-size: 0.88rem;
  font-weight: 760;
  line-height: 1;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.report-action[hidden] {
  display: none;
}

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

.report-confirm {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 247, 243, 0.92);
  border: 1px solid rgba(170, 23, 28, 0.18);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(87, 35, 23, 0.07);
}

.report-confirm[hidden] {
  display: none;
}

.report-confirm strong {
  color: var(--red-deep);
  font-size: 0.88rem;
  line-height: 1.3;
}

.report-confirm span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 660;
  line-height: 1.45;
}

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

.report-submit,
.report-cancel,
.report-confirm-submit,
.report-confirm-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 760;
}

.report-submit {
  color: #fff;
  background: var(--red-deep);
  border: 1px solid var(--red-deep);
  box-shadow: 0 10px 20px rgba(132, 17, 22, 0.12);
}

.report-confirm-submit {
  color: #fff;
  background: var(--red-deep);
  border: 1px solid var(--red-deep);
}

.report-cancel,
.report-confirm-back {
  color: rgba(118, 98, 92, 0.92);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(234, 215, 206, 0.9);
}

.report-action:hover,
.report-action:focus-visible {
  color: #fff;
  background: #701015;
  border-color: #701015;
  box-shadow: 0 13px 24px rgba(132, 17, 22, 0.15);
  transform: translateY(-1px);
  outline: none;
}

.report-cancel:hover,
.report-cancel:focus-visible,
.report-confirm-back:hover,
.report-confirm-back:focus-visible {
  color: var(--red-deep);
  background: rgba(170, 23, 28, 0.1);
  outline: none;
}

.report-submit:hover,
.report-submit:focus-visible,
.report-confirm-submit:hover,
.report-confirm-submit:focus-visible {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 14px 24px rgba(132, 17, 22, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.report-action:disabled,
.report-submit:disabled,
.report-confirm-submit:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.report-action[aria-expanded="true"]:disabled {
  cursor: default;
  opacity: 0.78;
  box-shadow: none;
}

.report-actions [data-report-state] {
  min-height: 1.2em;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
  line-height: 1.5;
}

.report-actions [data-report-state][data-tone="success"] {
  color: #47743f;
}

.report-actions [data-report-state][data-tone="error"] {
  color: var(--red-deep);
}

.owner-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(234, 215, 206, 0.86);
  border-radius: 8px;
}

.owner-actions[hidden] {
  display: none;
}

.owner-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--red-deep);
  background: rgba(170, 23, 28, 0.08);
  border: 1px solid rgba(170, 23, 28, 0.18);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 820;
  line-height: 1;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.owner-action:hover,
.owner-action:focus-visible {
  background: rgba(170, 23, 28, 0.12);
  border-color: rgba(170, 23, 28, 0.24);
  transform: translateY(-1px);
  outline: none;
}

.owner-action.is-danger {
  color: #fff;
  background: var(--red-deep);
  border-color: var(--red-deep);
}

.owner-action.is-danger:hover,
.owner-action.is-danger:focus-visible {
  background: var(--red);
  border-color: var(--red);
}

.owner-actions small {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.5;
}

.dialog-open {
  overflow: hidden;
}

.share-dialog-open {
  overflow: hidden;
}

@keyframes digitWheelRoll {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(calc(var(--roll-steps) * -1em));
  }
}

@keyframes shareCardRise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@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;
  }
}

@media (max-width: 1180px) {
  .currency {
    font-size: 4.8rem;
  }

  .total-number {
    font-size: 9.2rem;
  }

  .upload-panel {
    grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  }

  .file-field {
    grid-column: 2;
    grid-row: 1;
  }

}

@media (max-width: 820px) {
  .hero {
    min-height: 46vh;
    padding-top: 48px;
    padding-bottom: 52px;
  }

  .currency {
    font-size: 4rem;
  }

  .total-number {
    font-size: 6.4rem;
  }

  .primary-action {
    margin-top: 66px;
  }

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

  .upload-fields,
  .file-field,
  .wide-field,
  .form-state,
  .submit-button {
    grid-column: 1;
  }

  .file-field {
    grid-row: auto;
  }

  .file-field .upload-dropzone {
    min-height: 0;
  }

  .receipt-preview {
    max-height: 360px;
  }

  .dialog-panel {
    grid-template-columns: 1fr;
  }

  .detail-media,
  .detail-body {
    max-height: none;
  }

  .detail-media {
    min-height: auto;
  }

  .detail-image-frame {
    max-height: 62vh;
  }

  .detail-body {
    border-left: 0;
    border-top: 1px solid rgba(234, 215, 206, 0.9);
    padding-top: 28px;
  }

  .dialog-panel {
    overflow: auto;
  }
}

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

  .hero {
    min-height: 42vh;
    padding-bottom: 42px;
  }

  .currency {
    font-size: 2.5rem;
  }

  .total-number {
    font-size: 4rem;
  }

  .primary-action {
    margin-top: 52px;
  }

  .amount-entry {
    grid-template-columns: 1fr;
  }

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

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

  .cards-toolbar {
    align-items: stretch;
    justify-content: space-between;
  }

  .receipt-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .receipt-search-box {
    width: 100%;
  }

  .sort-control {
    flex: 0 0 auto;
  }

  .upload-panel {
    padding: 16px;
  }

  .share-card {
    padding: 14px;
  }

  .share-card-dialog {
    width: 100%;
    padding: 0;
  }

  .security-note,
  .share-card-art {
    padding: 14px;
  }

  .share-card-message {
    font-size: 1rem;
  }

  .dialog-panel {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .detail-toolbar {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    padding: 12px;
  }

  .image-nav {
    width: 34px;
    height: 34px;
  }

  .detail-image-frame {
    max-height: 56vh;
    padding: 12px;
  }

  .detail-body {
    padding-inline: 18px;
  }

  .detail-amount {
    font-size: 2.7rem;
  }
}

body[data-home-mode="intake"] {
  background: var(--paper);
}

body[data-home-mode="intake"] .background-danmaku {
  opacity: 0.42;
}

body[data-home-mode="intake"] .danmaku-line {
  color: rgba(132, 17, 22, 0.34);
}

body[data-home-mode="intake"] .total-stage,
body[data-home-mode="intake"] .cards-section,
body[data-home-mode="intake"] .share-card,
body[data-home-mode="intake"] .receipt-dialog {
  display: none;
}

body[data-home-mode="intake"] .paper-page {
  min-height: 100svh;
  background: transparent;
}

body[data-home-mode="intake"] .hero {
  row-gap: 28px;
  min-height: 100svh;
  padding: 32px 18px;
}

body[data-home-mode="intake"]:not(.upload-open) .hero {
  padding-bottom: clamp(104px, 14vh, 150px);
}

body[data-home-mode="intake"] .intake-notice {
  position: relative;
  z-index: 2;
  display: block;
  width: min(860px, calc(100vw - 36px));
  margin: 0;
  color: rgba(39, 21, 21, 0.64);
  font-size: 0.98rem;
  font-weight: 620;
  line-height: 1.95;
  text-wrap: balance;
  white-space: pre-line;
}

html:not([data-lang="en"]) body[data-home-mode="intake"] .intake-notice {
  width: min(900px, calc(100vw - 72px));
}

@media (min-width: 760px) {
  html:not([data-lang="en"]) body[data-home-mode="intake"] .intake-notice {
    white-space: pre;
  }
}

@media (max-width: 520px) {
  body[data-home-mode="intake"] .intake-notice {
    width: min(100%, calc(100vw - 32px));
    font-size: 0.92rem;
    line-height: 1.86;
  }
}

body[data-home-mode="intake"] .primary-action {
  min-width: 144px;
  margin-top: 0;
}

body[data-home-mode="intake"].upload-open .hero {
  min-height: auto;
  padding: 22px 18px 10px;
}

body[data-home-mode="intake"].upload-open .intake-notice {
  display: none;
}

body[data-home-mode="intake"] .upload-section {
  padding-inline: clamp(14px, 5vw, 76px);
  padding-block: 0 42px;
}

body[data-home-mode="intake"] .upload-section:not(.is-collapsed) {
  max-height: none;
  overflow: visible;
}

body[data-home-mode="intake"] .upload-panel {
  margin-block: clamp(18px, 5vh, 48px);
}
