.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sheet {
  width: min(700px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  background: #f3eddd;
  color: #163f42;
  border: 0;
  border-radius: 12px;
  padding: 24px 32px;
  overflow: auto;
}
.sheet::backdrop {
  background: #071e27d9;
}
.sheet-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid #9bae9f;
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.sheet-heading h2 {
  font-size: 2rem;
  margin: 0;
}
.sheet-heading > button {
  padding: 4px 14px;
  font-size: 22px;
}
.sheet .secondary,
.tutorial-dialog .secondary {
  color: #163f42;
  border-color: #668173;
}
.sheet .secondary:hover {
  background: #dedfce;
}
.sheet-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 22px 0 8px;
}
.sheet p {
  font-size: 1rem;
}
.sheet a {
  color: #175a70;
  text-underline-offset: 3px;
}
.rules-copy p {
  margin: 18px 0;
}
.clue-example {
  display: grid;
  gap: 12px;
  text-align: center;
  padding: 20px;
  background: #dce3cf;
  border-radius: 7px;
}
.audio-setting {
  margin: 26px 0;
}
.audio-setting > label {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
}
.audio-setting > div {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
}
.audio-setting input {
  border: 0;
  accent-color: #b52c3f;
  padding: 0;
  min-height: 44px;
  background: transparent;
}
.audio-setting button {
  width: 110px;
  flex-shrink: 0;
}
.setting-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
}
.setting-check input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: #174b4c;
}
.settings-note {
  color: #465c51;
}
.pack-sheet {
  width: min(820px, calc(100% - 28px));
}
.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.pack-choice {
  position: relative;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: center;
  border: 2px solid #b2beb0;
  border-radius: 7px;
  min-height: 115px;
  padding: 12px;
  cursor: pointer;
}
.pack-choice:has(input:checked) {
  border-color: #17574e;
  background: #dde6d1;
}
.pack-choice:focus-within {
  outline: 3px solid #a83441;
  outline-offset: 3px;
}
.pack-choice input {
  position: absolute;
  width: 22px;
  height: 22px;
  min-height: 22px;
  top: 5px;
  right: 5px;
  accent-color: #17574e;
}
.pack-choice img,
.pack-monogram {
  width: 58px;
  height: 70px;
  object-fit: contain;
}
.pack-monogram {
  font-size: 3rem;
  display: grid;
  place-items: center;
  color: #267b73;
}
.pack-choice strong {
  display: block;
  overflow-wrap: anywhere;
}
.pack-choice small {
  display: block;
  font-size: 0.75rem;
  margin-top: 5px;
}
.pack-browser { display: flex; gap: 18px; align-items: end; margin: 25px 0 10px; flex-wrap: wrap; }
.pack-browser label { flex: 1; min-width: 180px; }
.pack-browser select { display: block; width: 100%; margin-top: 8px; }
.spectrum-list { padding: 0; list-style: none; }
.spectrum-list li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid #bec9b6; }
.spectrum-list li span:last-child { text-align: right; }
.avatar-sheet {
  width: min(740px, calc(100% - 28px));
}
#avatar-preview {
  display: grid;
  place-items: center;
  margin: 12px auto 25px;
}
#avatar-preview .avatar {
  width: 165px;
  height: 165px;
}
.avatar-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-tabs button {
  padding: 10px 8px;
}
.avatar-tabs button[aria-pressed="true"] {
  background: #174b4c;
  color: #f5efdf;
  border-color: #174b4c;
}
.avatar-parts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
  max-height: 295px;
  overflow: auto;
  padding: 5px;
}
.part-choice {
  aspect-ratio: 1;
  background: #e3e5d3;
  border: 2px solid transparent;
  min-width: 0;
  padding: 5px;
  display: grid;
  place-items: center;
}
.part-choice img {
  width: 100%;
  height: 100%;
  max-height: 90px;
  object-fit: contain;
}
.part-choice.selected {
  border-color: #a72a3d;
  background: #f3e5cf;
}
.part-choice span {
  color: #163f42;
  font-size: 0.8rem;
}
.sheet .room-invite {
  margin: 20px auto;
}
.sheet .player-roster {
  gap: 18px;
  margin: 25px 0;
}
.sheet .player > span:last-child,
.sheet .player-state {
  color: #465c51;
}
.sheet .player strong {
  max-width: 100px;
  overflow-wrap: anywhere;
}
.portrait-button {
  padding: 0;
  background: transparent;
  border-radius: 50%;
  color: inherit;
}
.player strong {
  font-size: 1rem;
  max-width: 150px;
  overflow-wrap: anywhere;
}
.player small {
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
}
.player.is-offline .avatar {
  filter: grayscale(0.9);
  opacity: 0.65;
}
.player.is-me > strong {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.lobby {
  max-width: 1100px;
}
.lobby-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  text-align: left;
}
.lobby-heading h1 {
  font-size: clamp(2.7rem, 4vw, 4rem);
}
.lobby-heading .room-invite {
  margin: 0;
  flex-wrap: wrap;
  max-width: 350px;
}
.lobby-settings {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  padding: 25px 0 8px;
  border-top: 1px solid #688f87;
}
.lobby-settings label {
  display: grid;
  gap: 10px;
  text-align: left;
  font-size: 0.9rem;
  max-width: 360px;
}
.lobby-settings select {
  font-size: 1rem;
  padding: 12px;
  min-height: 50px;
}
.lobby-settings .pack-summary {
  min-height: 50px;
  max-width: 250px;
}
.mode-description {
  max-width: 620px;
  margin: 20px auto;
  color: #d0dccc;
}
.lobby-bottom {
  margin: 20px 0;
}
.lobby-bottom p {
  min-height: 26px;
}
.table-tools {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.team-button {
  font-size: 0.8rem;
  padding: 8px 12px;
  background: #f3eddd;
  color: #174b4c;
  min-height: 44px;
}
.team-button:disabled {
  opacity: 1;
}
.play {
  max-width: 1200px;
  margin: auto;
  position: relative;
}
.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
  min-height: 44px;
  color: #d2ddcd;
  border-bottom: 1px solid #61867e;
}
.table-meta button {
  padding: 8px 10px;
  font-size: 0.85rem;
}
.compact-roster {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: start;
  flex-wrap: wrap;
  margin: 15px 0 10px;
  min-height: 78px;
}
.compact-roster .avatar {
  width: 44px;
  height: 44px;
}
.compact-roster .player {
  position: relative;
  grid-template-columns: 44px auto;
  grid-template-rows: 23px 22px;
  column-gap: 9px;
  row-gap: 0;
  justify-items: start;
  min-width: 90px;
  max-width: 200px;
}
.compact-roster .player > .avatar,
.compact-roster .player > .portrait-button {
  grid-row: 1/3;
}
.compact-roster .player > strong {
  align-self: end;
  font-size: 0.9rem;
  max-width: 130px;
}
.compact-roster .player-state {
  font-size: 0.7rem;
  max-width: 140px;
}
.compact-roster .remove-seat {
  grid-column: 1/3;
  padding: 2px 5px;
  font-size: 0.7rem;
}
.play-intro {
  text-align: center;
  margin: 2px 0 0;
}
.play-intro h1 {
  font-size: clamp(2.1rem, 3.2vw, 3.4rem);
  margin: 5px 0 12px;
  overflow-wrap: anywhere;
}
.play-intro p {
  margin: 4px auto 8px;
  font-size: 0.9rem;
  max-width: 660px;
  color: #d6dfcf;
}
.psychic-caption {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: #d7dfce;
  font-size: 0.9rem;
}
.psychic-caption .avatar {
  width: 40px;
  height: 40px;
}
.board-wrap {
  max-width: min(760px, calc((100dvh - 375px) * 1.65));
  min-width: min(100%, 420px);
  margin: 0 auto;
  text-align: center;
}
.board-wrap .spectrum {
  position: relative;
  z-index: 1;
  margin-top: -14px;
}
.board-wrap .spectrum strong {
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  max-width: 37%;
}
.board-wrap #round-result {
  min-height: 12px;
}
.action-area {
  margin: 25px auto 10px;
  max-width: 650px;
  min-height: 68px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.action-area > .primary,
.action-area > .secondary {
  min-width: 230px;
}
.action-cue > .primary,
.action-cue .clue-form > .primary {
  box-shadow: 0 0 0 4px #f3cb6266;
}
.ready-count {
  font-size: 0.8rem;
  color: #c8d8c7;
}
.clue-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  width: 100%;
  text-align: center;
}
.clue-options {
  grid-column: 1/-1;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.clue-options button {
  font-size: 0.8rem;
  padding: 7px 12px;
}
.private-note {
  font-size: 0.8rem;
  color: #d2ddcc;
  margin: 4px 0;
}
.waiting-action {
  color: #d2ddcc;
  margin: 5px;
}
.writing-done {
  text-align: center;
  max-width: 650px;
  margin: 60px auto;
}
.finished-mark {
  font-size: 5rem;
  color: #ecc365;
}
.writing .play-intro {
  margin-bottom: 8px;
}
.writing .play-intro p {
  margin: 3px;
}
.writing .board-wrap {
  max-width: min(740px, calc((100dvh - 400px) * 1.7));
}
.writing .action-area {
  margin-top: 25px;
}
.reaction-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin: 10px auto 4px;
}
.reaction-button {
  background: transparent;
  color: inherit;
  font-size: 1.7rem;
  width: 48px;
  height: 48px;
  padding: 5px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.reaction-button:hover {
  background: #ffffff15;
  transform: scale(1.12);
}
.more-reactions {
  padding: 8px 12px;
  letter-spacing: 3px;
}
.reaction-button:disabled {
  opacity: 0.3;
}
.all-reactions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 15px;
  place-items: center;
  padding: 10px 0;
}
.sheet .reaction-button:hover {
  background: #d3ddc9;
}
#reactions {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 110;
  overflow: hidden;
}
.live-reaction {
  position: absolute;
  bottom: 15%;
  font-size: 4rem;
  animation: float-reaction 2.6s ease-out both;
  filter: drop-shadow(0 4px 6px #0003);
}
@keyframes float-reaction {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.5);
  }
  15% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-300px) rotate(12deg);
  }
}
.points-award {
  font-size: 3.2rem;
  color: #f1ce6a;
  margin: 14px 0 0;
  animation: award 0.5s ease-out;
}
.points-award small {
  font-size: 1.1rem;
}
.board-wrap #round-result p {
  font-size: 0.9rem;
  margin: 4px 0;
}
.countdown {
  font-size: 3.4rem;
  color: #f1ce6a;
  font-weight: 700;
  line-height: 1;
}
.side-actions {
  display: flex;
  gap: 20px;
}
.side-actions button {
  min-width: 150px;
}
.secondary.selected {
  background: #f3eddd;
  color: #174b4c;
  border-color: #f3eddd;
}
.history-list {
  display: grid;
  gap: 10px;
}
.history-item {
  display: grid;
  grid-template-columns: 30px 1fr 35px;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: #dce4d2;
  color: #173f42;
}
.history-item strong {
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}
.history-item small {
  grid-column: 2/4;
  font-size: 0.85rem;
  font-weight: 400;
}
.history-points {
  text-align: center;
  font-size: 1.5rem !important;
  margin: 30px 0 5px;
}
.history-dial {
  margin-top: 20px;
}
.sheet .spectrum {
  font-size: 1.1rem;
}
.finale {
  text-align: center;
  max-width: 950px;
  margin: auto;
}
.finale h1 {
  font-size: clamp(2.7rem, 4.5vw, 4.5rem);
  margin: 8px 0;
}
.final-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 10px auto -10px;
}
.final-score strong {
  font-size: 4rem;
  color: #f0c967;
  font-weight: 400;
  line-height: 1;
}
.final-score span {
  font-size: 1rem;
}
.finale #final-dial {
  max-width: 620px;
  margin: 0 auto;
}
.finale > .spectrum {
  max-width: 620px;
  margin: -14px auto 22px;
  font-size: 1rem;
}
.round-path {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 25px auto 12px;
}
.round-path button {
  display: grid;
  gap: 4px;
  border-radius: 5px;
  background: #204d4f;
  color: #cfddc8;
  padding: 8px 12px;
  min-width: 52px;
}
.round-path button span {
  font-size: 0.7rem;
}
.round-path button strong {
  font-size: 1.2rem;
}
.round-path button.counted {
  background: #e6bf5e;
  color: #173f42;
}
.finale-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px auto;
}
.final-players {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap;
  margin: 35px auto;
}
.final-players > div {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 150px;
}
.final-players > div > span:last-child {
  font-size: 0.8rem;
  color: #d0ddc8;
}
.final-players strong {
  overflow-wrap: anywhere;
  max-width: 140px;
}
#finale-caption {
  min-height: 25px;
  overflow-wrap: anywhere;
}
.calm .live-reaction {
  animation: none;
  bottom: 25%;
  opacity: 1;
}
.calm .points-award {
  animation: none;
}
@keyframes award {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 1050px) {
  .lobby-heading {
    display: block;
    text-align: center;
  }
  .lobby-heading .room-invite {
    margin: 25px auto;
  }
  .lobby-settings {
    gap: 15px;
    flex-wrap: wrap;
  }
  .board-wrap {
    max-width: min(720px, calc((100dvh - 370px) * 1.7));
  }
  .compact-roster {
    gap: 14px;
  }
  .compact-roster .player {
    min-width: 80px;
  }
  .compact-roster .player strong {
    max-width: 100px;
  }
  .play-intro h1 {
    font-size: 2.5rem;
  }
  .pack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-meta {
    font-size: 0.85rem;
  }
  .table-meta button {
    font-size: 0.8rem;
  }
}
@media (min-width: 701px) and (max-height: 900px) {
  main:has(.play) { padding-top: 10px; padding-bottom: 14px; }
  .play .compact-roster { min-height: 50px; margin: 10px 0; }
  .play .play-intro h1 { font-size: 2.6rem; margin-bottom: 8px; }
  .play .board-wrap,
  .writing .board-wrap { max-width: min(740px, calc((100dvh - 565px) * 1.7)); }
  .play .action-area,
  .writing .action-area { margin-top: 15px; }
  body:has(.play) > footer { padding: 5px; }
}
@media (max-width: 700px) {
  .sheet {
    padding: 20px 18px;
  }
  .sheet-heading h2 {
    font-size: 1.65rem;
  }
  .pack-grid {
    gap: 10px;
  }
  .pack-choice {
    grid-template-columns: 44px 1fr;
    gap: 8px;
    padding: 10px;
    min-height: 105px;
  }
  .pack-choice img,
  .pack-monogram {
    width: 40px;
    height: 60px;
  }
  .pack-choice strong {
    font-size: 0.9rem;
  }
  .avatar-parts {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    max-height: 270px;
  }
  .avatar-tabs {
    gap: 5px;
  }
  .avatar-tabs button {
    font-size: 0.85rem;
    padding: 10px 5px;
  }
  .sheet-actions {
    gap: 10px;
  }
  .lobby-settings {
    align-items: stretch;
  }
  .lobby-settings label {
    width: 100%;
    max-width: 430px;
  }
  .lobby-settings #clue-count-wrap {
    width: calc(50% - 8px);
    max-width: 200px;
  }
  .lobby-settings .pack-summary {
    max-width: 230px;
    flex: 1;
    font-size: 0.85rem;
  }
  .lobby .player-roster {
    gap: 20px;
    margin: 25px 0;
  }
  .lobby .player {
    min-width: 90px;
  }
  .mode-description {
    font-size: 0.9rem;
  }
  .table-meta {
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
  }
  .table-meta button {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 7px 5px;
  }
  .compact-roster {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: auto;
    margin: 12px 0;
    gap: 18px;
    min-height: 72px;
    padding: 0 5px 5px;
    scrollbar-width: thin;
  }
  .compact-roster .player {
    flex-shrink: 0;
    grid-template-columns: 34px auto;
    grid-template-rows: 21px 21px;
    max-width: 165px;
    min-width: 110px;
    column-gap: 7px;
  }
  .compact-roster .avatar {
    width: 34px;
    height: 34px;
  }
  .compact-roster .portrait-button {
    min-height: 44px;
  }
  .compact-roster .player > strong {
    font-size: 0.8rem;
    max-width: 110px;
  }
  .compact-roster .player-state {
    font-size: 0.7rem;
  }
  .play-intro h1 {
    font-size: clamp(1.8rem, 6.5vw, 2.6rem);
    margin: 4px 0 9px;
  }
  .play-intro p {
    font-size: 0.85rem;
    margin: 3px auto 12px;
    padding: 0 7px;
  }
  .psychic-caption {
    font-size: 0.85rem;
  }
  .psychic-caption .avatar {
    width: 34px;
    height: 34px;
  }
  .board-wrap,
  .writing .board-wrap {
    max-width: 630px;
    min-width: 0;
    width: 100%;
    margin-top: 10px;
  }
  .board-wrap .spectrum {
    margin-top: -7px;
    gap: 80px;
    padding: 0 5.5%;
  }
  .board-wrap .spectrum strong {
    font-size: clamp(1rem, 3.5vw, 1.35rem);
    max-width: 39%;
  }
  .action-area,
  .writing .action-area {
    margin: 23px auto 8px;
    min-height: 80px;
    gap: 8px;
  }
  .clue-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .clue-form input {
    font-size: 1rem;
    min-width: 0;
    padding: 12px;
  }
  .clue-form > .primary {
    font-size: 1rem;
    padding: 12px 18px;
  }
  .clue-options {
    gap: 4px;
  }
  .clue-options button {
    font-size: 0.75rem;
    padding: 8px;
  }
  .private-note {
    font-size: 0.75rem;
    margin: 0;
  }
  .reaction-bar {
    gap: 7px;
    margin-top: 15px;
  }
  .reaction-button {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
  }
  .more-reactions {
    padding: 8px;
  }
  .all-reactions {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
  .points-award {
    font-size: 2.7rem;
    margin: 12px 0 0;
  }
  .board-wrap #round-result p {
    font-size: 0.8rem;
  }
  .side-actions {
    gap: 14px;
  }
  .side-actions button {
    min-width: 125px;
  }
  .writing-done {
    margin: 30px auto;
  }
  .writing-done h1 {
    font-size: 2.3rem;
  }
  .writing-done p {
    font-size: 1rem;
  }
  .finale h1 {
    font-size: 2.6rem;
  }
  .final-score strong {
    font-size: 3.4rem;
  }
  .finale > .spectrum {
    font-size: 0.85rem;
    gap: 90px;
  }
  .final-players {
    gap: 20px;
  }
  .final-players > div {
    max-width: 110px;
  }
  .round-path {
    gap: 6px;
  }
  .round-path button {
    min-width: 44px;
    padding: 8px;
  }
  .finale-actions {
    gap: 10px;
  }
  .finale-actions > .primary {
    order: -1;
    width: 100%;
  }
  .finale-actions .text-button {
    font-size: 0.8rem;
  }
  .entry .entry-form > .text-button {
    font-size: 0.8rem;
  }
}
@media (max-width: 380px) {
  .reaction-bar {
    gap: 2px;
  }
  .clue-form {
    grid-template-columns: 1fr;
  }
  .clue-form > .primary {
    width: 100%;
  }
  .clue-options {
    grid-column: 1;
  }
  .table-meta {
    font-size: 0.75rem;
  }
  .table-meta button {
    font-size: 0.7rem;
  }
  .sheet-actions button {
    font-size: 0.9rem;
  }
  .pack-choice {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .pack-choice img,
  .pack-monogram {
    height: 50px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .live-reaction {
    animation: none;
    bottom: 25%;
    opacity: 1;
  }
}
