/* 2인 반응속도 대결 */
.duel-setup {
  margin-top: 22px;
  text-align: center;
}
.duel-names {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}
@media (max-width: 520px) {
  .duel-names {
    grid-template-columns: 1fr;
  }
}
.duel-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}
.duel-field span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.duel-field input {
  appearance: none;
  width: 100%;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  min-height: 46px;
}
.duel-field input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}
.duel-setup .rounds {
  margin: 18px 0 16px;
}
.duel-start {
  width: min(100%, 320px);
  font-size: 1.08rem;
}
.duel-setup kbd,
.side-key {
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
}
.tag {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}
.tag.t1 {
  background: #ef4444;
}
.tag.t2 {
  background: #1d4ed8;
}

/* 대결 판: 기본은 왼쪽 · 오른쪽 (PC) */
.arena {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: 's1 s2' 'mid mid';
  gap: 10px;
  margin-top: 22px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.side {
  appearance: none;
  border: 0;
  margin: 0;
  min-width: 0;
  height: clamp(300px, 58vh, 480px);
  padding: 16px;
  border-radius: 24px;
  font: inherit;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  box-shadow: var(--shadow);
  transition: background-color 0.06s linear;
}
.side.s1 {
  grid-area: s1;
}
.side.s2 {
  grid-area: s2;
}
.side-in {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  pointer-events: none;
}
.side-top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0.95;
}
.side-name {
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-wins {
  font-variant-numeric: tabular-nums;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}
.side-title {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.side-sub {
  font-size: 1rem;
  opacity: 0.92;
  font-variant-numeric: tabular-nums;
}
.side-key {
  margin-top: 6px;
}

.side[data-state='set'] {
  background: var(--ink);
  color: var(--bg);
}
.side[data-state='wait'] {
  background: var(--wait);
}
.side[data-state='go'] {
  background: var(--go);
}
.side[data-state='win'] {
  background: #f2b134;
  color: #241800;
}
.side[data-state='lose'] {
  background: var(--surface-2);
  color: var(--ink);
}
.side[data-state='foul'] {
  background: var(--early);
}

.mid {
  grid-area: mid;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.mid-round {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.mid-btns {
  display: flex;
  gap: 8px;
}
.mid-btn {
  appearance: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

/* 휴대폰 · 세로 태블릿: 화면 전체를 위 · 아래로 나누고 위쪽은 맞은편 사람이 읽게 거꾸로 */
@media (max-width: 760px), (orientation: portrait) and (pointer: coarse) {
  .arena {
    position: fixed;
    inset: 0;
    z-index: 60;
    margin: 0;
    padding: 8px;
    gap: 6px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: 's1' 'mid' 's2';
  }
  .side {
    height: auto;
    min-height: 0;
    border-radius: 20px;
  }
  .side.s1 .side-in {
    transform: rotate(180deg);
  }
  .side-key {
    display: none;
  }
  .mid {
    padding: 0 4px;
  }
  html.duel-on,
  html.duel-on body {
    overflow: hidden;
  }
}

/* 결과: 판별 기록 */
.duel-log-wrap {
  position: relative;
  overflow-x: auto;
  margin-top: 18px;
}
.duel-log {
  font-size: 0.92rem;
}
.duel-log th,
.duel-log td {
  text-align: center;
  padding: 8px 6px;
}
.duel-log td {
  font-variant-numeric: tabular-nums;
}
.duel-log td.win {
  font-weight: 800;
}
.duel-log-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
}

/* 점토 캐릭터(힉스필드, /game/duel-*.webp): 시작 화면 VS, 각 판의 선수, 결과 트로피 */
.duel-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 0 6px;
}
.duel-vs img {
  width: 96px;
  height: 96px;
}
.duel-vs b {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--brand);
  letter-spacing: 0.02em;
}
.side-char {
  width: clamp(56px, 14vh, 96px);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
  transition: transform 0.15s ease;
}
.side[data-state='go'] .side-char {
  transform: scale(1.08);
}
.side[data-state='win'] .side-char {
  animation: duel-hop 0.5s ease-out;
}
.side[data-state='lose'] .side-char {
  filter: grayscale(0.7) opacity(0.75);
}
@keyframes duel-hop {
  40% {
    transform: translateY(-14px) scale(1.12);
  }
}
.duel-trophy {
  display: block;
  width: 88px;
  height: 88px;
  margin: 4px auto 0;
}
@media (max-width: 760px), (orientation: portrait) and (pointer: coarse) {
  .side-char {
    width: clamp(44px, 9vh, 72px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .side[data-state='win'] .side-char {
    animation: none;
  }
}
