/* ==========================================================================
   南汉非遗·匠心物语 - 8-Bit Pixel Retro Theme CSS
   ========================================================================== */

:root {
  --pixel-bg: #111422;
  --pixel-bg-card: #1d2136;
  --pixel-bg-light: #282e4a;
  --pixel-gold: #ffcc00;
  --pixel-gold-dark: #b8860b;
  --pixel-red: #e74c3c;
  --pixel-red-dark: #962d22;
  --pixel-green: #2ecc71;
  --pixel-green-dark: #219d55;
  --pixel-blue: #3498db;
  --pixel-teal: #1abc9c;
  --pixel-border: #ffffff;
  --pixel-text: #ffffff;
  --pixel-text-dim: #9aa2c2;
  --pixel-shadow: rgba(0, 0, 0, 0.6);
  --pixel-palace-red: #c0392b;
  --pixel-paper: #f7ede2;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}

body {
  background-color: var(--pixel-bg);
  color: var(--pixel-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  background-image: 
    radial-gradient(#252a45 1px, transparent 1px),
    linear-gradient(to bottom, #111422, #0d0f1b);
  background-size: 24px 24px, 100% 100%;
}

/* 核心移动端容器 */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 16px 12px 60px 12px;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 像素边框通用规范 */
.pixel-box {
  background: var(--pixel-bg-card);
  border: 4px solid #000;
  box-shadow: 
    -4px -4px 0 0 #4a5582,
    4px 4px 0 0 #080a14,
    inset -4px -4px 0 0 #131726,
    inset 4px 4px 0 0 #323b61;
  position: relative;
  padding: 16px;
  margin-bottom: 16px;
}

.pixel-box-gold {
  background: #23221a;
  border: 4px solid #000;
  box-shadow: 
    -4px -4px 0 0 #ffe066,
    4px 4px 0 0 #3a2e00,
    inset -4px -4px 0 0 #483905,
    inset 4px 4px 0 0 #856a09;
}

.pixel-box-paper {
  background: var(--pixel-paper);
  color: #2c3e50;
  border: 4px solid #000;
  box-shadow: 
    -4px -4px 0 0 #ffffff,
    4px 4px 0 0 #7f6a52;
}

/* 像素按钮规范 */
.pixel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  color: #fff;
  background-color: var(--pixel-red);
  border: 3px solid #000;
  box-shadow: 
    -3px -3px 0 0 #ff7979,
    3px 3px 0 0 #591b16,
    0 4px 0 0 #000;
  cursor: pointer;
  user-select: none;
  transition: all 0.05s ease;
  text-decoration: none;
  text-align: center;
}

.pixel-btn:active {
  transform: translate(2px, 3px);
  box-shadow: 
    -1px -1px 0 0 #ff7979,
    1px 1px 0 0 #591b16,
    0 1px 0 0 #000;
}

.pixel-btn-gold {
  background-color: var(--pixel-gold);
  color: #2b2000;
  box-shadow: 
    -3px -3px 0 0 #fff3bf,
    3px 3px 0 0 #6e5500,
    0 4px 0 0 #000;
}

.pixel-btn-green {
  background-color: var(--pixel-green);
  color: #042710;
  box-shadow: 
    -3px -3px 0 0 #b2f2bb,
    3px 3px 0 0 #135229,
    0 4px 0 0 #000;
}

.pixel-btn-blue {
  background-color: var(--pixel-blue);
  color: #ffffff;
  box-shadow: 
    -3px -3px 0 0 #a5d8ff,
    3px 3px 0 0 #184e77,
    0 4px 0 0 #000;
}

.pixel-btn-ghost {
  background-color: #282e4a;
  color: #e2e8f0;
  box-shadow: 
    -2px -2px 0 0 #5b689a,
    2px 2px 0 0 #0f1220,
    0 3px 0 0 #000;
}

.pixel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* 顶部状态栏 HUD */
.hud-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0b0d18;
  border: 3px solid #000;
  padding: 8px 12px;
  margin-bottom: 14px;
  font-size: 13px;
  box-shadow: 0 4px 0 0 #282e4a;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: bold;
}

.hud-hp {
  color: #ff5e7e;
}

.hud-coin {
  color: var(--pixel-gold);
}

.hud-audio-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #fff;
}

/* 经验进度条 */
.exp-container {
  margin-bottom: 14px;
}

.exp-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--pixel-text-dim);
  margin-bottom: 4px;
  font-weight: bold;
}

.exp-bar-frame {
  width: 100%;
  height: 14px;
  background: #000;
  border: 2px solid #58638c;
  padding: 1px;
}

.exp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff922b, #ffcc00);
  width: 0%;
  transition: width 0.3s ease;
}

/* 对话NPC系统 */
.npc-dialogue-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #181d2f;
  border: 3px solid #000;
  padding: 12px;
  margin-bottom: 16px;
  position: relative;
  box-shadow: 3px 3px 0 0 #3a456d;
}

.npc-avatar {
  width: 52px;
  height: 52px;
  min-width: 52px;
  background: #ffeaa7;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  image-rendering: pixelated;
  box-shadow: inset -2px -2px 0 0 #d4a373;
}

.npc-content {
  flex: 1;
}

.npc-speaker {
  font-size: 11px;
  font-weight: bold;
  color: var(--pixel-gold);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.npc-text {
  font-size: 13px;
  line-height: 1.5;
  color: #e2e8f0;
}

.npc-cursor {
  display: inline-block;
  width: 8px;
  height: 12px;
  background: var(--pixel-gold);
  margin-left: 4px;
  animation: blink 0.8s infinite;
}

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

/* 关卡指示器 */
.stage-pills {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.stage-pill {
  flex: 1;
  text-align: center;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: bold;
  background: #191c2c;
  color: #717d9a;
  border: 2px solid #000;
}

.stage-pill.active {
  background: var(--pixel-red);
  color: #fff;
  border-color: #ffe066;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}

.stage-pill.completed {
  background: var(--pixel-green);
  color: #063814;
}

/* 问题卡片 */
.question-card {
  margin-bottom: 18px;
}

.question-header {
  margin-bottom: 12px;
}

.question-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  background: #e67e22;
  color: #fff;
  padding: 2px 8px;
  border: 1px solid #000;
  margin-bottom: 6px;
}

.question-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  color: #fff;
}

.question-tip {
  font-size: 12px;
  color: var(--pixel-text-dim);
  margin-top: 4px;
}

/* 选项列表 */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #252b45;
  border: 3px solid #000;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: 
    -2px -2px 0 0 #46517a,
    2px 2px 0 0 #0d101c;
  transition: all 0.1s ease;
  user-select: none;
}

.option-item:hover {
  background: #2d3557;
}

.option-item.selected {
  background: #39446d;
  border-color: var(--pixel-gold);
  box-shadow: 
    -2px -2px 0 0 #ffe066,
    2px 2px 0 0 #856a09;
}

.option-indicator {
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: #111422;
  border: 2px solid #6b779e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
}

.option-item.selected .option-indicator {
  background: var(--pixel-gold);
  color: #000;
  border-color: #fff;
}

.option-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  flex: 1;
}

/* 5星打分量表 */
.star-scale-group {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 12px 0;
}

.star-scale-btn {
  flex: 1;
  height: 52px;
  background: #242a44;
  border: 3px solid #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #9aa2c2;
  font-weight: bold;
  font-size: 12px;
}

.star-scale-btn span.star-icon {
  font-size: 18px;
  margin-bottom: 2px;
}

.star-scale-btn.active {
  background: #d35400;
  color: #fff;
  border-color: var(--pixel-gold);
  box-shadow: 0 0 6px rgba(255, 204, 0, 0.7);
}

/* NPS 0-10 打分 */
.nps-group {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.nps-btn {
  height: 38px;
  background: #242a44;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
}

.nps-btn.active {
  background: var(--pixel-gold);
  color: #000;
  border-color: #fff;
}

/* 输入框 */
.pixel-input, .pixel-textarea {
  width: 100%;
  background: #111422;
  border: 3px solid #000;
  color: #fff;
  padding: 12px;
  font-size: 14px;
  box-shadow: inset 2px 2px 0 0 #000, inset -2px -2px 0 0 #3a456d;
  margin-top: 8px;
  outline: none;
}

.pixel-input:focus, .pixel-textarea:focus {
  border-color: var(--pixel-gold);
}

.pixel-textarea {
  min-height: 85px;
  resize: vertical;
}

/* 角色选择卡片 */
.role-card-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #1b2034;
  border: 3px solid #000;
  padding: 12px;
  cursor: pointer;
  box-shadow: 
    -3px -3px 0 0 #3f4a74,
    3px 3px 0 0 #0b0d18;
  transition: transform 0.1s;
}

.role-card:active {
  transform: translate(2px, 2px);
}

.role-card.active {
  border-color: var(--pixel-gold);
  background: #2c3352;
  box-shadow: 
    -3px -3px 0 0 #ffe066,
    3px 3px 0 0 #7e6300;
}

.role-icon-box {
  width: 56px;
  height: 56px;
  min-width: 56px;
  background: #282f4d;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.role-info-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.role-info-subtitle {
  font-size: 11px;
  color: var(--pixel-gold);
  margin-top: 2px;
}

.role-info-desc {
  font-size: 12px;
  color: var(--pixel-text-dim);
  margin-top: 4px;
  line-height: 1.35;
}

/* 浮动金币动效 */
@keyframes coinFloat {
  0% { transform: translateY(0px) scale(0.8); opacity: 0; }
  30% { transform: translateY(-20px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-45px) scale(1); opacity: 0; }
}

.coin-floating-effect {
  position: fixed;
  font-size: 22px;
  font-weight: 900;
  color: var(--pixel-gold);
  pointer-events: none;
  animation: coinFloat 0.9s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  z-index: 9999;
  text-shadow: 2px 2px 0 #000;
}

/* 测试卡图鉴弹窗 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.test-card-modal {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: #1d2136;
  border: 4px solid #fff;
  box-shadow: 0 0 20px rgba(0,0,0,0.9);
  padding: 18px;
}

.test-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.test-card-item {
  background: #282e4a;
  border: 2px solid #000;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  box-shadow: 2px 2px 0 0 #0b0e1a;
}

.test-card-item:hover {
  border-color: var(--pixel-gold);
}

.test-card-item .card-icon {
  font-size: 30px;
  margin-bottom: 6px;
}

.test-card-item .card-name {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 4px;
}

.test-card-item .card-price {
  font-size: 11px;
  color: var(--pixel-gold);
}

/* 成就徽章栏 */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.badge-item {
  background: #252b45;
  border: 3px solid #000;
  padding: 12px 8px;
  text-align: center;
}

.badge-item.unlocked {
  border-color: var(--pixel-gold);
  background: #2d2613;
}

.badge-item .badge-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.badge-item .badge-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.badge-item .badge-status {
  font-size: 11px;
  color: var(--pixel-text-dim);
  margin-top: 2px;
}

.badge-item.unlocked .badge-status {
  color: var(--pixel-gold);
}

/* 底部操作工具栏 */
.action-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.action-bar-inner {
  width: 100%;
  max-width: 480px;
  background: #0f121e;
  border-top: 3px solid #3d476e;
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.5);
}

/* 管理后台暗门抽屉 */
.admin-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0b0d18;
  border-top: 4px solid var(--pixel-gold);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 2000;
  padding: 18px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.8);
}
