/* The home is a viewport-sized launch surface. Only overlay content scrolls. */
:root {
  --nav-height: 76px;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  min-height: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
.topbar {
  width: calc(100% - 24px);
  max-width: none;
  height: var(--nav-height);
  min-height: var(--nav-height);
  flex-shrink: 0;
  padding: 8px 24px;
  position: relative;
  z-index: 1100;
}
main {
  width: calc(100% - 40px);
  max-width: 1760px;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 0 20px;
}
.headline {
  flex: 0 0 auto;
  margin: 0 0 18px;
}
.headline h1 {
  font-size: clamp(26px, 3.2vw, 52px);
}
.headline p {
  font-size: clamp(14px, 1.3vw, 20px);
}
.stage {
  flex: 1;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.stage .panel {
  min-height: 0;
  min-width: 0;
  padding: clamp(16px, 2vw, 30px);
  mask-image: none;
  -webkit-mask-image: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stage .panel::after {
  display: none;
}
.stage .panel h2 {
  font-size: clamp(19px, 1.9vw, 30px);
  gap: 10px;
  margin: 0;
}
.stage .panel > p {
  margin: 8px 0;
  font-size: 15px;
}
.stage .panel > button {
  margin: auto auto 0;
  width: min(320px, 100%);
  min-height: 52px;
  justify-content: center;
}
.stage .panel-title-row {
  flex-shrink: 0;
  gap: 8px;
}
.stage .panel-link {
  margin: 0;
  padding: 8px;
  min-height: 40px;
  font-size: 13px;
}
.stage .roulette {
  grid-area: 1 / 2 / 3 / 3;
  width: 100%;
  max-height: 100%;
  align-self: center;
  margin: 0;
}
.stage .create-panel {
  grid-area: 1 / 1;
}
.stage .join-panel {
  grid-area: 1 / 3;
}
.stage .collection-panel {
  grid-area: 2 / 1;
}
.stage .social-panel {
  grid-area: 2 / 3;
}
.stage .games {
  min-height: 0;
  flex: 1;
  align-items: stretch;
  margin-top: 8px;
}
.stage .game {
  display: flex;
  flex-direction: column;
}
.stage .game-art {
  min-height: 0;
  flex: 1;
  aspect-ratio: auto;
  background-size: auto 200%;
}
.stage .game strong {
  min-height: 0;
  padding: 8px;
  font-size: 14px;
}
.stage .game small {
  padding: 0 8px 8px;
}
#social-body {
  min-height: 0;
  overflow: hidden;
  margin-top: 12px;
}
#social-body .friend-list {
  margin: 8px 0;
}
#social-body .friend-row {
  padding: 5px 0;
}
#social-body .friend-id {
  font-size: 13px;
}
#notice[popover] {
  position: fixed;
  inset: auto 20px 20px auto;
  margin: 0;
  max-width: min(580px, calc(100vw - 40px));
  padding: 18px 24px;
  box-shadow: 0 12px 50px #0008;
}
dialog::backdrop {
  background: #03121ccb;
  backdrop-filter: blur(5px);
}
dialog.section-overlay,
#account-dialog.section-overlay {
  position: fixed;
  inset: calc(var(--nav-height) + 8px) 12px 12px;
  margin: 0;
  width: calc(100vw - 24px);
  max-width: none;
  height: calc(100dvh - var(--nav-height) - 20px);
  max-height: none;
  padding: clamp(18px, 2.3vw, 40px);
  border: 1px solid #b48c58;
  border-radius: 22px;
  background: linear-gradient(125deg, #123442, #091e2a 85%);
  color: var(--ink);
  overflow: hidden;
  z-index: 900;
}
dialog.section-overlay[open] {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.overlay-heading,
.account-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 18px;
}
.overlay-heading h2 {
  display: flex;
  align-items: center;
  gap: 20px;
}
.overlay-heading h2,
.section-overlay .account-heading h2 {
  font-size: clamp(28px, 3vw, 48px);
}
.overlay-heading svg {
  width: 1.1em;
  height: 1.1em;
  color: var(--teal);
}
.overlay-close {
  font-size: 30px;
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
}
.overlay-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.surface {
  border: 1px solid var(--line);
  background: #071d2866;
  border-radius: 18px;
  padding: clamp(18px, 2vw, 30px);
}
.surface h3 {
  font-size: clamp(22px, 2vw, 30px);
  margin: 0 0 18px;
}
.surface p {
  line-height: 1.6;
}
.empty-state {
  padding: 30px 12px;
  color: var(--muted);
  line-height: 1.6;
}
.hint {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}
.join-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
}
.join-entry #join-form {
  width: 100%;
  max-width: none;
  margin: 24px 0;
}
.join-entry #join-form label {
  display: block;
}
.join-entry #join-form button {
  width: auto;
  min-width: 200px;
  margin-left: auto;
  justify-content: center;
}
.join-entry .input-shell {
  height: 64px;
}
.join-entry .hint {
  margin-top: 28px;
}
.collection-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.collection-toolbar input {
  flex: 1;
}
.collection-toolbar button {
  flex-shrink: 0;
}
[aria-pressed='true'].quiet,
.catalog-card[aria-pressed='true'] {
  border-color: var(--amber);
  background-color: #294550;
}
.collection-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: 30px;
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-content: start;
}
.catalog-card {
  display: block;
  text-align: left;
  padding: 0;
  border-width: 2px;
}
.catalog-card .game-art {
  aspect-ratio: 0.9;
}
.catalog-card strong {
  font-size: 22px;
  padding: 16px 14px 8px;
}
.catalog-card small {
  padding: 0 14px 18px;
}
.game-detail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}
.game-detail .game-art {
  aspect-ratio: 1.7;
  border-radius: 12px;
}
.game-detail h3 {
  margin: 0;
}
.game-detail button {
  justify-content: center;
}
#room-section {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
#room-section > h2,
#room-section > p {
  display: none;
}
#room-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.lobby-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 30px;
}
.lobby-art {
  height: clamp(120px, 23vh, 290px);
  border-radius: 12px;
  background: url('/assets/create-art.png') center / cover;
  margin-bottom: 22px;
}
.lobby-overview h3 {
  margin-top: 20px;
}
.lobby-overview .hint {
  margin-top: 20px;
}
.lobby-members {
  padding: 18px;
}
.lobby-members > p {
  font-size: 24px;
  font-weight: 700;
}
.lobby-members .members {
  margin: 18px 0;
  padding: 0;
}
.lobby-members .members li {
  padding: 18px 0;
  flex-wrap: wrap;
  gap: 12px;
}
.lobby-members .member-avatar {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
}
.room-actions {
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.room-actions button:last-child {
  margin-left: auto;
  color: #ff9a8e;
}
.create-overlay #create-room-form {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  min-height: 0;
  overflow: auto;
}
.create-overlay #create-room-form::before {
  content: '';
  grid-area: 2 / 1 / 5 / 2;
  min-height: 250px;
  border-radius: 18px;
  background: url('/assets/create-art.png') center / cover;
}
.create-overlay h2 {
  grid-column: 1 / -1;
  font-size: clamp(28px, 3vw, 48px);
  margin-bottom: 16px;
}
.create-overlay label,
.create-overlay select,
.create-overlay .hint {
  grid-column: 2;
  margin: 0;
}
.create-overlay select {
  height: 56px;
}
.create-overlay .dialog-actions {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
#account-dialog[data-screen='friends'] > .account-tabs {
  display: none;
}
#account-dialog.section-overlay .account-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  gap: 18px;
}
.friends-workspace {
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(0, 1.35fr) minmax(
      230px,
      0.9fr
    );
  gap: 24px;
  flex: 1;
  min-height: 0;
}
#friend-navigation {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#friend-navigation button {
  justify-content: space-between;
  text-align: left;
}
.count-badge {
  color: var(--teal);
}
.friend-center {
  min-height: 0;
  overflow: auto;
}
.friend-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 20px;
}
.friend-search label {
  grid-column: 1 / -1;
}
.account-body .friend-search > button[type='submit'] {
  margin: 0;
  width: auto;
}
.friend-select {
  width: 100%;
  margin: 10px 0;
  padding: 10px 16px;
  text-align: left;
}
.friend-select .friend-row {
  border: 0;
  padding: 0;
}
.friend-detail {
  overflow: auto;
  text-align: center;
}
.friend-detail > .friend-row {
  flex-direction: column;
  gap: 24px;
  border: 0;
}
.friend-detail .friend-identity {
  flex-direction: column;
}
.friend-detail .account-avatar {
  width: 130px;
  height: 130px;
  flex-basis: 130px;
}
.friend-detail strong {
  font-size: 26px;
}
.friend-detail .friend-actions {
  flex-direction: column;
  width: 100%;
}
.friend-detail button {
  width: 100%;
  justify-content: center;
}
.friends-footer {
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 14px;
}
.wheel-popup {
  width: min(650px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 1px solid #b48c58;
  background: #102b3a;
}
.wheel-popup .wheel-result {
  border: 0;
  padding: 0;
  margin: 12px 0 24px;
  background: none;
}
.wheel-popup .wheel-result strong {
  font-size: 30px;
}
@media (max-height: 760px) and (min-width: 851px) {
  :root {
    --nav-height: 64px;
  }
  main {
    padding-top: 10px;
  }
  .headline {
    margin-bottom: 12px;
  }
  .headline h1 {
    font-size: 32px;
  }
  .headline::after {
    display: none;
  }
  .stage {
    gap: 12px;
  }
  .stage .panel {
    padding: 16px;
  }
  .stage .panel h2 {
    font-size: 21px;
  }
  .stage .panel > p {
    margin: 6px 0;
  }
  .stage .game-art {
    max-height: 15vh;
  }
  #social-body .friend-list .friend-row:nth-child(n + 2) {
    display: none;
  }
  .lobby-art {
    height: 140px;
  }
}
@media (max-width: 850px) {
  :root {
    --nav-height: 64px;
  }
  .topbar {
    width: 100%;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 0;
  }
  .topbar .brand {
    font-size: 18px;
    margin: 0;
  }
  .topbar .brand img {
    width: 34px;
    height: 34px;
  }
  .topbar nav {
    gap: 12px;
  }
  .topbar nav a span {
    display: none;
  }
  .topbar nav a {
    display: flex;
    padding: 6px;
  }
  .topbar nav svg {
    width: 26px;
    height: 26px;
  }
  .utilities {
    gap: 4px;
  }
  #account-open {
    padding: 4px;
    min-height: 40px;
  }
  #account-open span:not(.header-avatar) {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  main {
    width: calc(100% - 24px);
    padding: 10px 0 12px;
  }
  .headline {
    margin-bottom: 12px;
  }
  .headline h1 {
    font-size: clamp(22px, 4vw, 32px);
    letter-spacing: -0.5px;
  }
  .headline p {
    font-size: 13px;
    margin-top: 4px;
  }
  .headline::after {
    display: none;
  }
  .stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
  .stage .roulette {
    grid-area: 1 / 1 / 2 / 3;
    width: auto;
    height: 100%;
    aspect-ratio: 1;
    justify-self: center;
    margin: 0;
  }
  .stage .create-panel {
    grid-area: 2 / 1;
  }
  .stage .join-panel {
    grid-area: 2 / 2;
  }
  .stage .collection-panel {
    grid-area: 3 / 1;
  }
  .stage .social-panel {
    grid-area: 3 / 2;
  }
  .stage .panel {
    padding: 12px;
  }
  .stage .panel h2 {
    font-size: 17px;
    gap: 6px;
  }
  .stage .panel > p {
    font-size: 12px;
    margin: 6px 0;
  }
  .stage .panel > button {
    min-height: 40px;
    padding: 8px;
    font-size: 14px;
    width: 100%;
  }
  .stage .panel-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .stage .panel-link {
    padding: 4px 0;
    min-height: 32px;
  }
  .stage .games {
    display: none;
  }
  .stage .collection-panel {
    background:
      linear-gradient(#071e2bbf, #071e2bee),
      url('/assets/hub-art-atlas.png') left top / cover;
  }
  #social-body {
    margin: 2px 0;
    font-size: 12px;
  }
  #social-body .friend-id,
  #social-body .friend-list,
  #social-body button {
    display: none;
  }
  dialog.section-overlay,
  #account-dialog.section-overlay {
    inset: var(--nav-height) 0 0;
    width: 100vw;
    height: calc(100dvh - var(--nav-height));
    border-radius: 0;
    padding: 18px;
  }
  dialog.section-overlay[open] {
    gap: 16px;
  }
  .overlay-heading h2,
  .section-overlay .account-heading h2 {
    font-size: 28px;
    gap: 10px;
  }
  .join-workspace,
  .lobby-workspace,
  .collection-workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .join-entry {
    order: -1;
  }
  .collection-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .collection-toolbar input {
    flex-basis: 100%;
  }
  .collection-toolbar button {
    font-size: 13px;
    padding: 8px 12px;
  }
  .catalog-grid {
    gap: 10px;
  }
  .catalog-card strong {
    font-size: 15px;
    padding: 8px;
  }
  .catalog-card small {
    padding: 0 8px 8px;
  }
  .game-detail .game-art {
    max-height: 180px;
  }
  .friends-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  #friend-navigation {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  #friend-navigation button {
    font-size: 13px;
    padding: 8px 12px;
    gap: 10px;
  }
  .friend-center,
  .friend-detail {
    overflow: visible;
  }
  .friend-detail .account-avatar {
    width: 80px;
    height: 80px;
    flex-basis: 80px;
  }
  .create-overlay #create-room-form {
    display: flex;
    flex-direction: column;
  }
  .create-overlay #create-room-form::before {
    display: none;
  }
}
@media (max-width: 420px) {
  .topbar .brand {
    gap: 0;
  }
  .topbar .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .topbar nav {
    gap: 4px;
  }
  #account-open span:not(.header-avatar) {
    display: none;
  }
  .stage .panel h2 {
    font-size: 15px;
  }
  .stage .panel h2 svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
}
@media (max-height: 570px) {
  .headline {
    display: none;
  }
  .stage .panel > p,
  #social-body .friend-list,
  .stage .game small {
    display: none;
  }
  .stage .panel h2 {
    font-size: 16px;
  }
  .stage .panel {
    padding: 10px;
  }
  .stage .panel > button {
    min-height: 36px;
    padding: 6px;
  }
}

.game-art,
.stage .game-art {
  background-size: 400% 200%;
}
.stage .collection-panel .panel-link {
  background: transparent;
}
.section-overlay::backdrop {
  top: var(--nav-height);
}
.collection-workspace .game-detail .game-art {
  max-height: 22vh;
  flex-shrink: 0;
}
.section-overlay .account-heading h2 {
  display: flex;
  gap: 16px;
  align-items: center;
}
.section-overlay .account-heading h2 svg {
  color: var(--teal);
  width: 1.1em;
  height: 1.1em;
}

#lobby-dialog .overlay-body {
  overflow: hidden;
  display: flex;
}
#room-section {
  flex: 1;
  min-width: 0;
  height: 100%;
}
#room-body {
  height: 100%;
}
.lobby-workspace {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.room-actions {
  flex-shrink: 0;
}
#collection-dialog .overlay-body {
  display: flex;
  flex-direction: column;
}
.collection-toolbar {
  flex-shrink: 0;
}
.collection-workspace {
  min-height: 0;
  flex: 1;
  overflow: auto;
}
.create-overlay > .overlay-close {
  position: absolute;
  top: 24px;
  right: 24px;
}
.create-overlay h2 {
  padding-right: 60px;
}
@media (max-width: 850px) {
  .room-actions {
    gap: 6px;
  }
  .room-actions button {
    padding: 8px 10px;
    min-height: 40px;
    font-size: 12px;
  }
}

[hidden] {
  display: none !important;
}
.join-preview {
  margin: 24px 0;
}
.preview-members {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 22px 0;
}
#confirm-join {
  margin-left: auto;
  justify-content: center;
}

.lobby-overview .lobby-art {
  height: min(18vh, 200px);
  margin-bottom: 12px;
}
.lobby-overview h3 {
  font-size: 24px;
  margin: 12px 0;
}
.lobby-overview p {
  line-height: 1.5;
  font-size: 15px;
}
.lobby-overview .code-label {
  display: block;
  margin-top: 18px;
  color: var(--muted);
}
.lobby-overview .room-code {
  margin-top: 8px;
  font-size: 20px;
  color: var(--amber);
}
.sharing-help {
  margin-top: 18px;
}
.sharing-help summary {
  color: var(--muted);
  cursor: pointer;
}
.friend-select {
  justify-content: flex-start;
}
.friend-select .friend-row {
  width: 100%;
}

.join-footer {
  flex-shrink: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

#lobby-dialog #drawing-launch-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: auto;
  max-width: 310px;
  min-height: 60px;
  padding: 7px 12px 7px 25px;
  margin: 0 auto;
  border: 1px solid #ffd099;
  border-radius: 999px;
  background: linear-gradient(145deg, #ffd59a, #ef9a57);
  color: #233a3d;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 #fff5d5,
    0 5px 15px #0004;
}
#lobby-dialog .drawing-launch-number {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  font-size: 23px;
  color: #ffe2b0;
  background:
    radial-gradient(closest-side, #1c3c43 83%, transparent 87%),
    conic-gradient(#244b50 var(--remaining), #c17948 0);
}
#lobby-dialog .room-actions:has(.drawing-launch-area) {
  flex-wrap: wrap;
}
#lobby-dialog .drawing-launch-area {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#lobby-dialog .drawing-cancel-launch {
  color: #ffe0b4;
  border-color: #9b805e;
  background: #102f3b;
  position: absolute;
  left: calc(50% + 165px);
}
#lobby-dialog #drawing-launch-countdown {
  padding: 8px 24px;
  cursor: pointer;
}
#lobby-dialog #drawing-launch-countdown:disabled {
  cursor: default;
}
#lobby-dialog #drawing-launch-countdown:disabled:not(:has(strong)) {
  opacity: 0.5;
}
#lobby-dialog #drawing-launch-countdown:has(strong) {
  opacity: 1;
}
@media (max-width: 620px) {
  #lobby-dialog .drawing-launch-area {
    flex-wrap: wrap;
    gap: 8px;
  }
  #lobby-dialog .drawing-cancel-launch {
    position: static;
  }
}
