/* Mobile layouts shared by the lobby, directories, dialogs, and debate room. */
@media (max-width: 780px) {
  html { -webkit-text-size-adjust: 100%; }
  body { min-width: 0; }
  header, .guest-view header {
    height: auto; min-height: 0; padding: 12px 16px; gap: 10px;
    flex-direction: column; align-items: stretch;
  }
  header .brand { align-self: flex-start; min-width: 0; gap: 8px; font-size: 25px; letter-spacing: -.8px; }
  header .brand img { width: 56px; height: 40px; }
  header .header-label, header #connection { display: none; }
  header .header-right, .guest-view .header-right {
    display: flex; width: 100%; min-width: 0; margin: 0; gap: 8px;
  }
  header .header-right > button { min-width: 0; min-height: 44px; }
  header #account-button, .guest-view header #account-button,
  header #invitations-button, header #register-button {
    flex: 1 1 0; max-width: none; padding: 11px 10px; font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  header #copy { flex: 0 0 44px; padding: 10px; font-size: 0; }
  header #copy::after { content: '↗'; font-size: 19px; }
  input, textarea, select, #auth-club, .profile-fields select, #audio-input { font-size: 16px; min-width: 0; max-width: 100%; }
  input, select { min-height: 46px; }
  label { font-size: 13px; }
  input[type=datetime-local] { width: 100%; min-width: 0; }
  .lobby { min-height: 0; margin: 0 auto; padding: 24px 16px 40px; align-items: flex-start; }
  .entry-options, .create-card { width: min(100%, 440px); max-width: 100%; margin: 0; }
  .entry-options { gap: 12px; }
  .entry-option { min-height: 76px; padding: 22px 18px; font-size: 19px; line-height: 1.4; }
  .create-card { padding: 22px; border-radius: 18px; }
  .create-card h2 { font-size: 23px; line-height: 1.3; margin: 16px 0 24px; }
  .create-card small { font-size: 12px; line-height: 1.5; }
  #entry-profile-note { margin-bottom: 18px; }
  .create-card .primary { min-height: 48px; justify-content: center; gap: 10px; }
  #join-code { font-size: 20px; letter-spacing: 3px; }
  #join-code::placeholder { font-size: 14px; }
  .directory-page { width: 100%; padding: 22px 16px 36px; }
  .page-breadcrumb { margin-bottom: 18px; }
  .profile-overview, .profile-section, .club-overview { padding: 20px; margin-bottom: 18px; border-radius: 18px; min-width: 0; }
  .directory-page h1 { font-size: 27px; }
  .directory-page h2 { font-size: 19px; line-height: 1.35; }
  .profile-overview .profile-hero { display: grid; grid-template-columns: 88px minmax(0,1fr); gap: 16px; position: relative; padding-top: 0; }
  .profile-overview .profile-avatar-preview { width: 88px; height: 88px; }
  .profile-overview .profile-avatar-preview > .profile-avatar { font-size: 28px; }
  .profile-overview .profile-identity { min-width: 0; padding-right: 0; align-self: center; }
  .profile-overview .profile-identity h1 { font-size: 25px; line-height: 1.2; }
  .profile-overview:has(#profile-actions:not([hidden])) .profile-hero { padding-top: 48px; }
  .profile-actions { display: contents; }
  .profile-actions .pencil-button { width: 40px; height: 40px; position: absolute; top: 0; right: 0; }
  .profile-actions .logout-button { grid-column: 1/-1; justify-self: end; margin: 0; min-height: 44px; padding: 10px 12px; }
  .profile-identity .club-link { font-size: 14px; flex-wrap: wrap; gap: 7px; }
  .profile-identity .telegram-link { margin-top: 14px; width: 36px; height: 36px; }
  .profile-identity .club-role-badge { max-width: 100%; font-size: 10px; }
  .club-speakers-row { gap: 8px; margin-bottom: 18px; }
  .club-speakers-panel { margin: 0; padding: 18px; }
  #profile-club-speakers .speaker-card { width: 100%; flex-basis: 100%; padding: 12px; }
  .club-open-button { width: 40px; border-radius: 12px; }
  .speaker-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .speaker-card { padding: 12px; gap: 10px; }
  .speaker-card > div { min-width: 0; }
  .speaker-card .profile-avatar { width: 40px; height: 40px; }
  .club-member-remove { width: 40px; }
  .club-title-row { gap: 14px; }
  .club-title-row img { width: 64px; height: 64px; }
  .club-details { gap: 18px 28px; }
  .club-details dd { overflow-wrap: anywhere; }
  .game-card, .game-card-main, .game-card-top, .archive-team { min-width: 0; }
  .game-card { padding: 16px; }
  .game-card-top { flex-direction: column; gap: 10px; }
  .game-card-top strong, .game-creator, .game-info, .archive-person, .team-registration-row { overflow-wrap: anywhere; }
  .game-card-top strong { font-size: 16px; }
  .room-list-item { gap: 8px; }
  .room-remove-button { width: 40px; }
  .activity-row { grid-template-columns: minmax(0,1fr) 64px 64px; gap: 8px; }
  .activity-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
  dialog, .account-dialog, .game-dialog, .profile-edit-dialog {
    width: calc(100% - 24px); max-width: 540px; max-height: calc(100dvh - 24px);
    padding: 24px 18px; margin: auto; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 18px;
  }
  dialog h2 { font-size: 23px; line-height: 1.3; padding-right: 24px; overflow-wrap: anywhere; }
  .dialog-close { width: 44px; height: 44px; top: 6px; right: 6px; padding: 4px; }
  .profile-fields, .archive-roster { grid-template-columns: minmax(0,1fr); }
  .dialog-actions, .registration-actions { flex-wrap: wrap; gap: 8px; }
  .dialog-actions > button, .registration-actions > button { flex: 1 1 130px; min-height: 44px; padding: 12px; white-space: normal; }
  #auth-submit, #auth-mode, #profile-save, #game-room-link { min-height: 46px; }
  .game-registration-section { padding: 16px; border-radius: 14px; }
  .game-registration-heading { flex-direction: column; align-items: stretch; gap: 16px; }
  .game-registration-heading .registration-actions { width: 100%; }
  .game-registration-heading h3 { font-size: 16px; }
  .team-registration-row { padding: 14px; }
  .game-room-link { display: block; text-align: center; }
  .partner-result { min-height: 48px; }
  .partner-result span { overflow-wrap: anywhere; min-width: 0; }
  #room { padding: 24px 16px calc(190px + env(safe-area-inset-bottom)); }
  .room-heading { gap: 14px; margin-bottom: 18px; }
  .room-title-block { flex-basis: 100%; }
  .room-heading h1 { font-size: 25px; line-height: 1.2; }
  .room-heading .eyebrow { line-height: 1.6; }
  .room-heading-tools { gap: 8px; flex-wrap: wrap; }
  .room-side-actions { gap: 8px; margin-left: auto; }
  .room-options summary { width: 44px; height: 44px; }
  .room-options-menu { min-width: 210px; max-width: calc(100vw - 32px); }
  .room-options-menu button { min-height: 44px; }
  #copy-code { min-height: 44px; }
  .room-side-actions > .primary { max-width: 180px; white-space: normal; }
  .motion { padding: 16px; }
  .motion-top { gap: 10px; flex-wrap: wrap; }
  .motion-top > div { display: flex; flex-wrap: wrap; gap: 6px; }
  .motion h2 { font-size: 18px; overflow-wrap: anywhere; }
  #info { overflow-wrap: anywhere; }
  .round-flow { flex-direction: column; align-items: stretch; }
  .round-flow > div { flex-direction: column; }
  .round-flow button { min-height: 44px; }
  .timer-panel { max-width: 350px; min-width: 0; padding: 16px 4px 22px; }
  .timer-panel select { width: 100%; max-width: 100%; font-size: 14px; white-space: normal; }
  .timer-circle { width: 224px; height: 224px; }
  #time { font-size: 57px; }
  #phase { font-size: 9px; }
  .durations button { min-height: 40px; font-size: 13px; }
  .timer-controls button, .poi { min-height: 46px; }
  .timer-controls .primary, .poi { font-size: 14px; }
  .sound-toggle, .complete-speech { min-height: 44px; }
  .timer-panel .poi-countdown strong { font-size: 76px !important; }
  .team { padding: 18px; min-width: 0; min-height: 0; }
  .team-title { margin-bottom: 14px; }
  .team-title h3 { font-size: 17px; }
  .seat { flex-wrap: nowrap; gap: 10px; margin-top: 16px; min-height: 44px; }
  .seat-copy b { max-width: none; font-size: 13px; }
  .seat-copy small { font-size: 11px; line-height: 1.4; }
  .seat button { min-height: 40px; padding: 9px; font-size: 12px; }
  .prep-entry { min-height: 44px; font-size: 12px; }
  .judge-card { padding: 16px; gap: 12px; }
  .judge-copy { min-width: 0; }
  .judge-actions { padding-left: 0; }
  .judge-actions button, #judge-select { min-height: 44px; font-size: 14px; }
  .judge-actions label { font-size: 12px; }
  .prep-room, .team-chat { padding: 18px; border-radius: 18px; }
  .prep-heading { flex-wrap: wrap; }
  .prep-members { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .prep-person { padding: 16px; }
  .team-message { max-width: 95%; }
  .team-chat-form { flex-direction: column; align-items: stretch; gap: 10px; }
  .team-chat-form button { min-height: 46px; }
  .people { gap: 12px; }
  .person { max-width: 100%; overflow-wrap: anywhere; font-size: 12px; }
  .call-summary { padding: 16px; }
  .call-summary > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
  .call-summary button { min-height: 44px; }
  .dock { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
  .dock .me { min-width: 0; }
  .dock .me > div { min-width: 0; }
  .dock .me b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dock .leave { min-height: 40px; padding: 8px; }
  .dock-controls { grid-column: 1/-1; display: flex; gap: 6px; width: 100%; min-width: 0; }
  .dock-controls button { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 9px 5px; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
  #toast { bottom: calc(155px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); }
  .question-notice { top: 16px; z-index: 40; }
}
@media (max-width: 520px) {
  .speaker-grid { grid-template-columns: minmax(0,1fr); }
  .arena { grid-template-columns: minmax(0,1fr); grid-template-rows: auto; gap: 12px; }
  .timer-panel { grid-area: auto; order: -1; }
  #team-0, #team-1, #team-2, #team-3 { grid-area: auto; }
  .arena-top { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 360px) {
  header, .guest-view header { padding-left: 12px; padding-right: 12px; }
  header .brand { font-size: 23px; }
  .directory-page, #room { padding-left: 12px; padding-right: 12px; }
  .profile-overview, .profile-section, .club-overview { padding: 16px; }
  .profile-overview .profile-hero { grid-template-columns: 72px minmax(0,1fr); gap: 12px; }
  .profile-overview .profile-avatar-preview { width: 72px; height: 72px; }
  .profile-overview .profile-identity h1 { font-size: 23px; }
  .activity-row { grid-template-columns: minmax(0,1fr) 54px 54px; }
  .create-card { padding: 20px; }
}

@media(max-width:780px){.room-help{padding:18px;margin-bottom:18px}.room-help-steps{grid-template-columns:minmax(0,1fr);gap:20px}.room-help-heading{align-items:flex-start}.room-help-heading h2{font-size:18px;line-height:1.4}.room-help p{font-size:13px}.room-help .secondary{min-height:44px}#toast[popover]{bottom:calc(155px + env(safe-area-inset-bottom));max-width:calc(100vw - 32px);width:max-content}.room-help-steps>section{gap:10px}}

@media(max-width:780px){header #copy.copy-confirmed::after{content:"✓"}}
@media(max-width:780px){.room-role-actions{gap:8px}.room-role-actions button{flex:1 1 140px;font-size:12px;min-height:44px}.judging-actions{padding:16px;align-items:stretch;flex-direction:column}.judging-actions button{min-height:46px}.judging-room{padding:18px;border-radius:18px}.judging-heading{flex-direction:column;align-items:stretch;gap:12px}.judging-clock{padding:14px}.judging-clock strong{font-size:50px}.judging-game{padding:16px}.judging-roster,.judging-places{grid-template-columns:minmax(0,1fr)}.judging-places select,#judging-duration{font-size:16px;min-height:46px}.judging-room button{min-height:44px}.judging-return button{width:100%}.team-title{gap:10px}.team-place{font-size:12px}}
@media(max-width:780px){.guide-dialog{padding:24px 18px}.guide-dialog article{padding:14px}.guide-dialog p{font-size:14px}.guide-dialog article .text-button{min-height:44px}.team-swap{min-height:36px;font-size:11px;padding:7px 9px}.team-title{align-items:center}.seat{padding:4px}.seat.active .avatar{outline-width:3px;outline-offset:2px;box-shadow:0 0 0 6px #e9ddff!important}.seat-icons{flex-shrink:0}.seat.mic-on .seat-icons{max-width:60px;font-size:9px}.dock .spectator-button{padding:8px 0 8px 8px;min-height:40px;font-size:10px;max-width:125px}.speech-prep-button{min-height:44px;font-size:13px}.speech-prep-countdown strong{font-size:42px}.full-room-help{width:100%;min-height:44px}}

@media(max-width:780px){.seat{padding-right:12px}.seat.active .avatar{outline:none!important;box-shadow:none!important}.seat.mic-on .seat-icons{max-width:none;min-width:30px;min-height:30px;font-size:17px}.guide-window{right:8px;top:130px;width:min(360px,calc(100vw - 16px));height:min(500px,calc(100dvh - 146px))}.guide-window-header{padding:10px 12px}.guide-window-header h2{font-size:15px}.guide-window-content{padding:0 12px 10px}.guide-window-content p{font-size:13px}.guide-window-content .text-button{min-height:40px}.guide-window-footer #guide-resize{width:40px;height:40px}.guide-window-footer .secondary{min-height:40px}.guide-window-hint{padding-left:12px;line-height:1.5}}

@media(max-width:780px){.seat{padding-left:10px}}
