@font-face {
  font-family: 'Chakra Petch';
  src: url('fonts/chakra-petch-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Chakra Petch';
  src: url('fonts/chakra-petch-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/barlow-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/barlow-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow';
  src: url('fonts/barlow-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --bg: #1a212b;
  --inset: #141a22;
  --panel: #212a36;
  --raised: #2a3544;
  --line: #364354;
  --text: #ece9e2;
  --muted: #8f9bab;
  --accent: #e8a33d;
  --accent-ink: #1d1406;
  --danger: #e5534b;
  --good: #4cc38a;
  --display: 'Chakra Petch', 'Segoe UI', sans-serif;
  --ui: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --r: 3px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  margin: 0;
}
h2 {
  font-size: 19px;
  margin-bottom: 12px;
}
h3 {
  font-size: 15px;
}
p {
  margin: 0;
}
.muted {
  color: var(--muted);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row.wrap {
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
  margin-top: 18px;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: crosshair;
}
body:not([data-screen='game']) #game {
  visibility: hidden;
}
#ui {
  position: fixed;
  inset: 0;
  overflow: auto;
}
body[data-screen='game'] #ui {
  pointer-events: none;
  overflow: hidden;
}
body[data-screen='game'] #ui > * > * {
  pointer-events: auto;
}

/* ---------------------------------------------------------- controls */
input,
select {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 11px;
  min-width: 0;
  flex: 1;
}
input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
}
input::placeholder {
  color: #6b7686;
}
.code-input {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  max-width: 130px;
  text-align: center;
}
.btn {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 16px;
  background: var(--raised);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover {
  background: #344155;
  border-color: #4a596e;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover {
  background: #f0b456;
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(229, 83, 75, 0.45);
}
.btn.danger:hover {
  background: rgba(229, 83, 75, 0.1);
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  padding: 6px 11px;
  font-size: 14px;
}
.btn.tiny {
  padding: 3px 8px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.big-btn {
  width: 100%;
  margin-top: 14px;
  font-family: var(--display);
  font-size: 18px;
  padding: 12px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
}
.note {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}
.err {
  color: var(--danger);
}
.avatar-tile {
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

/* ---------------------------------------------------------- wordmark */
.wordmark {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  position: relative;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 0.85;
  color: var(--text);
}
.wordmark .sq {
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  background: var(--accent);
  margin-left: 0.06em;
  margin-bottom: 0.02em;
  position: relative;
}
/* the joke: a round character sits on the square */
.wordmark canvas {
  position: absolute;
  right: -0.12em;
  bottom: 0.56em;
  width: 0.62em;
  height: 0.62em;
}

/* ---------------------------------------------------------- boot / access */
.boot {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.boot .wordmark {
  font-size: 72px;
}
.boot-status {
  color: var(--muted);
  max-width: 46ch;
}
.access {
  display: grid;
  gap: 10px;
  width: min(420px, 90vw);
  text-align: left;
}

/* ---------------------------------------------------------- top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar .wordmark {
  font-size: 40px;
}
.me {
  display: flex;
  align-items: center;
  gap: 12px;
}
.me .avatar-tile {
  width: 46px;
  height: 46px;
}
.me-name {
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.1;
}
.me-stats {
  font-size: 13px;
  color: var(--muted);
}

/* ---------------------------------------------------------- menu */
.menu {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}
.menu-body {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 24px;
  padding: 28px clamp(16px, 3vw, 40px);
  align-content: start;
}
.menu-actions {
  display: grid;
  gap: 16px;
  align-content: start;
}
.menu-actions form,
.menu-actions .block {
  display: grid;
  gap: 8px;
}
.menu-actions h2 {
  margin: 0;
}
.menu-actions p {
  color: var(--muted);
  font-size: 14px;
}
.rooms-table {
  width: 100%;
  border-collapse: collapse;
}
.rooms-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  padding: 0 10px 8px;
}
.rooms-table td {
  padding: 10px;
  border-top: 1px solid var(--line);
}
.rooms-table td:last-child {
  text-align: right;
}
.rooms-empty {
  color: var(--muted);
  padding: 28px 0 8px;
  max-width: 44ch;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  background: var(--good);
}
.status-dot.busy {
  background: var(--accent);
}

/* ---------------------------------------------------------- lobby */
.lobby {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}
.room-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.room-title h1 {
  font-size: 28px;
}
.code-chip {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  border-radius: var(--r);
}
.code-chip:hover {
  background: rgba(232, 163, 61, 0.1);
}
.lobby-body {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 20px;
  padding: 20px clamp(16px, 3vw, 40px) 28px;
  min-height: 0;
}
.lobby-left {
  display: grid;
  gap: 16px;
  align-content: start;
}
.player-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
}
.player-row + .player-row {
  border-top: 1px solid var(--line);
}
.player-row .avatar-tile {
  width: 44px;
  height: 44px;
}
.player-row.away {
  opacity: 0.45;
}
.pr-name {
  font-weight: 600;
}
.pr-actions {
  display: flex;
  gap: 6px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--muted);
  margin-left: 4px;
  vertical-align: 1px;
}
.badge.you {
  border-color: var(--accent);
  color: var(--accent);
}
.team {
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 3px solid #4f8ff7;
}
.team-1 {
  border-left-color: var(--danger);
}
.team h3 {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
}
#host-controls {
  margin-top: 14px;
}
.bot-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bot-row span {
  color: var(--muted);
  font-size: 14px;
  margin-right: 4px;
}
.waiting {
  margin-top: 8px;
  color: var(--muted);
}
.chat ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  max-height: 150px;
  min-height: 48px;
  overflow: auto;
  font-size: 14px;
}
.chat li {
  padding: 2px 0;
}
.chat li strong {
  font-weight: 600;
  margin-right: 4px;
}
.lobby-settings {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
}
.settings-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--line);
}
.tabs {
  display: flex;
  gap: 2px;
}
.tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 12px 10px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
}
.tabs button:hover {
  color: var(--text);
}
.tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.presets {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-bottom: 8px;
}
.presets select {
  min-width: 150px;
  flex: none;
  padding: 6px 8px;
}
.settings-body {
  padding: 16px 18px;
  overflow: auto;
  max-height: calc(100vh - 190px);
}
.fields {
  display: grid;
}
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.field + .field {
  border-top: 1px solid rgba(54, 67, 84, 0.6);
}
.f-label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.f-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--inset);
}
.stepper button {
  width: 32px;
  height: 32px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--muted);
}
.stepper button:hover:not(:disabled) {
  color: var(--text);
  background: var(--raised);
}
.stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}
.stepper output {
  min-width: 58px;
  text-align: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
}
.switch {
  width: 44px;
  height: 24px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: var(--inset);
  position: relative;
  cursor: pointer;
  flex: none;
}
.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--muted);
  transition: left 0.12s, background 0.12s;
}
.switch.on {
  border-color: var(--accent);
}
.switch.on span {
  left: 23px;
  background: var(--accent);
}
.switch:disabled {
  opacity: 0.5;
  cursor: default;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.seg button {
  border: 0;
  background: var(--inset);
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.seg button + button {
  border-left: 1px solid var(--line);
}
.seg button.on {
  background: var(--raised);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.rarity-field {
  display: grid;
  grid-template-columns: 120px 1fr 48px 58px;
}
.rarity-field input {
  accent-color: var(--accent);
  padding: 0;
  background: none;
  border: 0;
}
.rarity-field output {
  text-align: right;
  font-family: var(--display);
  font-weight: 600;
}
.rarity-field .pct {
  color: var(--muted);
}
.gem {
  width: 10px;
  height: 10px;
  background: var(--gem);
  display: inline-block;
}
.preset-row {
  margin-top: 14px;
}
.pack-head {
  margin: 18px 0 2px;
  color: var(--muted);
  font-size: 13px;
}
.card-tools[hidden] {
  display: none;
}
.card-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.card-tools input {
  min-width: 180px;
}
.card-tools select {
  flex: 0 0 auto;
}
.card-summary {
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.map-tile {
  border: 1px solid var(--line);
  padding: 0;
  background: var(--inset);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}
.map-tile canvas {
  width: 100%;
  display: block;
}
.map-tile span {
  display: block;
  padding: 7px 10px;
  font-family: var(--display);
  font-weight: 600;
}
.map-tile span em {
  display: block;
  font-family: var(--body);
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.map-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 8px;
}
.map-group:first-of-type {
  margin-top: 6px;
}
.map-group h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
}
.map-group .btn {
  margin-left: auto;
}
.map-tile.off {
  opacity: 0.35;
  filter: grayscale(1);
}
.map-tile:disabled {
  cursor: default;
}

/* ---------------------------------------------------------- cards */
.card {
  --rim: #aeb7c6;
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: center;
  border: 0;
  padding: 0;
  background: linear-gradient(180deg, #1b2029 0%, #12151c 100%);
  color: #f2f4f8;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 0 0 2px var(--rim),
    0 10px 28px rgba(0, 0, 0, 0.55);
  font-family: var(--ui);
}
.card.r-uncommon {
  --rim: #5be3a0;
}
.card.r-rare {
  --rim: #5aa2ff;
}
.card.r-epic {
  --rim: #c084fc;
}
.card.r-legendary {
  --rim: #ffc247;
}
.card.r-curse {
  --rim: #ff5d6c;
}
.card-art {
  position: relative;
  flex: 0 0 38%;
  min-height: 0;
  border-bottom: 2px solid var(--rim);
  overflow: hidden;
}
.card-art .art {
  display: block;
  width: 100%;
  height: 100%;
}
/* light sweeping across the picture of the best cards */
.card.r-legendary .card-art::after,
.card.r-epic .card-art::after {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg, transparent 44%, rgba(255, 255, 255, 0.34) 50%, transparent 56%);
  animation: sheen 3.2s ease-in-out infinite;
}
@keyframes sheen {
  0%,
  55% {
    transform: translateX(-45%);
  }
  100% {
    transform: translateX(45%);
  }
}
.card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 11px 12px 4px;
}
.card-name {
  font: 700 18px/1.08 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-wrap: balance;
}
.card-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
  font-size: 13.5px;
  line-height: 1.22;
  text-align: left;
}
.card-lines li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #dfe4ec;
}
.card-lines i {
  flex: 0 0 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 13px/1 var(--ui);
  font-style: normal;
  color: #0d1016;
  background: var(--good);
}
.card-lines .bad i {
  background: var(--danger);
}
.card-lines b {
  font-weight: 700;
  color: var(--good);
}
.card-lines .bad b {
  color: var(--danger);
}
.card-desc {
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.3;
  color: #a9b3c2;
  text-wrap: pretty;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: #7f8a9b;
}
.card-foot .rar {
  color: var(--rim);
}
.card-key {
  position: absolute;
  top: 8px;
  left: 8px;
  font: 700 12px var(--ui);
  background: rgba(8, 10, 16, 0.72);
  color: #fff;
  border-radius: 5px;
  padding: 1px 7px;
}
.card-back {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0 10px, transparent 10px 20px),
    radial-gradient(circle at 50% 40%, #39305c, #151226);
}
.card-back span {
  font: 700 84px/1 var(--display);
  color: var(--rim);
}
.card-back em {
  font-style: normal;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--rim);
}
.card.mini {
  min-height: 268px;
  border-radius: 10px;
  box-shadow:
    0 0 0 1.5px color-mix(in srgb, var(--rim) 70%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.35);
}
.card.mini .card-art {
  flex-basis: 84px;
}
.card.mini .card-body {
  padding: 9px 10px 2px;
  gap: 5px;
}
.card.mini .card-name {
  font-size: 15px;
}
.card.mini .card-desc {
  font-size: 12px;
}
.card.mini .card-lines {
  font-size: 12.5px;
}
.card.mini .card-foot {
  padding: 6px 10px 8px;
  font-size: 11px;
}
.card.mini:hover:not(:disabled) {
  box-shadow:
    0 0 0 2px var(--rim),
    0 6px 16px rgba(0, 0, 0, 0.45);
}
.card.mini:disabled {
  cursor: default;
}
.card.banned {
  filter: grayscale(1);
  opacity: 0.38;
}
.ban-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: #fff;
  font: 600 12px var(--ui);
  padding: 1px 7px;
  border-radius: 4px;
  z-index: 1;
}

/* ---------------------------------------------------------- pick */
.pick {
  --cw: clamp(150px, min(15.6vw, calc((100vw - 60px) / (var(--n) * 0.94)), 36vh), 244px);
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  justify-items: center;
  gap: 10px;
  padding: clamp(14px, 3vh, 34px) 20px clamp(12px, 2.4vh, 26px);
  background:
    radial-gradient(ellipse at 50% 58%, color-mix(in srgb, var(--pc) 16%, transparent) 0%, transparent 62%),
    radial-gradient(ellipse at 50% 50%, rgba(13, 16, 24, 0.86) 0%, rgba(4, 5, 9, 0.97) 100%);
  backdrop-filter: blur(6px);
  overflow: hidden;
  animation: pick-in 0.25s ease-out both;
}
@keyframes pick-in {
  from {
    opacity: 0;
  }
}
.pick-head {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.pick-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--pc), 0 0 26px color-mix(in srgb, var(--pc) 60%, transparent);
}
.pick-title {
  font: 700 clamp(26px, 3.4vw, 44px) / 1.05 var(--display);
  color: #fff;
}
.pick:not(.mine) .pick-title {
  color: var(--pc);
}
.pick-sub {
  color: #9aa5b6;
  font-size: 15px;
  margin-top: 3px;
}
.pick-timer {
  width: min(420px, 60vw);
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.pick-timer i {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: left;
  transform: scaleX(0);
}
.pick-timer i.low {
  background: var(--danger);
}
/* the cards fan out like a hand: the outer ones sit lower and lean away */
.fan {
  align-self: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(6px, 1vw, 16px);
  padding: 30px 0 50px;
  perspective: 1400px;
}
.fan-slot {
  width: var(--cw);
  aspect-ratio: 5 / 7.35;
  transform: translateY(calc(var(--o) * var(--o) * 7px)) rotate(calc(var(--o) * 3.6deg));
  transition:
    transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.25),
    opacity 0.3s,
    filter 0.3s;
  animation: deal 0.5s cubic-bezier(0.2, 0.85, 0.25, 1.1) both;
  animation-delay: calc(var(--i) * 75ms);
}
@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(70vh) rotate(calc(var(--o) * 14deg + 12deg)) scale(0.7);
  }
}
.fan-slot .card {
  width: 100%;
  height: 100%;
  font-size: calc(var(--cw) / 244 * 1em);
  animation: bob 3.6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.7s);
  transition: box-shadow 0.2s;
}
@keyframes bob {
  50% {
    transform: translateY(-7px);
  }
}
.fan-slot .card-name {
  font-size: clamp(14px, calc(var(--cw) * 0.088), 21px);
}
.fan-slot .card-lines {
  font-size: clamp(11.5px, calc(var(--cw) * 0.06), 14.5px);
}
.fan-slot .card-desc {
  font-size: clamp(11px, calc(var(--cw) * 0.055), 13.5px);
}
.pick.mine .fan-slot:not(.locked):not(.dim):hover,
.pick.mine .fan-slot:focus-within,
.fan-slot.hl,
.fan-slot.taken {
  transform: translateY(-30px) rotate(0deg) scale(1.1);
  z-index: 5;
}
.pick.mine .fan-slot:not(.locked):not(.dim):hover .card,
.fan-slot.hl .card,
.fan-slot.taken .card {
  animation-play-state: paused;
  box-shadow:
    0 0 0 3px var(--rim),
    0 0 46px color-mix(in srgb, var(--rim) 70%, transparent),
    0 22px 50px rgba(0, 0, 0, 0.7);
}
.fan-slot.hl .card {
  box-shadow:
    0 0 0 3px var(--pc),
    0 0 46px color-mix(in srgb, var(--pc) 70%, transparent),
    0 22px 50px rgba(0, 0, 0, 0.7);
}
.fan-slot.taken {
  transform: translateY(-44px) rotate(0deg) scale(1.2);
}
.fan-slot.dim {
  opacity: 0.2;
  filter: grayscale(0.8);
  transform: translateY(calc(var(--o) * var(--o) * 7px + 46px)) rotate(calc(var(--o) * 3.6deg)) scale(0.94);
}
.fan-slot.locked {
  opacity: 0.35;
  filter: grayscale(1);
}
.pick:not(.mine) .card {
  cursor: default;
}
.pick-owned {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  max-width: min(1100px, 94vw);
  max-height: 86px;
  overflow: hidden;
}
.owned-label {
  color: #7f8a9b;
  font-size: 13px;
  font-weight: 600;
  margin-right: 4px;
}
.chip {
  --rim: #aeb7c6;
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  color: var(--rim);
  background: color-mix(in srgb, var(--rim) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rim) 45%, transparent);
}
.chip.r-uncommon {
  --rim: #5be3a0;
}
.chip.r-rare {
  --rim: #5aa2ff;
}
.chip.r-epic {
  --rim: #c084fc;
}
.chip.r-legendary {
  --rim: #ffc247;
}
.chip.r-curse {
  --rim: #ff5d6c;
}
.chip.none {
  --rim: #5d6878;
}
@media (prefers-reduced-motion: reduce) {
  .fan-slot,
  .fan-slot .card,
  .card-art::after {
    animation: none !important;
  }
}

/* ---------------------------------------------------------- end of match */
#end-layer:not(:empty) {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(16, 21, 28, 0.6);
}
.match-end {
  width: min(720px, 94vw);
}
.match-end h2 {
  font-size: 28px;
  font-weight: 700;
}
.match-end table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
}
.match-end th {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 8px;
}
.match-end td {
  padding: 7px 8px;
  border-top: 1px solid var(--line);
}
.match-end td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.match-end td .avatar-tile {
  width: 30px;
  height: 30px;
}
.match-end tr.winner td {
  color: var(--accent);
}
.end-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(236, 233, 226, 0.8);
  font-size: 13px;
  text-align: center;
  width: max-content;
  max-width: 94vw;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* ---------------------------------------------------------- modals */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 21, 28, 0.75);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 10;
}
#modal[hidden] {
  display: none;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px;
  max-height: 92vh;
  overflow: auto;
}
.profile-modal {
  width: min(900px, 96vw);
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 28px;
}
.pm-preview {
  display: grid;
  gap: 12px;
  align-content: start;
}
.pm-preview canvas {
  width: 230px;
  height: 230px;
}
.pm-preview input {
  width: 100%;
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  flex: none;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin: 4px 0 0;
}
.stats dt {
  font-size: 12px;
  color: var(--muted);
}
.stats dd {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
}
.fav {
  font-size: 13px;
}
.pm-options {
  min-width: 0;
}
.opt-group {
  margin-bottom: 16px;
}
.opt-group h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.swatches button {
  width: 30px;
  height: 30px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: var(--c);
  cursor: pointer;
}
.swatches button.on {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.opt-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opt-grid button {
  width: 50px;
  height: 50px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--inset);
  cursor: pointer;
  padding: 3px;
}
.opt-grid button.on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.opt-grid canvas {
  width: 42px;
  height: 42px;
}
.settings-modal {
  width: min(560px, 96vw);
}
.settings-modal h2 {
  font-size: 22px;
}
.settings-modal input[type='range'] {
  accent-color: var(--accent);
  max-width: 260px;
  padding: 0;
  background: none;
  border: 0;
}
.settings-modal h3 {
  margin: 18px 0 8px;
}
.controls {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.controls td {
  padding: 6px;
  border-top: 1px solid var(--line);
}
.controls td:first-child {
  font-weight: 600;
}
.controls td:last-child {
  color: var(--muted);
}
.esc-modal {
  width: min(340px, 94vw);
  display: grid;
  gap: 8px;
}
.esc-modal p {
  margin: 0 0 8px;
  color: var(--muted);
}
.prompt-modal {
  width: min(400px, 94vw);
  display: grid;
  gap: 12px;
}

#toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r);
}

@media (max-width: 900px) {
  .menu-body,
  .lobby-body,
  .profile-modal {
    grid-template-columns: 1fr;
  }
  .settings-body {
    max-height: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .card.big {
    animation: none;
  }
  * {
    transition: none !important;
  }
}

.card.locked {
  opacity: 0.35;
  filter: grayscale(0.8);
  cursor: not-allowed;
}

.card-back {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  background: repeating-linear-gradient(45deg, var(--raised) 0 10px, var(--panel) 10px 20px);
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
}
.card-back em {
  font-style: normal;
  font-family: var(--body);
  font-size: 13px;
  color: var(--muted);
  text-transform: capitalize;
}

.map-sec {
  border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}
.map-sec > summary {
  list-style: none;
  cursor: pointer;
}
.map-sec > summary::-webkit-details-marker {
  display: none;
}
.map-sec > summary .map-group h4::before {
  content: '▸';
  display: inline-block;
  width: 1.1em;
  transition: transform 0.15s;
}
.map-sec[open] > summary .map-group h4::before {
  transform: rotate(90deg);
}
.map-sec .map-grid {
  margin-bottom: 14px;
}
