/* =========================================================
   FIGHTDLE — UFC GRID
   Only what this mode needs. Fonts, tokens and focus states come from
   /shared/brand.css; the logo, mode bar, modals and footer from
   /shared/layout.css. Page frame copied from Higher or Lower so
   everything sits exactly where it does on the other modes.
   ========================================================= */

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: var(--font-body);
  width: 100%;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  color: var(--ink);
  text-align: center;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,.55) 50%, rgba(0,0,0,.78) 100%),
    url('/IMAGES/BACKGROUNDFINAL.png') center / cover no-repeat;
  background-color: #101010;
}
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding-bottom: 50px;
}
@media (max-width: 768px) {
  /* `clip`, not `hidden`, as on the other mode pages: hidden can turn the
     body into a scroll box of its own, which traps swipes on iOS. */
  body { overflow-x: clip; }
  .container { width: 100%; padding: 15px; box-sizing: border-box; }
}

/* ---------- the game panel ---------- */
.grid-game {
  box-sizing: border-box;
  width: min(560px, 100%);
  margin: 18px auto 0;
  padding: 16px 14px 14px;
  background: rgba(30, 30, 30, .85);
  border: 2px solid var(--gold);
  border-radius: 12px;
}
.grid-game h2,
.grid-game p,
.grid-game button { text-shadow: none; }
.grid-title {
  margin: 0 0 4px;
  font-size: clamp(26px, 7vw, 34px);
  color: #fff;
}
.grid-intro {
  margin: 0 auto 14px;
  max-width: 440px;
  font-size: 15px;
  line-height: 1.4;
  color: #cfcfcf;
}

/* 4 x 4: corner + 3 column headers, then a row header + 3 squares per row */
.grid-board {
  display: grid;
  grid-template-columns: minmax(64px, .8fr) repeat(3, 1fr);
  gap: 6px;
  max-width: 470px;
  margin: 0 auto;
}
.grid-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}
.grid-corner__n {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 40px);
  color: var(--gold-bright, #d9b77a);
}
.grid-corner__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #aaa;
}
.grid-head {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-family: var(--font-body);
  font-size: clamp(11px, 3.1vw, 14px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
  overflow-wrap: anywhere;
}
.grid-head--col { min-height: 44px; }
.grid-head--row { text-align: center; }

.grid-cell {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, .05);
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  color: #fff;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
@media (hover: hover) {
  .grid-cell:not(:disabled):hover { border-color: var(--gold); transform: translateY(-1px); }
}
.grid-cell:disabled { cursor: default; }
.grid-cell__plus {
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 36px);
  color: rgba(217, 183, 122, .55);
}
.grid-cell.is-filled { border-color: var(--correct, #2ecc71); background: #0d0d0d; }
.grid-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
.grid-cell__name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 4px 4px;
  background: linear-gradient(to top, rgba(0, 0, 0, .9), rgba(0, 0, 0, 0));
  font-size: clamp(10px, 2.8vw, 13px);
  font-weight: 700;
  line-height: 1.1;
}
/* Missed after the game: a fighter who'd have fitted, like a filled square
   but with a red border. */
.grid-cell.is-missed { border-color: var(--wrong, #e74c3c); background: #0d0d0d; }
.grid-cell.is-right { animation: grid-pop .5s ease; }
.grid-cell.is-wrong { animation: grid-shake .45s ease; border-color: var(--wrong, #e74c3c); }
@keyframes grid-pop { 40% { transform: scale(1.06); } }
@keyframes grid-shake {
  20% { transform: translateX(-5px); } 40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}

/* ---------- under the board while playing ---------- */
.grid-play { margin-top: 10px; }
.grid-message { min-height: 1.3em; margin: 0 0 8px; font-size: 15px; color: #d6d6d6; }
.grid-message.is-bad { color: #ff8a80; }
.grid-message:empty { min-height: 0; margin: 0; }
.grid-giveup {
  margin: 4px 0 0;
  width: auto;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  color: #ccc;
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
}

/* ---------- result ---------- */
.grid-result { margin-top: 14px; }
.grid-result[hidden], .grid-play[hidden] { display: none; }
.grid-result__title { margin: 0; font-size: clamp(24px, 6.5vw, 30px); color: #fff; }
.grid-score {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(40px, 12vw, 56px);
  color: var(--gold-bright, #d9b77a);
}
.grid-verdict { margin: 0 0 4px; font-size: 17px; color: #e6e6e6; }
.grid-share {
  width: 100%;
  max-width: 420px;
  margin: 6px auto 0;
  padding: 12px 20px;
  background: var(--correct, #2ecc71);
  border: 2px solid var(--correct, #2ecc71);
  border-radius: var(--radius-sm, 10px);
  color: #10250f;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: .05em;
  cursor: pointer;
}
.grid-share-note { min-height: 0; margin: 6px 0 0; font-size: 14px; color: #bdbdbd; }
.grid-share-note:empty { margin: 0; }
.grid-result .victory-next-button { margin-top: 6px; }

/* ---------- choosing a square ---------- */
/* The square you're typing into glows yellow. */
.grid-cell.is-selected {
  border-color: #ffd43b;
  background: rgba(255, 212, 59, .1);
  box-shadow: 0 0 0 2px rgba(255, 212, 59, .35), 0 0 18px rgba(255, 212, 59, .65);
  animation: grid-glow 1.6s ease-in-out infinite;
}
.grid-cell.is-selected .grid-cell__plus { color: #ffd43b; }
@keyframes grid-glow {
  50% { box-shadow: 0 0 0 3px rgba(255, 212, 59, .5), 0 0 26px rgba(255, 212, 59, .9); }
}

/* ---------- the name box under the grid ---------- */
.grid-target {
  margin: 14px auto 8px;
  max-width: 460px;
  font-size: 14px;
  line-height: 1.35;
  color: #aaa;
}
.grid-target.is-active { color: #ffd43b; font-weight: 600; }
.grid-entry { max-width: 420px; margin: 0 auto; text-align: left; }
#gridSearch {
  box-sizing: border-box;
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  background: #0f0f0f;
  border: 2px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;   /* 16px stops iOS zooming in on focus */
}
#gridSearch:focus { outline: none; border-color: #ffd43b; }
.grid-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.grid-results:empty { margin: 0; }
.grid-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 5px;
  padding: 6px 16px 6px 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 16px;
  text-align: left;
  text-shadow: none;
  cursor: pointer;
}
@media (hover: hover) { .grid-option:hover { border-color: #ffd43b; } }
/* Same shape as Classic's dropdown faces. */
.grid-option__face {
  flex: none;
  width: 56px;
  height: 41px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center 15%;
  background: rgba(255, 255, 255, .06);
}
.grid-results__note { padding: 6px 4px; font-size: 14px; color: #aaa; text-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .grid-cell.is-right, .grid-cell.is-wrong, .grid-cell.is-selected { animation: none; }
}
