body {
  background: #edf4f1;
  color: #17211f;
}

.tarpi-page {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.tarpi-header {
  margin-bottom: 14px;
}

.tarpi-layout {
  display: grid;
  gap: 12px;
}

.battle-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.72fr) minmax(0, 1fr);
  gap: 8px;
}

.team-panel,
.turn-panel {
  min-height: 72px;
  border: 1px solid rgba(25, 38, 35, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 14px;
}

.team-panel span,
.turn-panel span {
  display: block;
  color: #62736d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-panel strong,
.turn-panel strong {
  display: block;
  color: #111917;
  font-size: 32px;
  line-height: 1.1;
  margin-top: 4px;
}

.team-panel.blue {
  border-left: 6px solid #2f80ed;
}

.team-panel.red {
  border-left: 6px solid #e05245;
}

.turn-panel {
  text-align: center;
}

.turn-panel strong {
  font-size: 21px;
  margin-top: 9px;
}

.arena-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1120 / 640;
  min-height: 340px;
  border: 8px solid #26362f;
  border-radius: 8px;
  overflow: hidden;
  background: #9fd7f2;
  box-shadow: 0 18px 48px rgba(11, 26, 22, 0.18);
}

#arena {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.game-banner {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 28px));
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(15, 26, 23, 0.72);
  color: #f8fffb;
  padding: 9px 14px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.game-banner.hide {
  opacity: 0;
  transform: translate(-50%, -8px);
}

.control-strip,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.control-strip label {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(35, 83, 73, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0 10px;
}

.control-strip span {
  color: #52635f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-strip input[type="range"] {
  width: 150px;
  accent-color: #2f80ed;
}

.control-strip output {
  min-width: 40px;
  color: #16201d;
  font-size: 15px;
  font-weight: 900;
  text-align: right;
}

.control-strip select {
  min-width: 118px;
  border: 0;
  background: transparent;
  color: #15211d;
  font: 800 15px/1 system-ui, sans-serif;
}

.action-row .btn-primary,
.action-row .btn-secondary {
  min-width: 122px;
  border-radius: 8px;
}

.action-row .btn-primary {
  background: #e05245;
}

.action-row .btn-primary:hover:not(:disabled) {
  background: #c94439;
}

.action-row .btn-secondary {
  color: #245349;
  border-color: rgba(36, 83, 73, 0.24);
  background: rgba(255, 255, 255, 0.66);
}

.action-row .btn-secondary:hover:not(:disabled) {
  background: rgba(36, 83, 73, 0.12);
}

@media (max-width: 740px) {
  .tarpi-page {
    width: min(100% - 14px, 1180px);
    padding-top: 12px;
  }

  .battle-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .turn-panel {
    grid-column: 1 / -1;
    order: 3;
    min-height: 58px;
  }

  .team-panel,
  .turn-panel {
    min-height: 58px;
    padding: 8px 10px;
  }

  .team-panel strong {
    font-size: 26px;
  }

  .turn-panel strong {
    font-size: 18px;
    margin-top: 5px;
  }

  .arena-wrap {
    min-height: 390px;
    aspect-ratio: 7 / 9;
    border-width: 6px;
  }

  .control-strip label {
    width: 100%;
    justify-content: space-between;
  }

  .control-strip input[type="range"] {
    width: min(46vw, 190px);
  }
}
