html,
body {
  margin: 0;
  padding: 20px;
  font-family: Arial, sans-serif;
  text-align: center;
  color: #fef5d3;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: -1;
}

body {
  background-color: #1a0a00;

  background-image:
    url("../images/BG.png");

  background-repeat: repeat;
  background-size: auto;
}

.container {
  max-width: 1180px;
  margin: auto;
}

.poll-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 2rem;
}

.league-header {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-content: center;
  column-gap: 0;
  row-gap: 0.65rem;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 0.5rem;
}

@media (max-width: 720px) {
  .league-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.league-header-logo {
  width: 264px;
  height: auto;
  max-height: 336px;
  object-fit: contain;
  border: none;
  border-radius: 0;
  display: block;
  align-self: center;
  justify-self: center;
}

.league-header-text {
  width: max-content;
  max-width: min(52rem, 100%);
  margin: 0;
  text-align: center;
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 720px) {
  .league-header-text {
    justify-self: center;
  }
}

.league-title {
  margin: 0;
  font-size: clamp(1.15rem, 2.8vw, 1.65rem);
  line-height: 1.3;
  color: #fef5d3;
  text-align: center;
}

.league-title-line2 {
  display: block;
  margin-top: 0.15em;
  font-weight: 700;
}

.row-relics-regions {
  display: grid;
  grid-template-columns: 11fr 4fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .row-relics-regions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .row-relics-regions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Flatten both columns so mobile can use a single ordered flow. */
  .row-relics-regions > .panel-relics,
  .row-relics-regions > .panel-regions {
    display: contents;
  }

  .panel-regions-name {
    order: 1;
  }

  .panel-relics-top {
    order: 2;
    margin-top: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(204, 51, 0, 0.22);
  }

  .panel-regions-picks {
    order: 3;
  }

  .panel-relics-q3 {
    order: 4;
    width: min(100%, 54rem);
    margin-left: auto;
    margin-right: auto;
  }

  .panel-relics-mid {
    order: 5;
  }

  .panel-regions-exit {
    order: 6;
  }
}

.panel-relics,
.panel-regions {
  text-align: center;
}

.panel-regions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;

  padding: 10px 8px 14px;
  box-sizing: border-box;
}

.panel-regions-name,
.panel-regions-picks {
  width: 100%;
}

.panel-regions-picks {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(204, 51, 0, 0.22);
}

.panel-regions-name > h2 {
  margin: 0 0 0.25rem;
}

.panel-regions-name .name-input {
  margin-bottom: 0;
}

.panel-regions-picks > h2 {
  margin: 0 0 0.15rem;
}

.panel-regions-picks > h2 + h4 {
  margin: 0 0 0.45rem;
}

.panel-regions-exit {
  width: 100%;
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(204, 51, 0, 0.22);
}

.panel-relics {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
  overflow: visible;
  padding: 10px 8px 14px;
  min-width: 0;
}

.panel-relics-top {
  text-align: center;
}

.panel-relics-q3 {
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(204, 51, 0, 0.25);
}

.panel-relics-q3 h2 {
  text-align: center;
}

.panel-relics-mid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
  padding-top: 1rem;
  border-top: 1px solid rgba(204, 51, 0, 0.25);
}

.panel-relics-rank,
.panel-relics-extra {
  min-width: 0;
}

.panel-relics-extra-submit {
  display: flex;
  justify-content: center;
  padding-top: 1.25rem;
  margin-top: 0.35rem;
  width: 100%;
}

.panel-regions-exit .panel-relics-extra-submit {
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(204, 51, 0, 0.22);
}

@media (max-width: 700px) {
  .panel-relics-mid {
    grid-template-columns: 1fr;
  }
}

.panel-relics .grid {
  overflow: visible;
  padding: 6px;
  margin-bottom: 0;
}

.question-block {
  text-align: center;
}

.question-block > h2,
#question5 > h2 {
  margin: 0 0 0.2rem;
}

.question-block > h2 + h4,
.question-block > h2 + p {
  margin-top: 0;
  margin-bottom: 0.45rem;
}

#question5 > h2 + h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.panel-relics-top > h2 {
  margin: 0 0 0.15rem;
}

.panel-relics-top > h2 + h4 {
  margin: 0 0 0.45rem;
}

.question-column {
  min-width: 0;
}

.q3-intro {
  max-width: 36rem;
  margin: 0 auto 0.65rem;
  line-height: 1.5;
  text-align: center;
}

.q3-intro a {
  color: #ffcc66;
  font-weight: bold;
}

.q3-intro a:hover {
  text-decoration: underline;
}

.q3-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: bold;
  font-size: 0.95rem;
  text-align: center;
}

.q3-build-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.panel-relics-q3 input.q3-build-input {
  width: 100%;
  max-width: 100%;
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.name-input {
  margin-bottom: 20px;
}

input[type="text"],
input[type="url"],
input[type="email"] {
  padding: 10px;
  font-size: 16px;
  width: 250px;
  text-align: center;
  border-radius: 6px;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  color: #fef5d3;
}

.grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.cell {
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  color: #fef5d3;
}

.cell:hover {
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.cell.selected {
  border-color: #ff3300;
  background: #4d0f00;
}

.cell-image {
  width: 80%;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.submit-btn {
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  color: #fef5d3;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  border-radius: 6px;
  transition: 0.2s;
}

.submit-btn:hover {
  background: rgba(78, 16, 0, 0.5);
  border-color: #ff3300;
}

.info-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 2px 6px;
  border: none;
  background: rgba(255, 102, 0,0.8);
  color: #1a0a00;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
}

#infoOverlay {
  display: none;
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: rgba(0,0,0,0.85);
  justify-content:center;
  align-items:center;
  z-index: 1000;

}

#infoOverlayContent {
  display: flex;
  gap: 20px;
  background: rgba(51, 10, 0,0.5);
  padding: 20px;
  border-radius: 10px;
  max-width: min(800px, 96vw);
  min-width: min(600px, 96vw);
  position: relative;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: center;
  overflow: hidden;
  color: #fef5d3;
  border: 2px solid #cc3300;
}

#infoOverlay[data-mode="reloaded"] #infoOverlayContent {
  min-width: min(520px, 96vw);
  max-width: min(640px, 96vw);
}

.reloaded-picker-wrap {
  text-align: center;
  padding: 0.5rem 0;
}

.reloaded-picker-hint {
  margin: 0 0 1rem;
  line-height: 1.4;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

#infoOverlayContent img {
  width: 100px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.info-card {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.info-card h1 {
  text-align: center;
  margin-bottom: 10px;
  color: #ffcc66;
}

#closeInfo {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #ffcc66;
}

#gridQ2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
}

.cardQ2 {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  border-radius: 8px;
  padding: 8px;
  width: 100%;
  max-width: 280px;
  box-sizing: border-box;
  cursor: pointer;
  transition: 0.2s;
  color: #fef5d3;
  font-weight: bold;
}

.cardQ2:hover {
  transform: scale(1.03);
  border-color: #ff6600;
}

.cardQ2.selected {
  border-color: #ff3300;
  background: #4d0f00;
}

.cardQ2 img {
  width: 20px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ff6600;
  flex-shrink: 0;
}

.rank-question-intro {
  margin: 0 auto 0.4rem;
  max-width: 36rem;
  line-height: 1.5;
}

.rank-order-hint {
  margin: 0 auto 1rem;
  max-width: 36rem;
  font-size: 0.9rem;
  line-height: 1.55;
  opacity: 0.92;
}

.rank-pick-label {
  margin: 0 0 0.5rem;
}

#gridQRank {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  justify-items: center;
  align-items: stretch;
  width: 100%;
  max-width: min(266px, 100%);
  margin: 0 auto 12px;
}

.cardQRank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1;
  padding: 4px 3px 5px;
  background: rgba(51, 10, 0, 0.3);
  border: 1px solid rgba(204, 51, 0, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: #fef5d3;
  font-weight: bold;
  text-align: center;
}

.cardQRank:focus {
  outline: 2px solid #ff6600;
  outline-offset: 2px;
}

.cardQRank:focus:not(:focus-visible) {
  outline: none;
}

.cardQRank:hover {
  border-color: #ff6600;
  box-shadow: 0 0 0 2px rgba(255, 102, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.3);
}

.cardQRank.selected {
  border-color: #ff3300;
  background: #4d0f00;
  box-shadow: 0 0 0 2px rgba(255, 51, 0, 0.35);
}

.cardQRank img {
  width: min(100%, 88px);
  height: auto;
  max-height: 58px;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

.cardQRank-label {
  font-size: 0.82rem;
  line-height: 1.1;
  padding: 0 2px;
  max-width: 100%;
}

.rank-card-bronze {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 120px;
  width: 100%;
}

#gridQ4 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
}

.cardQ4 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  border-radius: 8px;
  padding: 8px;
  width: min(100%, 280px);
  box-sizing: border-box;
  cursor: pointer;
  transition: 0.2s;
  color: #fef5d3;
  font-weight: bold;
  text-align: left;
}

.cardQ4 span {
  text-align: left;
  width: 100%;
}

.cardQ4:hover {
  transform: scale(1.03);
  border-color: #ff6600;
}

.cardQ4.selected {
  border-color: #ff3300;
  background: #4d0f00;
}

.cardQ4 img {
  width: 20px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ff6600;
}

.reloaded-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  max-width: 550px;
}

.reload-option {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s;
}

.reload-option:hover {
  transform: scale(1.05);
}

.reload-option img {
  width: 100%;
  display: block;
}

.reloaded-overlay {
  position: absolute;
  width: 30%;
  bottom: 5px;
  right: 5px;
  pointer-events: none;
}

.tooltip {
  position: fixed;
  background: rgba(51, 10, 0,0.9);
  border: 1px solid rgba(204, 51, 0.3);
  color:  #ffcc66;;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#question5 {
  margin-top: 0;
  text-align: center;
  width: 100%;
  max-width: 100%;
}

.panel-regions-exit #gridQ5 {
  margin-bottom: 12px;
}

.q5-yesno {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

.q5-yesno button {
  padding: 10px 20px;
  cursor: pointer;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  color: #fef5d3;
  border-radius: 8px;
  font-weight: bold;
  transition: 0.2s;
}

.q5-yesno button:hover {
  transform: scale(1.03);
}

.q5-yesno button.selected {
  border-color: #ff3300;
  background: #4d0f00;
}

#gridQ5 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 16px;
  margin-bottom: 20px;
}

#gridQ5Contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  width: 100%;
}

.q5-contact-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

.q5-contact-option .cardQ5 {
  width: min(100%, 200px);
  max-width: 100%;
  box-sizing: border-box;
}

.q5-inline-field {
  width: min(100%, 200px);
  max-width: 100%;
  box-sizing: border-box;
}

.q5-inline-field input {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  margin: 0 auto;
}

.q5-contact-option .q5-inline-field input[type="text"],
.q5-contact-option .q5-inline-field input[type="email"] {
  width: 100%;
}

.cardQ5 {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(51, 10, 0,0.3);
  border: 1px solid rgba(204, 51, 0.3);
  border-radius: 8px;
  padding: 10px;
  width: min(100%, 200px);
  cursor: pointer;
  transition: 0.2s;
  color: #fef5d3;
  font-weight: bold;
  text-align: center;
}

.cardQ5:hover {
  transform: scale(1.03);
  border-color: #ff6600;
}

.cardQ5.selected {
  border-color: #ff3300;
  background: #4d0f00;
}

.hidden {
  display: none;
}

#toastHost {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  width: min(92vw, 760px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(18, 8, 4, 0.95);
  border: 1px solid rgba(204, 51, 0, 0.45);
  border-left-width: 5px;
  border-radius: 8px;
  color: #fef5d3;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-line;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-info {
  border-left-color: #ffcc66;
}

.toast-warning {
  border-left-color: #ff9900;
}

.toast-success {
  border-left-color: #2ecc71;
}

.toast-error {
  border-left-color: #ff4d4d;
}
