:root {
  /* 调色板：新中式红金 */
  --bg-deep: #1a0505;
  --bg-red: #4a0404;
  --red-primary: #d91d2a;
  --red-dark: #8f0e16;
  
  --gold-light: #fff5d1;
  --gold-main: #fcc24d;
  --gold-dark: #cf9215;
  
  --text-main: #fffcf5;
  --text-sub: #dccbc6;
  
  --glass-bg: rgba(40, 10, 10, 0.65);
  --glass-border: rgba(255, 220, 150, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  --radius-l: 24px;
  --radius-m: 16px;
  --radius-s: 12px;
}

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

/* 修复黑框问题：隐藏时不仅是不显示，还要去除 block 属性 */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* === 背景与氛围 === */
.bg-fixed {
  position: fixed; inset: 0; z-index: -1;
  background: 
    radial-gradient(circle at 50% 120%, var(--red-dark), transparent 70%),
    radial-gradient(circle at 10% 20%, #3d0000, transparent 40%),
    linear-gradient(180deg, #120202 0%, #2b0505 100%);
}

.gold-dust {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

.lantern {
  position: absolute; top: -20px; width: 60px; height: 80px;
  background: radial-gradient(circle, #ff5e62 0%, #d4141d 100%);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(255, 50, 50, 0.4);
  z-index: 10;
}
.lantern::after {
  content:''; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 30px; background: var(--gold-main);
}
.l1 { left: 5%; animation: swing 4s infinite ease-in-out; }
.l2 { right: 5%; animation: swing 5s infinite ease-in-out reverse; }
@keyframes swing { 0%,100% {transform: rotate(-3deg);} 50% {transform: rotate(3deg);} }

/* === 布局容器 === */
.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* === 顶部 Hero 区域 === */
.hero { text-align: center; padding-bottom: 24px; }

.banner-box {
  position: relative;
  height: 160px;
  overflow: hidden;
}
.banner-img {
  width: 100%; height: 100%; object-fit: cover;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.badge-float {
  position: absolute; top: 16px; right: 16px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border: 1px solid var(--gold-dark);
  color: var(--gold-main);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.hero-content { padding: 0 20px; margin-top: -30px; position: relative; z-index: 2; }

.gradient-text {
  font-family: 'Noto Serif SC', serif;
  font-size: 32px;
  margin: 10px 0;
  background: linear-gradient(to bottom, #ffeeba 0%, #d49f39 60%, #996a12 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 10px rgba(212, 159, 57, 0.3);
}

.sub { font-size: 14px; color: var(--text-sub); margin-bottom: 20px; }
.sub strong { color: var(--gold-main); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.stat-item {
  background: rgba(0,0,0,0.2);
  padding: 10px 4px;
  border-radius: var(--radius-s);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-item .k { font-size: 11px; opacity: 0.7; margin-bottom: 4px; }
.stat-item .v { font-weight: 700; font-size: 15px; font-family: monospace; }
.stat-item .highlight { color: var(--gold-main); }

/* 领取按钮 */
.cta-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.btn-main {
  position: relative;
  width: 100%;
  max-width: 320px;
  padding: 16px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, #ffd700, #fdb931);
  color: #5a0000;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(253, 185, 49, 0.4), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.1s, filter 0.2s;
  overflow: hidden;
}
.btn-main:active { transform: scale(0.98); box-shadow: 0 2px 10px rgba(253, 185, 49, 0.3); }
.btn-main:disabled { filter: grayscale(1); opacity: 0.6; cursor: not-allowed; }

.btn-shine {
  position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.6), transparent);
  transform: skewX(-20deg);
  animation: btnShine 3s infinite;
}
@keyframes btnShine { 0% {left: -100%} 20% {left: 200%} 100% {left: 200%} }

.hint { font-size: 12px; color: var(--text-sub); }
.hint a { color: var(--gold-main); text-decoration: none; border-bottom: 1px dashed; }

.confirmed-box {
  margin-top: 15px;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.3);
  padding: 12px;
  border-radius: var(--radius-s);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  text-align: left;
}

.my-claim{
  margin-top: 12px;
  background: rgba(252, 194, 77, 0.14);
  border: 1px solid rgba(252, 194, 77, 0.28);
  padding: 12px;
  border-radius: var(--radius-s);
  display:flex;
  align-items:flex-start;
  gap: 12px;
  text-align:left;
}
.my-claim .icon{
  width: 36px; height: 36px;
  display:flex;align-items:center;justify-content:center;
  border-radius: 12px;
  background: rgba(0,0,0,0.20);
}
.my-claim .title{font-weight:900;color:var(--gold-light);margin-bottom:2px}
.my-claim .line{font-size:12px;color:rgba(255,255,255,0.86);margin-top:3px}
.my-claim .amt{font-weight:900;color:var(--gold-main)}
.my-claim a{color:var(--gold-main);text-decoration:underline;text-underline-offset:2px}
.my-claim .mono{word-break: break-all; overflow-wrap:anywhere}
.confirmed-box .mono { font-family: monospace; color: #fff; word-break: break-all; }

/* === 交互区域 Grid === */
.interaction-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

/* 聊天部分 */
.chat-section { display: flex; flex-direction: column; height: 420px; }
.chat-header {
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-tabs{
  margin-left:auto;
  display:flex;
  gap:8px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 4px;
}
.chat-tabs .tab{
  border:0;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-weight: 800;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.chat-tabs .tab.active{
  background: rgba(252,194,77,0.22);
  border: 1px solid rgba(252,194,77,0.35);
  color: var(--gold-light);
}
.avatar {
  width: 36px; height: 36px;
  background: var(--gold-main);
  color: #5a0000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
}
.chat-header .name { font-weight: bold; font-size: 14px; }
.chat-header .status { font-size: 11px; opacity: 0.7; }

.chat-viewport {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Markdown-lite rendering inside bot bubbles */
.bubble.bot .md-h{font-family:'Noto Serif SC',serif;font-weight:900;margin:6px 0 4px;color:var(--gold-light)}
.bubble.bot .md-h1{font-size:16px}
.bubble.bot .md-h2{font-size:15px}
.bubble.bot .md-h3{font-size:14px}
.bubble.bot strong{color:var(--gold-main)}
.bubble.bot .md-a{color:var(--gold-main);text-decoration:underline;text-underline-offset:2px}
.bubble.bot .md-ul,.bubble.bot .md-ol{margin:6px 0 6px 18px;padding:0}
.bubble.bot .md-ul li,.bubble.bot .md-ol li{margin:2px 0}
.bubble.bot .md-code{background:rgba(0,0,0,0.35);border:1px solid rgba(255,255,255,0.10);padding:1px 6px;border-radius:8px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px}
@keyframes popIn { from {opacity: 0; transform: scale(0.9);} to {opacity: 1; transform: scale(1);} }

.bubble.bot { align-self: flex-start; background: #333; color: #fff; border-top-left-radius: 2px; }
.bubble.me { align-self: flex-end; background: var(--red-primary); color: white; border-top-right-radius: 2px; }

/* 聊天输入区 (方案A) */
.chat-input-area {
  padding: 12px 12px 4px 12px; 
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0, 0, 0, 0.2);
}

#chat_input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0 16px;
  height: 46px;
  border-radius: 12px;
  color: #fff;
  outline: none;
  font-size: 15px;
  transition: all 0.3s ease;
}
#chat_input:focus {
  background: rgba(0, 0, 0, 0.4);
  border-color: var(--gold-main);
  box-shadow: 0 0 15px rgba(252, 194, 77, 0.15);
}

.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  height: 46px;
  background: linear-gradient(135deg, #fff3c9 0%, #f6c343 50%, #d69a1a 100%);
  border: 1px solid #ffeeba;
  color: #4a0404;
  font-weight: 900;
  font-size: 15px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-send:hover { transform: translateY(-1px); filter: brightness(1.1); box-shadow: 0 6px 16px rgba(246, 195, 67, 0.3); }
.btn-send:active { transform: translateY(1px); filter: brightness(0.95); }
.btn-send:disabled{
  filter: grayscale(1);
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 新手引导链接 */
.quick-qs{
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255,255,255,0.06);
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.qbtn{
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.qbtn:hover{filter:brightness(1.08);border-color: rgba(252,194,77,0.35)}
.qbtn:active{transform:translateY(1px)}

.input-hint {
  padding: 8px 16px 12px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
}
.input-hint a {
  color: var(--gold-main);
  text-decoration: none;
  border-bottom: 1px dashed rgba(246, 195, 67, 0.5);
  margin-left: 4px;
  transition: all 0.2s;
}
.input-hint a:hover { color: #fff; border-color: #fff; }

/* 红包视觉部分 */
.envelope-section {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; text-align: center;
}
.envelope-container { perspective: 1000px; margin-bottom: 20px; }
.envelope {
  position: relative; width: 140px; height: 180px;
  background: #c0392b;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.5s;
}
.envelope:hover { transform: translateY(-5px) rotateY(10deg); }

.envelope .flap {
  position: absolute; top: 0; left: 0; width: 100%; height: 50%;
  background: #d4141d;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 2;
  transform-origin: top;
  transition: 0.4s;
}
.envelope .seal {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  background: var(--gold-main);
  border-radius: 50%;
  z-index: 3;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  font-weight: 900; color: #8f0e16;
}
.envelope.open .flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .seal { opacity: 0; }

.rules h3 { color: var(--gold-main); margin: 0 0 10px; font-size: 16px; }
.rules ol { text-align: left; padding-left: 20px; margin: 0; font-size: 13px; color: var(--text-sub); }
.rules li { margin-bottom: 6px; }

/* === 记录列表 === */
.records { padding: 20px; min-height: 200px; }
.rec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.rec-head h2 { margin: 0; font-size: 18px; color: var(--gold-light); }
.badge-mini { font-size: 10px; padding: 2px 6px; background: rgba(255,255,255,0.1); border-radius: 4px; }

.rec-list { display: flex; flex-direction: column; gap: 10px; }
.rec-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.rec-left { display: flex; flex-direction: column; }
.rec-addr { font-family: monospace; font-size: 13px; color: #fff; }
.rec-meta { font-size: 11px; color: #888; }
.rec-amt { color: var(--gold-main); font-weight: bold; }
.rec-item a {
  display: inline-block; padding: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold-light);
  text-decoration: none;
  border-radius: 20px;
  font-size: 12px;
}

.footer { text-align: center; font-size: 12px; opacity: 0.4; padding: 30px 0; }

/* === 新手引导弹窗 === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-card {
  position: relative;
  width: 100%; max-width: 400px;
  padding: 24px;
  background: rgba(30, 10, 10, 0.9);
  border: 1px solid var(--gold-dark);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  transform: scale(1); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.hidden .modal-card { transform: scale(0.9); }

.modal-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 24px; cursor: pointer; padding: 5px 10px;
}
.modal-card h3 { margin: 0 0 20px; text-align: center; color: var(--gold-main); font-size: 18px; }

.guide-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.step {
  display: flex; gap: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}
.step-icon {
  font-size: 24px;
  width: 40px; height: 40px;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-text h4 { margin: 0 0 4px; font-size: 14px; color: #fff; }
.step-text p { margin: 0; font-size: 12px; color: var(--text-sub); line-height: 1.5; }
.highlight { color: var(--gold-main); font-weight: bold; }
.mono { font-family: monospace; background: rgba(0,0,0,0.3); padding: 2px 4px; border-radius: 4px; color: var(--gold-light); }
.tip { margin-top: 6px !important; font-size: 11px !important; opacity: 0.7; font-style: italic; }

/* === 移动端响应式 === */
@media (max-width: 768px) {
  .wrap { padding: 12px; gap: 16px; }
  .interaction-grid { grid-template-columns: 1fr; gap: 16px; }
  
  .envelope-section { order: 2; flex-direction: row; text-align: left; gap: 15px; padding: 16px; }
  .envelope-container { margin-bottom: 0; transform: scale(0.6); margin-right: -20px; }
  .envelope:hover { transform: none; }
  
  .chat-section { order: 1; height: 380px; }
  
  .banner-box { height: 120px; }
  .hero-content { margin-top: -20px; }
  .gradient-text { font-size: 26px; }
  
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-item { padding: 8px; flex-direction: row; justify-content: space-between; padding: 8px 12px; }
  .stat-item .k { margin: 0; }
  
  .rec-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .rec-item a { width: 100%; text-align: center; background: rgba(255,255,255,0.08); }

  .modal-card { padding: 20px; max-width: 90%; }
  .step { padding: 10px; gap: 10px; }
  .step-icon { width: 32px; height: 32px; font-size: 18px; }
}