@font-face {
  font-family: 'ChangBanDianSong';
  src: url('../fonts/ChangBanDianSong-16-SC.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1a1a1a;
  --ink: #111;
  --paper: #f5f2ea;
  --paper-dim: #e8e5dd;
  --accent: #b94e48;
  --accent-light: #d66b65;
  --text: #f0f0f0;
  --muted: #888;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'Noto Sans SC', sans-serif;
  --font-brand: 'ChangBanDianSong', 'Noto Sans SC', serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

/* ==================== 顶部导航 ==================== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.15em;
  padding: 4px 8px;
  transition: color 0.3s;
  cursor: pointer;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: var(--accent); }

/* ==================== 页面框架 ==================== */
.page {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
  padding: 5vh 5vw;
}
.page.active { opacity: 1; pointer-events: auto; }

/* ==================== 主页 ==================== */
.hero-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-top: 0;
}
.brand-line {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.4em;
  display: block;
  margin-bottom: 8px;
}
.brand {
  position: absolute;
  top: 29vh;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  z-index: 20;
}
.brand-title {
  font-family: var(--font-brand);
  font-size: clamp(38px, 8vw, 96px);
  font-weight: normal;
  margin: 0;
  line-height: 1;
  letter-spacing: 0.05em;
  color: #fff;
  text-shadow: 0 0 40px rgba(185, 78, 72, 0.35);
  transform: translateY(2px);
}
.brand-sub {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
  letter-spacing: 0.15em;
}

/* ---- 打印机：SVG Loading 动画 ---- */
.printer-slot {
  width: 600px;
  height: 420px;
  position: relative;
  margin: 13px 0 0;
  overflow: hidden;
  transform: scale(0.9);
}
.printer-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(185, 78, 72, 0.4));
  animation: printerPulse 2s ease-in-out infinite;
}
@keyframes printerPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.96); }
  50%      { opacity: 1;   transform: scale(1); }
}
.printer-slot.active .printer-svg {
  animation: printerActive 0.3s ease-out forwards;
}
@keyframes printerActive {
  0%   { opacity: 0.4; transform: scale(0.96); filter: drop-shadow(0 0 12px rgba(185, 78, 72, 0.4)); }
  100% { opacity: 1;   transform: scale(1);    filter: drop-shadow(0 0 30px rgba(185, 78, 72, 0.9)); }
}
.printer-led {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
  transition: background 0.3s, box-shadow 0.3s;
}
.printer-slot.active .printer-led { background: #4ade80; box-shadow: 0 0 10px #4ade80; }

/* ---- Loading... 文字 ---- */
.loading-text {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin: 0;
  animation: loadingBlink 1.5s ease-in-out infinite;
}
@keyframes loadingBlink {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ---- 主按钮：暗红底白字 50%→100% ---- */
.main-btn {
  position: relative;
  background: rgba(185, 78, 72, 0.5);
  color: #fff;
  border: none;
  padding: 16px 40px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.2em;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.3s, opacity 0.3s, box-shadow 0.3s;
  text-transform: uppercase;
  margin-top: 0;
}
.main-btn:hover {
  background: rgba(185, 78, 72, 1);
  box-shadow: 0 0 30px rgba(185, 78, 72, 0.5);
}
.main-btn.small { padding: 12px 24px; font-size: 12px; }
.main-btn:disabled { opacity: 0.25; cursor: not-allowed; box-shadow: none; }
.main-btn:disabled:hover { background: rgba(185, 78, 72, 0.5); box-shadow: none; }
.btn-glitch { display: block; }
.btn-quiet {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  opacity: 0.7;
  margin-top: 4px;
}
.print-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  margin: 8px 0 0;
}

/* ---- 底部按钮区域：绝对定位 ---- */
.bottom-actions {
  position: absolute;
  bottom: 28vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- 返回按钮 ---- */
.home-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: rgba(0,0,0,0.6);
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, background 0.3s;
}
.home-btn:hover { background: var(--accent); color: #fff; transform: rotate(90deg); }
.home-btn.visible { opacity: 1; pointer-events: auto; }

/* ==================== 清单页 ==================== */
/* ---- 清单页整体可滚动 ---- */
#page-list {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 200px 0 12vh;
  justify-content: flex-start;
  flex-direction: column;
  align-items: center;
}
#page-list::-webkit-scrollbar { display: none; }

/* ---- 页面顶部打印机 ---- */
.list-printer {
  position: relative;
  width: min(340px, 80vw);
  height: 32px;
  margin: 0 auto;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  flex-shrink: 0;
}
.list-printer.visible {
  opacity: 1;
}
.list-printer-svg {
  display: none;
}

/* 打印机机身：暗红色横向条形，圆角 */
.list-printer-body {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* 打印机出口：中间的黑色横缝 */
.list-printer-slot {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: min(280px, 68vw);
  height: 3px;
  background: #080808;
  border-radius: 1px;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 3;
}

/* 打印时出口内纸张微光 */
.list-printer.printing .list-printer-slot::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(245, 242, 234, 0.15) 30%,
    rgba(245, 242, 234, 0.25) 50%,
    rgba(245, 242, 234, 0.15) 70%,
    transparent 100%
  );
  animation: paperShine 0.4s ease-in-out infinite alternate;
}
@keyframes paperShine {
  from { opacity: 0.3; }
  to   { opacity: 0.7; }
}

/* LED 指示灯 */
.list-printer-led {
  position: absolute;
  right: 12px;
  top: 13px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #333;
  transition: background 0.3s, box-shadow 0.3s;
  z-index: 4;
}
.list-printer.printing .list-printer-led {
  background: #4ade80;
  box-shadow: 0 0 10px #4ade80;
  animation: ledBlink 0.3s ease-in-out infinite;
}
@keyframes ledBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 打印机震动 */
.list-printer.printing .list-printer-body {
  animation: printerShake 0.12s ease-in-out infinite;
}
@keyframes printerShake {
  0%, 100% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(-1px) translateY(0.5px); }
  50% { transform: translateX(1px) translateY(-0.5px); }
  75% { transform: translateX(-0.5px) translateY(0.5px); }
}

/* 打印机上方遮罩：与打印机、收据一体滚动 */
.printer-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 232px; /* 覆盖到打印机出口（200+32=232px） */
  background: #0d0d0d;
  z-index: 35; /* 高于收据，低于打印机(z-index:40) */
  pointer-events: none;
}

.receipt-wall {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 0 12vh;
  position: relative;
  z-index: 5;
}

/* ---- 打印出票动画：收据从打印机出口向下滑动，底部先出来 ---- */
.receipt-wrap.printing-out {
  position: relative;
}
.receipt.printing-out {
  transform-origin: top center;
  will-change: transform, opacity;
}

/* 打印时收据内容扫描显现：白色遮罩从上到下收起 */
.receipt-wrap.printing-out .receipt .print-scan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper);
  pointer-events: none;
  z-index: 10;
  animation: printScan 4.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
@keyframes printScan {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
/* -- 机械感打印下滑动画 -- */
@keyframes receiptDrop {
  0%   { transform: translateY(calc(-100vh)); opacity: 0.3; }
  15%  { transform: translateY(calc(-50vh)); opacity: 0.5; }
  30%  { transform: translateY(calc(-20vh)); opacity: 0.7; }
  50%  { transform: translateY(calc(-5vh)); opacity: 0.85; }
  70%  { transform: translateY(0); opacity: 0.95; }
  80%  { transform: translateY(-4px); opacity: 1; }
  90%  { transform: translateY(2px); }
  100% { transform: translateY(0); opacity: 1; }
}
.receipt-wrap.printing {
  animation: receiptDrop 1.4s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.receipt-wrap {
  position: relative;
  width: min(280px, 68vw);
  margin: 0 auto;
}
.receipt-wrap:not(.printing):not(.printing-out) {
  animation: receiptSlide 0.5s ease-out both;
}
@keyframes receiptSlide {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.receipt {
  background: var(--paper);
  color: var(--ink);
  padding: 0 22px 36px;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* 底部波浪边缘：深色半圆向上凸出，形成向上凹的波浪缺口 */
.receipt-bottom-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: 
    radial-gradient(circle at 10px 12px, var(--bg) 7px, transparent 7.5px) 0 0 / 20px 12px repeat-x;
  pointer-events: none;
  z-index: 3;
}

/* 顶部条形码区域 */
.receipt-top-barcode {
  height: 32px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 1px,
    transparent 1px 2px,
    var(--ink) 2px 3px,
    transparent 3px 4px,
    var(--ink) 4px 5px,
    transparent 5px 7px,
    var(--ink) 7px 8px,
    transparent 8px 10px,
    var(--ink) 10px 12px,
    transparent 12px 14px,
    var(--ink) 14px 15px,
    transparent 15px 17px,
    var(--ink) 17px 19px,
    transparent 19px 21px
  );
  opacity: 0.85;
  margin: 0 16px;
}

/* 条形码下方的虚线分隔线（单层虚直线，两端黑色三角形） */
.receipt-wavy-divider {
  height: 1px;
  margin: 8px 0;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.16) 0 6px, transparent 6px 10px);
  position: relative;
}

.receipt-wavy-divider::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 16px solid #000;
}

.receipt-wavy-divider::after {
  content: '';
  position: absolute;
  right: -22px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 16px solid #000;
}

/* 移除旧的伪元素波浪（改用mask实现） */
.receipt::before,
.receipt::after {
  display: none;
}

.receipt-header {
  text-align: center;
  padding-top: 22px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  position: relative;
}

/* 标题下方的虚线分隔线 */
.receipt-header::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 6px,
    transparent 6px 10px
  );
}

.receipt-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  white-space: nowrap;
}
.receipt-title { 
  font-size: 30px; 
  font-weight: 700; 
  margin: 0 0 8px; 
  letter-spacing: 0.08em;
  font-family: var(--font-brand);
}
.receipt-date { font-size: 12px; color: #555; letter-spacing: 0.05em; }

/* ---- 清单行（含滑动操作）---- */
.receipt-items { position: relative; }

.receipt-item-wrap {
  position: relative;
  overflow: hidden;
}

/* 清单项之间的浅浅横线 */
.receipt-item-wrap::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 1px;
  background: rgba(0,0,0,0.08);
}

.receipt-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  position: relative;
  z-index: 2;
  background: var(--paper);
  transition: transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  touch-action: pan-y;
  cursor: grab;
}
.receipt-item:active { cursor: grabbing; }
.receipt-item.swiped-left  { transform: translateX(-140px); }
.receipt-item.swiped-right { transform: translateX(0); }

/* 背后的操作按钮 */
.receipt-swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 1px;
  display: flex;
  z-index: 1;
}
.receipt-swipe-btn {
  width: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.receipt-swipe-btn.finish {
  background: #4a9e5c;
}
.receipt-swipe-btn.finish:active { background: #3a7e4c; }
.receipt-swipe-btn.delete {
  background: var(--accent);
}
.receipt-swipe-btn.delete:active { background: #933c37; }

.receipt-item-index {
  font-size: 13px;
  color: var(--accent);
  min-width: 26px;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.receipt-item-text {
  flex: 1;
  font-size: 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  outline: none;
  padding: 2px 0;
  -webkit-user-select: text;
  user-select: text;
}
.receipt-item-text:focus { border-bottom-color: var(--accent); }
.receipt-item-text::placeholder { 
  color: #999; 
  font-style: normal;
}

/* 已完成状态（Finish 后） */
.receipt-item-wrap.finished .receipt-item-text {
  color: #999;
  pointer-events: none;
  opacity: 0.6;
}
.receipt-item-wrap.finished .receipt-item-index {
  color: #7a9a6d;
}
.receipt-item-wrap.finished .receipt-item {
  background: var(--paper-dim);
}

/* ---- 无边框添加行按钮 ---- */
.receipt-add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #aaa;
  font-family: var(--font-sans);
  font-size: 13px;
  width: 100%;
  transition: color 0.2s;
  outline: none;
}
.receipt-add-row:hover { color: var(--ink); }
.receipt-add-row .plus-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s;
  color: #888;
}
.receipt-add-row:hover .plus-icon { background: rgba(0,0,0,0.15); color: #555; }

/* ---- Footer & Barcode ---- */
.receipt-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.25em;
  font-family: var(--font-mono);
  padding-bottom: 4px;
}
.receipt-barcode {
  height: 36px;
  margin-top: 14px;
  margin-bottom: 6px;
  background: repeating-linear-gradient(
    90deg,
    #000 0 1px,
    transparent 1px 2px,
    #000 2px 3px,
    transparent 3px 4px,
    #000 4px 5px,
    transparent 5px 7px,
    #000 7px 8px,
    transparent 8px 10px,
    #000 10px 11px,
    transparent 11px 13px,
    #000 13px 14px,
    transparent 14px 16px,
    #000 16px 17px,
    transparent 17px 19px
  );
  opacity: 0.9;
}

/* ---- Actions（只保留归档按钮）---- */
.receipt-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 16px;
}
.receipt-actions .mini-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.receipt-actions .mini-btn:hover { background: var(--accent); color: #fff; }
.receipt-actions .mini-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---- Connector ---- */
.receipt-connector {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 12px;
  background: 
    radial-gradient(circle at 10px 0, transparent 7px, var(--bg) 7.5px) 0 0 / 20px 12px repeat-x;
  pointer-events: none;
  z-index: 1;
}
.receipt-connector:hover { opacity: 1; }
.receipt-connector.cut { opacity: 0.3; }

/* ---- Stamp ---- */
.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg) scale(0);
  width: 140px;
  height: 140px;
  border: 4px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.85;
  pointer-events: none;
  animation: stampIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes stampIn { to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }
.stamp.archived { border-color: #7a9a6d; color: #7a9a6d; }

/* ==================== 票夹 / 时光机 / 统计 ==================== */
.archive-stage, .time-stage, .stats-stage {
  width: min(960px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 40px 0;
  scrollbar-width: none;
}
.archive-stage::-webkit-scrollbar,
.time-stage::-webkit-scrollbar,
.stats-stage::-webkit-scrollbar { display: none; }
.archive-title, .time-title, .stats-title {
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 32px;
  letter-spacing: 0.05em;
  color: #fff;
}
.archive-title span, .time-title span, .stats-title span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 16px;
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.2em;
}

/* ---- 归档页：像素文件夹区域 ---- */
.archive-folder-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  position: relative;
  padding-top: 90px;
}

/* 像素文件夹 */
.pixel-folder {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 10;
}
.pixel-folder:hover { transform: scale(1.05); }
.pixel-folder:active { transform: scale(0.97); }
.pixel-folder.opened {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#folder-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 173px;
  height: 144px;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.5));
}

.folder-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.15em;
  animation: folderPulse 2s ease-in-out infinite;
  margin-top: 16px;
}
@keyframes folderPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.pixel-folder.opened .folder-label { display: none; }

/* ---- 轮播区域（点击文件夹后显示） ---- */
.flying-tickets {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin-top: -140px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.flying-tickets.active {
  opacity: 1;
  pointer-events: auto;
}

/* 轮播主体：当前卡片居中展示 */
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 300px;
  height: 140px;
}

/* 左右切换按钮 */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
  user-select: none;
}
.carousel-btn:hover { background: rgba(0,0,0,0.8); border-color: var(--accent); color: var(--accent); }
.carousel-btn.prev { left: -48px; }
.carousel-btn.next { right: -48px; }
.carousel-btn:disabled { opacity: 0.2; pointer-events: none; }

/* 页码指示器 */
.carousel-indicator {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ---- 归档小票卡片（轮播模式） ---- */
.archive-ticket {
  width: 160px;
  height: 70px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  box-shadow: 2px 2px 0 #e0ddd5, 4px 4px 0 #d5d2ca, 0 8px 32px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.3s ease,
              width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              height 0.4s ease;
  overflow: hidden;
  position: relative;
}

/* 卡片入场动画（从文件夹飞出到轮播位置） */
.archive-ticket.fly-in-carousel {
  animation: ticketFlyToCarousel 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes ticketFlyToCarousel {
  0% { opacity: 0; transform: scale(0.3) translateY(60px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* 卡片切换动画 */
.archive-ticket.slide-left {
  animation: slideLeft 0.3s ease forwards;
}
.archive-ticket.slide-right {
  animation: slideRight 0.3s ease forwards;
}
@keyframes slideLeft {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(-60px) scale(0.9); }
}
@keyframes slideRight {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(60px) scale(0.9); }
}
.archive-ticket.slide-in-left {
  animation: slideInLeft 0.3s ease forwards;
}
.archive-ticket.slide-in-right {
  animation: slideInRight 0.3s ease forwards;
}
@keyframes slideInLeft {
  0% { opacity: 0; transform: translateX(60px) scale(0.9); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes slideInRight {
  0% { opacity: 0; transform: translateX(-60px) scale(0.9); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}

/* ---- 简洁视图：默认显示日期+条形码 ---- */
.archive-ticket-simple {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  transition: opacity 0.2s ease;
}
.archive-ticket-simple-date {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.03em;
  text-align: center;
}
.archive-ticket-simple-barcode {
  width: 80%;
  height: 22px;
  background: repeating-linear-gradient(
    90deg,
    #000 0 1px, transparent 1px 2px,
    #000 2px 3px, transparent 3px 4px,
    #000 4px 5px, transparent 5px 7px,
    #000 7px 8px, transparent 8px 10px
  );
  opacity: 0.7;
}

/* ---- 详细视图（点击展开） ---- */
.archive-ticket-detail {
  display: none;
  overflow: hidden;
}
.archive-ticket.expanded {
  width: 220px;
  height: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 2px 2px 0 #e0ddd5;
}
.archive-ticket.expanded .archive-ticket-simple {
  opacity: 0;
  pointer-events: none;
}
.archive-ticket.expanded .archive-ticket-detail {
  display: block;
  animation: detailFadeIn 0.35s ease forwards;
}
@keyframes detailFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 小票内部结构 */
.archive-ticket-top-barcode {
  height: 20px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 1px, transparent 1px 2px,
    var(--ink) 2px 3px, transparent 3px 4px,
    var(--ink) 4px 5px, transparent 5px 7px,
    var(--ink) 7px 8px, transparent 8px 10px
  );
  opacity: 0.7;
  margin: 10px 14px 0;
}

.archive-ticket-divider {
  height: 1px;
  margin: 6px 10px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 4px, transparent 4px 7px);
}

.archive-ticket-header {
  text-align: center;
  padding: 10px 10px 8px;
}
.archive-ticket-tag {
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.archive-ticket-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  font-family: var(--font-brand);
  letter-spacing: 0.05em;
}
.archive-ticket-date {
  font-size: 9px;
  color: #555;
  letter-spacing: 0.03em;
}

.archive-ticket-items {
  padding: 6px 14px;
  line-height: 1.6;
}
.archive-ticket-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
}
.archive-ticket-item-index {
  font-size: 10px;
  color: var(--accent);
  min-width: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.archive-ticket-item-text {
  font-size: 10px;
  font-family: var(--font-sans);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.archive-ticket-item-text.empty {
  color: #bbb;
  font-style: italic;
}

.archive-ticket-footer {
  text-align: center;
  padding: 8px 10px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #666;
}
.archive-ticket-bottom-barcode {
  height: 24px;
  margin: 8px 20px 16px;
  background: repeating-linear-gradient(
    90deg,
    #000 0 1px, transparent 1px 2px,
    #000 2px 3px, transparent 3px 4px,
    #000 4px 5px, transparent 5px 7px,
    #000 7px 8px, transparent 8px 10px,
    #000 10px 11px, transparent 11px 13px
  );
  opacity: 0.8;
}

/* 小票底部波浪边缘 */
.archive-ticket-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background:
    radial-gradient(circle at 10px 12px, var(--bg) 7px, transparent 7.5px) 0 0 / 20px 12px repeat-x;
  pointer-events: none;
  z-index: 2;
}

/* 小票顶部波浪边缘 */
.archive-ticket-wave-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12px;
  background:
    radial-gradient(circle at 10px 0, transparent 7px, var(--bg) 7.5px) 0 0 / 20px 12px repeat-x;
  pointer-events: none;
  z-index: 2;
}

/* 收回按钮 */
.archive-collect-btn {
  display: none;
  margin-top: 20px;
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 20px;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.2s;
  z-index: 10;
  position: relative;
}
.archive-collect-btn.visible { display: inline-block; }
.archive-collect-btn:hover { border-color: var(--accent); color: var(--accent); }

.archive-empty { color: var(--muted); font-family: var(--font-mono); text-align: center; padding: 60px 0; display: none; }
.archive-empty.visible { display: block; }

.time-desc { color: var(--muted); margin: 0 0 24px; }
.time-input-wrap { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.time-input-wrap input {
  flex: 1;
  min-width: 260px;
  background: rgba(255,255,255,0.04);
  border: 1px solid #333;
  color: #fff;
  padding: 14px 18px;
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
}
.time-input-wrap input:focus { border-color: var(--accent); }
.snapshot-card { background: rgba(255,255,255,0.04); border: 1px solid #333; padding: 28px; animation: fadeUp 0.5s ease; }
.snapshot-card.hidden { display: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.snapshot-label { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.15em; margin-bottom: 12px; }
.snapshot-text { font-size: 18px; line-height: 1.7; margin-bottom: 24px; color: #eee; }
.snapshot-text strong { color: var(--accent-light); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stats-card { background: rgba(255,255,255,0.03); border: 1px solid #222; padding: 24px; transition: border-color 0.3s, transform 0.3s; }
.stats-card:hover { border-color: var(--accent); transform: translateY(-4px); }
.stats-label { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.15em; margin-bottom: 12px; }
.stats-number { font-size: 48px; font-weight: 900; line-height: 1; color: #fff; }
.stats-unit { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stats-saved { font-family: var(--font-mono); font-size: 12px; color: #7a9a6d; margin-top: 14px; }
.stats-chart { background: rgba(255,255,255,0.03); border: 1px solid #222; padding: 24px; }
.chart-title { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: 0.15em; margin-bottom: 20px; }
.trend-bars { display: flex; align-items: flex-end; justify-content: space-between; gap: 4px; height: 120px; }
.trend-bar { flex: 1; background: var(--accent); min-width: 8px; opacity: 0.7; transition: opacity 0.2s, transform 0.2s; position: relative; }
.trend-bar:hover { opacity: 1; transform: scaleY(1.05); }
.trend-bar.zero { background: #333; opacity: 0.3; }

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  .top-nav { gap: 12px; padding: 8px 12px; }
  .nav-link { font-size: 15px; }
  .receipt { padding: 0 20px 34px; }
  .receipt-top-barcode { margin: 0 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .receipt-swipe-btn { width: 60px; font-size: 11px; }
  .receipt-item.swiped-left { transform: translateX(-120px); }
}
