/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/* ==========================================================================
   Base styles
   ========================================================================== */
:root {
  --page-bg: #fff1e6;
  --panel-bg: rgba(255, 248, 238, 0.94);
  --text: #2b1b16;
  --muted: #7d6257;
  --border: rgba(71, 45, 35, 0.16);
  --shadow: 0 18px 40px rgba(96, 42, 16, 0.14);

  --teal: #20c7c9;
  --teal-dark: #009aa0;
  --orange: #ff4b16;
  --orange-dark: #d9350d;
  --yellow: #ffe100;
  --cream: #ffe5b7;
  --grey: #b5b1ad;
  --purple: #7b4dff;
  --pink: #ff4fa3;
  --green: #40e28a;
  --blue: #72dfff;

  --pool-a: #dac6ff;
  --pool-b: #baffd5;
  --pool-c: #ff9ecf;
  --pool-d: #a7fbff;
  --pool-e: #ffc15d;
  --pool-f: #9ad6ff;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

html {
  min-height: 100%;
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(0, 207, 210, 0.22), transparent 18rem),
    radial-gradient(circle at 92% 8%, rgba(255, 221, 0, 0.28), transparent 16rem),
    radial-gradient(circle at 12% 88%, rgba(255, 73, 20, 0.18), transparent 17rem),
    linear-gradient(135deg, #fff4ea 0%, #ffe6d9 42%, #fff7e8 100%);
}

body {
  min-width: 320px;
  margin: 0;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   App layout
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px clamp(16px, 4vw, 52px);
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 112, 56, 0.5), transparent 18rem),
    linear-gradient(135deg, #3c1b13 0%, #f04817 48%, #ff8f1f 100%);
  border-bottom: 8px solid #12bfc8;
  box-shadow: 0 12px 36px rgba(124, 45, 18, 0.24);
}

.eyebrow {
  margin: 0 0 7px;
  color: #ff4b16;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-header .eyebrow {
  color: #ffeb3b;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  font-weight: 1000;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.intro {
  max-width: 720px;
  margin: 12px 0 0;
  color: #fff5d8;
  font-size: 1.05rem;
  font-weight: 650;
}

.reset-button {
  padding: 13px 18px;
  color: #35180f;
  font-weight: 950;
  background: #ffeb3b;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  box-shadow: 0 9px 0 rgba(92, 37, 17, 0.22);
}

.page-shell {
  display: grid;
  gap: 24px;
  padding: clamp(16px, 4vw, 48px);
}

.panel {
  padding: clamp(16px, 3vw, 28px);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

/* ==========================================================================
   Pool cards
   ========================================================================== */

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

.pool-card {
  overflow: hidden;
  background: #ffffff;
  border: 3px solid rgba(54, 30, 20, 0.16);
  border-radius: 24px;
  box-shadow: 0 10px 0 rgba(95, 48, 25, 0.08);
}

.pool-card h3 {
  padding: 12px 14px;
  color: #241411;
  font-size: 1.1rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.pool-card[data-pool="A"] h3 {
  background: var(--pool-a);
}

.pool-card[data-pool="B"] h3 {
  background: var(--pool-b);
}

.pool-card[data-pool="C"] h3 {
  background: var(--pool-c);
}

.pool-card[data-pool="D"] h3 {
  background: var(--pool-d);
}

.pool-card[data-pool="E"] h3 {
  background: var(--pool-e);
}

.pool-card[data-pool="F"] h3 {
  background: var(--pool-f);
}

.pool-table {
  width: 100%;
  border-collapse: collapse;
}

.pool-table th,
.pool-table td {
  padding: 10px 12px;
  text-align: left;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.pool-table th {
  color: #7b4d3c;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: #fff8ef;
}

.pool-table td:first-child {
  font-weight: 850;
}

.pool-table select {
  width: 74px;
  padding: 7px 8px;
  color: var(--text);
  font-weight: 850;
  background: #ffffff;
  border: 2px solid rgba(72, 44, 33, 0.18);
  border-radius: 999px;
}

/* ==========================================================================
   Bracket
   ========================================================================== */

.bracket-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.92), rgba(255, 245, 229, 0.82)),
    linear-gradient(135deg, rgba(255, 98, 40, 0.12), rgba(0, 194, 203, 0.12));
}

.bracket-scroll {
  overflow-x: auto;
  padding: 12px 2px 18px;
}

.bracket-grid {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(230px, 1fr) minmax(210px, 0.9fr) minmax(215px, 0.9fr);
  gap: clamp(16px, 2vw, 30px);
  align-items: center;
  min-width: 1040px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bracket-round > h3 {
  align-self: center;
  min-width: 150px;
  padding: 9px 14px;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  background: #2f1a13;
}

.match-list {
  display: grid;
  gap: 14px;
}

.quarter-list {
  padding-top: 50px;
  gap: 88px;
}

.semi-list {
  padding-top: 138px;
  gap: 220px;
}

.final-list {
  padding-top: 90px;
  gap: 28px;
}

.match-card {
  overflow: hidden;
  min-height: 118px;
  color: #21120d;
  border-radius: 24px;
  box-shadow:
    0 10px 0 rgba(58, 31, 18, 0.13),
    0 18px 32px rgba(98, 54, 30, 0.18);
}

#roundOf16 .match-card {
  background: linear-gradient(145deg, #34dce0, #10aeb6);
}

#quarterFinals .match-card {
  background: linear-gradient(145deg, #ff682c, #f23a10);
}

#semiFinals .match-card {
  background: linear-gradient(145deg, #c8c2bd, #9f9893);
}

#finals .match-card {
  background: linear-gradient(145deg, #ffea00, #ffc400);
}

#finals .match-card:first-child {
  background: linear-gradient(145deg, #ffe8be, #f5c985);
}

.match-title {
  display: grid;
  gap: 3px;
  padding: 12px 12px 9px;
  color: rgba(35, 20, 13, 0.82);
  font-size: 0.7rem;
  font-weight: 1000;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 2px solid rgba(40, 21, 13, 0.12);
}

.team-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.24);
  border-top: 1px solid rgba(40, 21, 13, 0.12);
}

.team-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 1000;
  line-height: 1.08;
  text-transform: uppercase;
}

.team-source {
  display: block;
  margin-top: 3px;
  color: rgba(35, 20, 13, 0.74);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-row.is-winner {
  background: linear-gradient(90deg, rgba(255, 235, 59, 0.88), rgba(255, 255, 255, 0.36));
  box-shadow: inset 5px 0 0 #2f1a13;
}

.winner-button {
  min-width: 62px;
  padding: 7px 9px;
  color: #ffffff;
  font-size: 0.69rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #2f1a13;
  border: 0;
  border-radius: 999px;
}

.winner-button:disabled {
  color: #2f1a13;
  cursor: not-allowed;
  background: #ffffff;
  opacity: 0.85;
}

.champion-panel {
  color: #2f1a13;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.72), transparent 12rem),
    linear-gradient(145deg, #ffea00, #ffc400);
  border: 4px solid rgba(47, 26, 19, 0.12);
}

.champion-panel::before {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto 8px;
  content: "🏆";
  font-size: 2.6rem;
  line-height: 58px;
}

.champion-panel h2 {
  margin-top: 4px;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  font-weight: 1000;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .site-header,
  .section-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .reset-button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 14px;
  }

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

  .bracket-grid {
    min-width: 980px;
  }
}

/* ==========================================================================
   Best third-place ranking
   ========================================================================== */

.third-place-panel {
  background:
    radial-gradient(circle at top left, rgba(32, 199, 201, 0.18), transparent 22rem),
    radial-gradient(circle at bottom right, rgba(255, 225, 0, 0.22), transparent 18rem),
    var(--panel-bg);
}

.third-place-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.third-place-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  background: #ffffff;
  border: 3px solid rgba(54, 30, 20, 0.14);
  border-radius: 20px;
  box-shadow: 0 8px 0 rgba(95, 48, 25, 0.08);
}

.third-place-card[data-qualified="true"] {
  background:
    linear-gradient(135deg, rgba(255, 235, 59, 0.34), rgba(255, 255, 255, 0.8)),
    #ffffff;
  border-color: rgba(15, 118, 110, 0.32);
}

.third-rank {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 1000;
  background: #2f1a13;
  border-radius: 50%;
}

.third-details {
  display: grid;
  gap: 2px;
}

.third-details strong {
  color: #241411;
  font-size: 0.98rem;
  font-weight: 1000;
  line-height: 1.1;
  text-transform: uppercase;
}

.third-details span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.third-details em {
  color: #0f766e;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 1000;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.third-place-card[data-qualified="false"] .third-details em {
  color: #9f3412;
}

.third-rank-select {
  width: 66px;
  padding: 8px 9px;
  color: var(--text);
  font-weight: 950;
  background: #ffffff;
  border: 2px solid rgba(72, 44, 33, 0.18);
  border-radius: 999px;
}

.third-place-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
  padding: 13px;
  color: #2f1a13;
  background: rgba(255, 255, 255, 0.72);
  border: 2px dashed rgba(47, 26, 19, 0.18);
  border-radius: 18px;
}

.third-place-summary strong {
  margin-right: 6px;
  font-weight: 1000;
}

.third-place-summary span {
  padding: 6px 9px;
  font-size: 0.78rem;
  font-weight: 900;
  background: #fff3cf;
  border-radius: 999px;
}
