/* ============ 码票器 · 暖黄童趣主题 ============ */
:root {
  --cream: #fff8e9;
  --milk: #fffdf6;
  --butter: #ffe9b0;
  --honey: #ffd371;
  --sun: #ffc14d;
  --amber: #f0a93e;
  --caramel: #d18a34;
  --brown: #9a6428;
  --darkbrown: #6b4423;
  --softbrown: #b98a52;
  --blush: #ff9f7d;
  --leaf: #8fbf7a;
  --sky: #8fc6e8;
  --shadow: rgba(143, 92, 28, 0.18);
  --line: #e3b96b;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

@font-face {
  font-family: 'ZCOOL KuaiLe';
  src: url('../assets/fonts/ZCOOLKuaiLe.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'ZCOOL KuaiLe', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', sans-serif;
  color: var(--darkbrown);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.75) 0 6px, transparent 7px),
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.55) 0 10px, transparent 11px),
    radial-gradient(circle at 75% 78%, rgba(255, 255, 255, 0.5) 0 8px, transparent 9px),
    radial-gradient(circle at 20% 88%, rgba(255, 255, 255, 0.55) 0 12px, transparent 13px),
    linear-gradient(160deg, #fff3d2 0%, #ffe6ac 45%, #ffd98c 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ============ 浮动手绘装饰 ============ */
.doodle {
  position: fixed;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
  animation: floaty 6s ease-in-out infinite;
}
.doodle.d1 { top: 6%; left: 4%; animation-delay: 0s; }
.doodle.d2 { top: 22%; right: 5%; animation-delay: 1.2s; }
.doodle.d3 { bottom: 14%; left: 6%; animation-delay: 2s; }
.doodle.d4 { bottom: 30%; right: 7%; animation-delay: 0.6s; }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}

/* ============ 门禁页 ============ */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  position: relative;
  z-index: 1;
}
.gate-card {
  width: 100%;
  max-width: 460px;
  background: var(--milk);
  border: 3px dashed var(--line);
  border-radius: 34px;
  padding: 30px 26px 34px;
  text-align: center;
  box-shadow: 0 14px 0 rgba(209, 138, 52, 0.18), 0 22px 40px var(--shadow);
  position: relative;
}
.gate-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 26px;
  border: 2px solid rgba(255, 211, 113, 0.45);
  pointer-events: none;
}

.mascot-stand {
  width: 190px;
  margin: -82px auto 2px;
  position: relative;
  z-index: 2;
}
.mascot-stand img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 12px 10px rgba(143, 92, 28, 0.22));
  animation: bob 3s ease-in-out infinite;
}
.mascot-stand.small {
  width: 130px;
  margin: -64px auto 0;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

.gate h1 {
  font-size: 30px;
  margin: 6px 0 4px;
  color: var(--caramel);
  letter-spacing: 1px;
}
.gate .subtitle {
  font-size: 15px;
  color: var(--softbrown);
  margin: 0 0 20px;
}

.cute-input {
  width: 100%;
  padding: 15px 18px;
  font-size: 17px;
  color: var(--darkbrown);
  background: var(--cream);
  border: 3px solid var(--line);
  border-radius: 20px;
  outline: none;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.cute-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 5px rgba(255, 193, 77, 0.25);
  transform: translateY(-2px);
}
.cute-input::placeholder { color: #d8b483; }

.gate-tip {
  margin: 10px 2px 22px;
  font-size: 13.5px;
  color: var(--blush);
  line-height: 1.6;
}
.gate-tip b { color: #ef7f5a; }

/* ============ 果冻按钮 ============ */
.jelly-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 19px;
  color: #fff;
  background: linear-gradient(180deg, #ffd06a 0%, #f0a93e 100%);
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 6px 0 var(--caramel), 0 10px 18px var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
  letter-spacing: 1px;
  width: 100%;
}
.jelly-btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--caramel), 0 4px 8px var(--shadow);
}
.jelly-btn.secondary {
  background: linear-gradient(180deg, #fff3d2 0%, #ffe0a0 100%);
  color: var(--brown);
  box-shadow: 0 5px 0 var(--line), 0 8px 14px var(--shadow);
}
.jelly-btn.secondary:active { box-shadow: 0 1px 0 var(--line); }
.jelly-btn.small { padding: 9px 18px; font-size: 15px; width: auto; }
.jelly-btn.danger {
  background: linear-gradient(180deg, #ffb199 0%, #f07b58 100%);
  box-shadow: 0 5px 0 #cf623f, 0 8px 14px var(--shadow);
}
.jelly-btn.danger:active { box-shadow: 0 1px 0 #cf623f; }
.jelly-btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* ============ 主应用顶栏 ============ */
.app {
  position: relative;
  z-index: 1;
  padding-bottom: 150px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(255, 240, 205, 0.97), rgba(255, 232, 178, 0.92));
  backdrop-filter: blur(6px);
  border-bottom: 3px solid rgba(227, 185, 107, 0.55);
  padding: 12px 0;
  margin-bottom: 14px;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .brand {
  font-size: 21px;
  color: var(--caramel);
  flex-shrink: 0;
}
.name-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--milk);
  border: 2.5px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 15px;
}
.name-pill .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--leaf); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(143, 191, 122, 0.25);
}
.name-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--milk);
  border: 2.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: transform 0.12s;
}
.icon-btn:active { transform: scale(0.9); }

/* ============ 搜索与分类 ============ */
.search-box {
  position: relative;
  margin-bottom: 12px;
}
.search-box .mag {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  opacity: 0.7;
}
.search-box input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  font-size: 16px;
  background: var(--milk);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  outline: none;
  color: var(--darkbrown);
  box-shadow: 0 4px 0 rgba(227, 185, 107, 0.4);
}
.search-box input:focus { border-color: var(--amber); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 14.5px;
  border-radius: 999px;
  background: var(--milk);
  border: 2.5px solid var(--line);
  color: var(--brown);
  transition: all 0.15s;
}
.chip.active {
  background: linear-gradient(180deg, #ffd06a, #f0a93e);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 4px 0 var(--caramel);
}

/* ============ 礼物网格 ============ */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.gift-card {
  background: var(--milk);
  border: 3px solid #f0d7a3;
  border-radius: var(--radius-lg);
  padding: 12px 10px 14px;
  text-align: center;
  position: relative;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 5px 0 rgba(227, 185, 107, 0.45);
}
.gift-card.picked {
  border-color: var(--amber);
  background: linear-gradient(180deg, #fffdf6 0%, #fff4d8 100%);
  box-shadow: 0 5px 0 var(--caramel), 0 0 0 4px rgba(255, 193, 77, 0.22);
  transform: translateY(-3px);
}
.gift-icon {
  width: 84px;
  height: 84px;
  margin: 2px auto 6px;
  object-fit: contain;
  transition: transform 0.15s;
}
.gift-card.picked .gift-icon {
  transform: scale(1.08) rotate(-3deg);
}
.gift-name {
  font-size: 15.5px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gift-price {
  font-size: 13px;
  color: var(--softbrown);
  margin-bottom: 10px;
}
.gift-price .coin {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--butter);
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--brown);
}

/* 卡通加减控制 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.round-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid #fff;
  transition: transform 0.12s;
  position: relative;
}
.round-btn svg { width: 18px; height: 18px; }
.round-btn.plus {
  background: linear-gradient(180deg, #ffd06a, #f0a93e);
  box-shadow: 0 4px 0 var(--caramel);
}
.round-btn.minus {
  background: linear-gradient(180deg, #fff0cf, #ffd98c);
  box-shadow: 0 4px 0 var(--line);
}
.round-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--caramel);
}
.round-btn.minus:active { box-shadow: 0 1px 0 var(--line); }
.round-btn:disabled { opacity: 0.4; pointer-events: none; }

/* 数量气泡 */
.count-bubble {
  min-width: 46px;
  height: 38px;
  padding: 0 8px;
  border-radius: 14px;
  background: var(--cream);
  border: 2.5px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--caramel);
}
.count-bubble.zero { color: #d8b483; }

.empty-tip {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--softbrown);
  font-size: 17px;
}
.empty-tip .big { font-size: 52px; display: block; margin-bottom: 10px; }

/* ============ 毛毛虫进度条 ============ */
.caterpillar {
  display: flex;
  align-items: center;
  gap: 0;
  height: 18px;
  position: relative;
}
.caterpillar .track {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--line);
  overflow: hidden;
  position: relative;
}
.caterpillar .fill {
  height: 100%;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.35) 0 6px, transparent 6px 14px),
    linear-gradient(90deg, #ffd06a, #f08f3a);
  transition: width 0.35s cubic-bezier(.34,1.56,.64,1);
}
.caterpillar .head {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd06a, #f0a93e);
  border: 2.5px solid #fff;
  margin-left: -5px;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 3px 0 var(--caramel);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.caterpillar .head i {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--darkbrown); display: block;
}

/* ============ 底部提交栏 ============ */
.submit-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(255, 243, 210, 0.96), rgba(255, 232, 178, 0.97));
  border-top: 3px solid var(--line);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px var(--shadow);
}
.submit-bar-inner {
  max-width: 760px;
  margin: 0 auto;
}
.submit-meta {
  display: flex;
  justify-content: space-between;
  font-size: 14.5px;
  margin-bottom: 7px;
  color: var(--brown);
}
.submit-meta b { color: var(--caramel); font-size: 17px; }
.submit-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.submit-row .caterpillar { flex: 1; }
.submit-row .jelly-btn {
  width: auto;
  padding: 11px 24px;
  font-size: 17px;
  flex-shrink: 0;
}

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(107, 68, 35, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 84vh;
  overflow-y: auto;
  background: var(--milk);
  border-radius: 28px;
  border: 3px solid var(--line);
  padding: 24px 20px;
  position: relative;
  box-shadow: 0 16px 40px rgba(107, 68, 35, 0.3);
  animation: popIn 0.28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 {
  margin: 0 0 14px;
  text-align: center;
  color: var(--caramel);
  font-size: 24px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--butter);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-hero {
  text-align: center;
  padding: 8px 0 16px;
}
.success-hero .big-emoji {
  font-size: 64px;
  display: block;
  animation: bob 2.2s ease-in-out infinite;
}
.success-hero p { margin: 6px 0; color: var(--brown); font-size: 16px; }
.success-hero b { color: var(--caramel); font-size: 20px; }

/* 我的记录列表 */
.my-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.my-summary .box {
  flex: 1;
  background: var(--cream);
  border: 2.5px solid var(--line);
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
}
.my-summary .box b { display: block; font-size: 20px; color: var(--caramel); }
.my-summary .box small { color: var(--softbrown); font-size: 12.5px; }

.record-item {
  background: var(--cream);
  border: 2.5px solid var(--line);
  border-radius: 16px;
  padding: 11px 13px;
  margin-bottom: 10px;
  font-size: 14px;
}
.record-item .time { color: var(--softbrown); font-size: 12.5px; margin-bottom: 5px; }
.record-item .line-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.record-item img { width: 30px; height: 30px; object-fit: contain; }
.record-item .gname { flex: 1; }
.record-item .gcount { color: var(--caramel); font-weight: bold; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--darkbrown);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  z-index: 200;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  animation: toastIn 0.25s;
  max-width: 88%;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; } }

/* ============ 后台数据端 ============ */
.admin-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px 60px;
  position: relative;
  z-index: 1;
}
.admin-head {
  text-align: center;
  padding: 26px 0 18px;
}
.admin-head h1 {
  font-size: 30px;
  color: var(--caramel);
  margin: 0 0 6px;
}
.admin-head p { margin: 0; color: var(--softbrown); font-size: 14.5px; }

.admin-login {
  max-width: 420px;
  margin: 40px auto;
  background: var(--milk);
  border: 3px dashed var(--line);
  border-radius: 28px;
  padding: 28px 24px;
  box-shadow: 0 12px 30px var(--shadow);
}
.admin-login .cute-input { margin-bottom: 14px; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 20px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 5px 0 rgba(227, 185, 107, 0.45);
}
.stat-card .ico { font-size: 28px; display: block; margin-bottom: 4px; }
.stat-card b { font-size: 24px; color: var(--caramel); display: block; }
.stat-card small { color: var(--softbrown); font-size: 13px; }

.admin-tools {
  display: flex;
  gap: 9px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-tools .search-box { flex: 1; min-width: 180px; margin-bottom: 0; }
.admin-tools .jelly-btn { width: auto; padding: 11px 18px; font-size: 15px; }

.person-card {
  background: var(--milk);
  border: 3px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 0 rgba(227, 185, 107, 0.4);
}
.person-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.person-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--butter);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 0 var(--line);
  flex-shrink: 0;
}
.person-head .pname {
  font-size: 19px;
  color: var(--caramel);
  flex: 1;
  min-width: 100px;
  word-break: break-all;
}
.person-head .ptags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.person-head .ptag {
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--brown);
}
.person-head .ptag b { color: var(--caramel); }

.gift-rows { margin-bottom: 12px; }
.gift-row {
  display: grid;
  grid-template-columns: 38px 1fr 56px;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.gift-row img { width: 36px; height: 36px; object-fit: contain; }
.gift-row .gmeta { min-width: 0; }
.gift-row .gmeta .gn {
  font-size: 14.5px;
  display: block;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gift-row .gc {
  text-align: right;
  color: var(--caramel);
  font-size: 16px;
  font-weight: bold;
}
.gift-row .gc small {
  display: block;
  font-size: 11px;
  color: var(--softbrown);
  font-weight: normal;
}

.batch-list {
  border-top: 2.5px dashed var(--line);
  padding-top: 10px;
}
.batch-title {
  font-size: 13.5px;
  color: var(--softbrown);
  margin-bottom: 8px;
}
.batch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.batch-item .btime { color: var(--softbrown); font-size: 12px; flex-shrink: 0; }
.batch-item .bdesc { flex: 1; min-width: 0; }
.batch-item .bdesc span { display: inline-block; margin-right: 8px; white-space: nowrap; }
.batch-item .del-btn {
  flex-shrink: 0;
  padding: 6px 13px;
  font-size: 13px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #ffb199, #f07b58);
  border: 2px solid #fff;
  box-shadow: 0 3px 0 #cf623f;
}
.batch-item .del-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #cf623f; }

.loading-box {
  text-align: center;
  padding: 70px 20px;
  color: var(--softbrown);
  font-size: 17px;
}
.loading-box .spin {
  font-size: 44px;
  display: block;
  margin-bottom: 12px;
  animation: spin 1.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式 ============ */
@media (min-width: 600px) {
  .gift-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-cards { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 860px) {
  .gift-grid { grid-template-columns: repeat(4, 1fr); }
}
