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

body {
  background: #101318;
  color: #f0f0f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.game-root {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

/* 상단 헤더 */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #1b212b;
  border-radius: 8px;
  margin-bottom: 8px;
}

.top-header h1 {
  font-size: 20px;
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-right select {
  background: #151921;
  color: #f0f0f0;
  border-radius: 4px;
  border: 1px solid #333;
  padding: 2px 6px;
}

/* 공통 패널 */
.panel {
  background: #1a1f28;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px;
  box-shadow: 0 0 0 1px #252a35;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

/* 전투 영역 */
.battle-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 4px;
  margin-bottom: 6px;
}

.sprite-wrapper {
  position: relative;
  width: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sprite-wrapper img {
  max-width: 100%;
  max-height: 120px;
  image-rendering: pixelated;
}

.fx {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  pointer-events: none;
}

.fx-hidden {
  opacity: 0;
}

/* 사거리 라인 */
.range-line {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.range-line .cell {
  border-radius: 4px;
  background: #222734;
  text-align: center;
  padding: 6px 0;
  font-size: 13px;
  position: relative;
  transition: background 0.15s, box-shadow 0.15s;
}

.range-legend {
  margin-top: 6px;
  font-size: 12px;
  color: #c0c5d0;
  display: flex;
  justify-content: space-between;
}

/* 몬스터 위치 표시 */
.range-line .cell.has-monster {
  border: 1px solid #f0e68c;
  box-shadow: 0 0 8px rgba(255, 255, 200, 0.7);
}

.range-line .cell.has-monster::after {
  content: "▲";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #f9e79f;
}

/* 사거리 색 히트 */
.cell-hit-red {
  background: #5c1d1d;
  box-shadow: 0 0 6px rgba(255, 80, 80, 0.9);
}

.cell-hit-blue {
  background: #1c294d;
  box-shadow: 0 0 6px rgba(120, 170, 255, 0.9);
}

.cell-hit-yellow {
  background: #4a4420;
  box-shadow: 0 0 6px rgba(255, 230, 130, 0.9);
}

.cell-hit-dash {
  background: #3c2045;
  box-shadow: 0 0 8px rgba(200, 120, 255, 0.9);
}

/* 몬스터 셀 페인트 */
.cell-paint-yellow {
  outline: 2px solid #ffe680;
}

.cell-paint-blue {
  outline: 2px solid #8ab4ff;
}

.cell-paint-red {
  outline: 2px solid #ff8a80;
}

/* 콤보 파동 */
@keyframes combo-wave {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.0);
  }
  100% {
    box-shadow: 0 0 10px 4px rgba(0, 0, 0, 0.0);
  }
}

.cell-combo-root {
  box-shadow: 0 0 10px 3px rgba(60, 200, 120, 0.9);
  animation: combo-wave 0.4s ease-out;
}

.cell-combo-silence {
  box-shadow: 0 0 10px 3px rgba(255, 170, 80, 0.9);
  animation: combo-wave 0.4s ease-out;
}

.cell-combo-drain {
  box-shadow: 0 0 10px 3px rgba(200, 120, 255, 0.9);
  animation: combo-wave 0.4s ease-out;
}

/* 정보 영역 */
.info-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 4px;
  margin-bottom: 6px;
}

.cooldown-group {
  margin-top: 4px;
}

.cd-row {
  display: grid;
  grid-template-columns: 50px 1fr 60px;
  gap: 4px;
  align-items: center;
  margin-bottom: 3px;
}

.cd-label {
  font-size: 13px;
}

.cd-bar-wrap {
  background: #181c26;
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}

.cd-bar {
  height: 100%;
  width: 0%;
}

.cd-yellow {
  background: linear-gradient(90deg, #ffcc00, #ff9900);
}

.cd-blue {
  background: linear-gradient(90deg, #8ab4ff, #5c7aff);
}

.cd-red {
  background: linear-gradient(90deg, #ff9e80, #ff5252);
}

.cd-text {
  font-size: 12px;
  text-align: right;
}

#current-color-text {
  margin-top: 6px;
}

.color-yellow {
  color: #ffe680;
}

.color-blue {
  color: #8ab4ff;
}

.color-red {
  color: #ff8a80;
}

/* 스탯 */
.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.stat-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
}

/* 몬스터 상태 */
.cast-line {
  margin-top: 4px;
  font-size: 13px;
  color: #f5dd90;
}

.small-text {
  font-size: 12px;
  color: #c0c5d0;
  margin-top: 2px;
}

/* 하단 */
.bottom-row {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 4px;
}

.log-panel {
  min-height: 160px;
}

.log-area {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
  font-size: 12px;
}

.log-area div {
  margin-bottom: 2px;
}

.help-panel {
  min-height: 160px;
}

.hint-text {
  margin-top: 6px;
  font-size: 12px;
  color: #c0c5d0;
}

/* 오버레이 공통 */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.overlay.hidden {
  display: none !important;
}

.overlay-inner {
  background: #1f2430;
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 260px;
  max-width: 480px;
  box-shadow: 0 0 0 1px #3b4253;
  text-align: center;
}

.overlay-inner h2 {
  margin-bottom: 8px;
}

.overlay-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.overlay-buttons button {
  padding: 6px 10px;
  background: #30364a;
  border: 1px solid #4a5370;
  border-radius: 6px;
  cursor: pointer;
  color: #f0f0f0;
  font-size: 13px;
}

.overlay-buttons button:hover {
  background: #3a4160;
}

/* 이벤트 이미지 */
.event-image {
  max-width: 100%;
  max-height: 160px;
  margin: 6px 0;
  image-rendering: pixelated;
}

/* 흔들림 효과 */
@keyframes shake {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3px, 0); }
  40%  { transform: translate(3px, 0); }
  60%  { transform: translate(-2px, 0); }
  80%  { transform: translate(2px, 0); }
  100% { transform: translate(0, 0); }
}

.shake {
  animation: shake 0.25s;
}
