:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  background: #eee;
  font-synthesis: none;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
html, body { overflow: hidden; overscroll-behavior: none; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, textarea:focus-visible { outline: 2px solid #3986c8; outline-offset: -3px; }
[hidden] { display: none !important; }

.chat-layout {
  position: fixed;
  top: var(--chat-viewport-top, 0px);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 37% minmax(0, 1fr);
  gap: 9px;
  height: 100vh;
  height: var(--chat-viewport-height, 100dvh);
  padding: 6px;
}

.videos { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
.video-panel { position: relative; min-height: 0; overflow: hidden; background: #000; }
.video-panel video { display: block; width: 100%; height: 100%; object-fit: contain; }
.stranger-panel { isolation: isolate; }
/* Keep the complete portrait frame visible; soften the unused space around it. */
.stranger-panel::before { content: ""; position: absolute; inset: -24px; background: url("assets/video-backdrop.jpg") center / cover no-repeat; filter: blur(20px) brightness(.6); pointer-events: none; }
.stranger-panel:has(video[hidden])::before { display: none; }
.stranger-panel video { position: relative; z-index: 1; object-position: center; }
.stranger-camera-off { position: absolute; z-index: 2; isolation: isolate; inset: 0; display: grid; place-items: center; overflow: hidden; margin: 0; background: #000; color: #fff; font-size: 14px; text-shadow: 0 1px 5px #000; }
.stranger-camera-off::before { content: ""; position: absolute; z-index: -1; inset: -20px; background: url("assets/screenshot-2026-02-09-at-18.40.09-2.png") center 10% / cover no-repeat; filter: blur(12px) brightness(.55); pointer-events: none; }
.stranger-camera-off.is-disconnected { color: #aaa; }
.stranger-camera-off.is-disconnected::before { display: none; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #ffffff70; border-radius: 3px; color: white; background: #0008; }
.icon-button svg { width: 19px; height: 19px; }
.sound-button { position: absolute; z-index: 3; right: 11px; bottom: 12px; }
.video-button { display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid #5b5b5b; border-radius: 3px; padding: 11px 15px; color: #e8e8e8; background: #191919; font-size: 14px; }
.video-button:hover { background: #2c2c2c; border-color: #858585; }
.play-button { position: absolute; z-index: 3; top: 50%; left: 50%; transform: translate(-50%, -50%); white-space: nowrap; }

.conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; gap: 9px; }
.chat-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; background: #fff; border: 1px solid #bbb; }
.chat-header { flex-shrink: 0; padding: 10px 12px 0; }
.chat-header p { margin: 0; font-size: 16px; line-height: 1.45; font-weight: 700; }
.transcript { flex: 1; min-height: 0; padding: 14px 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; overflow-wrap: anywhere; }
.message, .typing, .system-message { margin: 0 0 11px; font-size: 16px; line-height: 1.5; }
.message-label { font-weight: bold; margin-right: 7px; }
.message--stranger .message-label { color: #e22828; }
.message--you .message-label { color: #174af2; }
.message-content { white-space: pre-wrap; }
.message-content a { color: #125cbd; text-decoration: underline; }
.message-image-link { display: block; width: fit-content; max-width: 100%; margin: 8px 0 0; }
.message-image { display: block; max-width: min(100%, 320px); max-height: 360px; width: auto; height: auto; border: 1px solid #ddd; border-radius: 2px; }
.message-image-error { display: block; margin-top: 8px; color: #777; font-size: 13px; }
.typing, .system-message { color: #777; }
.typing { font-style: italic; }
.chat-error { padding: 10px 12px; background: #fff8ed; border-top: 1px solid #e4d2b7; font-size: 13px; line-height: 1.5; }
.chat-error button { margin-left: 7px; border: 0; padding: 0; background: none; color: #195ca2; text-decoration: underline; }
.composer { flex-shrink: 0; display: grid; grid-template-columns: 115px minmax(0, 1fr) 100px; gap: 9px; height: 94px; }
.chat-button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; color: #333; border: 1px solid #bbb; border-radius: 2px; background: linear-gradient(#fff, #e6e6e6); font-size: 20px; }
.chat-button:hover:enabled { background: linear-gradient(#fff, #d9e6ee); border-color: #999; }
.chat-button:active:enabled { background: #e4e4e4; }
.chat-button small { color: #929292; font-size: 12px; }
.chat-button:disabled { color: #a0a0a0; }
textarea { width: 100%; min-width: 0; height: 100%; resize: none; border: 1px solid #aaa; border-radius: 2px; padding: 10px; background: #fff; color: #222; font-size: 16px; line-height: 1.4; }
textarea:disabled { background: #fafafa; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 700px) {
  .chat-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, var(--mobile-video-height, 1fr)) minmax(0, 1fr); gap: 6px; padding: 5px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .conversation { gap: 6px; }
  .chat-header { padding: 9px 10px 0; }
  .chat-header p { font-size: 13px; }
  .transcript { padding: 12px 10px; }
  .message, .typing, .system-message { font-size: 14px; }
  .composer { height: 72px; grid-template-columns: 67px minmax(0, 1fr) 63px; gap: 6px; }
  .chat-button { font-size: 16px; }
  .chat-button small { font-size: 10px; }
  .sound-button { right: 7px; bottom: 8px; width: 27px; height: 27px; }
  .video-button { gap: 6px; padding: 9px; font-size: 12px; }
}

@media (max-height: 480px) and (min-width: 701px) {
  .composer { height: 65px; }
  .chat-header p { font-size: 14px; }
}
