/* ルーム：受付・マッチング・観戦一覧・接続案内
 * 読み込み順：base.css → 局面を扱う画面では board.css → カテゴリ.css
 * 条件付き指定は直前の通常指定と併せて確認する。ファイル追加は事前承認制。
 */

.roomPage {
  position: relative;
  width: min(1430px, 100% - 160px);
  margin: 0px auto;
  padding: 12px 0px 28px;
}

.roomSidebar {
  padding: 18px 12px;
  background: rgb(247, 250, 243);
}

.sideBrand {
  font-weight: 700;
  font-size: 21px;
  margin-bottom: 28px;
}

.sideBrand span {
  display: block;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--green);
}

.roomSidebar .statusGrid {
  grid-template-columns: 1fr;
  gap: 2px;
  font-size: 12px;
}

.roomSidebar .statusGrid dd {
  margin-bottom: 10px;
  color: rgb(32, 37, 31);
}

.roomSidebar .notice {
  font-size: 12px;
  padding: 8px;
}

.statePanel {
  padding: 24px;
  border: 1px solid var(--control-edge);
  background: linear-gradient(110deg, rgb(243, 252, 241), rgb(243, 252, 241));
  margin-bottom: 12px;
}

.statePanel h2 {
  font-size: 26px;
  margin: 0px 0px 12px;
}

@media (max-width: 1200px) {
  .roomPage {
    width: calc(100% - 24px);
}
}

@media (max-width: 900px) {
  .sideBrand {
    display: none;
}

  .roomSidebar .statusGrid {
    grid-template-columns: 120px minmax(0px, 1fr);
    gap: 4px 12px;
}

  .roomSidebar .statusGrid dd {
    margin: 0px;
}
}

@media (max-width: 600px) {
  .roomPage {
    width: 100%;
    padding: 0px;
}

  .statePanel {
    padding: 18px;
}
}

.roomSidebar {
  order: 0;
  border-right: 1px solid var(--line);
  border-top: 0px;
}

.tallLayout .roomSidebar {
  order: 2;
  border-right: 0px;
  border-top: 1px solid var(--line);
  width: 100%;
}

.hasGame .statePanel {
  padding: 12px;
  margin: 8px 0px 0px;
}

.hasGame .statePanel h2 {
  font-size: 20px;
  margin: 0px;
}

.hasGame .statePanel .eyebrow {
  display: none;
}

.hasGame .statePanel p {
  margin: 4px 0px;
}

.hasGame .statePanel .actions {
  margin-top: 8px;
}

.leaveDialog {
  max-width: min(440px, 100% - 24px);
  border: 1px solid var(--control-edge);
  background: rgb(243, 252, 241);
  color: rgb(32, 37, 31);
  padding: 22px;
}

.leaveDialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.leaveDialog h2 {
  margin: 0px;
  font-size: 22px;
}

.queueDial {
  position: relative;
}

.playing .roomSidebar .statusGrid {
  display: none;
}

body:not(.hasGame) .roomSidebar {
  order: 2;
  border-right: 0px;
  border-top: 1px solid var(--line);
}

.queueRules {
  inset: 24%;
  position: static;
  display: grid;
}

.queueRules > div:last-child {
  border-bottom: 0px;
}

.hasGame .roomSidebar {
  display: none;
}

#queuePanel .eyebrow {
  font-size: 9px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.queueElapsed {
  position: absolute;
  inset: 0px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: rgb(32, 37, 31);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.queueRules {
  flex-direction: column;
  justify-content: center;
  gap: 0px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

#queueMessage {
  margin-right: 0px;
  margin-bottom: 0px;
  margin-left: 0px;
}

#queuePanel {
  text-align: center;
  border: 0px;
  background: linear-gradient(145deg, rgb(243, 252, 241), rgb(243, 252, 241) 65%);
  box-shadow: rgba(82, 99, 75, 0.15) 0px 12px 36px, rgba(82, 99, 75, 0.15) 0px 1px inset;
  border-radius: 8px;
  width: min(200px, 100%);
  padding: 10px;
  margin: 12px auto 18px;
}

#queuePanel h2 {
  font-size: 19px;
  margin-bottom: 4px;
}

.queueDial {
  aspect-ratio: 1 / 1;
  width: 130px;
  margin: 6px auto;
}

.queueRules > div {
  border-bottom: 1px solid rgba(195, 206, 193, 0.125);
  padding: 2px 0px;
}

#queueMessage {
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

.statePanel {
  overflow-wrap: anywhere;
  user-select: none;
}

.formationChoice {
  width: 250px;
  max-width: 100%;
  padding: 12px;
  background: rgb(243, 252, 241);
  border: 1px solid var(--control-edge);
  text-align: center;
  display: block;
  cursor: pointer;
}

.formationChoice strong {
  display: block;
  margin-bottom: 12px;
}

.formationChoice:hover {
  border-color: var(--theme-hover);
}

#formationPick {
  padding: 12px;
}

.roomView .roomPage {
  width: min(100%, 50% + 392px);
  max-width: none;
  padding: 0px 0px 24px;
  z-index: 1;
}

.roomView .statePanel {
  position: relative;
  background: rgb(10, 10, 10);
  color: rgb(221, 221, 221);
  border: 1px solid rgb(85, 85, 85);
  border-radius: 2px;
  box-shadow: rgba(0, 0, 0, 0.8) 0px 0px 10px inset;
}

.roomView .leaveDialog {
  position: fixed;
}

.roomView .statePanel::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-image: none;
  pointer-events: none;
}

.roomView .leaveDialog::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-image: none;
  pointer-events: none;
}

.roomView .statePanel::after {
  border-right: 2px solid rgb(136, 136, 136);
  border-bottom: 2px solid rgb(136, 136, 136);
}

.roomView .leaveDialog::after {
  border-right: 2px solid rgb(136, 136, 136);
  border-bottom: 2px solid rgb(136, 136, 136);
}

.roomView .statePanel::before {
  border-top: 2px solid rgb(136, 136, 136);
  border-left: 2px solid rgb(136, 136, 136);
  top: 0px;
  left: 0px;
  border-right: 0px;
  border-bottom: 0px;
}

.roomView .leaveDialog::before {
  border-width: 2px 0px 0px 2px;
  border-style: solid none none solid;
  border-color: rgb(136, 136, 136) currentcolor currentcolor rgb(136, 136, 136);
  top: 0px;
  left: 0px;
}

.roomView .statePanel::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-image: none;
  pointer-events: none;
  bottom: 0px;
  right: 0px;
  border-left: 0px;
  border-top: 0px;
}

.roomView .leaveDialog::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-image: none;
  pointer-events: none;
  bottom: 0px;
  right: 0px;
  border-left: 0px;
  border-top: 0px;
}

.roomView .formationChoice:hover {
  background: rgba(225, 239, 221, 0.15);
  border-color: var(--theme-hover);
  text-decoration: none;
}

.roomView .leaveDialog::backdrop {
  background: rgba(0, 0, 0, 0.733);
}

#stockGameNote {
  font-size: 12px;
  color: var(--muted);
}

#queueReturn p {
  font-size: 13px;
  color: var(--muted);
}

.roomSponsor {
  margin: 8px 12px;
  padding: 8px 12px;
  border-left: 3px solid var(--control-edge);
  background: rgb(255, 246, 206);
  color: rgb(32, 37, 31);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.roomCredits {
  margin: 24px 0px 0px;
  padding: 16px;
  border-top: 1px solid var(--control-edge);
  font-size: 14px;
  color: rgb(82, 96, 79);
  background: rgba(247, 250, 243, 0.91);
}

.roomView .formationChoice {
  position: relative;
  border: 1px solid var(--control-edge);
}

.roomView #queuePanel::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  border-image: none;
}

.roomView #queuePanel::after {
  border-right: 2px solid var(--control-edge);
  border-bottom: 2px solid var(--control-edge);
}

.roomView .formationChoice::before {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  border-image: none;
}

.roomView .formationChoice::after {
  border-right: 2px solid var(--control-edge);
  border-bottom: 2px solid var(--control-edge);
}

.roomView #queuePanel::before,
.roomView .formationChoice::before {
  border-width: 2px 0px 0px 2px;
  border-style: solid none none solid;
  border-color: var(--control-edge) currentcolor currentcolor var(--control-edge);
  top: 0px;
  left: 0px;
}

.roomView #queuePanel::after,
.roomView .formationChoice::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  border-image: none;
  bottom: 0px;
  right: 0px;
  border-left: 0px;
  border-top: 0px;
}

.roomView .formationChoice:not(:disabled):hover {
  border-color: var(--theme-hover);
  background: var(--control-hover);
}

.roomView .formationChoice:not(:disabled):hover::before,
.roomView .formationChoice:not(:disabled):hover::after {
  border-color: var(--theme-hover);
}

.roomView .queueElapsed {
  font-variant-numeric: tabular-nums;
}

.roomView .leaveDialog {
  border-radius: 2px;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.035), transparent 65%), rgb(243, 252, 241);
  border: 1px solid var(--control-edge);
  box-shadow: rgba(82, 99, 75, 0.15) 0px 8px 24px, rgba(82, 99, 75, 0.15) 0px 1px inset;
  color: rgb(32, 37, 31);
}

.roomView .leaveDialog h2 {
  border-left: 3px solid var(--control-edge);
  padding-left: 10px;
}

.roomView .roomSidebar .statusGrid {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  font-size: 17px;
}

.roomView.hasGame .roomSidebar {
  display: none;
}

.matchModeCards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 360px));
  gap: 4px 16px;
  justify-content: center;
}

.matchModeCard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  max-width: 360px;
  padding: 14px 18px 18px;
  background: var(--hud-surface);
  color: var(--hud-ink);
  border: 1px solid var(--hud-edge);
  cursor: pointer;
}

.matchModeCard strong {
  font-size: 18px;
  line-height: 1.35;
}

.matchModeCard span {
  line-height: 1.7;
}

.matchModeCard:not(:disabled):hover {
  background: var(--hud-hover);
  border-color: var(--theme-hover);
}

.matchModeCard:disabled {
  opacity: 0.5;
  cursor: default;
}

.matchModeCard .matchModeIcon {
  font-size: 48px;
  line-height: 1.1;
  align-self: center;
}

.matchModeCard > strong {
  align-self: center;
  text-align: center;
}

.roomView.tallLayout.hasGame .roomPage {
  width: 100%;
}

.roomView .queueDial {
  border-radius: 50%;
}

body.roomView :is(.centerRoomCard, :where(#formationOpen), .formationSlot, .formationChoice, :where(#queuePanel), .matchModeCard) {
  color: var(--theme-ink);
  background: var(--theme-card);
  border-color: var(--theme-line);
  border-radius: var(--theme-radius);
  box-shadow: var(--theme-shadow);
}

body.roomView .roomSidebar,
body.roomView .roomCredits {
  color: var(--theme-muted);
  background: var(--theme-page);
  border-color: var(--theme-line);
}
body.roomView :is(:where(#queuePanel), :where(#formationPick), :where(#matchModePick)) button:where(:not(.uiAction)){
  color: var(--theme-ink);
  background: var(--theme-card);
  border-color: var(--theme-line);
  border-radius: var(--theme-radius);
  box-shadow: rgba(52, 75, 48, 0.08) 0px 1px 3px;
  text-shadow: none;
}

body.roomView :is(.centerRoomCard > strong, .centerRoomCard .roomRules, .queueRules, .queueElapsed) {
  color: var(--theme-ink);
}

body.roomView .formationChoice:not(:disabled):not(.roomClosed):hover,
body.roomView .matchModeCard:not(:disabled):not(.roomClosed):hover {
  color: var(--theme-ink);
  background: var(--theme-soft);
  text-decoration: none;
}

.roomView #queuePanel {
  position: relative;
}

.roomView .queueDial {
  background: none;
}

.roomView .queueRules > div {
  border-bottom-color: rgba(168, 182, 151, 0.19);
}

.roomView #matchModePick {
  padding-top: 2px;
  padding-bottom: 2px;
  margin-bottom: 0;
  color: var(--theme-ink);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.roomView .roomSponsor {
  color: var(--theme-ink);
  background: rgb(245, 240, 216);
}

body.roomView .matchModeCard {
  background: var(--theme-card);
  border: 2px solid var(--theme-line);
  border-radius: var(--theme-radius);
  box-shadow: var(--theme-shadow);
}

body.roomView #queuePanel {
  border: 2px solid var(--theme-line);
  border-radius: var(--theme-radius);
  box-shadow: var(--theme-shadow);
  margin: 6px auto 9px;
  padding: 5px 10px;
  background: rgb(237, 243, 232);
}

.roomView #queuePanel .eyebrow {
  margin-bottom: 2px;
  line-height: 1.4;
}

.roomView #queuePanel h2 {
  margin-bottom: 2px;
  line-height: 1.35;
}

.roomView #queuePanel .queueDial {
  width: 100px;
  margin: 3px auto;
}

.roomView #queuePanel .queueRules {
  line-height: 16px;
}

.roomView #queuePanel .queueRules > div {
  padding: 1px 0px;
}

.roomView #queuePanel #queueMessage,
.roomView #queuePanel #endMessage,
.roomView #queuePanel #queueReturn p {
  margin: 3px 0px 0px;
  line-height: 1.4;
}

.roomView #queuePanel .actions {
  margin-top: 8px;
}

.roomView .queueRules {
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

.roomView .queueCancel {
  background: rgb(255, 253, 245);
  color: rgb(34, 49, 62);
  border-color: rgb(166, 183, 189);
}

.roomView .queueCancel:hover {
  background: rgb(255, 248, 233);
}

.roomView .matchModePick {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.roomView .roomCredits ul {
  padding-left: 18px;
}

.roomView .roomCredits a {
  color: rgb(23, 57, 87);
  text-decoration: underline rgba(23, 57, 87, 0.376);
  text-underline-offset: 3px;
}

.roomView .roomCredits a:hover {
  color: rgb(23, 57, 87);
  text-decoration-color: var(--theme-hover);
  text-decoration-thickness: 3px;
}

#matchSpeed { grid-column: 1; grid-row: 1; }
#matchRelaxed { grid-column: 2; grid-row: 1; }
#beginnerMatchNotice {
  container-type: inline-size;
  min-width: 0;
  grid-column: 1;
  grid-row: 2;
  text-align: center;
  margin: 0;
  font-weight: 700;
}

#beginnerMatchNotice > span { display: block; white-space: nowrap; font-size: min(12px, 3cqw); }

@media (max-width: 600px) {
  .matchModeCards { grid-template-columns: minmax(0, 360px); }
  #matchRelaxed { grid-column: 1; grid-row: 3; }
  body.roomView .roomPage {
    margin-top: 0px;
    padding-top: 0px;
}
}

body.watchMode .roomSidebar,
body.watchMode #roomSponsor {
  display: none !important;
}

.watchStatus {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0px 8px;
  line-height: 1.5;
}

.watchStatus a {
  font-weight: 700;
  color: rgb(23, 57, 87);
}

.watchGames {
  display: grid;
}

#spectatorCount {
  font-weight: 700;
}

.watchStatus[hidden],
#watchKifu[hidden] {
  display: none !important;
}

body.roomView.watchMode #watchListPanel {
  color: rgb(25, 31, 31);
}

.watchModeLabel {
  display: none;
}

body.watchMode .watchModeLabel {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: rgb(23, 57, 87);
  margin: 10px 0px;
}

body.watchMode #watchListPanel h2 {
  margin: 0px 0px 10px;
}

.watchGameHead {
  font-size: 13px;
  color: rgb(83, 99, 90);
}

.watchSide,
.watchRank,
.watchRate {
  font-size: 12px;
}

.watchEnter {
  color: rgb(33, 101, 78);
}

body.watchMode .watchModeLabel:empty {
  display: none;
}

body.watchMode #watchListPanel {
  padding: 14px 12px;
}

.watchGames {
  gap: 12px;
}

.watchGameHead {
  margin: 0px 0px 9px;
}

.watchName {
  grid-column: 2;
  overflow-wrap: anywhere;
  grid-row: 1;
  font-size: 18px;
}

.watchUser {
  grid-area: 2 / 2;
  font-size: 14px;
  color: rgb(96, 112, 107);
  overflow-wrap: anywhere;
}

.watchStats {
  grid-area: 3 / 1 / auto / -1;
  font-size: 14px;
}

.watchEnter {
  text-align: right;
  font-weight: 700;
  grid-area: 4 / 1 / auto / -1;
  font-size: 13px;
}

.watchVs {
  font-size: 30px;
  font-weight: 800;
  font-style: italic;
  color: rgb(25, 31, 31);
}

@media (max-width: 600px) {
  .watchName {
    font-size: 14px;
}

  .watchUser,
  .watchStats,
  .watchEnter {
    font-size: 11px;
}

  .watchVs {
    font-size: 18px;
}
}

body.roomView :is(.accountGrid dt, .queueRules, .watchGameHead, .watchUser) {
  color: var(--theme-muted);
}

body.roomView .watchEnter {
  color: var(--theme-green);
}

body.roomView.watchMode #watchListPanel {
  border: 0px;
  box-shadow: none;
  border-radius: 0px;
  padding: 4px 0px;
  background: var(--theme-page);
}

body.roomView #watchListPanel::before,
body.roomView #watchListPanel::after {
  content: none;
}

@media (max-width: 900px) {
  body.roomView .roomPage {
    width: 100%;
    margin: 0px;
    padding-left: 0px;
    padding-right: 0px;
}

  body.roomView .roomCredits {
    padding-left: 0px;
    padding-right: 0px;
}
}

body.roomView .matchModeCard.inkInteractive > .inkOutline .inkNormal,
body.roomView .formationChoice.inkInteractive > .inkOutline .inkNormal {
  opacity: 1 !important;
}

body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHot,
body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHalo,
body.roomView .formationChoice.inkInteractive > .inkOutline .inkHot {
  transition: opacity 200ms;
}

body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHot,
body.roomView .formationChoice.inkInteractive > .inkOutline .inkHot {
  fill: var(--theme-hover);
}

body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHalo {
  filter: none;
}

body.roomView .formationChoice.inkInteractive > .inkOutline .inkHalo {
  transition: opacity 200ms;
  filter: none;
}

@media (hover: none) {
  body.roomView .matchModeCard.inkInteractive:not(:active):not(:focus-visible) > .inkOutline .inkHot,
  body.roomView .matchModeCard.inkInteractive:not(:active):not(:focus-visible) > .inkOutline .inkHalo,
  body.roomView .formationChoice.inkInteractive:not(:active):not(:focus-visible) > .inkOutline .inkHot,
  body.roomView .formationChoice.inkInteractive:not(:active):not(:focus-visible) > .inkOutline .inkHalo {
    opacity: 0;
}
}

body.roomView .matchModeCard.inkInteractive:active:not(:disabled) > .inkOutline .inkHot,
body.roomView .formationChoice.inkInteractive:active:not(:disabled) > .inkOutline .inkHot {
  opacity: 1;
}

body.roomView .formationChoice:disabled > .inkOutline .inkHot,
body.roomView .formationChoice:disabled > .inkOutline .inkHalo {
  opacity: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHot,
  body.roomView .matchModeCard.inkInteractive > .inkOutline .inkHalo,
  body.roomView .formationChoice.inkInteractive > .inkOutline .inkHot,
  body.roomView .formationChoice.inkInteractive > .inkOutline .inkHalo {
    transition: none !important;
}
}

body.roomView #formationPick .formationChoice.inkFrame {
  border-color: transparent !important;
}

body.roomView #formationPick {
  padding: 6px 8px;
}

body.roomView #formationPick > h2 {
  margin: 0px 0px 6px;
}

body.roomView #formationPickNotice {
  margin: 4px 0px 8px;
}

body.roomView #formationChoices {
  margin: 8px 0px;
  gap: 10px;
}

body.roomView #formationPick > .backLink {
  margin-top: 4px;
}

body.roomView #leaveDialog {
  background: var(--theme-page);
  color: var(--theme-ink);
  border: 2px solid rgb(147, 164, 140);
  border-radius: 8px;
  padding: 16px;
  box-shadow: rgba(82, 99, 75, 0.15) 0px 8px 24px;
}

body.roomView #leaveDialog::before,
body.roomView #leaveDialog::after {
  content: none;
}

body.roomView #leaveDialog h2 {
  border: 0px;
  padding: 0px;
  color: var(--theme-ink);
  text-shadow: none;
}

body.roomView #leaveDialog button {
  font-style: inherit;
  font-variant: inherit;
  font-stretch: inherit;
  font-size: inherit;
  line-height: inherit;
  font-family: inherit;
  font-optical-sizing: inherit;
  font-size-adjust: inherit;
  font-kerning: inherit;
  font-feature-settings: inherit;
  font-variation-settings: inherit;
  font-language-override: inherit;
  font-weight: 700;
  padding: 8px 12px;
}

@media (max-width: 600px) {
  body.roomView #formationPick {
    padding: 4px 2px;
}

  body.roomView #formationPick > h2,
  body.roomView #formationPickNotice,
  body.roomView #formationPick > .backLink {
    margin-left: 6px;
    margin-right: 6px;
}

  body.roomView #formationChoices {
    margin: 6px 3px;
}

  body.roomView #leaveDialog {
    padding: 12px;
}
}

body.roomView #matchModePick .matchModeCard.inkFrame {
  border-color: transparent !important;
}

body.roomView #leaveDialog :is(#leaveAccept, #leaveCancel):disabled {
  cursor: default;
}

/* === 見出し：通常・条件付き・操作状態をまとめて管理 === */

.roomCredits h2 {
  font-size: 17px;
  margin-top: 16px;
}

body.roomView .roomCredits h2 {
  background: var(--theme-heading);
  color: rgb(255, 253, 243);
  border: 1px solid rgb(50, 121, 93);
  border-radius: 5px 3px 5px 4px;
  box-shadow: rgba(48, 70, 43, 0.133) 0px 1px 1px, rgba(255, 255, 255, 0.125) 0px 1px inset;
  text-shadow: rgba(22, 67, 50, 0.44) 0px 1px 1px;
  font-weight: 800;
}

@media (max-width: 900px) {
  body.roomView .roomCredits h2 {
    margin-left: 0px;
    margin-right: 0px;
    padding: 3px 8px;
    line-height: 1.3;
}
}

@media (max-width: 600px) {
  body.roomView .roomCredits h2 {
    font-size: 16px;
}
}

/* === カード：通常・条件付き・操作状態をまとめて管理 === */

.roomCard {
  border: 1px solid var(--control-edge);
  background: rgba(243, 252, 241, 0.96);
  min-height: 700px;
}

@media (max-width: 600px) {
  .roomCard {
    border-left: 0px;
    border-right: 0px;
    min-height: 100vh;
}
}

.roomView .roomCard {
  position: relative;
  border: 1px solid var(--control-edge);
  min-height: 0px;
}

.roomView .roomCard::after {
  border-right: 2px solid var(--control-edge);
  border-bottom: 2px solid var(--control-edge);
}

.roomView .roomCard::before {
  position: absolute;
  width: 24px;
  height: 24px;
  border-image: none;
  pointer-events: none;
  z-index: 2;
  border-width: 2px 0px 0px 2px;
  border-style: solid none none solid;
  border-color: var(--control-edge) currentcolor currentcolor var(--control-edge);
  top: 0px;
  left: 0px;
}

.roomView .roomCard::after {
  position: absolute;
  width: 24px;
  height: 24px;
  border-image: none;
  pointer-events: none;
  z-index: 2;
  bottom: 0px;
  right: 0px;
  border-left: 0px;
  border-top: 0px;
}

body.roomView :is(.centerCard, .roomCard, .centerRoomCard, .formationSlot, .formationChoice, :where(#queuePanel), :where(#matchModePick))::before,
body.roomView :is(.centerCard, .roomCard, .centerRoomCard, .formationSlot, .formationChoice, :where(#queuePanel), :where(#matchModePick))::after {
  content: none;
}

body.roomView .roomCard {
  background: radial-gradient(#c6bba52b 0.65px, transparent 0.8px) 0 0 / 8px 8px, var(--theme-page);
  border-color: var(--theme-line);
  background-size: 7px 7px;
}

body.roomView .roomCard::before,
body.roomView .roomCard::after,
body.roomView #matchModePick::before,
body.roomView #matchModePick::after {
  content: none !important;
}

.watchGame {
  display: block;
  color: rgb(23, 57, 87);
  overflow-wrap: anywhere;
  border: 1px solid rgb(206, 203, 181);
  border-radius: 5px;
  text-decoration: none;
  line-height: 1.6;
  white-space: normal;
  position: relative;
  padding: 10px;
  background: rgb(255, 253, 246);
}

body.roomView .roomCard {
  box-shadow: rgba(0, 0, 0, 0.133) 0px 2px 12px;
  background-color: var(--theme-page);
  background-image: radial-gradient(rgba(141, 148, 117, 0.063) 0.7px, transparent 0.8px);
}

body.roomView :is(.watchGame, .watchPlayer) {
  background-color: rgb(255, 253, 247);
  background-image: linear-gradient(140deg, rgba(255, 255, 255, 0.44), rgba(228, 234, 223, 0.19));
  color: var(--theme-ink);
}

@media (max-width: 900px) {
  body.roomView .roomCard {
    border-left: 0px;
    border-right: 0px;
    padding-left: 0px;
    padding-right: 0px;
}
}

/* Give the long cancellation label room before shrinking it. */
body.roomView #queueCancel.uiAction {
  width: auto;
  max-width: 100%;
  white-space: nowrap;
}

/* During an interrupted game the notice floats over the unchanged board. */
.roomView .statePanel.reconnectPopup {
  position: fixed; inset: 50% auto auto 50%; transform: translate(-50%,-50%);
  width: min(28rem,calc(100% - 2rem)); box-sizing: border-box; z-index: 100;
  margin: 0; padding: 1rem; background: rgba(255,254,249,.94); color: #182c25;
  border: 2px solid #648c77; border-radius: .5rem; box-shadow: 0 .4rem 1.6rem #15271c40;
}
.roomView .statePanel.reconnectPopup::before,
.roomView .statePanel.reconnectPopup::after {display:none}

/* Locked entry and opponent preferences share one stamp treatment. */
.roomView .matchLock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 1; }
.roomView .matchModeEmblem { position: relative; display: grid; place-items: center; align-self: center; }
.roomView .matchLock .lockStamp { white-space: nowrap; background: #fffdf7d9; }
.roomView .matchLock[hidden] { display: none; }
.roomView .matchUnlockNotice { color: var(--lock-ink); display: block; font-size: 13px; line-height: 1.4; text-align: center; margin-top: 4px; }
.roomView .matchUnlockNotice[hidden] { display: none; }
.roomView .matchModeCard:disabled:has(.matchLock:not([hidden])) { opacity: 1; cursor: not-allowed; }
.roomView .matchModeCard:disabled:has(.matchLock:not([hidden])) > :not(.matchModeEmblem):not(.matchUnlockNotice):not(.inkOutline),
.roomView .matchModeCard:disabled .matchModeEmblem > .matchModeIcon { opacity: .55; }
.roomView .matchPreferencePanel { padding: 2px 6px 8px; text-align: center; }
.roomView .matchPreferencePanel > p { margin: 0 0 3px; font-weight: bold; line-height: 1.25; }
.roomView .matchPreferencePanel > p small { display: inline-block; font-size: .75em; }
.roomView .matchPreferenceControl { --preference-gap: 8px; position: relative; width: min(100%, 354px); margin-inline: auto; }
.roomView .matchPreferenceChoices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--preference-gap); }
body.roomView .matchPreferenceChoices .preferenceChoice { flex-direction: column; min-width: 0; gap: 1px; padding: 6px 2px; font-size: clamp(12px, 3.6vw, 15px); line-height: 1.35; white-space: nowrap; }
.roomView .matchPreferenceChoices small { font-size: .75em; }
.roomView .matchPreferenceControl > .matchLock:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--preference-gap); justify-items: center; }
.roomView .matchPreferenceControl > .matchLock .lockStamp { font-size: 18px; letter-spacing: .5px; padding: 3px 5px; }
.roomView .matchPreferenceControl > .matchLock .lockStamp:last-child { grid-column: 3; }
.roomView .disconnectEnglish { display: block; font-size: .8em; line-height: 1.5; }
.roomView .disconnectElapsed { margin-top: 12px; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.roomView .disconnectElapsed small { display: block; font-size: .8em; }
.roomView :is(.disconnectEnglish,.disconnectElapsed)[hidden] { display: none; }

body.roomView #matchModePick > h2 { margin-bottom: 2px; font-size: 22px; line-height: 1.35; }
body.roomView .matchContent:has(> #matchModePick:not([hidden])) { padding-top: 2px; }
body.roomView:has(#matchModePick:not([hidden])) .roomSponsor { margin-block: 2px; }
body.roomView :is(#queuePanel.uiPaperCard, .matchModeCard.uiPaperCard) {
  background-color: var(--paper-current, var(--paper-tone, #fffdf7));
  background-image: var(--ui-paper-texture);
  color: var(--theme-ink);
  box-shadow: 0 1px 3px #344b3014;
}
@media (hover: hover) and (pointer: fine) {
  body.roomView .matchModeCard.uiPaperCard:hover:not(:disabled) { --paper-current: #fff3df; }
}
body.roomView .matchModeCard.uiPaperCard:active:not(:disabled) { --paper-current: #e7eeda; }
@media (max-width: 600px) {
  .matchModeCards { gap: 4px; }
  body.roomView #matchModePick { padding-inline: 6px; }
  body.roomView #matchModePick > h2 { font-size: 18px; }
  .matchModeCard { padding: 8px 12px 12px; gap: 4px; }
  .matchModeCard > strong { font-size: 16px; }
  .matchModeCard .matchModeIcon { font-size: 40px; }
  .roomView .matchPreferenceControl { --preference-gap: 5px; }
}
.roomView #queuePanel .queueDial {
  background: radial-gradient(circle at 35% 25%, #ffffffed, #e9eee0 56%, #ccd8c6);
  box-shadow: 0 2px 5px #25443725, inset 0 1px 2px #fff, inset 0 -2px 4px #49695126;
}
.roomView .queueClock circle { stroke-linecap: round; }
.roomView .queueElapsed { text-shadow: 0 1px 0 #fff; font-variant-numeric: tabular-nums; }
