:root {
  --action-blue: #0066cc;
  --action-blue-focus: #0071e3;
  --canvas: #ffffff;
  --canvas-soft: #f5f5f7;
  --hairline: #d8d8df;
  --ink: #1d1d1f;
  --ink-muted: #6e6e73;
  --negative: #c32121;
  --positive: #1d7f45;
  --surface-dark: #242426;
  --warning: #b45f06;

  color-scheme: light;
  font-family: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
  background: var(--canvas-soft);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 16%, rgba(0, 102, 204, 0.12), transparent 32%),
    var(--canvas-soft);
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(210px, 1fr) auto auto auto;
  gap: 16px;
  padding: 24px 30px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  font-weight: 600;
}

h1 {
  font-size: 40px;
}

h2 {
  font-size: 20px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.meta span {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  padding: 8px 12px;
  font-size: 14px;
}

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.fighter {
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: var(--canvas);
  padding: 18px;
}

.fighter p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
}

.fighter strong {
  display: block;
  margin-top: 10px;
  font-size: 42px;
}

.versus {
  min-width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-dark);
  color: #ffffff;
  padding: 0 14px;
  font-size: 21px;
  font-weight: 600;
  text-align: center;
}

.versus.win {
  background: var(--positive);
}

.versus.lose {
  background: var(--negative);
}

.versus.draw {
  background: var(--warning);
}

.move {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.move-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: linear-gradient(180deg, var(--canvas), var(--canvas-soft));
  color: var(--ink);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 18px 34px rgba(17, 24, 39, 0.08);
}

.pending {
  color: var(--ink-muted);
}

.controls {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: end;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--canvas);
  padding: 12px 20px;
  color: var(--ink);
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--action-blue-focus);
  outline-offset: 2px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.choices button {
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--action-blue);
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition:
    background-color 120ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 120ms cubic-bezier(0.16, 1, 0.3, 1);
}

.choices button:hover:not(:disabled) {
  background: var(--action-blue-focus);
}

.choices button:active:not(:disabled) {
  transform: scale(0.96);
}

.choice-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.choices button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.result,
.history {
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--canvas);
  padding: 16px;
}

.result {
  display: grid;
  gap: 6px;
}

.result.win {
  border-color: rgba(29, 127, 69, 0.3);
  background: #f1fbf5;
}

.result.lose {
  border-color: rgba(195, 33, 33, 0.26);
  background: #fff5f4;
}

.result.draw {
  border-color: rgba(180, 95, 6, 0.28);
  background: #fff9ef;
}

.result strong {
  font-size: 20px;
  font-weight: 600;
}

.result span {
  color: var(--ink-muted);
  font-size: 14px;
}

.history {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
}

.history ol {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history li {
  display: grid;
  gap: 5px;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: rgba(245, 245, 247, 0.72);
  padding: 10px;
}

.history li span,
.history li small,
.empty-history {
  color: var(--ink-muted);
  font-size: 12px;
}

.history li strong {
  font-size: 15px;
  font-weight: 600;
}

.empty-history {
  margin: 0;
}

.error {
  margin: 0;
  border-radius: 18px;
  background: #fff0f0;
  padding: 12px;
  color: #d70015;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 780px) {
  .shell {
    min-height: 100svh;
    grid-template-rows: auto auto auto auto auto;
    padding: 18px;
  }

  .hero,
  .arena,
  .controls,
  .history {
    display: block;
  }

  .meta {
    justify-content: start;
    margin-top: 16px;
  }

  h1 {
    font-size: 34px;
  }

  .fighter {
    min-height: 130px;
    margin-bottom: 10px;
  }

  .versus {
    width: 92px;
    height: 54px;
    margin: 0 auto 10px;
    font-size: 18px;
  }

  label,
  .choices,
  .history ol {
    margin-top: 12px;
  }

  .choices,
  .history ol {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .choices button {
    transition: none;
  }
}
