* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #1f2933;
  background: #f6f7f9;
}

main {
  width: min(1100px, calc(100% - 32px));
  margin: 32px auto;
}

header {
  margin-bottom: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

p {
  margin: 0;
  color: #52606d;
}

.upload,
.player {
  background: white;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: #1d4ed8;
  color: white;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .7;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  min-height: 44px;
  background: #e5e7eb;
  color: #1f2933;
}

.tab:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.tab.active {
  background: #1d4ed8;
  color: white;
}

.estimate-note {
  margin-bottom: 14px;
  font-size: 14px;
}

#status {
  display: block;
  min-height: 1.2em;
  margin-top: 8px;
  color: #52606d;
}

.upload-help,
#queue-position {
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.upload-help {
  line-height: 1.5;
}

#queue-position {
  min-height: 1.2em;
  color: #52606d;
  font-variant-numeric: tabular-nums;
}

.player h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.player.is-winner {
  border-left: 4px solid #15803d;
}

.player.is-loser {
  border-left: 4px solid #b91c1c;
}

.player-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.outcome {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.outcome.winner {
  background: #dcfce7;
  color: #166534;
}

.outcome.loser {
  background: #fee2e2;
  color: #991b1b;
}

.bo-players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bo-table {
  display: grid;
  grid-template-columns: 80px 72px minmax(150px, 1fr) repeat(4, 54px);
  gap: 0;
  overflow-x: auto;
}

.bo-head,
.bo-cell {
  min-height: 36px;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f6;
}

.bo-head {
  color: #52606d;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.bo-cell {
  font-variant-numeric: tabular-nums;
}

.bo-cell.step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resource-head,
.resource-cell {
  text-align: center;
}

.summary-ages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.summary-age {
  min-width: 0;
  padding: 16px;
  background: white;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.summary-age-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 20px;
}

.age-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 44px;
}

.summary-resources {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 8px;
}

.summary-resources .resource-head,
.summary-resources .resource-cell {
  padding: 4px;
  text-align: center;
}
.summary-resources .resource-head {
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-resources .resource-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.summary-resources .resource-cell {
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}


.summary-section + .summary-section {
  margin-top: 16px;
}

.summary-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.summary-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.summary-item > span:not(.summary-quantity) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.summary-quantity {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.summary-spoken {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


.summary-empty {
  color: #52606d;
}

.resource-head {
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.resource-cell {
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timeline {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px 12px;
  margin: 0;
}

.time {
  color: #52606d;
  font-variant-numeric: tabular-nums;
}

.event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eef2f6;
}

.icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 28px;
}

.icon.empty {
  display: inline-block;
}

@media (max-width: 760px) {
  main {
    width: min(100% - 20px, 1100px);
    margin: 20px auto;
  }

  .bo-players,
  .bo-table {
    display: block;
  }

  .summary-ages {
    grid-template-columns: minmax(0, 1fr);
  }

  .bo-head {
    display: none;
  }

  .bo-cell {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    border-bottom: 0;
    padding: 4px 0;
  }

  .bo-cell::before {
    content: attr(data-label);
    color: #52606d;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .bo-cell.step {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .resource-cell::before {
    content: "";
    width: 22px;
    height: 22px;
    background: center / contain no-repeat;
    justify-self: start;
  }

  .resource-cell.food::before {
    background-image: url("assets/icons/resources/food.png");
  }

  .resource-cell.wood::before {
    background-image: url("assets/icons/resources/wood.png");
  }

  .resource-cell.gold::before {
    background-image: url("assets/icons/resources/gold.png");
  }

  .resource-cell.stone::before {
    background-image: url("assets/icons/resources/stone.png");
  }

  .summary-resources .resource-head {
    display: flex;
  }

  .summary-resources .resource-cell {
    display: block;
    min-height: 0;
    padding: 4px;
    border-bottom: 1px solid #eef2f6;
  }

  .summary-resources .resource-cell::before {
    content: none;
  }
}
