.lobby-view .hub-direct-chat-card { grid-column: 1 / -1; min-height: 210px; }
.lobby-view .hub-direct-chat-card > .hub-section-art { height: 168px; }
.lobby-view .direct-chat-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #f3c36c; color: #111726; font-size: 12px; font-weight: 800; vertical-align: middle; }
.lobby-view .direct-chat-unread[hidden] { display: none !important; }

.student-direct-chat { max-width: 1120px; margin: 0 auto; }
.student-direct-chat-header { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 12px; align-items: center; margin: 4px 0 12px; }
.student-direct-chat-header h1 { margin: 5px 0; color: var(--ink); font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.035em; line-height: 1.12; }
.student-direct-chat-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.student-direct-chat-header img { display: block; width: 100%; max-height: 66px; object-fit: contain; }
.student-direct-chat-panel { display: flex; min-height: 0; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--cabinet-panel); box-shadow: 0 20px 60px #080c1840; }
.student-direct-chat-toolbar { display: flex; align-items: center; gap: 12px; min-height: 75px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.student-direct-chat-teacher-avatar { display: grid; flex: 0 0 43px; width: 43px; height: 43px; place-items: center; border: 1px solid #7565a0; border-radius: 15px; color: #eee8ff; background: linear-gradient(145deg, #5c4a85, #35335d); font-size: 20px; font-weight: 800; }
.student-direct-chat-teacher { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.student-direct-chat-teacher strong { color: var(--ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-direct-chat-teacher small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-direct-chat-toolbar button, .student-direct-chat-older { display: grid; min-width: 38px; min-height: 38px; padding: 7px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: #222b3e; color: #ddd3ff; font: inherit; cursor: pointer; }
.student-direct-chat-toolbar button { flex: 0 0 38px; font-size: 24px; line-height: 1; }
.student-direct-chat-toolbar button:hover, .student-direct-chat-older:hover { background: #343952; border-color: #7b6d9e; }
.student-direct-chat-toolbar button:disabled, .student-direct-chat-older:disabled { opacity: .55; cursor: wait; }
.student-direct-chat-status { min-height: 0; padding: 8px 20px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.student-direct-chat-status:empty { display: none; }
.student-direct-chat-status.is-error { color: #ffb0ae; }
.student-direct-chat-older { align-self: center; min-height: 32px; margin: 11px 0 0; padding: 6px 14px; font-size: 12px; }
.student-direct-chat-messages { display: flex; flex-direction: column; gap: 11px; height: clamp(340px, 56dvh, 670px); min-height: 0; overflow-y: auto; padding: 20px 24px 24px; overscroll-behavior: contain; overflow-anchor: none; scrollbar-gutter: stable; background: radial-gradient(ellipse at 20% 0, #222840 0, transparent 48%), #171e2d; }
.student-direct-chat-empty { margin: auto; max-width: 380px; padding: 20px; color: var(--muted); text-align: center; line-height: 1.55; }
.student-direct-chat-date { align-self: center; margin: 6px 0; padding: 6px 12px; border: 1px solid #3a4359; border-radius: 20px; color: #c4cadd; background: #252d40; font-size: 11px; font-weight: 750; }
.student-direct-chat-message { max-width: min(76%, 630px); padding: 11px 14px 8px; border: 1px solid #3b465c; border-radius: 17px 17px 17px 5px; background: #2a3448; color: var(--ink); overflow-wrap: anywhere; box-shadow: 0 4px 16px #080c1824; }
.student-direct-chat-message.is-own { align-self: flex-end; border-color: #7669a0; border-radius: 17px 17px 5px 17px; background: #514669; }
.student-direct-chat-message.is-pending { opacity: .78; }
.student-direct-chat-message.is-failed { border-color: #dc858c; }
.student-direct-chat-message p { margin: 0; white-space: pre-wrap; line-height: 1.48; font-size: 14px; }
.student-direct-chat-message footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; margin-top: 6px; color: #d3d7e2; font-size: 10px; }
.student-direct-chat-message footer time { white-space: nowrap; }
.student-direct-chat-message footer button { padding: 0; border: 0; background: transparent; color: #ffd3d5; font: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; }
.student-direct-chat-form { display: flex; align-items: flex-end; gap: 10px; padding: 14px 18px 8px; border-top: 1px solid var(--line); background: var(--cabinet-panel); }
.student-direct-chat-form textarea { flex: 1; min-width: 0; min-height: 48px; max-height: 148px; resize: none; padding: 12px 14px; border: 1px solid #586178; border-radius: 14px; outline: none; background: #111927; color: var(--ink); font: inherit; font-size: 15px; line-height: 1.45; }
.student-direct-chat-form textarea::placeholder { color: #aab2c3; }
.student-direct-chat-form textarea:focus { border-color: #b6a5ff; box-shadow: 0 0 0 3px #b6a5ff26; }
.student-direct-chat-form button { display: grid; flex: 0 0 48px; width: 48px; height: 48px; padding: 0; place-items: center; border: 0; border-radius: 14px; background: #c8b5ee; color: #192031; font: inherit; font-size: 22px; font-weight: 800; cursor: pointer; }
.student-direct-chat-form button:hover { background: #ddcdfc; }
.student-direct-chat-form button:disabled { opacity: .5; cursor: default; }
.student-direct-chat-hint { margin: 0; padding: 0 18px 12px; color: #9ea6b8; font-size: 10px; }
.student-direct-chat :is(textarea, button):focus-visible { outline: 2px solid #d4caff; outline-offset: 2px; }

/* Size the whole conversation, including its composer, to the desktop window. */
@media (min-width: 761px) {
  .lobby-view[data-cabinet-page="direct-chat"] { display: flex; height: 100dvh; min-height: 0; flex-direction: column; }
  .lobby-view[data-cabinet-page="direct-chat"] > .app-header,
  .lobby-view[data-cabinet-page="direct-chat"] > .teacher-preview-bar { flex-shrink: 0; }
  .lobby-view[data-cabinet-page="direct-chat"] .lobby-main { display: flex; flex: 1; min-height: 0; padding-top: 14px; padding-bottom: 16px; }
  .lobby-view[data-cabinet-page="direct-chat"] .cabinet-footer { display: none; }
  .student-direct-chat { display: flex; width: 100%; min-height: 0; flex: 1; flex-direction: column; }
  .student-direct-chat > .hub-breadcrumb { align-self: flex-start; margin-bottom: 4px; min-height: 28px; }
  .student-direct-chat-header { flex-shrink: 0; }
  .student-direct-chat-panel { flex: 1; }
  .student-direct-chat-panel > :not(.student-direct-chat-messages) { flex-shrink: 0; }
  .student-direct-chat-messages { height: auto; flex: 1; }
}

@media (max-width: 760px) {
  .lobby-view[data-cabinet-page="direct-chat"] .cabinet-footer { display: none; }
  .lobby-view[data-cabinet-page="direct-chat"] .lobby-main { padding-bottom: calc(var(--cabinet-nav-height) + 12px); }
  .lobby-view .hub-direct-chat-card { grid-template-columns: minmax(0, 1fr) 76px; min-height: 204px; }
  .lobby-view .hub-direct-chat-card h2 { font-size: 22px; overflow-wrap: normal; word-break: normal; }
  .lobby-view .hub-direct-chat-card > .hub-section-art { height: 100px; }
  .student-direct-chat-header { display: block; margin: 8px 0 16px; }
  .student-direct-chat-header h1 { font-size: 27px; }
  .student-direct-chat-header p { display: none; }
  .student-direct-chat-header img { display: none; }
  .student-direct-chat-panel { border-radius: 17px; }
  .student-direct-chat-toolbar { min-height: 66px; padding: 10px 12px; gap: 9px; }
  .student-direct-chat-teacher-avatar { flex-basis: 39px; width: 39px; height: 39px; border-radius: 13px; }
  .student-direct-chat-teacher strong { font-size: 13px; }
  .student-direct-chat-status { padding: 7px 12px; }
  .student-direct-chat-messages { height: clamp(170px, calc(100dvh - 460px), 480px); min-height: 0; padding: 15px 12px 18px; }
  .student-direct-chat-message { max-width: 89%; }
  .student-direct-chat-form { padding: 10px 10px 6px; gap: 7px; }
  .student-direct-chat-hint { display: none; }
}
@media (max-width: 360px) {
  .lobby-view .hub-direct-chat-card { grid-template-columns: minmax(0, 1fr) 64px; }
  .lobby-view .hub-direct-chat-card h2 { font-size: 20px; }
}
