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

body {
  font-family: Arial, sans-serif;
  background: #2c3e50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 5px;
  overflow-x: hidden;
}

#game-screen {
  position: fixed;
  display: flex;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;  
}
#game-container {

  background: #34495e;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  max-width: 650px;
  max-height: 95vh;
}

#info-panel {
  background: #1a252f;
  color: white;
  padding: 10px;
  border-radius: 5px;
  font-size: 12px;
}

#turn-info {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  flex: 3;
}



#unit-info {
  font-size: 11px;
  min-height: 60px;
  line-height: 1.5;
}

#unit-info small {
  color: #f1c40f;
  font-size: 10px;
}

#unit-stats {
  margin-top: 8px;
  padding: 8px;
  background: #0f1821;
  border-radius: 3px;
  font-size: 10px;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

#unit-stats.show { 
  display: grid; 
}

#unit-info-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.unit-info-column {
  background: #0f1821;
  border-radius: 3px;
  padding: 8px;
  font-size: 10px;
  line-height: 1.6;
}

.unit-info-header {
  font-weight: bold;
  color: #f1c40f;
  margin-bottom: 5px;
  font-size: 11px;
}

.unit-info-content {
  color: #ecf0f1;
}

#unit-stats {
  display: none;
}

.stat-item {
  text-align: center;
  padding: 4px;
  background: #1a252f;
  border-radius: 3px;
}

.stat-item .stat-label {
  display: block;
  color: #95a5a6;
  font-size: 9px;
  margin-bottom: 2px;
}

.stat-item .stat-value {
  display: block;
  color: #ecf0f1;
  font-size: 12px;
  font-weight: bold;
}

#turn-order {
  margin-top: 10px;
  padding: 8px;
  background: #0f1821;
  border-radius: 3px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
}

.turn-order-unit {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  position: relative;
  flex-shrink: 0;
}

.turn-order-unit.active {
  border: 2px solid #f1c40f;
}

#canvas-container {
  display: block;
  position: relative;
}
#canvas {
  border: 3px solid #1a252f;
  background: #8fbc8f;
  display: block;
  cursor: pointer;
  touch-action: none;
  width: 100%;
  height: auto;
  position: relative;
}

.damage-number {
  position: absolute;
  font-size: 20px;
  font-weight: bold;
  color: #BD0125;
  text-shadow: 1px 1px 0px rgba(255,255,255,1), 
  1px -1px 0px rgba(255,255,255,1), 
  -1px 1px 0px rgba(255,255,255,1), 
  -1px -1px 0px rgba(255,255,255,1), 
  -1px -1px 4px rgba(0,0,0,1);
  pointer-events: none;
  animation: damageFloat 1s ease-out forwards;
  z-index: 100;
}

.damage-number.heal {
  color: #2ecc71;
}

@keyframes damageFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  20% {
    transform: translateY(-10px) scale(1);
    opacity: 1;
  }
  85% {
    transform: translateY(-10px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(+40px) scale(1);
    opacity: 0;
  }
}

#controls {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  padding: 4px 4px;
  font-size: 12px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background: #3498db;
  color: white;
  font-weight: bold;
  transition: background 0.3s;
  flex: 1;
}

button:hover { 
  background: #2980b9; 
}

button:disabled { 
  background: #7f8c8d; 
  cursor: not-allowed; 
}

/* キャラクター選択画面（出撃準備） */
#character-select {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;
}

#character-select.show { 
  display: flex; 
}

.select-container {
  background: #1a252f;
  border-radius: 10px;
  padding: 15px;
  max-width: 650px;
  max-height: 95vh;
  overflow-y: auto;
}

.select-header {
  background: #2c3e50;
  color: #3498db;
  font-size: 18px;
  font-weight: bold;
  padding: 12px;
  text-align: center;
  border-radius: 5px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s;
  grid-column: 1 / -1;
}

.select-header.ready {
  background: #2ecc71;
  color: white;
}

.select-header.ready:hover {
  background: #27ae60;
}

.select-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
}

/* ミニマップエリア */
.minimap-area {
  grid-row: 1 / 3;
  background: #0f1821;
  border: 2px solid #3498db;
  border-radius: 5px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.minimap-title {
  color: #3498db;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
}

#minimap-canvas {
  border: 2px solid #1a252f;
  border-radius: 3px;
}

/* 敵編成エリア */
.enemy-composition {
  background: #0f1821;
  border: 2px solid #e74c3c;
  border-radius: 5px;
  padding: 10px;
}

.enemy-composition-title {
  color: #e74c3c;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

.enemy-units-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.enemy-unit-icon {
  width: 32px;
  height: 32px;
  background: #e74c3c;
  border-radius: 3px;
  border: 1px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* 選択中ユニット詳細 */
.selected-unit-detail {
  background: #0f1821;
  border: 2px solid #f1c40f;
  border-radius: 5px;
  padding: 10px;
}

.detail-header {
  color: #f1c40f;
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 8px;
  text-align: center;
}

.detail-content {
  display: flex;
  gap: 10px;
}

.detail-stats {
  flex: 1;
  font-size: 10px;
  color: #ecf0f1;
  line-height: 1.6;
}

.detail-icon {
  width: 55px;
  height: 55px;
  background: #3498db;
  border-radius: 5px;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-icon svg {
  width: 40px;
  height: 40px;
}

/* ユニット選択グリッド */
.unit-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  background: #0f1821;
  border-radius: 5px;
}

.unit-card {
  background: #2c3e50;
  border: 2px solid #34495e;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  position: relative;
}

.unit-card:hover {
  border-color: #3498db;
  transform: translateY(-2px);
}

.unit-card.selected {
  border-color: #2ecc71;
  border-width: 3px;
}

.unit-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.unit-card-icon {
  width: 40px;
  height: 40px;
  background: #3498db;
  border-radius: 5px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.unit-card-checkbox {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #7f8c8d;
  border: 2px solid #95a5a6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.unit-card.selected .unit-card-checkbox {
  background: #2ecc71;
  border-color: white;
}

.unit-card-checkbox svg {
  width: 12px;
  height: 12px;
  display: none;
}

.unit-card.selected .unit-card-checkbox svg {
  display: block;
}

.unit-card-name {
  color: white;
  font-size: 10px;
  font-weight: bold;
}

