.group-button {
  font:
    700 16px Georgia,
    serif;
  padding: 12px 18px;
  border: 2px solid #b8860b;
  border-radius: 6px;
  background: #b8860b;
  color: #110d09;
  cursor: pointer;
  min-height: 44px;
}
.group-button:disabled {
  opacity: 0.5;
  cursor: default;
}
#groupPanel {
  background: #1b1310;
  color: #e8dcc0;
  border: 2px solid #b8860b;
  border-radius: 8px;
  padding: 16px;
  width: min(94%, 420px);
  margin: 20px auto;
  font:
    16px/1.4 system-ui,
    sans-serif;
  box-sizing: border-box;
}
#groupPanel[hidden],
#groupPanel [hidden] {
  display: none !important;
}
#groupPanel h2 {
  font-size: 21px;
  margin: 0 0 8px;
  color: #ffd76a;
}
#groupPanel p {
  font-size: 14px;
  margin: 8px 0;
}
#groupPanel input,
#groupPanel textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  font:
    16px system-ui,
    sans-serif;
  color: #eee;
  background: #100c09;
  border: 1px solid #b8860b;
  border-radius: 4px;
}
#groupPanel textarea {
  min-height: 65px;
  resize: vertical;
}
#groupPanel label {
  display: block;
  margin: 10px 0 5px;
}
#groupPanel button {
  font:
    600 14px system-ui,
    sans-serif;
  min-height: 44px;
  margin: 4px 4px 4px 0;
  padding: 8px 12px;
  cursor: pointer;
}
#groupPanel a {
  color: #ffe271;
  overflow-wrap: anywhere;
}
#groupStatus {
  color: #f2dba4;
  min-height: 20px;
}
#groupMessages {
  height: 230px;
  overflow: auto;
  border-block: 1px solid #614713;
  padding: 8px 0;
  overscroll-behavior: contain;
}
#groupMessages p {
  overflow-wrap: anywhere;
  padding: 4px;
  margin: 0 0 6px;
  text-align: left;
}
#groupMessages strong {
  color: #ffd76a;
}
#groupQR {
  background: white;
  padding: 8px;
  display: inline-block;
  line-height: 0;
  margin: 8px 0;
}
#groupQR svg {
  width: 150px;
  height: 150px;
}
#groupMembers {
  max-height: 160px;
  overflow: auto;
  font-size: 14px;
}
#groupMembers div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
#groupMembers button {
  font-size: 12px;
}
#groupToggle {
  position: fixed;
  right: 12px;
  top: 8px;
  z-index: 40;
}
body.group-guest {
  margin: 0;
  background: #0a0806;
  color: #e8dcc0;
}
body.group-guest #groupPanel {
  max-width: 560px;
  width: 94%;
}
body.group-guest #groupMessages {
  height: 38vh;
}
@media (min-width: 1280px) {
  body.group-open:not(.group-guest) #stage {
    margin-left: calc((100vw - 1240px) / 2);
    margin-right: 340px;
  }
  body:not(.group-guest) #groupPanel {
    position: fixed;
    right: max(12px, calc((100vw - 1240px) / 2));
    top: 62px;
    width: 310px;
    max-height: calc(100vh - 80px);
    overflow: auto;
    margin: 0;
  }
}
#groupToggle {
  font:
    600 14px system-ui,
    sans-serif;
  width: auto;
}
@media (max-width: 1279px) {
  #groupToggle {
    position: static;
    display: block;
    margin: 10px auto;
  }
}
/* Keep the composer and room controls compact without shrinking touch targets. */
#groupPanel details {
  margin: 6px 0;
}
#groupPanel summary {
  cursor: pointer;
  padding: 6px 0;
}
#groupStatus:empty {
  display: none;
}
#groupPanel .groupComposer {
  position: relative;
}
#groupPanel .groupComposer textarea {
  display: block;
  resize: vertical;
  min-height: 100px;
  padding-bottom: 54px;
}
#groupPanel .groupComposer #groupSubmit {
  position: absolute;
  right: 5px;
  bottom: 5px;
  margin: 0;
  min-height: 40px;
  min-width: 72px;
  width: auto;
}
body:not(.group-guest) #groupPanel {
  padding: 12px;
}
#gameToolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 8px auto;
  padding: 0 12px;
}
#gameToolbar .group-button {
  font:
    600 14px system-ui,
    sans-serif;
  padding: 8px 14px;
}
#gameToolbar #groupToggle {
  position: static;
  display: inline-block;
  margin: 0;
}
#displayNotice {
  font:
    13px system-ui,
    sans-serif;
  color: #e8dcc0;
}
html:fullscreen {
  overflow: auto;
  background: #0a0806;
}
html:-webkit-full-screen {
  overflow: auto;
  background: #0a0806;
}
body.game-expanded #gameToolbar {
  max-width: none;
}
body.game-expanded #stage {
  max-width: none;
  width: auto;
  margin: 8px 12px;
  min-height: calc(100dvh - 72px);
}
body.game-expanded #artwrap {
  aspect-ratio: auto;
  height: min(70dvh, calc(100dvh - 180px));
  min-height: 180px;
}
body.game-expanded #artInner img,
body.game-expanded #artInner video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}
@media (min-width: 1000px) {
  body.game-expanded.group-open:not(.group-guest) #stage {
    margin-left: 12px;
    margin-right: 332px;
  }
  body.game-expanded #groupPanel {
    position: fixed;
    right: 12px;
    top: 64px;
    width: 308px;
    max-height: calc(100dvh - 80px);
    overflow: auto;
    margin: 0;
  }
  body.game-expanded #groupMessages {
    height: clamp(160px, 42dvh, 480px);
  }
}
@media (max-width: 999px) {
  body.game-expanded #groupPanel {
    position: static;
    width: calc(100% - 24px);
    max-width: none;
    margin: 12px;
  }
}

/* Keep the opening controls compact without reducing touch targets. */
#gameToolbar button.group-button,
#gameToolbar button {
  position: relative;
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 9px;
  margin: 0;
  font-size: 0;
  border: 1px solid #b98b18;
  border-radius: 50%;
  background: transparent;
  color: #e7c66b;
}
#gameToolbar button::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  background: currentColor;
  mask: var(--control-icon) center/contain no-repeat;
  -webkit-mask: var(--control-icon) center/contain no-repeat;
}
#gameToolbar button:hover,
#gameToolbar button[aria-pressed="true"],
#gameToolbar button[aria-expanded="true"] {
  background: #332712;
  color: #ffdf83;
}
#gameToolbar button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
#gameToolbar #groupToggle {
  font-size: 0;
  width: 44px;
}
#gameToolbar #menuMusicButton {
  width: 44px;
}
body:has(#startScreen.hidden) #gameToolbar #menuMusicButton {
  display: none;
}
#groupToggle {
  --control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M21%2011a9%209%200%200%201-9%209%2010%2010%200%200%201-4-.8L3%2021l1.8-5A9%209%200%201%201%2021%2011Z%22/%3E%3Cpath%20d%3D%22M8%2011h.01M12%2011h.01M16%2011h.01%22/%3E%3C/svg%3E");
}
#menuMusicButton {
  --control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M11%204%206%208H3v8h3l5%204Z%22/%3E%3Cpath%20d%3D%22M15%208a6%206%200%200%201%200%208m3-11a10%2010%200%200%201%200%2014%22/%3E%3C/svg%3E");
}
#fullScreenButton {
  --control-icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M8%203H3v5m13-5h5v5M3%2016v5h5m13-5v5h-5M3%203l6%206m12-6-6%206M3%2021l6-6m12%206-6-6%22/%3E%3C/svg%3E");
}

#topbar {
  flex-wrap: wrap;
  gap: 8px;
}
#topbar #gameToolbar {
  margin: 0 0 0 auto;
  padding: 0;
  max-width: none;
  flex-wrap: nowrap;
  flex-shrink: 0;
  gap: 6px;
}
#topbar #title {
  flex: 1;
  min-width: 140px;
}
#topbar #lives {
  white-space: nowrap;
}
#topbar #displayNotice:empty {
  display: none;
}
#topbar #displayNotice:not(:empty) {
  position: absolute;
  right: 12px;
  top: 60px;
  max-width: 260px;
  padding: 8px;
  background: #100b08;
  z-index: 10;
}
@media (max-width: 600px) {
  #topbar #title {
    flex-basis: calc(100% - 160px);
  }
  #topbar #gameToolbar {
    margin-left: auto;
  }
}
