* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", "YuGothic", sans-serif;
  background: #f7f7f7;
  color: #222;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

h1,
h2 {
  text-align: center;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 32px;
}

.question-hint {
  text-align: center;
  color: #666;
  margin: 12px 0;
  font-size: 14px;
}

.item-list {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.item-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: white;
}

.primary-button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 16px;
  font-weight: bold;
  font-size: 18px;
  background: #222;
  color: white;
}

.secondary-button {
  width: 100%;
  border: 1px solid #bbb;
  border-radius: 10px;
  padding: 14px;
  background: white;
}

.bracket {
  display: grid;
  gap: 24px;
  margin: 28px 0;
}

.round {
  background: white;
  padding: 16px;
  border-radius: 12px;
}

.round h3 {
  margin-top: 0;
}

.bracket-match {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.bracket-item {
  flex: 1;
  padding: 8px;
  background: #f2f2f2;
  border-radius: 6px;
  text-align: center;
}

.unknown {
  color: #aaa;
}

.match-number {
  text-align: center;
  color: #777;
}

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 24px 0 36px;
}

.food-card {
  min-height: 110px;
  background: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-weight: bold;
  font-size: 20px;
  text-align: center;
}

/* 勝利時のハイライト */
.winner-highlight {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
  border-radius: 12px;
}

.vs {
  font-weight: bold;
  color: #999;
}

.question {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.question-title {
  margin: 0 0 12px;
  font-weight: bold;
}

.battle-ui {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
}

.choice-button {
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 12px 6px;
  background: #fafafa;
}

.choice-button.selected {
  background: #222;
  color: white;
  border-color: #222;
}

.neutral-button {
  min-width: 60px;
}

#decide-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.score-preview {
  text-align: center;
  color: #777;
  margin: 20px 0;
}

/* 自動進行にしたため決定ボタンは非表示にする */
#decide-button {
  display: none;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.active {
  display: flex;
}

.modal {
  background: white;
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 16px;
  text-align: center;
}

.winner-name {
  font-size: 28px;
  font-weight: bold;
  margin: 24px 0;
}

@media (max-width: 520px) {
  .container {
    width: min(100% - 20px, 720px);
    padding-top: 20px;
  }

  .battle-ui {
    grid-template-columns: 1fr;
  }

  .neutral-button {
    order: 3;
  }
}
