/* 文字传奇 - 主样式文件 v5 */

:root {
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --gold: #fbbf24;
  --gold-light: #fcd34d;
  --secondary: #1e293b;
  --bg: #0f0f1a;
  --card-bg: #1a1a2e;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --hp-color: #ef4444;
  --mp-color: #3b82f6;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px;
}

/* 顶部状态栏 */
.game-header {
  background: linear-gradient(135deg, var(--secondary), #0f172a);
  border-radius: 15px;
  padding: 15px 20px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border: 2px solid var(--gold);
  box-shadow: var(--shadow);
  min-height: 80px;
}

.player-info-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.player-emoji { font-size: 2rem; }

.player-name-level {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.player-name { 
  font-size: 1.1rem; 
  font-weight: 600; 
  color: var(--gold);
  line-height: 1.2;
}

.player-level {
  background: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  align-self: flex-start;
}

.player-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.stat-bar { display: flex; align-items: center; gap: 10px; }

.stat-label {
  width: 45px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
}

.bar-container {
  flex: 1;
  height: 16px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.bar-fill { height: 100%; transition: width 0.3s ease; }
.hp-bar .bar-fill { background: linear-gradient(90deg, var(--hp-color), #f87171); }
.mp-bar .bar-fill { background: linear-gradient(90deg, var(--mp-color), #60a5fa); }

.stat-value {
  width: 55px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

/* 主游戏区域 */
.game-main {
  flex: 1;
  display: flex;
  gap: 15px;
  overflow: hidden;
  min-height: 400px;
}

/* 左侧技能栏 */
.skill-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: rgba(30,41,59,0.5);
  border-radius: 15px;
  border: 2px solid rgba(251,191,36,0.3);
  min-width: 80px;
}

.skill-btn-vertical {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #2d3748, #1a202c);
  border: 2px solid var(--gold);
  border-radius: 10px;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  overflow: hidden;
}

.skill-btn-vertical:hover:not(:disabled) {
  transform: translateX(-3px);
  box-shadow: 0 5px 20px rgba(251,191,36,0.4);
}

.skill-btn-vertical:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
}

.skill-icon { font-size: 1.5rem; }
.skill-name { font-size: 0.65rem; text-align: center; }

.skill-cd-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7);
  height: 0%;
  transition: height 0.1s linear;
  pointer-events: none;
}

.skill-cd-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 0 5px rgba(0,0,0,0.8);
  z-index: 5;
}

/* 战斗区域 */
.battle-area {
  flex: 1;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 15px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(251,191,36,0.3);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.battle-area::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(251,191,36,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.monster-zone {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

/* 卡片样式 - 放大 30% */
.card {
  width: 95px;
  height: 135px;
  background: linear-gradient(135deg, #2d3748, #1a202c);
  border: 2px solid var(--gold);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px 5px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.card:hover { transform: scale(1.05); box-shadow: 0 0 30px rgba(251,191,36,0.5); }

.card.player {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
}

.card.monster {
  border-color: var(--primary);
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
}

/* 锁定状态 - 只用 CSS 动画区分 */
.card.locked {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(251,191,36,0.8);
  animation: locked-pulse 1.5s ease infinite;
}

@keyframes locked-pulse {
  0%, 100% { 
    box-shadow: 0 0 30px rgba(251,191,36,0.8);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 50px rgba(251,191,36,1);
    transform: scale(1.05);
  }
}

.card-level {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--primary);
  padding: 2px 5px;
  border-radius: 6px;
  font-size: 0.6rem;
  font-weight: 600;
}

.card-emoji { 
  font-size: 2rem; 
  margin: 5px 0;
  flex-shrink: 0;
}

.card-name { 
  font-size: 0.7rem; 
  font-weight: 600; 
  text-align: center; 
  padding: 0 5px; 
  word-break: break-word;
  flex-shrink: 0;
}

.card-hp-bar {
  position: relative;
  width: 80%;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  overflow: hidden;
  margin-top: auto;
  flex-shrink: 0;
}

.card-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hp-color), #f87171);
  transition: width 0.3s ease;
}

.monster-card { position: absolute; pointer-events: auto; transition: all 0.5s ease; }

/* 战斗日志 */
.battle-log {
  height: 60px;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.75rem;
  margin-top: 10px;
}

.log-entry { padding: 2px 0; border-bottom: 1px dashed rgba(255,255,255,0.1); animation: slideIn 0.3s ease; }
.log-entry:last-child { border-bottom: none; }
.log-entry.drop { color: var(--gold); }
.log-entry.system { color: #60a5fa; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 底部操作栏 */
.game-footer {
  background: linear-gradient(135deg, var(--secondary), #0f172a);
  border-radius: 15px;
  padding: 12px;
  margin-top: 10px;
  border: 2px solid rgba(251,191,36,0.3);
  box-shadow: var(--shadow);
}

.action-bar { display: flex; gap: 10px; justify-content: center; }

.action-btn {
  padding: 12px 25px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(220,38,38,0.4);
}

/* 模态框通用样式 */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
  background: #1e293b;
  border: 2px solid var(--gold);
  border-radius: 15px;
  padding: 25px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.modal-header h3 { color: var(--gold); font-size: 1.3rem; }

.close-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover { color: white; }

/* 背包样式 */
.backpack-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.backpack-slot {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.backpack-slot:hover {
  border-color: var(--gold);
  background: rgba(251,191,36,0.1);
}

.backpack-slot .item-icon { font-size: 1.8rem; }
.backpack-slot .item-count {
  position: absolute;
  bottom: 3px; right: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
}

.backpack-slot.empty { cursor: default; }

.backpack-info {
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
}

/* 角色面板样式 */
.character-panel { max-width: 550px; }

.char-basic {
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.char-basic-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.char-basic-row:last-child { border-bottom: none; }
.char-label { color: var(--text-light); }
.char-value { color: var(--gold); font-weight: 600; }

.char-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.char-tab {
  flex: 1;
  padding: 12px;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.char-tab:hover { border-color: var(--gold); }
.char-tab.active {
  background: rgba(251,191,36,0.2);
  border-color: var(--gold);
  color: var(--gold);
}

.char-content { display: none; }
.char-content.active { display: block; }

/* 装备网格 - 正方形格子 */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

@media (max-width: 768px) {
  .equipment-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .equip-slot {
    min-width: 60px;
    min-height: 60px;
  }
  
  .slot-icon { font-size: 1.5rem; }
  .slot-name { font-size: 0.55rem; }
}

.equip-slot {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.equip-slot:hover { 
  border-color: var(--gold);
  background: rgba(251,191,36,0.1);
}

.slot-icon { font-size: 2rem; display: block; }
.slot-name { 
  font-size: 0.65rem; 
  color: var(--text-light); 
  display: block; 
  margin-top: 3px;
  text-align: center;
}

/* 装备提示框 */
.equip-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.95);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 12px;
  min-width: 180px;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.equip-slot:hover .equip-tooltip { display: block; }

.tooltip-name { 
  color: var(--gold); 
  font-weight: 600; 
  font-size: 0.9rem;
  margin-bottom: 8px;
  text-align: center;
}

.tooltip-stat {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tooltip-stat:last-child { border-bottom: none; }
.tooltip-stat span:last-child { color: var(--text); }

/* 属性网格 */
.attrs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.attr-item {
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.attr-label { color: var(--text-light); font-size: 0.85rem; }
.attr-value { color: var(--gold); font-size: 0.95rem; font-weight: 600; }

/* 飘血飘蓝动画 */
@keyframes float-damage {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-50px) scale(1.2); }
}

@keyframes float-heal {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1.1); }
}

.floating-text {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 800;
  text-shadow: 0 0 3px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 100;
  animation: float-damage 1s ease forwards;
  white-space: nowrap;
}

.floating-text.damage { color: #ef4444; }
.floating-text.crit { color: var(--gold); font-size: 0.9rem; text-shadow: 0 0 8px rgba(251,191,36,0.8); }
.floating-text.heal { color: #22c55e; animation: float-heal 0.8s ease forwards; }
.floating-text.mp-damage { color: #3b82f6; }
.floating-text.mp-heal { color: #60a5fa; animation: float-heal 0.8s ease forwards; }

/* CSS 动画定义 */
@keyframes attack {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(30px) scale(1.1); }
}

@keyframes hit {
  0%, 100% { transform: translateX(0); filter: brightness(1); }
  50% { transform: translateX(-10px); filter: brightness(2) hue-rotate(20deg); }
}

@keyframes skill-fire {
  0%, 100% { transform: scale(1) rotate(0deg); filter: brightness(1) blur(0px); box-shadow: 0 0 10px var(--gold); }
  50% { transform: scale(1.3) rotate(180deg); filter: brightness(2) blur(2px); box-shadow: 0 0 60px #dc2626, 0 0 100px var(--gold), inset 0 0 30px var(--gold); }
}

@keyframes skill-lightning {
  0%, 100% { transform: scale(1) skewX(0deg); filter: brightness(1); box-shadow: 0 0 10px #a855f7; }
  50% { transform: scale(1.2) skewX(-15deg); filter: brightness(3); box-shadow: 0 0 80px #a855f7, 0 0 150px #c084fc, inset 0 0 50px #e9d5ff; }
}

@keyframes death {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(0) rotate(720deg); }
}

@keyframes levelup {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 20px var(--gold); }
  50% { transform: translateY(-20px) scale(1.1); box-shadow: 0 0 60px var(--gold), 0 0 100px var(--gold-light); }
}

@keyframes monster-approach {
  0% { transform: scale(0.8) translateX(100px); opacity: 0; }
  100% { transform: scale(1) translateX(0); opacity: 1; }
}

/* 动画 class */
.anim-attack { animation: attack 0.5s ease; }
.anim-hit { animation: hit 0.4s ease; }
.anim-skill-fire { animation: skill-fire 1s ease; }
.anim-skill-lightning { animation: skill-lightning 0.8s ease; }
.anim-death { animation: death 0.8s ease forwards; }
.anim-levelup { animation: levelup 1.5s ease; }
.anim-approach { animation: monster-approach 0.5s ease forwards; }

/* 滚动条样式 */
.battle-log::-webkit-scrollbar, .modal-content::-webkit-scrollbar { width: 8px; }
.battle-log::-webkit-scrollbar-track, .modal-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 4px; }
.battle-log::-webkit-scrollbar-thumb, .modal-content::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

/* 响应式 */
@media (max-width: 768px) {
  .game-main { flex-direction: column; }
  .skill-sidebar {
    flex-direction: row;
    min-width: auto;
    overflow-x: auto;
  }
  .skill-btn-vertical { min-width: 60px; }
  .card { width: 70px; height: 100px; }
  .card-emoji { font-size: 1.5rem; }
  .card-name { font-size: 0.65rem; }
  .action-bar { flex-wrap: wrap; }
  .action-btn { min-width: 100px; padding: 10px 15px; }
  .equipment-grid, .attrs-grid { grid-template-columns: 1fr; }
}
