/* ========== CSS Variables & Reset ========== */
:root {
  --color-primary: #D4A574;
  --color-primary-dark: #B8865A;
  --color-sky: #5B9BD5;
  --color-sky-light: #87CEEB;
  --color-red: #C75044;
  --color-green: #4CAF50;
  --color-blue: #2196F3;
  --color-purple: #9C27B0;
  --color-orange: #FF9800;
  --color-bg: #F5EDE0;
  --color-card: #FFF8F0;
  --color-text: #3E2723;
  --color-text-light: #8D6E63;
  --color-border: #D7CCC8;
  --font-main: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(62, 39, 35, 0.12);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
}

#app {
  width: 100%;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ========== Common Styles ========== */
.page {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: 80px;
  scrollbar-width: none; /* Firefox */
}
.page-content::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-main);
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-red), #A0342C);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 17px;
  width: 100%;
}

.btn-block {
  width: 100%;
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ========== Cards ========== */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.card-gentle {
  border-left: 4px solid var(--color-green);
}

.card-distant {
  border-left: 4px solid var(--color-blue);
}

.card-clear {
  border-left: 4px solid var(--color-orange);
}

/* ========== Header ========== */
.header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  min-height: 52px;
}

.header-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.header-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
}

.header-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

/* ========== Bottom Navigation ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
  color: var(--color-text-light);
  transition: color 0.2s;
  font-size: 11px;
  text-decoration: none;
}

.nav-item.active {
  color: var(--color-primary-dark);
}

.nav-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

/* ========== Form ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 15px;
  background: #fff;
  color: var(--color-text);
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--color-primary);
}

/* ========== Tags ========== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.tag-gentle {
  background: rgba(76, 175, 80, 0.15);
  color: var(--color-green);
}

.tag-distant {
  background: rgba(33, 150, 243, 0.15);
  color: var(--color-blue);
}

.tag-clear {
  background: rgba(255, 152, 0, 0.15);
  color: var(--color-orange);
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 0;
  background: var(--color-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.tab-item {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-text-light);
}

.tab-item.active {
  background: var(--color-primary);
  color: #fff;
}

/* ========== Grid ========== */
.kite-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px 0;
}

.kite-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid var(--color-border);
}

.kite-card:active {
  transform: scale(0.96);
}

.kite-card img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 8px;
}

.kite-card .kite-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.kite-card .kite-level {
  font-size: 12px;
  color: var(--color-text-light);
}

/* ========== Animations ========== */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes kiteFly {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  25% { transform: rotate(1deg) translateY(-6px); }
  50% { transform: rotate(-1deg) translateY(-10px); }
  75% { transform: rotate(3deg) translateY(-4px); }
}

@keyframes kiteSwing {
  0%, 100% { transform: scaleX(1); }
  25% { transform: scaleX(0.98); }
  75% { transform: scaleX(1.02); }
}

@keyframes kiteStringSway {
  0%, 100% { transform: rotate(3deg); }
  50% { transform: rotate(-3deg); }
}

@keyframes kiteGlow {
  from { filter: drop-shadow(0 4px 12px rgba(255,152,0,0.2)); }
  to { filter: drop-shadow(0 4px 20px rgba(255,152,0,0.45)); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, -50%) translateY(10px); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 152, 0, 0.3); }
  50% { box-shadow: 0 0 20px rgba(255, 152, 0, 0.6); }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

.animate-slideUp {
  animation: slideUp 0.4s ease-out;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(62, 39, 35, 0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 9999;
  animation: fadeInUp 0.2s ease-out;
  pointer-events: none;
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--color-card);
  border-radius: 16px;
  padding: 24px;
  width: 85%;
  max-width: 360px;
  animation: slideUp 0.3s ease-out;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.modal-body {
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

/* ========== Kite Search Page (Scene Style) ========== */
.kite-search-scene {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 52px);
  background: linear-gradient(180deg,
    #6EB5E8 0%,
    #8ECAEA 15%,
    #B8DEF2 35%,
    #DCEFEF 55%,
    #E8F0DC 72%,
    #C8DFA0 88%,
    #AACC78 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 云朵背景 */
.scene-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.scene-cloud {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: calc(var(--cr) * 1.4);
  height: calc(var(--cr) * 0.7);
  background:
    radial-gradient(ellipse at 25% 50%, rgba(255,255,255,var(--ca)) 0%, transparent 60%),
    radial-gradient(ellipse at 65% 45%, rgba(255,255,255,calc(var(--ca)*0.85)) 0%, transparent 55%),
    radial-gradient(ellipse at 42% 62%, rgba(255,255,255,calc(var(--ca)*0.7)) 0%, transparent 50%);
  filter: blur(2px);
}

/* 顶部信息栏 */
.scene-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
  position: relative;
  z-index: 10;
}
.scene-scroll-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(80,60,40,0.75);
  backdrop-filter: blur(6px);
  padding: 3px 9px 3px 7px;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.scroll-icon { font-size: 14px; }
.scroll-plus {
  background: #4CAF50;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 2px;
}
.scene-title {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(93,64,55,0.35), 0 0 24px rgba(255,255,255,0.3);
  margin: 0;
}
.scene-avatar {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px);
  padding: 3px 8px 3px 3px;
  border-radius: 14px;
}
.scene-avatar img {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 50%;
}
.scene-avatar span {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text);
}

/* 状态横幅 */
.scene-banner {
  text-align: center;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 10;
  margin: 0 12px 2px;
  border-radius: 10px;
}

/* 风筝区域（三列） */
.scene-kites-area {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 6px 4px 0;
  position: relative;
  z-index: 3;
  flex-shrink: 0;
}
.scene-kite-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30%;
}
.scene-kite-wrap {
  margin-top: 4px;
}
.scene-kite-img {
  width: 82px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.18));
}
.scene-bag-chain {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  margin-top: 3px;
}
.scene-bag-img {
  width: 26px; height: 26px;
  object-fit: contain;
}

/* 线轴区域（底部） */
.scene-spool-area {
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
  padding: 8px 20px 80px;
  position: relative;
  z-index: 5;
  margin-top: auto;
  flex-shrink: 0;
}
.scene-spool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,250,240,0.75);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 14px 12px 8px;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 3px 12px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5);
  border: 1.5px solid rgba(200,170,130,0.3);
  position: relative;
  min-width: 86px;
}
.scene-spool-card:active { transform: scale(0.95); }
.spool-cost-badge {
  position: absolute;
  top: 2px; right: 4px;
  background: linear-gradient(135deg,#BDBDBD,#9E9E9E);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: all 0.2s;
}
.spool-cost-badge:hover { transform: scale(1.08); }
.spool-cost-badge.is-10x {
  background: linear-gradient(135deg,#FFB300,#FF8F00);
  box-shadow: 0 2px 6px rgba(255,143,0,0.5);
}
.spool-reel-img {
  width: 52px; height: auto;
  object-fit: contain;
}
.spool-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text);
  margin: 3px 0 5px;
  white-space: nowrap;
}
.spool-select-btn {
  padding: 4px 22px;
  background: linear-gradient(135deg, var(--color-primary-dark), #A07548);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: var(--font-main);
  box-shadow: 0 2px 6px rgba(160,117,72,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.spool-select-btn:active { opacity: 0.85; }

/* 丝线 Canvas */
#threadCanvas {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}

.spool {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.spool:active {
  transform: scale(0.95);
}

.spool-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #D4A574, #B8865A);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(184, 134, 90, 0.4);
  border: 3px solid #8D6E63;
}

.spool-label {
  font-size: 11px;
  margin-top: 4px;
  color: var(--color-text);
  font-weight: 600;
}

.spool-btn {
  margin-top: 6px;
  padding: 4px 12px;
  background: var(--color-red);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
}

.spool-btn:active {
  opacity: 0.8;
}

/* ========== Search Controls ========== */
.search-controls {
  padding: 16px;
}

.scrolls-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.scrolls-count {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.ten-x-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: #ccc;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-switch.active {
  background: var(--color-primary);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.active::after {
  transform: translateX(22px);
}

/* ========== Status Banner ========== */
.status-banner {
  padding: 8px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  animation: sparkle 1.5s infinite;
}

.tianci-banner {
  background: linear-gradient(90deg, #FFD700, #FFA000);
  color: #5D4037;
}

.guilque-banner {
  background: linear-gradient(90deg, #9C27B0, #7B1FA2);
  color: #fff;
}

/* ========== Reward Overlay ========== */
.reward-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.reward-modal {
  background: var(--color-card);
  border-radius: 16px;
  padding: 24px;
  width: 85%;
  max-width: 360px;
  animation: slideUp 0.4s ease-out;
  text-align: center;
}

.reward-modal h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--color-primary-dark);
}

.reward-list {
  list-style: none;
  margin-bottom: 20px;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.bag-quality-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* ========== Battle Canvas ========== */
.battle-canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.battle-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 左上角垂直堆叠HUD（仿参考截图布局）*/
.battle-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 距离显示：大字粗体 */
.hud-distance {
  font-size: 36px;
  font-weight: 900;
  color: #1565C0;
  text-shadow: 0 2px 0 rgba(255,255,255,0.9), 0 3px 6px rgba(0,0,0,0.15);
  line-height: 1.1;
  letter-spacing: -1px;
}

/* 线长行：纸鸢图标 + 绿色进度条 + 当前/最大值 */
.hud-hp-row {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,248,240,0.88);
  backdrop-filter: blur(4px);
  padding: 3px 8px 3px 3px;
  border-radius: 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.hud-kite-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}

.hud-hp-bar-wrap {
  flex: 1;
  height: 14px;
  background: rgba(0,0,0,0.15);
  border-radius: 7px;
  overflow: hidden;
  min-width: 80px;
  max-width: 140px;
}

.hud-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #43A047, #66BB6A);
  border-radius: 7px;
  transition: width 0.25s ease-out;
  position: relative;
}
.hud-hp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 50%);
  border-radius: 7px;
}

.hud-hp-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

/* 浮动数字容器 */
#hudDeltaContainer {
  position: relative;
  margin-top: 2px;
  min-height: 20px;
  width: 0;
  overflow: visible;
}

@keyframes hudDeltaFade {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-22px); }
}

/* ========== Battle Reward Bar ========== */
.battle-reward-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 14px;
  z-index: 10;
  gap: 10px;
  pointer-events: none;
}

.reward-bar-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.08);
}

.reward-bar-items {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.reward-bar-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  align-self: center;
}

/* 奖励卡片（带图标的方块） */
.reward-card {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(212,165,116,0.2);
  border: 1.5px solid rgba(180,130,80,0.3);
  border-radius: 8px;
  padding: 2px 6px 2px 2px;
  pointer-events: auto;
}
.reward-card img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}
.reward-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary-dark);
  min-width: 12px;
  text-align: right;
}

/* ========== Battle End Overlay ========== */
.battle-end-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(62, 39, 35, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.battle-end-modal {
  background: var(--color-card);
  border-radius: 20px;
  padding: 28px 20px;
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.4s ease-out;
}

.battle-end-header {
  text-align: center;
  margin-bottom: 16px;
}

.battle-end-icon {
  font-size: 44px;
  margin-bottom: 4px;
}

.battle-end-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.battle-end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.battle-stat-card {
  background: rgba(212, 165, 116, 0.1);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
}

.battle-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary-dark);
  line-height: 1.2;
}

.battle-stat-unit {
  font-size: 12px;
  font-weight: 400;
}

.battle-stat-label {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.battle-end-kite {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(212, 165, 116, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.battle-end-kite img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.battle-end-loot {
  background: rgba(212, 165, 116, 0.08);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.battle-loot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.battle-loot-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 4px;
}

.battle-loot-scroll.loot-expanded {
  flex-wrap: wrap;
}

.battle-loot-scroll .loot-hidden {
  display: none;
}

.battle-loot-scroll.loot-expanded .loot-hidden {
  display: flex;
}

.battle-loot-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  flex-shrink: 0;
  white-space: nowrap;
}

.battle-loot-more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.4);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.battle-loot-icon {
  font-size: 14px;
}

.battle-loot-name {
  color: var(--color-text);
  font-weight: 500;
}

.battle-loot-count {
  color: var(--color-primary-dark);
  font-weight: 700;
}

.battle-end-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.battle-end-actions .btn {
  flex: 1;
}

/* ========== Login Page ========== */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: linear-gradient(180deg, #E8D5C4 0%, var(--color-bg) 100%);
}

.login-logo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.login-kite-string {
  position: absolute;
  top: -60px;
  left: 50%;
  width: 1px;
  height: 55px;
  background: linear-gradient(to bottom, transparent, rgba(160,110,60,0.5), rgba(180,145,100,0.25));
  transform-origin: top center;
  animation: kiteStringSway 4s ease-in-out infinite;
}

.login-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(255,152,0,0.25));
  animation: kiteFly 4s ease-in-out infinite, kiteGlow 3s ease-in-out infinite alternate;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary-dark);
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 32px;
}

.login-form {
  width: 100%;
  max-width: 320px;
}

.login-form .form-group {
  margin-bottom: 14px;
}

.login-form .btn {
  margin-top: 8px;
}

.login-switch {
  margin-top: 16px;
  font-size: 13px;
  color: var(--color-text-light);
  cursor: pointer;
}

.login-switch span {
  color: var(--color-primary-dark);
  font-weight: 600;
}

/* ========== Home Page (Scene Style) ========== */
.page-home {
  background: transparent;
  display: flex;
  flex-direction: column;
}

.page-home .page-content {
  padding-bottom: 80px;
}

.home-hero-scene {
  position: relative;
  background: linear-gradient(180deg,
    #87CEEB 0%,
    #A8D8EA 20%,
    #C8E6F5 38%,
    #E8F4E8 52%,
    #C8E090 68%,
    #A8D068 100%);
  border-radius: 0 0 28px 28px;
  padding: 16px 12px 24px;
  overflow: hidden;
  min-height: calc(100vh - 70px);
  color: var(--color-text);
  display: flex;
  flex-direction: column;
}

/* 背景装饰：远山+云层 */
.hero-bg-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-bg-decor::before {
  content: '';
  position: absolute;
  bottom: 18%;
  left: -10%;
  right: -10%;
  height: 80px;
  background:
    radial-gradient(ellipse at 20% 70%, rgba(139,158,74,0.35) 0%, transparent 50%),
    radial-gradient(ellipse at 55% 65%, rgba(139,158,74,0.3) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 72%, rgba(139,158,74,0.25) 0%, transparent 50%);
}
.hero-bg-decor::after {
  content: '';
  position: absolute;
  top: 15%;
  left: -5%;
  right: -5%;
  height: 60px;
  background:
    radial-gradient(ellipse at 15% 50%, rgba(255,255,255,0.5) 0%, transparent 30%),
    radial-gradient(ellipse at 60% 40%, rgba(255,255,255,0.4) 0%, transparent 25%),
    radial-gradient(ellipse at 88% 55%, rgba(255,255,255,0.45) 0%, transparent 28%);
}

/* 左上角宝箱 */
.hero-treasure-box {
  position: absolute;
  top: 14px;
  left: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s;
}
.hero-treasure-box:active { transform: scale(0.92); }
.hero-treasure-box img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
  animation: float 3s ease-in-out infinite;
}
.hero-treasure-box span {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #E8985A, #D4793A);
  padding: 1px 7px;
  border-radius: 8px;
  margin-top: 2px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 倒计时徽章 */
.hero-countdown-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(62,39,35,0.75);
  backdrop-filter: blur(6px);
  padding: 4px 12px;
  border-radius: 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}
.cd-icon { font-size: 13px; }
.cd-text { font-variant-numeric: tabular-nums; }

/* 标题行 */
.hero-title-row {
  text-align: center;
  padding-top: 36px;
  position: relative;
  z-index: 3;
}
.hero-main-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #5D4037;
  text-shadow:
    0 2px 0 rgba(255,255,255,0.7),
    0 3px 6px rgba(93,64,55,0.2),
    0 0 20px rgba(212,165,116,0.3);
  margin: 0;
}

/* 中央风筝展示区（Canvas） */
.hero-kite-showcase {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 220px;
}
.hero-kite-showcase canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 右下角线轴装饰 */
.hero-spool-decor {
  position: absolute;
  bottom: 110px;
  right: 8px;
  width: 52px;
  height: auto;
  object-fit: contain;
  opacity: 0.7;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
  transform: rotate(-15deg);
  z-index: 3;
}

/* 横幅风格入口按钮 - 推到底部 */
.hero-action-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 4px 8px;
  position: relative;
  z-index: 4;
  margin-top: auto;
}

.action-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  min-width: 130px;
  justify-content: center;
}
.action-banner:active {
  transform: scale(0.95);
}
.action-banner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

.banner-left {
  background: linear-gradient(135deg, #E8985A, #D4793A);
  color: #FFF;
  box-shadow: 0 3px 12px rgba(232,152,90,0.4),
              inset 0 1px 0 rgba(255,255,255,0.25);
}
.banner-right {
  background: linear-gradient(135deg, #E86B4A, #C84F38);
  color: #FFF;
  box-shadow: 0 3px 12px rgba(232,107,74,0.4),
              inset 0 1px 0 rgba(255,255,255,0.25);
}
.banner-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.banner-arrow {
  font-size: 16px;
  opacity: 0.8;
}

/* 奖励预览条（在 Hero 场景内部） */
.home-reward-bar {
  margin-top: 10px;
  background: linear-gradient(135deg, #FFD54F, #FFB300, #FFA000);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 3px 12px rgba(255,179,0,0.35);
  position: relative;
  z-index: 4;
}
.reward-bar-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #5D4037;
  margin-bottom: 6px;
  letter-spacing: 2px;
}
.reward-bar-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.reward-preview-item img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

/* ========== Task Page ========== */
.task-page {
  padding: 12px 16px 80px;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}
.task-page::-webkit-scrollbar {
  display: none;
}

.checkin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #FFF8F0, #FFE8CC);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.checkin-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkin-icon {
  font-size: 32px;
}

.checkin-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.checkin-sub {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.btn-disabled {
  background: #ccc;
  color: #999;
  cursor: default;
  box-shadow: none;
}

.task-tabs {
  display: flex;
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.task-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-tab.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  box-shadow: 0 2px 6px rgba(184, 134, 90, 0.3);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  transition: opacity 0.2s;
}

.task-item.claimed {
  opacity: 0.6;
}

.task-item-left {
  flex: 1;
  margin-right: 12px;
}

.task-item-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.task-item-desc {
  font-size: 12px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.task-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.task-bar {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.task-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
  border-radius: 3px;
  transition: width 0.3s;
}

.task-pct {
  font-size: 11px;
  color: var(--color-text-light);
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}

.task-item-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.task-reward {
  font-size: 12px;
  color: var(--color-primary-dark);
  font-weight: 600;
}

.task-claimed-badge {
  font-size: 11px;
  color: #999;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
}

.ach-category {
  margin-bottom: 16px;
}

.ach-cat-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
  padding-left: 4px;
}

/* ========== Ranking ========== */
.rank-top3 {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  padding: 20px 0;
}

.rank-podium {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: var(--color-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100px;
}

.rank-podium.first {
  height: 140px;
  background: linear-gradient(180deg, #FFD700 0%, #FFF8F0 40%);
}

.rank-podium.second {
  height: 115px;
  background: linear-gradient(180deg, #C0C0C0 0%, #FFF8F0 40%);
}

.rank-podium.third {
  height: 100px;
  background: linear-gradient(180deg, #CD7F32 0%, #FFF8F0 40%);
}

.rank-medal {
  font-size: 28px;
  margin-bottom: 6px;
}

.rank-name {
  font-size: 13px;
  font-weight: 600;
}

.rank-score {
  font-size: 11px;
  color: var(--color-text-light);
  margin-top: 2px;
}

.rank-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--color-card);
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.rank-num {
  width: 32px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-light);
}

.rank-info {
  flex: 1;
}

.rank-my {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.2), rgba(212, 165, 116, 0.1));
  border: 2px solid var(--color-primary);
}

/* ========== Kite Detail ========== */
.kite-detail-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 0 auto 16px;
  display: block;
}

.kite-detail-name {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.kite-detail-rarity {
  text-align: center;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-item {
  flex: 1;
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.upgrade-section {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.upgrade-progress {
  height: 20px;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  overflow: hidden;
  margin: 12px 0;
}

.upgrade-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-orange));
  border-radius: 10px;
  transition: width 0.3s;
  min-width: 0;
}

.upgrade-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-light);
}

/* ========== Battle Ready ========== */
.battle-ready-kite {
  text-align: center;
  padding: 24px;
}

.battle-ready-kite img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  animation: float 3s ease-in-out infinite;
}

.battle-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}

/* ========== Loading ========== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--color-text-light);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-light);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ========== Special Effects ========== */
.tianci-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.6) 0%, rgba(255, 165, 0, 0.3) 50%, transparent 80%);
  z-index: 999;
  animation: fadeIn 0.5s ease-out;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tianci-text {
  font-size: 28px;
  font-weight: 700;
  color: #5D4037;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  animation: slideUp 0.6s ease-out;
  text-align: center;
}
