* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #efefef;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
}

.sheet {
  max-width: 1060px;
  margin: 24px auto;
  background: #fff;
  padding: 32px 48px 38px;
  box-shadow: 0 2px 18px rgba(0,0,0,.12);
}

.pool-header {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  gap: 18px;
  align-items: center;
  text-align: center;
}

.nfl-badge {
  width: 72px;
  height: 72px;
  margin: auto;
  border: 4px solid #163b70;
  border-radius: 14px;
  color: #c71920;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
}

.title-block h1 {
  margin: 0;
  font-size: 28px;
}

.week-line {
  margin: 6px 0;
  font-size: 25px;
}

.week-line strong {
  margin-left: 16px;
  font-size: 39px;
}

.title-block p {
  margin: 10px 0 20px;
  font-size: 16px;
  line-height: 1.25;
}

.table-head {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  border: 1px solid #111;
  background: #fffcc7;
  font-weight: 700;
  text-align: center;
}

.table-head div {
  padding: 6px;
}

.games {
  border-left: 1px solid #111;
  border-right: 1px solid #111;
}

.game-row {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  min-height: 70px;
  border-bottom: 1px solid #111;
}

.side {
  position: relative;
  display: grid;
  align-items: center;
  min-width: 0;
  padding: 6px 12px;
  background: #fff;
  cursor: pointer;
  transition: background .12s ease;
}

.side.visitor {
  grid-template-columns: 32px minmax(0,1fr) 70px;
  gap: 10px;
}

.side.home {
  grid-template-columns: 70px minmax(0,1fr) 32px;
  gap: 10px;
}

/* Selected team stays white; the X in the pick box marks the choice. */
.side.selected {
  background: #fff;
}

.side input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.pick-box {
  width: 32px;
  align-self: stretch;
  min-height: 56px;
  background: #e8f3f8;
  border-left: 1px solid #111;
  border-right: 1px solid #111;
}

/* Put an X in the selected team's pick box. */
.side.selected .pick-box {
  position: relative;
  background: #e8f3f8;
}

.side.selected .pick-box::after {
  content: "X";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 900;
  color: #111;
  line-height: 1;
}

.team-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.visitor .team-copy {
  text-align: left;
}

.home .team-copy {
  text-align: right;
}

.city {
  font-size: 14px;
}

.team-copy strong {
  font-size: 27px;
  font-weight: 500;
  white-space: nowrap;
}

.side img {
  display: block;
  width: 64px;
  height: 50px;
  object-fit: contain;
}

.at {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-weight: 700;
}

.footer-fields {
  display: grid;
  grid-template-columns: 1fr 185px;
  grid-template-areas:
    "tie rules"
    "nick nick";
  gap: 16px 18px;
  align-items: center;
  padding: 18px 115px 0;
}

.tie-label {
  grid-area: tie;
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  align-items: center;
  text-align: right;
}

.rules {
  grid-area: rules;
  color: #e11;
  font-weight: 700;
  font-size: 18px;
}

.nick-label {
  grid-area: nick;
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
}

.nick-label span {
  padding-right: 8px;
  text-align: right;
}

.footer-fields input {
  width: 100%;
  height: 46px;
  padding: 8px;
  border: 1px solid #111;
  background: #e8f3f8;
  font-size: 18px;
}

.submit-area {
  margin-top: 20px;
  text-align: center;
}

.submit-area button,
.admin-card button,
.button-link {
  border: 0;
  border-radius: 6px;
  padding: 12px 22px;
  background: #111;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.submit-area button:disabled {
  background: #999;
  cursor: not-allowed;
}

.submit-area p {
  color: #555;
  font-size: 13px;
}

.message {
  max-width: 760px;
  margin: 20px auto;
  padding: 18px;
  border-radius: 8px;
}

.success {
  border: 1px solid #6bb97c;
  background: #ecf8ef;
}

.error {
  border: 1px solid #d88;
  background: #fff1f1;
}

.game-row.missing-pick {
  outline: 3px solid #d00;
  outline-offset: -3px;
}

.footer-fields input.missing-field {
  border: 3px solid #d00;
  background: #fff2f2;
}

.week-select {
  padding: 2px 10px;
  font-size: 34px;
  font-weight: 700;
}

/* Administrator pages */
.admin-wrap {
  max-width: 540px;
  margin: 40px auto;
  padding: 0 16px;
}

.admin-wrap.wide {
  max-width: 1000px;
}

.admin-card {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
}

.admin-card label {
  font-weight: 700;
}

.admin-card input {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 10px;
}

.admin-top {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.admin-top select {
  padding: 5px;
  font-size: 18px;
}

.submission summary {
  cursor: pointer;
}

.submission ol {
  columns: 2;
}

.error-text {
  color: #b00;
}

@media (max-width: 850px) {
  .sheet {
    margin: 0;
    padding: 18px 8px;
  }

  .pool-header {
    grid-template-columns: 1fr;
  }

  .nfl-badge {
    display: none;
  }

  .title-block h1 {
    font-size: 22px;
  }

  .game-row,
  .table-head {
    grid-template-columns: 1fr 34px 1fr;
  }

  .side.visitor {
    grid-template-columns: 28px minmax(0,1fr) 44px;
  }

  .side.home {
    grid-template-columns: 44px minmax(0,1fr) 28px;
  }

  /* Keep the pick box visible on phones so the selected X can be seen. */
  .pick-box {
    display: block;
    width: 28px;
    min-height: 44px;
  }

  .side img {
    width: 42px;
    height: 34px;
  }

  .team-copy strong {
    font-size: 18px;
    white-space: normal;
  }

  .city {
    font-size: 12px;
  }

  .footer-fields {
    padding: 16px 5px 0;
    grid-template-columns: 1fr;
    grid-template-areas:
      "tie"
      "rules"
      "nick";
  }

  .tie-label,
  .nick-label {
    grid-template-columns: 1fr;
  }

  .tie-label,
  .nick-label span {
    text-align: left;
  }

  .rules {
    text-align: center;
  }

  .submission ol {
    columns: 1;
  }
}

/* Thursday games shown in yellow and excluded from the pool */
.blocked-game,
.blocked-game .side,
.blocked-game .at {
  background: #fff500;
}

.blocked-game .side {
  cursor: default;
}

.blocked-game .pick-box {
  background: #fff500;
  border-color: transparent;
}

.blocked-at {
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.blocked-at small {
  display: block;
  color: #b00000;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.05;
}
