@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=VT323&display=swap');

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

html, body {
  width: 100%;
  min-height: 100%;
  background: linear-gradient(to bottom, #0a0520, #1a0a3e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  padding: 20px;
}

#game {
  width: 420px;
  background: #0d0519;
  border: 2px solid rgba(160,140,255,0.4);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 0 40px rgba(120,100,220,0.3);
}

.game-title {
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.35em;
  color: rgba(200,180,255,0.9);
  text-shadow: 0 0 12px rgba(160,140,255,0.6);
}

.field {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.player-area, .enemy-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(160,140,255,0.6);
}

.hp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.player-hp { background: linear-gradient(90deg, #05ffa1, #00ccaa); }
.enemy-hp  { background: linear-gradient(90deg, #ff71ce, #ff4444); }

.hp-text {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #e0d8ff;
}

.status-icons {
  font-size: 14px;
  min-height: 20px;
  display: flex;
  gap: 4px;
}

.played-card {
  width: 90px;
  height: 120px;
  border-radius: 10px;
  border: 1.5px solid rgba(160,140,255,0.3);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  padding: 6px;
  text-align: center;
}

.played-card img {
  width: 50px;
  image-rendering: pixelated;
}

.empty-text {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: rgba(255,255,255,0.2);
}

.played-name {
  font-family: 'VT323', monospace;
  font-size: 12px;
  color: rgba(200,190,255,0.85);
}

.played-atk {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: #ffe566;
}

.vs {
  font-size: 16px;
  color: rgba(200,180,255,0.4);
  letter-spacing: 0.1em;
  margin-top: 60px;
}

.log {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(160,140,255,0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'VT323', monospace;
  font-size: 15px;
  color: #c0b0ff;
  text-align: center;
  min-height: 40px;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.hand {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.card {
  width: 80px;
  height: 110px;
  border-radius: 10px;
  border: 1.5px solid rgba(160,140,255,0.35);
  background: linear-gradient(160deg, #1a0a3e, #0d0520);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 6px;
  position: relative;
}

.card:hover {
  transform: translateY(-10px) scale(1.06);
  box-shadow: 0 0 20px rgba(180,160,255,0.5);
}

.card img {
  width: 44px;
  image-rendering: pixelated;
  display: block;
}

.card-icon { font-size: 24px; }

.card-title {
  font-family: 'VT323', monospace;
  font-size: 12px;
  color: rgba(200,190,255,0.9);
  text-align: center;
  line-height: 1.1;
}

.card-effect {
  font-family: 'VT323', monospace;
  font-size: 10px;
  color: rgba(160,150,220,0.6);
  text-align: center;
}

.card-atk {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #ffe566;
}

.card-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-family: 'VT323', monospace;
  font-size: 9px;
  color: rgba(200,190,255,0.6);
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  padding: 1px 3px;
}

.fire   { border-color: #ff6644 !important; }
.water  { border-color: #44aaff !important; }
.earth  { border-color: #88cc44 !important; }
.shadow { border-color: #aa44ff !important; }
.light  { border-color: #ffee44 !important; }

.scores {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: rgba(160,150,220,0.7);
  letter-spacing: 0.1em;
}

.score-val { color: #ffe566; }

.btn-row {
  display: flex;
  justify-content: center;
}

.reset-btn {
  background: rgba(123,47,255,0.2);
  border: 1px solid #7b2fff;
  border-radius: 6px;
  color: #c0b0ff;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.15em;
  padding: 6px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.reset-btn:hover { background: rgba(123,47,255,0.4); }

.centered {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float-center 5s ease-in-out infinite;
}

@keyframes float-center {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50%       { transform: translate(-50%, -50%) translateY(-15px); }
}

#mode-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.mode-desc {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: rgba(160,150,220,0.6);
  letter-spacing: 0.2em;
}

.mode-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.mode-btn {
  background: rgba(123,47,255,0.15);
  border: 1px solid rgba(160,140,255,0.4);
  border-radius: 8px;
  color: #c0b0ff;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 0.2em;
  padding: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  width: 100%;
}

.mode-btn:hover {
  background: rgba(123,47,255,0.35);
  border-color: #c0b0ff;
}

.turn-label {
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 16px;
  letter-spacing: 0.15em;
  color: #05ffa1;
  min-height: 20px;
}

.btn-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.planet {
  position: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  z-index: 10;
  animation: float 5s ease-in-out infinite;
  transition: transform 0.2s ease;
}

.zoomable:hover { transform: scale(1.15) !important; }

.zoomable {
  z-index: 20;
}

.planet img { display: block; }

.planet-label {
  color: rgba(180,220,120,0.8);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  margin-top: 8px;
  opacity: 0.7;
  text-align: center;
  font-family: 'Cinzel', serif;
}

.planet:hover .planet-label {
  opacity: 1;
  color: #aaddaa;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-15px); }
}

.mirrored img { transform: scaleX(-1); }

.page-transition {
  position: fixed;
  inset: 0;
  background: #0a1a0a;
  z-index: 999;
  animation: fadein 0.6s ease 0.1s forwards;
  pointer-events: none;
  opacity: 1;
}

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

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

.centered {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float-center 5s ease-in-out infinite;
}

@keyframes float-center {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px); }
  50%       { transform: translate(-50%, -50%) translateY(-15px); }
}