/* FORM TOKENS */
:root {
  --form-panel-bg: rgba(36, 143, 22, 0.5);
  --form-card-bg: rgba(255, 255, 255, 0.6);
  --form-title-bg: rgba(255, 255, 255, 0.9);
  --form-radius: 15px;
}

/* FORM BASE */
body:has(> #PollaForm) > h1,
:where(#PollaForm) h1 {
  display: inline-block;
  max-width: 90%;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  border-radius: var(--form-radius);
  background-color: var(--form-title-bg);
  color: black;
  font-size: clamp(1.8rem, 8vw, 3.2rem);
  text-align: center;
  word-wrap: break-word;
}

body:has(> #PollaForm) > h1 span,
:where(#PollaForm) h1 span {
  display: block;
}

:where(#PollaForm) h2 {
  width: min(90%, 600px);
  margin: 0.75rem auto;
  padding: 0.75rem 1rem;
  border-radius: var(--form-radius);
  background-color: rgba(255, 255, 255, 0.8);
  color: black;
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  text-align: center;
}

:where(#PollaForm) h3 {
  color: black;
  font-size: 200%;
  line-height: 50%;
  text-align: center;
}

:where(#PollaForm) div {
  display: inline-block;
  margin: auto;
}

:where(#PollaForm) img {
  display: block;
  width: 30px;
  height: 20px;
  margin: auto;
  border-radius: 0;
}

:where(#PollaForm) p {
  display: table-row;
}

:where(#PollaForm) label {
  display: table-cell;
  margin-left: 5px;
  margin-right: 5px;
  padding: 5px;
  text-align: center;
  vertical-align: middle;
}

/* NAME / SUBMIT CONTROLS */
#PollaForm .btn {
  width: auto;
  height: 30px;
  position: fixed;
  top: 25%;
  left: 0%;
  margin-left: 20px;
  margin-right: 20px;
  display: inline-block;
  border-radius: 5px;
  -webkit-transition-duration: 0.4s;
  transition-duration: 0.4s;
  cursor: pointer;
}

#PollaForm .btn1 {
  width: auto;
  height: 30px;
  padding: 5px;
  display: inline-block;
  position: fixed;
  top: 25%;
  left: 80px;
  margin-left: 20px;
  margin-right: 20px;
  border-radius: 5px;
  -webkit-transition-duration: 0.4s;
  transition-duration: 0.4s;
  cursor: pointer;
}

#PollaForm .btn2 {
  width: auto;
  padding: 5px;
  border-radius: 5px;
  -webkit-transition-duration: 0.4s;
  transition-duration: 0.4s;
  cursor: pointer;
}

#PollaForm .btn1:hover,
#PollaForm .btn2:hover {
  background-color: #24D817;
  color: white;
}

.flag-cell {
  width: 30px;
  height: 20px;
  display: inline-block;
  margin-right: 5px;
  object-fit: contain;
  vertical-align: middle;
}

.team-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

#PollaForm>h2 {
  color: white;
  background-color: rgba(36, 143, 22, 0.5);
}

/* GROUP STAGE */
#PollaForm .group>h3,
#PollaForm .best-thirds>h3 {
  color: white;
}

#PollaForm .group {
  background-color: rgba(36, 143, 22, 0.5);
  padding: 10px;
  border-radius: 15px;
  margin: 10px;
  width: min(100%, 600px);
  min-height: 700px;
  vertical-align: top;
  box-sizing: border-box;
}

/* BEST THIRDS */
#PollaForm .best-thirds {
  background-color: rgba(36, 143, 22, 0.5);
  padding: 10px;
  border-radius: 15px;
  margin: 10px;
  width: min(100%, 500px);
  min-height: 0;
  vertical-align: top;
  box-sizing: border-box;
}

/* MATCH ROWS */
#PollaForm .fround {
  background-color: rgba(255, 255, 255, 0.6);
  --team-label-height: 1.65rem;
  padding: 10px;
  border-radius: 15px;
  margin: auto;
  max-width: 100%;
  box-sizing: border-box;
}

#PollaForm .namen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 15px;
  padding: 0.9rem 1rem;
  width: min(100%, 620px);
  box-sizing: border-box;
}

/* KNOCKOUT BRACKET */
#PollaForm .knock {
  background-color: rgba(36, 143, 22, 0.5);
  border-radius: 15px;
}

#PollaForm .knockout-shell {
  display: block;
  width: min(100%, 1280px);
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

/* FINAL PODIUM */
#PollaForm .final-podium {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: end;
  gap: 1rem;
  width: min(100%, 760px);
  margin: 1.25rem auto;
  padding: 1.25rem;
  background: rgba(36, 143, 22, 0.62);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
}

#PollaForm .podium-place.podium-first {
  order: 2;
  min-height: 220px;
  background: linear-gradient(160deg, #fff3a3 0%, #f6c343 44%, #d97706 100%);
}

#PollaForm .podium-place.podium-second {
  order: 1;
  min-height: 190px;
  background: linear-gradient(160deg, #f8fafc 0%, #cbd5e1 48%, #94a3b8 100%);
}

#PollaForm .podium-place.podium-third {
  order: 3;
  min-height: 120px;
  background: linear-gradient(160deg, #fed7aa 0%, #fb923c 46%, #b45309 100%);
}

#PollaForm .podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 170px;
  padding: 1rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  text-align: center;
  box-sizing: border-box;
}

#PollaForm .podium-place label {
  display: block;
  margin: 0;
  padding: 0;
}

#PollaForm .podium-place label:first-child {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  background: #003469;
  color: white;
  font-size: 0.95rem;
  font-weight: bold;
}

#PollaForm .podium-place label:nth-child(2) {
  min-height: 2.2rem;
  color: #111;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-weight: 800;
  line-height: 1.15;
}

#PollaForm .podium-place label:nth-child(3) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  margin-top: 0.75rem;
}

#PollaForm .podium-place label:nth-child(3) img {
  width: 54px;
  height: 36px;
  object-fit: contain;
}

/* MATCH INFO TOOLTIP */
#PollaForm .fround p {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) 30px 3em max-content 3em 30px minmax(0, 1fr);
  column-gap: 4px;
  align-items: center;
}

#PollaForm .match-info-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  min-width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  z-index: 5;
}

#PollaForm .match-info-wrapper.is-open {
  z-index: 999;
}

#PollaForm .match-info-button {
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid rgba(0, 52, 105, 0.45);
  border-radius: 50%;
  padding: 0;
  background: rgba(255, 255, 255, 0.56);
  color: rgba(0, 52, 105, 0.8);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
}

#PollaForm .match-info-button:hover,
#PollaForm .match-info-button:focus {
  background: rgba(255, 255, 255, 0.92);
  outline: 2px solid rgba(0, 52, 105, 0.28);
  outline-offset: 2px;
}

#PollaForm .match-info-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  width: min(240px, 78vw);
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(0, 52, 105, 0.22);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  color: #111;
  text-align: left;
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  z-index: 30;
}

#PollaForm .match-info-tooltip::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 2rem;
  height: 0.45rem;
}

#PollaForm .match-info-line {
  display: block;
}

#PollaForm .match-info-title {
  display: block;
  margin-bottom: 0.35rem;
  color: rgba(0, 52, 105, 0.96);
  font-size: 0.9rem;
  font-weight: bold;
}

#PollaForm .match-info-line+.match-info-line {
  margin-top: 0.28rem;
}

#PollaForm .match-info-ranking-table {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  width: 100%;
  margin-top: 0.45rem;
  font-size: 0.78rem;
}

#PollaForm .match-info-ranking-row {
  display: contents;
}

#PollaForm .match-info-ranking-cell {
  padding: 0.22rem 0.25rem;
  border-bottom: 1px solid rgba(0, 52, 105, 0.14);
  background: transparent;
  color: #111;
  text-align: left;
}

#PollaForm .match-info-ranking-head .match-info-ranking-cell {
  color: rgba(0, 52, 105, 0.92);
  font-weight: bold;
}

#PollaForm .match-info-ranking-cell:nth-child(2),
#PollaForm .match-info-ranking-cell:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}

#PollaForm .match-info-team-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

#PollaForm .match-info-flag {
  width: 18px;
  height: 12px;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 0;
  object-fit: cover;
}

#PollaForm .fround p label {
  display: block;
  padding-top: 2px;
  padding-bottom: 2px;
  padding-left: 3px;
  padding-right: 3px;
  box-sizing: border-box;
}

#PollaForm .fround p label:nth-of-type(2),
#PollaForm .fround p label:nth-of-type(3),
#PollaForm .fround p label:nth-of-type(7),
#PollaForm .fround p label:nth-of-type(8) {
  height: var(--team-label-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

#PollaForm .fround p label:first-of-type {
  display: none;
}

#PollaForm .fround p label:nth-of-type(2),
#PollaForm .fround p label:nth-of-type(8) {
  width: auto;
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow-wrap: break-word;
}

#PollaForm .fround input[type="number"] {
  width: 3em;
}

:where(#PollaForm) input {
  margin-left: 3px;
  margin-right: 3px;
  text-align: center;
}

:where(#PollaForm) input[type="number"] {
  width: 4rem;
}

#PollaForm .minom {
  width: 180px;
  min-height: 40px;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(0, 52, 105, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  color: #111;
  font-size: 0.98rem;
  font-weight: normal;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

#PollaForm .minom:focus {
  border-color: rgba(0, 52, 105, 0.55);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 3px rgba(0, 52, 105, 0.14);
  outline: none;
}

#PollaForm .minomb {
  min-width: 120px;
  min-height: 42px;
  padding: 0.65rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #168f16, #24D817);
  box-shadow: 0 8px 18px rgba(22, 143, 22, 0.28);
  color: white;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

#PollaForm .minomb:hover,
#PollaForm .minomb:focus {
  box-shadow: 0 10px 22px rgba(22, 143, 22, 0.36);
  filter: brightness(1.03);
  outline: none;
  transform: translateY(-1px);
}

#PollaForm .minomb:active {
  box-shadow: 0 5px 12px rgba(22, 143, 22, 0.26);
  transform: translateY(0);
}

#PollaForm table.knockout {
  border: 0.5px solid grey;
  border-collapse: collapse;
  min-width: 80px;
  height: 10px;
}

#PollaForm .knockout-bracket {
  --match-width: 188px;
  --match-height: 116px;
  --column-gap: 34px;
  position: relative;
  display: block;
  min-width: calc((var(--match-width) * 5) + (var(--column-gap) * 4) + 28px);
  max-width: 100%;
  min-height: 2160px;
  overflow-x: auto;
  padding: 14px;
}

#PollaForm .knockout-round-heading {
  position: absolute;
  top: 14px;
  left: calc(14px + ((var(--col) - 1) * (var(--match-width) + var(--column-gap))));
  width: var(--match-width);
  z-index: 2;
  margin: 0 0 10px;
  padding: 8px 6px;
  text-align: center;
  color: white;
  background-color: #4A2BBE;
  border-bottom: 2px solid grey;
  font-size: 0.95rem;
}

#PollaForm .knockout-match {
  position: absolute;
  top: calc(14px + var(--top));
  left: calc(14px + ((var(--col) - 1) * (var(--match-width) + var(--column-gap))));
  width: var(--match-width);
  height: var(--match-height);
  z-index: 2;
  border: 0.75px solid grey;
  background: rgba(255, 255, 255, 0.8);
  box-sizing: border-box;
}

#PollaForm .knockout-match.is-open {
  z-index: 100;
}

#PollaForm .knockout-match>.match-info-wrapper {
  position: absolute;
  top: 6px;
  left: 6px;
}

#PollaForm .knockout-match-section-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 6px;
  text-align: center;
  color: white;
  background-color: #4A2BBE;
  border-bottom: 2px solid grey;
  font-size: 0.95rem;
  font-weight: bold;
}

#PollaForm .knockout-match-title {
  padding: 6px;
  text-align: center;
  border-bottom: 2px solid black;
  font-weight: bold;
}

#PollaForm .knockout-team {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 26px;
  gap: 4px;
  align-items: center;
  min-height: 38px;
  padding: 4px 6px;
  border-top: 0.75px solid grey;
  box-sizing: border-box;
  line-height: 1.05;
}

#PollaForm .knockout-team-name {
  overflow-wrap: break-word;
}

#PollaForm .knockout-flag img {
  max-width: 28px;
  height: auto;
}

#PollaForm .knockout-connector {
  display: none;
}

#PollaForm .knockout-connectors {
  position: absolute;
  inset: 0;
  width: calc((var(--match-width) * 5) + (var(--column-gap) * 4) + 28px);
  height: 2160px;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

#PollaForm .knockout-connectors path {
  fill: none;
  stroke: black;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

@media (max-width: 900px) {
  #PollaForm .knockout-bracket {
      --match-width: 188px;
      width: 100%;
      min-width: 0;
      max-width: 100%;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
    }
}

#PollaForm #team {
  width: 80px;
  border: 0.75px solid grey;
  border-right: 0px;
  text-align: center;
  height: 5px;
  background: rgba(255, 255, 255, 0.6);

}

#PollaForm #Flag {
  border: 0.75px solid grey;
  border-left: 0px;
  height: 5px;
  background: rgba(255, 255, 255, 0.6);

}

#PollaForm #radiot {
  border: 0.75px solid grey;
  height: 18px;
  background: rgba(255, 255, 255, 0.6);

}

#PollaForm #Subtitle {
  height: 20px;
  border: 0px;
  border-bottom: 2px solid black;
  vertical-align: bottom;

}

#PollaForm #blanky {
  border: 0px;
  height: 18px;
}

#PollaForm #bordy {
  border: 0px;
}

#PollaForm #fatty {
  border: 0px;
  width: 5px;
}

table.results td:first-child .team-cell {
  justify-content: flex-start;
}

#PollaForm table.results th {
  background: #003469;
  color: white;
}

#PollaForm {
  font-weight: bold;
}

#PollaForm {
  max-width: 1280px;
  margin: 0 auto;
}

.submit-page .group {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 680px);
  min-height: 0;
  margin: 10px auto;
  padding: 18px 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
  color: #1f2933;
  font-size: 1.1rem;
  line-height: 1.45;
  text-align: left;
}

@media (max-width: 700px) {
  body:has(> #PollaForm) > h1,
  :where(#PollaForm) h1 {
      display: block;
      width: calc(100% - 32px);
      max-width: none;
      padding: 0.65rem 0.75rem;
      font-size: 1.55rem;
      line-height: 1.15;
      overflow-wrap: break-word;
    }

  :where(#PollaForm) div {
      display: block;
      width: 100%;
      margin: 0 auto;
    }

  .submit-page .group {
      grid-template-columns: auto 1fr;
      padding: 16px;
      font-size: 1rem;
    }
  
  #PollaForm .group {
      width: 100%;
      margin: 0.75rem auto;
      padding: 12px 10px;
      overflow-x: hidden;
    }
  
  #PollaForm .best-thirds {
      width: 100%;
      margin: 0.75rem auto;
      padding: 12px 10px;
    }
  
  #PollaForm .fround {
      padding: 12px 10px;
    }
  
  #PollaForm .final-podium {
      grid-template-columns: 1fr;
      gap: 0.85rem;
      padding: 1rem;
    }

  #PollaForm .podium-first,
    #PollaForm .podium-second {
      order: initial;
    }

  #PollaForm .podium-third {
      order: initial;
    }

  #PollaForm .btn,
    #PollaForm .btn1,
    #PollaForm .btn2 {
      position: static;
      display: block;
      width: min(100%, 220px);
      margin: 0.75rem auto;
    }
  
  #PollaForm .namen {
      width: 100%;
      padding: 12px 10px;
    }
  
  #PollaForm .minom {
      width: 100%;
      margin-bottom: 0.5rem;
    }
  
  #PollaForm .minomb {
      width: 100%;
      max-width: 220px;
      margin: 0.5rem auto;
    }
  
  :where(#PollaForm) input[type="text"],
    :where(#PollaForm) input[type="email"] {
      width: 100%;
    }
  
  :where(#PollaForm) input[type="number"] {
      width: 5.1rem;
    }
  
  #PollaForm .fround p {
      display: grid;
      grid-template-columns: 1.45rem minmax(0, 1fr) 28px 3rem auto 3rem 28px minmax(0, 1fr);
      grid-auto-rows: auto;
      align-items: center;
      gap: 0.3rem;
      padding: 0.5rem 0;
      border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    }
  
  #PollaForm .fround p:last-of-type {
      border-bottom: none;
    }
  
  #PollaForm .fround p>label {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 0;
      padding: 0;
      margin: 0;
      text-align: center;
    }
  
  #PollaForm .fround p label:nth-of-type(2),
    #PollaForm .fround p label:nth-of-type(3),
    #PollaForm .fround p label:nth-of-type(7),
    #PollaForm .fround p label:nth-of-type(8) {
      height: auto;
      min-height: 2.4rem;
    }
  
  #PollaForm .match-info-wrapper {
      grid-column: 1;
      grid-row: 1;
      align-self: start;
    }
  
  #PollaForm .fround p>label:nth-of-type(2) {
      grid-column: 2;
      justify-content: flex-start;
      text-align: left;
    }
  
  #PollaForm .fround p>label:nth-of-type(3) {
      grid-column: 3;
    }
  
  #PollaForm .fround p>label:nth-of-type(4) {
      grid-column: 4;
    }
  
  #PollaForm .fround p>label:nth-of-type(5) {
      grid-column: 5;
    }
  
  #PollaForm .fround p>label:nth-of-type(6) {
      grid-column: 6;
    }
  
  #PollaForm .fround p>label:nth-of-type(7) {
      grid-column: 7;
    }
  
  #PollaForm .fround p>label:nth-of-type(8) {
      grid-column: 8;
      justify-content: flex-end;
      text-align: right;
    }
  
  @media (max-width: 560px) {
    #PollaForm .fround input[type="number"] {
          width: 5.1rem;
          min-height: 2.45rem;
          font-size: 1rem;
          padding: 0.25rem 0.35rem;
        }
    
    #PollaForm .fround p {
          grid-template-columns: 1.45rem 28px minmax(0, 1fr) 5.1rem;
          justify-content: stretch;
          row-gap: 0.45rem;
        }
    
    #PollaForm .match-info-wrapper {
          grid-column: 1;
          grid-row: 1 / 3;
          justify-self: center;
          align-self: center;
          margin-right: 0;
        }
    
    #PollaForm .fround p>label:nth-of-type(2) {
          grid-column: 3;
          grid-row: 1;
          justify-content: flex-start;
          text-align: left;
        }
    
    #PollaForm .fround p>label:nth-of-type(3) {
          grid-column: 2;
          grid-row: 1;
          justify-self: center;
        }
    
    #PollaForm .fround p>label:nth-of-type(4) {
          grid-column: 4;
          grid-row: 1;
          justify-self: center;
          margin-bottom: 0.18rem;
        }
    
    #PollaForm .fround p>label:nth-of-type(5) {
          display: none;
        }
    
    #PollaForm .fround p>label:nth-of-type(6) {
          grid-column: 4;
          grid-row: 2;
          justify-self: center;
          margin-top: 0.18rem;
        }
    
    #PollaForm .fround p>label:nth-of-type(7) {
          grid-column: 2;
          grid-row: 2;
          justify-self: center;
        }
    
    #PollaForm .fround p>label:nth-of-type(8) {
          grid-column: 3;
          grid-row: 2;
          justify-content: flex-start;
          text-align: left;
        }
  }
  
  table.results .team-cell {
      display: inline-flex;
      align-items: center;
    }
  
  table.results .flag-cell {
      display: inline-block;
      width: 30px;
      height: 20px;
      flex: 0 0 auto;
      object-fit: contain;
    }
}
