#hosted-dialog { box-sizing: border-box; width: min(1180px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 20px; border: 1px solid #9a7535; border-radius: 18px; background: #24180f; color: #f5e7cc; overflow: auto; font-family: Georgia, serif; }
#hosted-dialog::backdrop { background: rgb(0 0 0 / 85%); }
#hosted-dialog [hidden] { display: none !important; }
#hosted-dialog * { box-sizing: border-box; }
#hosted-dialog .hosted-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#hosted-dialog h2, #hosted-dialog h3, #hosted-dialog p { margin: 0 0 12px; }
#hosted-dialog h2 { font-size: clamp(20px, 3vw, 30px); color: #f3d496; }
#hosted-dialog button, #hosted-dialog input, #hosted-dialog select { font: inherit; font-size: 16px; min-height: 44px; border-radius: 8px; padding: 10px 14px; max-width: 100%; }
#hosted-dialog button { cursor: pointer; border: 1px solid #b8904e; background: #553b20; color: #fff2d6; touch-action: manipulation; }
#hosted-dialog button:hover:not(:disabled) { background: #725128; }
#hosted-dialog button:disabled { opacity: .5; cursor: default; }
#hosted-dialog :focus-visible { outline: 3px solid #ffd279; outline-offset: 3px; }
#hosted-dialog input, #hosted-dialog select { color: #fff2d6; background: #120d08; border: 1px solid #b8904e; width: 100%; }
#hosted-dialog label { display: block; margin: 8px 0 4px; }
#hosted-lobby { width: min(100%, 640px); margin: 24px auto; line-height: 1.5; }
#hosted-choice, #hosted-invitation { display: grid; gap: 12px; }
#hosted-choice label { margin-bottom: -8px; }
#hosted-lobby-status { margin-top: 20px !important; }
#hosted-privacy, .hosted-muted { color: #c8b99d; font-size: 14px; }
#hosted-network { color: #f7ce83; min-height: 1.3em; font-size: 15px; overflow-wrap: anywhere; }
#hosted-match { display: grid; grid-template-columns: minmax(0, 1fr) 215px; gap: 18px; align-items: start; }
#hosted-game-canvas { display: block; width: 100%; height: auto; max-width: 100%; border-radius: 12px; touch-action: none; }
#hosted-match .hosted-controls { min-width: 0; padding: 14px; border: 1px solid #6b512e; border-radius: 12px; background: #19120c; font-size: 15px; }
#hosted-turn { margin-top: 10px !important; font-size: 21px; }
#hosted-dice-display { display: flex; gap: 10px; margin-bottom: 12px; }
#hosted-dice-display > span { display: grid; place-items: center; border: 1px solid #c3a66d; background: #f3e6cb; color: #25180b; width: 42px; height: 42px; border-radius: 7px; font-size: 25px; font-weight: bold; }
#hosted-confirm { width: 100%; }
#hosted-keyboard { margin-top: 12px; }
#hosted-keyboard summary { cursor: pointer; min-height: 44px; padding: 8px 0; }
#hosted-move { width: 100%; margin-top: 10px; }
#hosted-result { padding: 16px; margin-top: 16px !important; border: 1px solid #b8904e; border-radius: 10px; color: #ffdc95; font-size: 23px; text-align: center; }
#hosted-leave-prompt { border: 1px solid #d4aa66; border-radius: 10px; padding: 16px; margin-top: 12px; }
#hosted-leave-prompt button { margin: 4px; }
@media (max-width: 700px) and (orientation: portrait) {
  #hosted-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); padding: 12px; }
  #hosted-match { grid-template-columns: 1fr; gap: 10px; }
  #hosted-match .hosted-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; }
  #hosted-match .hosted-controls > * { margin: 0 !important; }
  #hosted-hint, #hosted-presence, #hosted-keyboard, #hosted-confirm { grid-column: 1 / -1; }
  #hosted-presence:empty { display: none; }
  #hosted-turn { font-size: 19px; }
  #hosted-lobby { margin-top: 12px; }
}
@media (max-height: 550px) and (orientation: landscape) {
  #hosted-dialog { padding: 10px; width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  #hosted-match { grid-template-columns: minmax(0, 1fr) 190px; }
  #hosted-game-canvas { max-height: calc(100dvh - 118px); width: auto; max-width: 100%; margin: auto; }
  #hosted-hint { display: none; }
}

#start-screen #start-future-modes .start-mode-card[data-availability="available"] { grid-template-columns: 46px minmax(0, 1fr) auto; min-height: 64px; gap: 11px; padding-block: 8px; color: var(--lobby-text, #f5e7cc); }
#start-screen #start-future-modes .start-mode-card[data-availability="available"] .start-mode-badge { color: #f3d496; border-color: #9a7535; }
#start-screen #start-future-modes .start-mode-card[data-availability="available"] .start-mode-icon { width: 42px; height: 42px; }

/* A modal lives in the top layer, outside the body's safe-area padding. */
#hosted-dialog { --hosted-inset-x: max(env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px), 12px); --hosted-inset-y: max(env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px), 12px); width: min(1180px, calc(100vw - 2 * var(--hosted-inset-x))); max-height: calc(100dvh - 2 * var(--hosted-inset-y)); }

#hosted-invitation { min-width: 0; padding: 18px; border: 1px solid #9a7535; border-radius: 12px; background: #19120c; }
#hosted-invitation h3, #hosted-invitation p { margin: 0; }
#hosted-invitation h3 { font-size: 21px; color: #f3d496; }
.hosted-copy-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
#hosted-invite-link { min-width: 0; font-size: 14px; }
#hosted-copy-status { color: #f3d496; }
#hosted-copy-status:empty, #hosted-lobby-status:empty { display: none; }
#hosted-lobby-status { padding: 16px; border-left: 3px solid #d3ad62; background: #19120c; font-size: 20px; font-weight: bold; overflow-wrap: anywhere; }
#hosted-dialog #hosted-close { background: transparent; border-color: #6b512e; color: #d9c7aa; }
#hosted-dialog #hosted-close:hover { background: #392718; }
@media (max-width: 540px) {
  .hosted-copy-row { grid-template-columns: minmax(0, 1fr); }
  #hosted-invitation { padding: 12px; }
}
