/* ===== Screen sizes, Dec 2026: iPads, Android tablets, small laptops and short (landscape) screens =====
   Checked at 375-430 px phones, 844 and 932 px phone landscape, iPad 744, 820 and 1024 portrait, 1133, 1180 and 1366 landscape,
   Android tablets 800x1280, 1280x800 and split screen, 1280 and 1366 laptops and 1920 desktop, in English and Arabic. */

/* 1. The channel list was 184 px on laptops and iPads: the account bar (picture, name, mic, headphones, settings) left the name one letter wide ("L...").
   A little wider floor keeps the name readable; dragging the list edge still sets any width. */
:root { --lay-list: clamp(216px, 12vw, 232px); }
/* touch tablets (iPad, Android tablet): fingers need the room, and the list holds the channel names and the account bar */
@media (hover: none) and (pointer: coarse) { :root:not(.ph) { --lay-list: clamp(232px, 19vw, 264px); } }

/* 2. Touch screens have no hover, so every channel row showed its invite, chat and settings buttons at once and the names were cut to "L..." and "annou...".
   Now only the open channel shows them; the others keep their full name, and press-and-hold still opens every channel option. */
@media (hover: none) {
  html:not(.ph) .channel-list .channel-item:not(.active) :is(.vc-tools, .channel-gear-btn) { display: none !important; }
  html:not(.ph) .channel-list .channel-item:not(.active) .vc-time { display: inline; }
  html:not(.ph) .channel-list .channel-item > span:first-child { min-width: 0; flex: 1 1 auto; }
}

/* 3. Arabic: an English channel name or topic was cut at its start ("...cements", "d plans for the evening"). Each name now reads in its own direction,
   so the cut and the dots fall at its end. */
:root[dir="rtl"] .channel-list .channel-item [data-notr],
:root[dir="rtl"] #chat-topic-display,
:root[dir="rtl"] #chat-title-heading,
:root[dir="rtl"] .server-title-btn { unicode-bidi: plaintext; }

/* 4. Short screens (a phone turned sideways, a small laptop window): pop-ups never run off the top or bottom. */
@media (min-width: 701px) and (max-height: 560px) {
  #member-action-dialog .profile-pop { max-height: calc(100dvh - 16px); overflow-y: auto; }
  /* settings use the whole screen instead of a small box with a scroll inside a scroll */
  dialog.fullscreen .settings-shell { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  dialog.fullscreen .settings-body { padding-top: 20px; }
  /* sign-in: the form alone, like on a phone (the "log in with your phone" code is for computers) */
  #auth-dialog .auth-card.auth-wide { display: block; width: 420px; padding: 24px 30px; }
  #auth-dialog .auth-card.auth-wide > :not(.auth-qr) { margin-left: 0; margin-right: 0; }
  #auth-dialog .auth-card.auth-wide > :first-child { margin-top: 0; }
  #auth-dialog .auth-card.auth-wide > .auth-qr { display: none; }
}

/* 5. Upright iPads and tablets (744-860 px wide, touch): the server list and the channel list stay on screen beside the chat, as on a computer,
   instead of hiding behind the menu button (owner's choice, Dec 2). Phones, split screens under 740 px and narrow computer windows keep the slide-out list.
   The member list stays a slide-out panel. */
@media (min-width: 740px) and (max-width: 860px) and (hover: none) and (pointer: coarse) {
  :root { --tab-srch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E"); }
  html:not(.ph) .app > .rail, html:not(.ph) .app > .channels-pane { position: relative; inset: auto; transform: none; z-index: auto; flex: none; transition: none; }
  html:not(.ph) .app > .channels-pane { width: 232px; }
  /* the member list slides over the chat from the side, wide enough for a name and its tag */
  html:not(.ph) .members-pane { width: 264px; box-shadow: 0 0 40px rgba(0,0,0,.45); }
  /* Arabic: the lists sit on the right, so the member list slides in from the left, over the chat and not over the channels */
  :root[dir="rtl"]:not(.ph) .members-pane { right: auto; left: 0; transform: translateX(-100%); }
  :root[dir="rtl"]:not(.ph) body.members-open .members-pane { transform: none; }
  /* header buttons a little tighter so the channel name keeps its room on the 744 px iPad mini */
  html:not(.ph) .main-header { gap: 2px; }
  html:not(.ph) .main-header > .icon-btn { width: 30px; min-width: 30px; }
  html:not(.ph) #btn-hamburger, html:not(.ph) #nav-overlay { display: none !important; }
  /* the channel name keeps its room in the header: search folds into a small magnifier and opens when tapped */
  html:not(.ph) #chat-title-heading { flex: 1 1 auto; min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html:not(.ph) #chat-search-input { flex: 0 0 34px; width: 34px; min-width: 34px; padding-inline: 30px 0; color: transparent; cursor: pointer; transition: width .15s ease;
    background-image: var(--tab-srch) !important;
    background-repeat: no-repeat !important; background-size: 16px !important; background-position: 9px center !important; }
  :root[dir="rtl"]:not(.ph) #chat-search-input { background-position: calc(100% - 9px) center !important; }
  /* the account bar: a little less outer margin in every look, so your name keeps its letters */
  html:not(.ph) .app > .channels-pane > .user-status-bar { margin-inline: 4px; padding-inline: 4px; }
  html:not(.ph) .user-quick-controls { gap: 0; }
  html:not(.ph) .user-quick-controls .quick-icon-btn { width: 32px; min-width: 32px; }
  html:not(.ph) #chat-search-input::placeholder { color: transparent; }
  :root[data-theme="light"]:not(.ph) #chat-search-input { background: #fff var(--tab-srch) no-repeat 9px center / 16px !important; border: 1px solid var(--border) !important; border-radius: 8px; }
  html:not(.ph) #chat-search-input:focus, html:not(.ph) #chat-search-input:not(:placeholder-shown) { flex-basis: 200px; width: 200px; padding-inline-end: 10px; color: var(--bright); cursor: text; }
  html:not(.ph) #chat-search-input:focus::placeholder { color: var(--muted); }
  /* Crystal: the two lists and the chat float as glass panels, the same as on a computer, with slightly smaller gaps */
  :root.ui-lq:not(.ph) .app { padding: 8px; gap: 8px; }
  :root.ui-lq:not(.ph) .app > :is(.rail, .channels-pane, .main) {
    border-radius: var(--lq-r-island); box-shadow: var(--lq-rim), var(--lq-drop); overflow: hidden;
    background-color: var(--lq-pane); background-image: linear-gradient(var(--lq-veil, transparent), var(--lq-veil, transparent));
    -webkit-backdrop-filter: var(--lq-blur); backdrop-filter: var(--lq-blur);
  }
  :root.ui-lq:not(.ph) .app > .main { background-color: var(--lq-main); }
  :root.ui-lq:not(.ph) .app > .rail { width: 64px; padding: 12px 0; overflow-y: auto; }
  :root.ui-lq:not(.ph) .app > .channels-pane > .user-status-bar { margin: 0 4px 4px; border-radius: var(--lq-r-card); box-shadow: var(--lq-rim); }
}
