:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #202020;
  --panel-2: #2e2e2e;
  --line: #080808;
  --text: #f6f6f6;
  --muted: #b9b9b9;
  --accent: #ff087c;
  --cyan: #56e8ef;
  --green: #39ff63;
  --yellow: #f1ff00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #2b2b2b 0, #111 44rem);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 8, 124, 0.26);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

button.secondary {
  background: #3c3c3c;
  box-shadow: none;
}

button.danger {
  background: #d61d3c;
  box-shadow: none;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  padding: 0 12px;
  background: #121212;
  color: white;
  outline: none;
}

input:focus {
  border-color: var(--cyan);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.lobby {
  display: grid;
  align-content: center;
  min-height: 100vh;
  gap: 28px;
}

.brand p,
.topbar p {
  margin: 0 0 6px;
  color: var(--cyan);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar p {
  margin: 0;
}

.brand h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 #000;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel,
.host-panel,
.current-card,
.vote-panel {
  border: 1px solid #3c3c3c;
  border-radius: 8px;
  background: rgba(32, 32, 32, 0.94);
}

.panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.panel h2 {
  margin: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.segmented label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid #424242;
  border-radius: 8px;
  padding: 0 12px;
  background: #171717;
  color: white;
}

.segmented input {
  width: auto;
  min-height: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #424242;
  border-radius: 8px;
  padding: 0 12px;
  background: #171717;
  color: white;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.mode-picker {
  position: relative;
  min-width: 0;
}

.mode-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #4a4a4a;
  background: #171717;
  box-shadow: none;
  color: #fff;
}

.mode-help {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #3a3a3a;
  color: var(--cyan);
  font-weight: 1000;
}

.mode-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  width: min(260px, 100%);
  gap: 6px;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  padding: 8px;
  background: #202020;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

.mode-menu button {
  min-height: 38px;
  padding: 0 10px;
  background: #303030;
  box-shadow: none;
  text-align: left;
}

.mode-menu button.selected {
  background: var(--cyan);
  color: #061314;
}

.game {
  position: relative;
  display: grid;
  gap: 12px;
  padding-top: 52px;
}

.leave-button {
  position: absolute;
  top: 0;
  left: 0;
  min-height: 40px;
  padding: 0 14px;
  background: #3a3a3a;
  box-shadow: none;
}

.topbar {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  border: 1px solid #3c3c3c;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(32, 32, 32, 0.72);
}

.host-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.host-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(190px, 260px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.host-room-code {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: max-content;
  min-height: 40px;
  border: 1px solid #343434;
  border-radius: 8px;
  padding: 0 12px;
  background: #171717;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
}

.host-room-code strong {
  color: var(--cyan);
  letter-spacing: 0.08em;
}

.lock-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: #3a3a3a;
  box-shadow: none;
  font-size: 1.2rem;
}

.lock-button.locked {
  background: #d61d3c;
}

.host-mode-picker {
  width: 100%;
  max-width: 260px;
}

.image-form {
  display: grid;
  grid-template-columns: 160px minmax(180px, 1fr) 130px;
  gap: 10px;
  align-items: end;
}

.host-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.host-actions button {
  min-width: 128px;
  padding: 0 14px;
}

.host-actions .lock-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.file-picker {
  min-height: 44px;
  border: 1px dashed #626262;
  border-radius: 8px;
  place-items: center;
  color: white;
  cursor: pointer;
}

.file-picker.loaded {
  border-color: var(--cyan);
  background: rgba(86, 232, 239, 0.12);
}

.file-picker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.stage {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: 0;
}

.game.host-view .stage {
  height: calc(100vh - 215px);
  min-height: 620px;
}

.game.ranker-view .stage {
  height: calc(100vh - 145px);
  min-height: 620px;
}

.game.ranker-view .current-card {
  height: calc(100vh - 145px);
  overflow: hidden;
}

.current-card {
  position: sticky;
  top: 18px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  align-self: start;
  gap: 14px;
  padding: 14px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.current-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 3px solid #050505;
  border-radius: 8px;
  background: #303030;
}

.game.host-view .current-image {
  max-height: 260px;
  aspect-ratio: 4 / 3;
}

.current-image.empty span {
  color: var(--muted);
  font-weight: 900;
}

.current-image.dragging {
  border-color: var(--cyan);
  background: rgba(86, 232, 239, 0.12);
}

.current-image.preset-mode {
  border-color: rgba(86, 232, 239, 0.7);
}

.current-image img {
  position: absolute;
  inset: 0;
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  object-position: center;
}

.vote-status {
  color: var(--muted);
  font-weight: 800;
}

.vote-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.vote-summary strong {
  color: #fff;
}

.vote-summary span {
  color: var(--cyan);
}

.vote-players {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.vote-chip {
  border: 1px solid #4a4a4a;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 0.82rem;
  line-height: 1;
  color: #fff;
  background: #242424;
}

.vote-chip.done {
  border-color: #31ff4b;
  color: #dfffe5;
  background: rgba(49, 255, 75, 0.14);
}

.vote-chip.missing {
  border-color: #ff4264;
  color: #ffd9df;
  background: rgba(255, 0, 61, 0.16);
}

.chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #3c3c3c;
  border-radius: 8px;
  padding: 10px;
  background: #1b1b1b;
}

.chat-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-messages.dragging {
  outline: 2px dashed var(--cyan);
  outline-offset: -4px;
  background: rgba(86, 232, 239, 0.08);
}

.chat-empty {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.chat-message {
  border: 1px solid #3f3f3f;
  border-radius: 8px;
  padding: 8px;
  background: #242424;
}

.chat-message.mine {
  border-color: rgba(86, 232, 239, 0.7);
}

.chat-meta {
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
}

.chat-message p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #fff;
  font-weight: 650;
}

.chat-message img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  margin-top: 7px;
  border-radius: 6px;
  background: #333;
  cursor: zoom-in;
}

.current-image img {
  cursor: zoom-in;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 42px;
  background: rgba(0, 0, 0, 0.78);
}

.image-modal img {
  max-width: min(1100px, 92vw);
  max-height: 88vh;
  object-fit: contain;
  border: 3px solid #050505;
  border-radius: 8px;
  background: #303030;
}

.image-modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: #f6f6f6;
  color: #111;
  box-shadow: none;
  font-size: 1.6rem;
  line-height: 1;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 76px;
  gap: 7px;
}

.chat-preview {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(86, 232, 239, 0.7);
  border-radius: 8px;
  padding: 7px;
  background: rgba(86, 232, 239, 0.1);
}

.chat-preview img {
  width: 52px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  background: #333;
}

.chat-preview span {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-preview button {
  min-height: 34px;
  padding: 0 9px;
  background: #3a3a3a;
  box-shadow: none;
  font-size: 0.78rem;
}

.chat-form input {
  min-height: 40px;
}

.chat-file {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  background: #171717;
  color: #fff;
  cursor: pointer;
  font-size: 1.3rem;
  font-weight: 900;
}

.chat-file.loaded {
  border-color: var(--cyan);
  background: rgba(86, 232, 239, 0.12);
  color: var(--cyan);
}

.chat-file input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.chat-form button {
  min-height: 40px;
}

.board-wrap {
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.vote-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
}

.slot-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 8px;
}

.slot-buttons button {
  min-width: 0;
  background: #3a3a3a;
  box-shadow: none;
}

.slot-buttons button.selected {
  background: var(--cyan);
  color: #061314;
  opacity: 1;
  outline: 3px solid white;
  outline-offset: 2px;
}

.boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.boards.final-mode {
  grid-template-columns: 1fr;
  align-items: start;
  height: 100%;
  overflow: hidden;
}

.final-vote-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.final-vote-summary {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.final-vote-summary strong {
  color: #fff;
}

.final-vote-options {
  display: grid;
  gap: 8px;
}

.final-vote-options button {
  min-height: 38px;
  padding: 0 12px;
  background: #303030;
  box-shadow: none;
}

.final-vote-options button.selected {
  background: var(--cyan);
  color: #061314;
  opacity: 1;
}

.final-comparison {
  min-width: 0;
  max-height: 100%;
  overflow-x: auto;
  border: 4px solid #050505;
  background: var(--line);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.final-grid {
  display: grid;
  min-width: min(100%, 920px);
}

.final-corner,
.final-player-header,
.final-rank-label,
.final-cell {
  min-width: 0;
  border-right: 1px solid #151515;
  border-bottom: 1px solid #151515;
}

.final-corner,
.final-player-header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 42px;
  background: #333;
}

.final-corner {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 1000;
}

.final-player-header {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 5px 7px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 1000;
  text-transform: uppercase;
  -webkit-text-stroke: 1px #050505;
  paint-order: stroke fill;
}

.final-player-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-tally {
  min-height: 16px;
  border-radius: 999px;
  padding: 2px 6px;
  background: #171717;
  color: var(--cyan);
  font-size: 0.72rem;
  line-height: 1;
  -webkit-text-stroke: 0;
  paint-order: normal;
}

.final-player-header.podium-gold {
  background: linear-gradient(180deg, #6a5010, #33260a);
  box-shadow: inset 0 0 0 2px #f1ff00;
}

.final-player-header.podium-silver {
  background: linear-gradient(180deg, #666, #303030);
  box-shadow: inset 0 0 0 2px #d8d8d8;
}

.final-player-header.podium-bronze {
  background: linear-gradient(180deg, #805033, #382116);
  box-shadow: inset 0 0 0 2px #c77b43;
}

.final-rank-label {
  display: grid;
  place-items: center;
  min-height: 50px;
  border-right: 4px solid #050505;
  color: white;
  font-size: 1.72rem;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 2px #050505;
  paint-order: stroke fill;
}

.final-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 50px;
  overflow: hidden;
  background: #333;
  transition: opacity 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

.final-cell img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 48px;
  object-fit: contain;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.comparison-pick.is-dimmed {
  opacity: 0.24;
  filter: grayscale(0.75);
}

.comparison-pick.is-highlighted {
  z-index: 1;
  opacity: 1;
  filter: none;
}

.final-cell.same-slot-match {
  box-shadow: inset 0 0 0 3px #f1ff00, inset 0 0 18px rgba(241, 255, 0, 0.42);
}

.rank-board {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.rank-board h2 {
  position: relative;
  margin: 0;
  height: 48px;
  display: grid;
  place-items: center;
  border: 4px solid #050505;
  border-bottom: 0;
  padding: 0 44px;
  background: #333;
  color: #fff;
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  line-height: 1;
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px #050505;
  paint-order: stroke fill;
  text-shadow: none;
  overflow: hidden;
}

.rank-board-name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-kick-player {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #5a5a5a;
  border-radius: 6px;
  background: #444;
  box-shadow: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 0;
  paint-order: normal;
}

.board-kick-player:hover,
.board-kick-player:focus-visible {
  background: #d61d3c;
  border-color: #ff4264;
}

.ranking-grid {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: repeat(10, minmax(0, 1fr));
  min-height: 0;
  height: 100%;
  border: 4px solid #050505;
  background: var(--line);
}

.rank-label {
  display: grid;
  place-items: center;
  border-right: 4px solid #050505;
  border-bottom: 1px solid #151515;
  color: white;
  font-size: 2.45rem;
  font-weight: 1000;
  line-height: 1;
  -webkit-text-stroke: 2px #050505;
  paint-order: stroke fill;
  text-shadow: none;
}

.rank-1 { background: #ff0084; }
.rank-2 { background: #ffb000; }
.rank-3 { background: #dcff00; }
.rank-4 { background: #31ff4b; }
.rank-5 { background: #053cff; }
.rank-6 { background: #1494ff; }
.rank-7 { background: #b500ff; }
.rank-8 { background: #54eff0; }
.rank-9 { background: #ff003d; }
.rank-10 { background: #e6ff00; font-size: 1.8rem; }

.rank-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid #1c1c1c;
  background: #333;
}

.rank-cell img {
  position: absolute;
  inset: 0;
  display: block;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
}

.empty-board {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid #5a5a5a;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f6f6f6;
  color: #111;
  font-weight: 800;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .lobby {
    align-content: start;
    min-height: 100svh;
    gap: 18px;
    padding-top: 10px;
  }

  .brand h1,
  .topbar h1 {
    font-size: clamp(2rem, 12vw, 3.1rem);
    line-height: 0.98;
  }

  .panel {
    padding: 16px;
  }

  .game {
    gap: 12px;
    padding-top: 0;
  }

  .leave-button {
    position: static;
    justify-self: stretch;
    width: 100%;
  }

  .lobby-grid,
  .stage,
  .image-form {
    grid-template-columns: 1fr;
  }

  .stage {
    display: flex;
    flex-direction: column;
  }

  .topbar {
    padding: 9px 11px;
  }

  .host-panel {
    padding: 10px;
  }

  .host-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .host-room-code,
  .mode-trigger {
    min-height: 42px;
  }

  .host-mode-picker {
    max-width: none;
  }

  .mode-menu {
    width: 100%;
  }

  .host-actions {
    grid-column: 1 / -1;
    display: flex;
  }

  .image-form button {
    width: 100%;
  }

  .host-actions .lock-button {
    flex: 0 0 44px;
    width: 44px;
  }

  .host-actions .danger {
    flex: 1 1 auto;
    min-width: 0;
  }

  .game.host-view .stage,
  .game.ranker-view .stage {
    height: auto;
    min-height: 0;
  }

  .game.ranker-view .current-card {
    height: auto;
    overflow: visible;
  }

  .current-card {
    display: contents;
  }

  .current-image {
    order: 1;
  }

  .vote-panel {
    order: 2;
  }

  .vote-status {
    order: 3;
  }

  .board-wrap {
    order: 4;
  }

  .chat {
    order: 5;
  }

  .current-image,
  .game.host-view .current-image {
    max-height: none;
    aspect-ratio: 4 / 3;
    min-height: 150px;
  }

  .chat {
    min-height: 170px;
    max-height: 260px;
  }

  .vote-panel {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .slot-buttons {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
    gap: 7px;
  }

  .boards {
    display: flex;
    grid-template-columns: none;
    gap: 12px;
    height: auto;
    margin-inline: -12px;
    padding: 0 12px 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 12px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .boards.final-mode {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }

  .final-vote-panel {
    padding: 10px;
  }

  .final-vote-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .final-vote-options button {
    min-width: 0;
  }

  .final-comparison {
    margin-inline: -12px;
    border-inline-width: 0;
  }

  .final-grid {
    min-width: max-content;
  }

  .final-player-header {
    min-height: 48px;
    font-size: 0.9rem;
  }

  .final-rank-label,
  .final-cell {
    min-height: 54px;
  }

  .final-cell img {
    max-height: 52px;
  }

  .board-wrap {
    overflow: hidden;
  }

  .rank-board {
    flex: 0 0 min(86vw, 360px);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    grid-template-rows: 44px auto;
    min-height: 0;
  }

  .boards:has(.rank-board:only-child) {
    display: grid;
    grid-template-columns: 1fr;
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }

  .boards:has(.rank-board:only-child) .rank-board {
    flex-basis: auto;
  }

  .rank-board h2 {
    height: 44px;
    padding: 0 40px;
    font-size: 1.08rem;
  }

  .board-kick-player {
    top: 6px;
    right: 6px;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .ranking-grid {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: repeat(10, 54px);
    height: auto;
  }

  .rank-label {
    font-size: 1.85rem;
  }

  .rank-10 {
    font-size: 1.55rem;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 10px;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .chat-form button {
    grid-column: 1 / -1;
  }

  .current-card {
    padding: 10px;
  }

  .current-image,
  .game.host-view .current-image {
    min-height: 135px;
  }

  .chat {
    min-height: 145px;
    max-height: 210px;
  }

  .slot-buttons {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .slot-buttons button {
    min-height: 42px;
  }

  .rank-board {
    flex-basis: 88vw;
  }

  .ranking-grid {
    grid-template-rows: repeat(10, 48px);
  }

  .final-vote-options {
    grid-template-columns: 1fr;
  }

  .final-rank-label,
  .final-cell {
    min-height: 48px;
  }

  .final-cell img {
    max-height: 46px;
  }

  .rank-label {
    font-size: 1.65rem;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .current-card {
    gap: 10px;
  }

  .vote-panel {
    padding: 10px;
  }

  .slot-buttons {
    gap: 6px;
  }

  .slot-buttons button {
    min-height: 38px;
  }
}
