* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  margin: 0;
  padding: 20px;
  background: #050816;
  color: #ffffff;
}

h1, h2, h3 {
  margin-top: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.panel {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.panel h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin: 12px 0 6px;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  transition: transform 0.1s ease, box-shadow 0.1s ease,
              background 0.15s ease, border 0.15s ease;
}

.option-btn.selected {
  border-color: #38bdf8;
  background: radial-gradient(circle at top left, #0ea5e9, #1e293b);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.stat-label {
  opacity: 0.7;
}

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

.bar-bg {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.6);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #a3e635);
  transition: width 0.25s ease;
}

.stat-number {
  font-size: 0.8rem;
  opacity: 0.8;
  min-width: 30px;
  text-align: right;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.9;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: none;
  padding: 10px 16px;
  margin-top: 12px;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  color: #0b1120;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.85rem;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 14px 30px rgba(14, 165, 233, 0.55);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.btn-action {
  flex: 1;
  min-width: 90px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  transition: transform 0.1s ease, box-shadow 0.1s ease,
              background 0.15s ease, border 0.15s ease, color 0.15s ease;
}

.btn-action.attack {
  border-color: rgba(248, 113, 113, 0.8);
}
.btn-action.guard {
  border-color: rgba(52, 211, 153, 0.8);
}
.btn-action.special {
  border-color: rgba(244, 114, 182, 0.9);
}

.btn-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
  background: radial-gradient(circle at top, #1f2937, #020617);
}

.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-upgrade-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.btn-upgrade {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 5px 6px;
  font-size: 0.78rem;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  transition: transform 0.1s ease, box-shadow 0.1s ease,
              background 0.15s ease, border 0.15s ease, color 0.15s ease;
}

.btn-upgrade:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  background: radial-gradient(circle at top, #1f2937, #020617);
}

.btn-upgrade:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.battle-robots {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.robot-card {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.3), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.9rem;
  color: #ffffff;
}

.robot-card.enemy {
  background: radial-gradient(circle at top, rgba(248, 113, 113, 0.3), rgba(15, 23, 42, 0.95));
}

.robot-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.robot-name {
  font-weight: 600;
  font-size: 1rem;
}

.robot-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* Robot images */
.robot-img {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  margin: 6px 0 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.9);
}

.hp-bar-wrap {
  margin-top: 4px;
  font-size: 0.8rem;
}

.hp-label-row {
  display: flex;
  justify-content: space-between;
  opacity: 0.8;
  margin-bottom: 1px;
}

.hp-bar-bg {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  overflow: hidden;
  border: 1px solid rgba(30, 64, 175, 0.8);
}

.hp-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transform-origin: left center;
  transition: width 0.22s ease-out;
}

.battle-log {
  margin-top: 8px;
  height: 230px;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.82rem;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #ffffff;
}

.battle-log-line {
  margin-bottom: 4px;
}

/* all log text white */
.log-turn,
.log-player,
.log-enemy,
.log-system,
.log-crit,
.log-miss {
  color: #ffffff;
}

.log-crit {
  font-weight: 600;
}
.log-miss {
  font-style: italic;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  font-size: 0.7rem;
  margin-right: 4px;
  margin-bottom: 4px;
  color: #ffffff;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22c55e;
}

.robot-summary {
  margin-top: 4px;
  font-size: 0.78rem;
  opacity: 0.8;
  line-height: 1.4;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.chips-row .pill {
  margin: 0;
}

.turn-indicator {
  margin-top: 6px;
  font-size: 0.82rem;
  opacity: 0.85;
}

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }
}
