:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #101322;
  color: #f7f8ff;
  font: 16px system-ui, sans-serif;
}

main {
  max-width: 860px;
  margin: auto;
  padding: 20px;
}

.card {
  background: #1a2035;
  border: 1px solid #354263;
  border-radius: 14px;
  padding: 18px;
  margin: 12px 0;
}

.hero {
  margin-top: 12vh;
  text-align: center;
}

.hint,
small {
  color: #aeb8d7;
}

.notice,
.champion {
  margin: 12px 0;
  padding: 14px;
  border-radius: 10px;
  font-weight: bold;
}

.notice {
  background: #7b2934;
}

.champion {
  background: #355a3d;
  color: #fff2ae;
  font-size: 18px;
}

input,
select,
button {
  width: 100%;
  margin: 4px 0;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  font: inherit;
}

input,
select {
  background: white;
  color: #111;
}

button {
  background: #ffcf5a;
  color: #17130a;
  font-weight: 700;
  cursor: pointer;
}

.secondary {
  background: #6eb9ff;
}

.mode-options {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #354263;
  text-align: left;
}

.danger {
  background: #ee6c74;
  color: white;
}

.me {
  color: #ffcf5a;
  font-weight: 800;
}

.match {
  margin: 10px 0;
  padding: 12px;
  background: #141a2d;
  border-left: 4px solid #6eb9ff;
  border-radius: 6px;
}

.match.live {
  border-color: #64e0b1;
}

.match.done {
  opacity: 0.65;
}

.fighters {
  color: #64e0b1;
}

.bracket.winners {
  border-color: #ffcf5a;
}

.bracket.losers {
  border-color: #d184ff;
}

.bracket.final {
  border-color: #64e0b1;
}

.bet,
.winner-buttons {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.bet {
  grid-template-columns: 1fr 1fr 1fr;
}

.winner-buttons {
  grid-template-columns: 1fr 1fr;
}

code {
  overflow-wrap: anywhere;
  color: #8ed0ff;
}

.rules-button {
  position: fixed;
  z-index: 20;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff2ae;
  border-radius: 50%;
  background: #ffcf5a;
  color: #17130a;
  font-size: 24px;
  line-height: 1;
}

.rules-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  padding: 20px;
  overflow: auto;
  background: #000b;
}

.rules-panel {
  position: relative;
  max-width: 650px;
  margin: 7vh auto;
  padding: 24px;
  border: 1px solid #6eb9ff;
  border-radius: 14px;
  background: #1a2035;
}

.rules-panel h2 {
  margin-top: 0;
}

.rules-panel h3 {
  margin: 20px 0 5px;
  color: #ffcf5a;
}

.rules-panel p {
  line-height: 1.45;
}

.rules-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  background: #ee6c74;
  color: white;
  font-size: 16px;
}

@media (max-width: 500px) {
  main {
    padding: 12px;
  }

  .bet {
    grid-template-columns: 1fr 1fr;
  }

  .bet button {
    grid-column: 1 / -1;
  }

  .rules-panel {
    margin: 2vh auto;
    padding: 20px;
  }

  .rules-button {
    top: 10px;
    right: 10px;
  }
}