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

body {
  background-color: #121213;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: clamp(.75rem, 3vw, 1rem);
  font-size: 1rem;
  color: white;
}

body > * {
  width: 100%;
  max-width: 900px;
}

.alert-container {
  position: fixed;
  top: 10vh;
  left: 50vw;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.alert {
  pointer-events: none;
  background-color: #d7dadc;
  color: #121213;
  padding: .75em;
  border-radius: .25em;
  opacity: 1;
  transition: opacity 500ms ease-in-out;
  margin-bottom: .5em;
  font-size: 1rem;
  font-weight: bold;
  max-width: min(90vw, 32rem);
  text-align: center;
}

.alert.hide {
  opacity: 0;
}

header {
  width: 100%;
  max-width: 900px;
  text-align: center;
  border-bottom: 1px solid #3a3a3c;
  padding-bottom: .5em;
  margin-bottom: 1em;
}

header h1 {
  font-size: clamp(1.45rem, 6vw, 2rem);
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: bold;
  margin: 0 0 .15em;
}

header p {
  font-size: .75em;
  color: #818384;
  margin: 0;
}

.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.ad-slot iframe,
.ad-slot script {
  display: block;
  margin: 0 auto;
}

.ad-slot iframe {
  width: 100%;
  max-width: 728px;
  min-width: 320px;
  height: 90px;
  border: 0;
  display: block;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 90px;
  color: #818384;
  font-size: .8rem;
  border: 1px dashed #3a3a3c;
  border-radius: .25rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5em;
  font-size: .7em;
  color: #818384;
  margin-bottom: 1em;
}

.legend span {
  display: flex;
  align-items: center;
  gap: .4em;
}

.dot {
  width: .7em;
  height: .7em;
  border-radius: 50%;
  display: inline-block;
}

.dot.correct { background-color: #538d4e; }
.dot.partial { background-color: #b59f3b; }
.dot.wrong   { background-color: #3a3a3c; border: 1px solid #565758; }

.input-area {
  display: flex;
  flex-wrap: wrap;
  gap: .5em;
  margin-bottom: 1em;
  width: 100%;
  max-width: 900px;
  position: relative;
}

.input-wrap {
  position: relative;
  flex: 1;
}

.input-area input[type="text"] {
  width: 100%;
  min-height: 3rem;
  padding: .65em .85em;
  background-color: #121213;
  border: 2px solid #3a3a3c;
  border-radius: 2px;
  color: white;
  font-size: 1rem;
  font-family: Arial;
  outline: none;
}

.input-area input[type="text"]:focus {
  border-color: #565758;
}

.input-area input[type="text"]:disabled {
  opacity: .4;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: #121213;
  border: 2px solid #3a3a3c;
  border-radius: 2px;
  z-index: 10;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.suggestions div {
  padding: .5em .75em;
  font-size: .85rem;
  cursor: pointer;
  color: white;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.suggestions div:hover {
  background-color: #3a3a3c;
}

.guess-btn {
  flex: 0 0 auto;
  font-size: inherit;
  min-height: 3rem;
  padding: .65em 1.1em;
  background-color: #538d4e;
  border: none;
  border-radius: 2px;
  color: white;
  font-family: Arial;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
}


.guess-btn:hover {
  background-color: #6aaa64;
}

.hint-btn {
  flex: 0 0 auto;
  font-size: inherit;
  min-height: 3rem;
  padding: .65em 1.1em;
  background-color: #b59f3b;
  border: none;
  border-radius: 2px;
  color: white;
  font-family: Arial;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
}

.hint-btn:hover {
  background-color: #c9b458;
}

.hint-btn:disabled {
  background-color: #3a3a3c;
  color: #818384;
  cursor: default;
}

.hint-text {
  width: 100%;
  max-width: 900px;
  color: #c9b458;
  font-size: .8rem;
  margin: 0 0 1em;
  min-height: 1.3em;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.guess-btn:disabled {
  background-color: #3a3a3c;
  color: #818384;
  cursor: default;
}

.guesses-left {
  font-size: .7em;
  color: #818384;
  margin-bottom: .75em;
  text-transform: uppercase;
  letter-spacing: .05em;
  min-height: 1.2em;
}

.grid-wrap {
  width: 100%;
  max-width: 900px;
  margin-bottom: 1em;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

thead th {
  padding: .6em .5em;
  text-align: center;
  color: #818384;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 2px solid #3a3a3c;
  font-family: Arial;
}

thead th:first-child { text-align: left; }

.guess-row td {
  padding: .45rem .35rem;
  text-align: center;
  border-bottom: 1px solid #3a3a3c;
  vertical-align: middle;
}

.guess-row td:first-child {
  text-align: left;
  font-weight: bold;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: white;
}

.cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.25rem;
  min-height: 3.25rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: .4rem .55rem;
  border-radius: 2px;
  font-size: .78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .03em;
  user-select: none;
}

.cell.correct {
  background-color: #538d4e;
  color: white;
}

.cell.partial {
  background-color: #b59f3b;
  color: white;
}

.cell.wrong {
  background-color: #3a3a3c;
  color: #d7dadc;
}

/* Genre column holds 3 stacked sub-cells, one per genre slot */
.genre-wrap {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  align-items: stretch;
}

.genre-cell {
  min-height: 1.9rem;
  min-width: 6.5rem;
  font-size: .68rem;
  width: 100%;
}

.reset-btn {
  font-size: inherit;
  min-height: 3rem;
  padding: .7em 1.5em;
  background-color: #538d4e;
  border: none;
  border-radius: 2px;
  color: white;
  font-family: Arial;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
  display: none;
  margin-top: .5em;
}

.reset-btn:hover {
  background-color: #6aaa64;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 900px;
  margin-top: auto;
  padding-top: 2rem;
  color: #818384;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

a {
  color: #d7dadc;
}

.site-footer a,
.back-link {
  color: #818384;
  text-decoration: none;
}

.site-footer a:hover,
.back-link:hover,
.info-page a:hover {
  color: #d7dadc;
  text-decoration: underline;
}

.info-page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.55;
}

.info-page h1 {
  margin: 1rem 0;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.info-page h2 {
  margin: 1.5rem 0 .5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.info-page p {
  margin: 0 0 1rem;
  color: #d7dadc;
}

.confetti {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 999;
}

.confetti-piece {
  position: absolute;
  top: -2rem;
  border-radius: 20%;
  animation: confetti-fall 2.7s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  body {
    align-items: stretch;
  }

  header,
  .input-area,
  .hint-text,
  .grid-wrap {
    max-width: none;
  }

  header h1 {
    line-height: 1.15;
  }

  .input-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .input-wrap {
    grid-column: 1 / -1;
  }

  .guess-btn,
  .hint-btn,
  .reset-btn {
    width: 100%;
    min-height: 2.75rem;
  }

  .suggestions div {
    font-size: .95rem;
    padding: .8rem;
  }

  .grid-wrap {
    overflow: visible;
  }

  .ad-slot {
    min-height: 50px;
    max-height: 70px;
    margin-bottom: .75rem;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: .75rem;
  }

  .guess-row {
    border: 2px solid #3a3a3c;
    border-radius: 2px;
    background-color: #121213;
    overflow: hidden;
  }

  .guess-row td,
  .guess-row td:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .65rem .75rem;
    text-align: right;
    border-bottom: 1px solid #3a3a3c;
    font-size: .9rem;
    letter-spacing: 0;
  }

  .guess-row td:last-child {
    border-bottom: 0;
  }

  .guess-row td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: #818384;
    font-size: .72rem;
    font-weight: bold;
    text-transform: uppercase;
  }

  .guess-row td:first-child {
    background-color: #1a1a1b;
  }

  .cell {
    font-size: .8rem;
    text-align: right;
    min-width: 7rem;
    min-height: 3rem;
  }

  .genre-wrap {
    flex: 1;
    align-items: stretch;
  }

  .genre-cell {
    min-width: 0;
    font-size: .75rem;
  }
}
