/* LoL Grid 3x3 — builds on style.css tokens. */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.grid-status {
  display: flex; justify-content: center; align-items: baseline; gap: 8px;
  margin: 20px 0 14px; font-size: 0.82rem; color: var(--text-muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.guesses-left {
  font-family: 'Cinzel', serif; font-size: 1.4rem; color: var(--gold-light);
  text-shadow: 0 0 8px rgba(200, 170, 110, 0.35);
}

/* 4x4 layout: corner + 3 column headers, then 3 × (row header + 3 cells). */
.lolgrid {
  display: grid;
  grid-template-columns: minmax(64px, 0.8fr) repeat(3, 1fr);
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.lolgrid-corner { display: flex; align-items: center; justify-content: center; }
.lolgrid-corner img { width: 46%; opacity: 0.55; filter: drop-shadow(0 0 6px rgba(200, 170, 110, 0.4)); }
.axis {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 6px 2px; min-height: 92px;
}

.cell {
  position: relative; aspect-ratio: 1;
  background: var(--panel2);
  border: 1px solid rgba(200, 170, 110, 0.22);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0, 180, 255, 0.03);
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
button.cell { cursor: pointer; font: inherit; color: inherit; }
button.cell:hover, button.cell:focus-visible {
  border-color: var(--gold);
  background: rgba(200, 170, 110, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), inset 0 0 8px rgba(200, 170, 110, 0.15);
  outline: none;
}
.cell-plus {
  font-size: 2.2rem; font-weight: 300; color: var(--gold);
  line-height: 1; opacity: 0.7; transition: opacity .2s, transform .2s;
}
button.cell:hover .cell-plus { opacity: 1; transform: scale(1.1); }

.cell.filled { border-color: rgba(74, 224, 136, 0.55); background: rgba(20, 43, 30, 0.55); }
.cell.revealed { opacity: 0.6; border-style: dashed; }
.cell-player { position: absolute; inset: 0; display: flex; flex-direction: column; }
/* flex-basis 0 + min-height 0: the 256px portrait shrinks to the space left above the nickname
   instead of pushing the nickname out of the cell. */
.cell-player .avatar { flex: 1 1 0; min-height: 0; width: 100%; border-radius: 0; font-size: 1.6rem; }
.cell-player-nick {
  flex-shrink: 0;
  background: linear-gradient(to top, rgba(5, 8, 17, 0.95), rgba(5, 8, 17, 0.7));
  padding: 4px 4px 5px; font-size: 0.74rem; font-weight: 700; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--gold-light);
}
.cell-count {
  position: absolute; top: 4px; right: 5px; font-size: 0.62rem; color: var(--text-muted);
  background: rgba(5, 8, 17, 0.75); border-radius: 3px; padding: 0 4px;
}

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: top;
  background: #1a2235; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--gold); font-size: 0.95rem; letter-spacing: 0.5px;
}
.avatar.initials { border: 1px solid rgba(200, 170, 110, 0.3); }

/* ---------- Condition badges ---------- */
.cond { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; max-width: 100%; }
.cond-icon {
  width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; position: relative;
}
.cond-icon > img { max-width: 100%; max-height: 100%; }
.cond-caption {
  font-size: 0.68rem; font-weight: 700; line-height: 1.2; color: var(--gold-light);
  text-transform: uppercase; letter-spacing: 0.3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cond.small .cond-icon { width: 36px; height: 36px; }
/* Team and league logos are designed for light backgrounds (Fnatic, Dignitas, LCK are dark) — give them a light plate. */
.cond-team .cond-icon > img, .cond-league .cond-icon > img {
  background: #ece6d6; border-radius: 10px; padding: 5px;
  width: 100%; height: 100%; object-fit: contain;
  box-shadow: 0 0 0 1px rgba(200, 170, 110, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
}
.cond.small .cond-caption { font-size: 0.64rem; }

.emblem {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.5px;
  color: #fff; border: 2px solid rgba(255, 255, 255, 0.35); text-align: center; line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
/* League emblem: shield shape, colour per league. */
.emblem-league { clip-path: polygon(50% 0, 100% 18%, 100% 62%, 50% 100%, 0 62%, 0 18%); border: none; }
.emblem-league[data-league="LCK"] { background: linear-gradient(160deg, #3d7bd9, #173a7a); }
.emblem-league[data-league="LPL"] { background: linear-gradient(160deg, #e0453a, #7a1a14); }
.emblem-league[data-league="LEC"] { background: linear-gradient(160deg, #22b8c7, #0d5260); }
.emblem-league[data-league="LCS"] { background: linear-gradient(160deg, #3a4b9b, #151d48); }
.emblem-league[data-league="LTA"] { background: linear-gradient(160deg, #e8a33a, #7a4a10); }
.emblem-team { border-radius: 10px; background: linear-gradient(160deg, #2a3550, #121a2c); font-size: 0.72rem; }

.cond-teammate .avatar { width: 100%; height: 100%; border: 2px solid var(--gold); }
.cond-teammate .handshake {
  position: absolute; right: -4px; bottom: -4px; font-size: 0.9rem;
  background: #0d1527; border: 1px solid var(--gold); border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
}

/* ---------- Search modal ---------- */
.search-modal { max-width: 460px; padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.search-conds {
  display: flex; align-items: center; justify-content: center; gap: 14px; padding-right: 20px;
}
.search-conds .times { color: var(--text-muted); font-size: 1.1rem; }
.search-input {
  width: 100%; padding: 12px 14px; border-radius: 4px;
  border: 1px solid rgba(200, 170, 110, 0.3); background: rgba(10, 16, 28, 0.8);
  color: var(--text); font-family: inherit; font-size: 1rem;
}
.search-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 10px rgba(200, 170, 110, 0.2); }
.search-results {
  list-style: none; max-height: min(52vh, 420px); overflow-y: auto;
  border: 1px solid rgba(200, 170, 110, 0.12); border-radius: 4px;
}
.search-results:empty { display: none; }
.result-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.result-item:last-child { border-bottom: none; }
.result-item.active, .result-item:hover { background: rgba(200, 170, 110, 0.12); }
.result-item.disabled { opacity: 0.35; cursor: not-allowed; }
.result-text { min-width: 0; }
.result-nick {
  font-weight: 800; font-size: 1.05rem; color: var(--gold-light); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.result-name { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-tag { margin-left: auto; font-size: 0.66rem; color: var(--text-muted); text-transform: uppercase; white-space: nowrap; }
.search-msg { min-height: 20px; text-align: center; font-size: 0.85rem; font-weight: 600; color: #ffca58; }
.search-msg.bad { color: #ff7a7a; }
.search-modal.shake { animation: shake .45s ease; }

.result-score {
  font-family: 'Cinzel', serif; font-size: 2rem; color: var(--gold-light);
  text-shadow: 0 0 10px rgba(200, 170, 110, 0.35);
}

@media (max-width: 520px) {
  .lolgrid { gap: 5px; grid-template-columns: minmax(54px, 0.75fr) repeat(3, 1fr); }
  .axis { min-height: 76px; }
  .cond-icon { width: 40px; height: 40px; }
  .cond-caption { font-size: 0.58rem; }
  .cell-player-nick { font-size: 0.64rem; }
}
