/* ====================================
   MECH LAB — Gundam builder + arena
   ==================================== */

.mech-container { position: relative; width: 100%; min-height: 80vh; }

/* ── Build layout: CSS grid ── */
.mech-build {
  display: grid;
  grid-template-columns: 260px 1fr 240px;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 12px;
}
.mech-build .mech-opponents {
  grid-column: 1 / -1;
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

/* ── Fight layout ── */
.mech-fight {
  display: grid;
  grid-template-columns: 1fr 320px 1fr;
  gap: 12px; padding: 12px;
}

/* ── Panels ── */
.mech-panel {
  background: rgba(4, 2, 10, 0.9);
  border: 1px solid rgba(212, 169, 74, 0.15);
  border-radius: 8px;
  padding: 14px;
  backdrop-filter: blur(8px);
  overflow-y: auto;
  max-height: 70vh;
}
.mech-panel h3 {
  font-size: 0.75rem; letter-spacing: 0.12em; color: var(--golden);
  margin-bottom: 10px; text-transform: uppercase;
}

/* ── Part cards ── */
.mech-slot-label {
  font-size: 0.65rem; letter-spacing: 0.1em; color: var(--text-light);
  margin: 10px 0 4px; text-transform: uppercase;
}
.mech-part-card {
  background: rgba(10, 8, 21, 0.85);
  border-left: 3px solid #888;
  border-radius: 4px; padding: 8px 10px;
  margin-bottom: 6px; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.mech-part-card:hover { background: rgba(20, 16, 40, 0.9); }
.mech-part-card.selected {
  box-shadow: 0 0 8px rgba(212, 169, 74, 0.4);
  background: rgba(212, 169, 74, 0.08);
}
.mech-part-card b { font-size: 0.78rem; color: var(--text); }

/* ── Stat bars ── */
.mech-stat-row { display: flex; align-items: center; gap: 6px; font-size: 0.65rem; color: var(--text-light); margin: 2px 0; }
.mech-stat-row span:first-child { width: 46px; text-align: right; }
.mech-stat-row span:last-child  { width: 26px; text-align: right; }
.mech-stat-track { flex: 1; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.mech-stat-fill  { height: 100%; border-radius: 2px; transition: width 0.3s; }
.mech-full-stats .mech-stat-track { height: 6px; }

/* ── 3D canvas ── */
.mech-canvas { width: 100%; height: 340px; border-radius: 6px; display: block; }
.fight-canvas { height: 260px; }

/* ── Tier badge ── */
.mech-tier-badge {
  display: inline-block; padding: 3px 12px; border-radius: 4px;
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(212, 169, 74, 0.15); color: var(--golden);
  border: 1px solid rgba(212, 169, 74, 0.3); margin-bottom: 10px;
}
.mech-hint { color: var(--text-light); font-size: 0.8rem; font-style: italic; }

/* ── AI opponent buttons ── */
.mech-ai-btn {
  background: rgba(10, 8, 21, 0.85);
  border: 1px solid rgba(212, 169, 74, 0.15);
  border-radius: 6px; padding: 10px 18px;
  color: var(--text); font-size: 0.82rem; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.mech-ai-btn:hover:not(:disabled) {
  background: rgba(20, 16, 40, 0.9);
  box-shadow: 0 0 12px rgba(212, 169, 74, 0.2);
}
.mech-ai-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.mech-ai-diff { font-size: 0.7rem; margin-right: 4px; }
.mech-opponents h3 {
  width: 100%; text-align: center;
  font-size: 0.75rem; letter-spacing: 0.12em; color: var(--golden); text-transform: uppercase;
}

/* ── Health bars (fight) ── */
.mech-fighter-hp { margin-bottom: 8px; }
.mech-hp-bar { height: 10px; background: rgba(255,255,255,0.08); border-radius: 5px; overflow: hidden; }
.mech-hp-fill { height: 100%; border-radius: 5px; transition: width 0.3s; }
.mech-hp-text { font-size: 0.7rem; color: var(--text-light); }

/* ── Battle log ── */
.mech-log {
  font-family: 'Courier New', monospace; font-size: 0.72rem;
  background: rgba(0,0,0,0.4); border-radius: 4px; padding: 10px;
  max-height: 320px; overflow-y: auto; color: var(--text);
  line-height: 1.6;
}
.mech-log-line.critical { color: #cc4444; font-weight: bold; }

/* ── Result overlay ── */
.mech-result {
  text-align: center; padding: 24px; margin-top: 16px;
  border-radius: 8px; animation: resultFade 0.5s ease;
}
.mech-win  { background: rgba(68, 170, 68, 0.12); border: 1px solid rgba(68, 170, 68, 0.3); }
.mech-loss { background: rgba(204, 68, 68, 0.12); border: 1px solid rgba(204, 68, 68, 0.3); }
.mech-win h2  { color: #44aa44; }
.mech-loss h2 { color: #cc4444; }
.mech-kono-reward {
  font-size: 1.4rem; color: var(--golden); font-weight: bold;
  text-shadow: 0 0 16px rgba(212, 169, 74, 0.6), 0 0 32px rgba(212, 169, 74, 0.3);
  animation: konoGlow 1.5s ease-in-out infinite alternate;
}
@keyframes konoGlow {
  from { text-shadow: 0 0 8px rgba(212,169,74,0.4); }
  to   { text-shadow: 0 0 24px rgba(212,169,74,0.8), 0 0 48px rgba(212,169,74,0.3); }
}
@keyframes resultFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.mech-back-btn {
  margin-top: 14px; padding: 8px 24px; border-radius: 4px;
  background: rgba(212, 169, 74, 0.15); border: 1px solid rgba(212, 169, 74, 0.3);
  color: var(--golden); font-size: 0.8rem; cursor: pointer; letter-spacing: 0.08em;
}
.mech-back-btn:hover { background: rgba(212, 169, 74, 0.25); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .mech-build  { grid-template-columns: 1fr; grid-template-rows: auto; }
  .mech-fight  { grid-template-columns: 1fr; }
  .mech-panel  { max-height: none; }
  .mech-canvas { height: 240px; }
}
