@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cinzel-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --gold: #c8aa6e;
  --gold-dim: #8a7448;
  --bg: #0b1114;
  --panel: #111a1e;
  --text: #e8e2d4;
  --muted: #8c958f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 45% at 30% 35%, rgba(70, 92, 70, .22), transparent 70%),
    radial-gradient(ellipse 55% 40% at 72% 65%, rgba(48, 80, 96, .25), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

button { font: inherit; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity .3s ease;
}
.backdrop.is-on { opacity: 1; }
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(6, 10, 12, .45), rgba(6, 10, 12, .8)),
    rgba(6, 10, 12, .25);
}

.board {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px) clamp(16px, 3vw, 48px) 48px;
  container-type: inline-size;
}

/* Title with the thin gold rules on each side, as in the reference */
.board__title {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2cqi, 24px);
  margin: 0 0 clamp(16px, 3cqi, 40px);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: clamp(17px, 4.3cqi, 64px);
  line-height: 1.1;
  letter-spacing: .03em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .6);
}
.board__title::before,
.board__title::after {
  content: "";
  flex: 1;
  min-width: 12px;
  height: 1px;
  background: var(--gold-dim);
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(20px, 3.4cqi, 48px) clamp(8px, 1.6cqi, 28px);
}

.slot {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, .5vw, 6px);
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  text-align: center;
}

.slot__art {
  position: relative;
  aspect-ratio: 195 / 330;
  overflow: hidden;
  background: #070b0d;
  box-shadow: 0 0 0 1px #000, 0 8px 24px rgba(0, 0, 0, .5);
  transition: box-shadow .15s ease;
}
.slot__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  display: block;
}

.slot__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  color: var(--gold-dim);
  font-size: clamp(10px, 1vw, 13px);
  background: linear-gradient(180deg, rgba(200, 170, 110, .06), transparent 60%);
}
.slot__empty b {
  font-size: clamp(22px, 3vw, 44px);
  font-weight: 300;
  line-height: 1;
}

.slot__name {
  position: absolute;
  inset: auto 0 0;
  padding: 18px 4px 5px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  font-size: clamp(10px, 1vw, 13px);
  font-weight: 600;
  opacity: 0;
  transition: opacity .15s ease;
}

.slot__crest {
  position: relative;
  aspect-ratio: 195 / 80;
  border: 1px solid var(--gold-dim);
  background: rgba(10, 15, 18, .72);
}
.slot__crest img {
  position: absolute;
  inset: 19% 20%;
  width: 60%;
  height: 62%;
  object-fit: contain;
}

.slot:hover .slot__art,
.slot:focus-visible .slot__art { box-shadow: 0 0 0 2px var(--gold), 0 8px 24px rgba(0, 0, 0, .5); }
.slot:hover .slot__name,
.slot:focus-visible .slot__name { opacity: 1; }
.slot:focus-visible { outline: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(24px, 4vw, 48px);
}

.btn {
  padding: 10px 18px;
  border: 1px solid var(--gold-dim);
  background: rgba(10, 15, 18, .8);
  color: var(--text);
  cursor: pointer;
  letter-spacing: .02em;
}
.btn:hover { border-color: var(--gold); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #12100a; font-weight: 600; }
.btn--gold:hover { background: #dcc28a; }
.btn--quiet { border-color: transparent; background: none; color: var(--muted); }
.btn--quiet:hover { color: var(--text); border-color: transparent; }
.btn--sm { padding: 6px 12px; font-size: 14px; }

.footer {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 0 16px 32px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.footer p { margin: 0 0 8px; }
.footer a { color: var(--gold); }


.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  padding: 0 clamp(16px, 3vw, 32px);
  border-bottom: 1px solid rgba(138, 116, 72, .35);
  background: rgba(8, 12, 14, .7);
  backdrop-filter: blur(6px);
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gold);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
}
.nav__brand span { overflow: hidden; text-overflow: ellipsis; }

.langs {
  display: inline-flex;
  flex-shrink: 0;
  gap: 4px;
}
.langs button {
  padding: 4px 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .08em;
}
.langs button:hover { color: var(--text); }
.langs button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold-dim); }
.langs button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Picker */
.picker {
  width: min(720px, calc(100% - 24px));
  height: min(640px, calc(100dvh - 24px));
  padding: 0;
  border: 1px solid var(--gold-dim);
  background: var(--panel);
  color: var(--text);
}
.picker::backdrop { background: rgba(0, 0, 0, .7); }
.picker[open] { display: flex; }

.picker__panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  margin: 0;
}

.picker__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}
.picker__crest { height: 34px; width: 34px; object-fit: contain; }
.picker__head h2 {
  flex: 1;
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 22px;
  color: var(--gold);
}
.picker__close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.picker__close:hover { color: var(--text); }

.picker__search {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border: 1px solid #2b363b;
  background: #0a1013;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.picker__search:focus { outline: none; border-color: var(--gold); }

.picker__list {
  list-style: none;
  margin: 0;
  padding: 0 16px 12px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
  align-content: start;
}

.champ {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}
.champ img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border: 1px solid #2b363b;
}
.champ:hover img,
.champ:focus-visible img { border-color: var(--gold); }
.champ:focus-visible { outline: none; }
.champ.is-current img { border: 2px solid var(--gold); }
.champ.is-current { color: var(--gold); }

.picker--bg { height: fit-content; max-height: calc(100dvh - 24px); }

.bg-list {
  list-style: none;
  margin: 0;
  padding: 0 16px 16px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.bg-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.bg-option img,
.bg-option__dark {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid #2b363b;
}
.bg-option__dark { background: radial-gradient(ellipse at 30% 35%, #1d2a26, #0b1114 70%); }
.bg-option:hover img,
.bg-option:hover .bg-option__dark,
.bg-option:focus-visible img,
.bg-option:focus-visible .bg-option__dark { border-color: var(--gold); }
.bg-option:focus-visible { outline: none; }
.bg-option.is-current img,
.bg-option.is-current .bg-option__dark { border: 2px solid var(--gold); }
.bg-option.is-current { color: var(--gold); }

.picker__empty { margin: 8px 16px 20px; color: var(--muted); text-align: center; }

.picker__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid #222c30;
  font-size: 14px;
  color: var(--muted);
}
.picker__all { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.picker__all input { accent-color: var(--gold); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--gold);
  color: #12100a;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

/* Fit the whole board on one desktop screen, like the original image */
@media (min-width: 761px) {
  .board { width: min(100%, 1400px, calc((100dvh - 92px) * 1.42)); }
}

@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .slot__name { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
