:root {
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: #17324d;
  background: #edf5ff;
  font-synthesis: none;
  line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 16px; height: 100vh; height: 100dvh; }
html:has(.panel[data-screen="conversation"]) { overflow: hidden; overscroll-behavior: none; }
body:has(.panel[data-screen="conversation"]) { position: fixed; top: var(--chat-viewport-top, 0px); left: 0; right: 0; height: var(--chat-viewport-height, 100dvh); overflow: hidden; }
button, input, textarea { font: inherit; }
button, .file-button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 16px;
  background: #1764cc;
  color: #fff;
  font-weight: 600;
}
button:disabled { opacity: .55; cursor: wait; }
button:hover:not(:disabled) { filter: brightness(.94); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible,
summary:focus-visible, .file-button:focus-within { outline: 3px solid #d78014; outline-offset: 2px; }
.panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  height: 100%;
  max-height: 900px;
  min-height: 0;
  margin: auto;
  background: #fff;
  border: 1px solid #dce6f0;
  border-radius: 14px;
  overflow: hidden;
}
header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 18px;
  border-bottom: 1px solid #dce6f0;
}
.brand { font-size: 23px; line-height: 1.2; letter-spacing: -1px; font-weight: 800; color: #17324d; text-decoration: none; }
.brand span { color: #1764cc; }
.private { font-size: 12px; color: #63758a; }
.welcome { padding: 32px; max-width: 560px; overflow: auto; }
.chat-symbol { font-size: 34px; color: #1764cc; }
h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.8px; margin: 12px 0 20px; }
p { color: #63758a; }
form { display: grid; gap: 12px; margin: 26px 0 12px; }
label { font-size: 14px; font-weight: 600; }
input, textarea { width: 100%; border: 1px solid #9bb2ca; border-radius: 8px; padding: 10px 12px; background: #fff; color: #17324d; font-size: 16px; }
.note { font-size: 12px; }
.quiet { background: transparent; color: #1764cc; font-size: 13px; padding: 8px 10px; }
#conversation { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.room { position: relative; display: flex; flex-shrink: 0; padding: 12px 18px; background: #fff; }
.room-copy { flex: 1; min-width: 0; }
.room h1 { padding-right: 90px; font-size: 18px; line-height: 1.25; margin: 0 0 3px; letter-spacing: -.3px; }
#event-title { overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.room p { margin: 1px 0; font-size: 12px; line-height: 1.45; }
#participants { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room #expiry { font-size: 11px; }
.room > button { position: absolute; top: 6px; right: 10px; white-space: nowrap; }
.call-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  flex-shrink: 0;
  padding: 10px 18px;
  background: #f4f8fd;
  border-top: 1px solid #dce6f0;
  border-bottom: 1px solid #dce6f0;
}
.call-copy { min-width: 0; }
.call-panel h2 { font-size: 13px; line-height: 1.3; margin: 0 0 2px; }
.call-panel p { margin: 0; font-size: 12px; line-height: 1.4; }
#call-status { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.call-controls, .ringtone-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; max-width: min(230px, 52vw); }
.call-controls button, .ringtone-controls button { min-height: 40px; font-size: 13px; padding: 8px 12px; white-space: nowrap; }
.call-controls .call-end { background: #fff0f1; color: #a52a36; }
.call-controls [aria-pressed="true"] { background: #fff0d8; color: #7e4b00; }
#call-join[data-incoming="true"] { animation: incoming-call-shake 1.2s ease-in-out 4; box-shadow: 0 0 0 3px #1764cc20; }
@keyframes incoming-call-shake { 0%, 45%, 100% { transform: translateX(0); } 10%, 30% { transform: translateX(-3px); } 20%, 40% { transform: translateX(3px); } }
#ringtone-status { min-width: 0; padding-top: 6px; overflow-wrap: anywhere; }
#ringtone-status:empty, .ringtone-controls:not(:has(button:not([hidden]))) { display: none; }
.ringtone-controls { padding-top: 6px; }
.ringtone-controls button { min-height: 40px; padding: 6px 8px; font-size: 12px; }
#call-message { grid-column: 1 / -1; color: #a52a36; padding-top: 6px; overflow-wrap: anywhere; }
#call-message:empty { display: none; }
#call-route-note { grid-column: 1 / -1; padding-top: 5px; font-size: 11px; }
#timeline { display: flex; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px; flex-direction: column; gap: 12px; }
#timeline > p { margin: auto; max-width: 260px; text-align: center; font-size: 14px; }
.bubble { max-width: 85%; flex-shrink: 0; align-self: flex-start; background: #f0f4f8; border-radius: 3px 12px 12px; padding: 9px 12px; overflow-wrap: anywhere; }
.bubble.own { align-self: flex-end; background: #e6f0ff; border-radius: 12px 3px 12px 12px; }
.bubble small { display: block; color: #63758a; font-size: 11px; margin-bottom: 3px; }
.bubble p { margin: 0; color: #17324d; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.bubble img, .bubble video { max-width: 100%; max-height: 240px; border-radius: 6px; display: block; }
.bubble audio { max-width: 100%; width: 260px; }
.bubble a { color: #1755a5; }
.call-event { align-self: center; flex-shrink: 0; max-width: 95%; padding: 2px 0; text-align: center; overflow-wrap: anywhere; }
.call-event p { display: inline; margin: 0; color: #63758a; font-size: 12px; line-height: 1.4; white-space: pre-wrap; }
.call-event small { display: inline; margin-left: 6px; color: #63758a; font-size: 10px; white-space: nowrap; }
.call-event button { display: block; min-height: 40px; margin: 5px auto 0; padding: 7px 14px; font-size: 13px; }
#typing-status { flex-shrink: 0; margin: 0; padding: 0 18px 5px; color: #63758a; font-size: 12px; line-height: 1.4; }
#typing-status:empty { display: none; }
.composer-area { position: relative; flex-shrink: 0; padding: 10px 18px 8px; border-top: 1px solid #dce6f0; background: #fff; }
#composer { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin: 0; }
#message { display: block; height: 44px; min-height: 44px; max-height: 104px; line-height: 22px; resize: none; overflow-y: auto; }
#composer > button { height: 44px; padding: 10px 16px; font-size: 14px; }
.tools { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.tools > button, .file-button, .chat-info > summary { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px; font-size: 12px; }
.file-button { position: relative; overflow: hidden; background: transparent; color: #1764cc; border-radius: 6px; white-space: nowrap; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.tools > .logout { margin-left: auto; }
.chat-info { min-width: 0; }
.chat-info > summary { cursor: pointer; color: #63758a; list-style: none; white-space: nowrap; border-radius: 6px; }
.chat-info > summary::-webkit-details-marker { display: none; }
.chat-info > summary::after { content: "+"; margin-left: 5px; font-size: 15px; }
.chat-info[open] > summary::after { content: "−"; }
.chat-info-content { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 50px; max-height: 180px; overflow: auto; padding: 12px 14px; border: 1px solid #dce6f0; border-radius: 8px; background: #fff; box-shadow: 0 3px 16px #17324d14; }
.chat-info-content p { margin: 0 0 7px; font-size: 12px; }
.chat-info-content p:last-child { margin-bottom: 0; }
#status { flex-shrink: 0; max-height: 84px; overflow: auto; margin: 0; padding: 0 18px 8px; color: #a52a36; font-size: 13px; }
#status:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.consent-notice { max-width: 640px; }
.consent-notice h1 { font-size: 26px; line-height: 1.3; }
.consent-notice p { white-space: pre-wrap; }
.consent-notice a { color: #1755a5; }
.consent-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; padding: 10px 0; font-size: 14px; line-height: 1.5; cursor: pointer; }
.consent-check input { flex-shrink: 0; width: 20px; height: 20px; margin: 1px 0 0; padding: 0; accent-color: #1764cc; }
#last4-form { max-width: 320px; }
#phone-last4 { letter-spacing: 5px; font-size: 22px; }
#phone-last4::placeholder { font-size: 16px; letter-spacing: 0; }
#last4-error { color: #a52a36; font-size: 14px; }
#last4-error:empty { display: none; }
.consent-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
#consent-error { color: #a52a36; font-size: 14px; }
#consent-error:empty { display: none; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  body { padding: 0; background: #fff; }
  .panel { max-height: none; border: 0; border-radius: 0; }
  header { min-height: 48px; padding: max(7px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 7px max(14px, env(safe-area-inset-left)); }
  .brand { font-size: 22px; }
  .private { font-size: 11px; }
  .welcome { padding: 24px; }
  h1 { font-size: 29px; }
  .room { padding: 10px 14px; }
  .room h1 { font-size: 17px; }
  .call-panel { column-gap: 8px; padding: 8px 14px; }
  #timeline { padding: 14px; gap: 10px; }
  #typing-status { padding-right: 14px; padding-left: 14px; }
  .composer-area { padding: 8px max(12px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  #status { padding-right: 14px; padding-left: 14px; }
  .panel[data-keyboard-open="true"] > header { display: none; }
  .panel[data-keyboard-open="true"] .room { min-height: 50px; padding-top: 6px; padding-bottom: 6px; }
  .panel[data-keyboard-open="true"] #event-title { -webkit-line-clamp: 1; }
  .panel[data-keyboard-open="true"] #expiry, .panel[data-keyboard-open="true"] #call-route-note { display: none; }
  .panel[data-keyboard-open="true"] .call-panel { padding-top: 5px; padding-bottom: 5px; }
  .panel[data-keyboard-open="true"] .composer-area { display: flex; flex-direction: column; padding-bottom: 5px; }
  .panel[data-keyboard-open="true"] .tools { order: -1; margin-top: 0; margin-bottom: 4px; }
  .panel[data-keyboard-open="true"] .chat-info-content { bottom: calc(100% - 4px); }
}
@media (max-height: 460px) and (orientation: landscape) {
  header { min-height: 38px; padding-top: 4px; padding-bottom: 4px; }
  .room { min-height: 50px; padding-top: 5px; padding-bottom: 5px; }
  .room-copy { display: flex; align-items: baseline; flex-wrap: nowrap; gap: 0 10px; padding-right: 90px; }
  .room h1 { flex: 1; min-width: 0; margin-bottom: 0; padding-right: 0; }
  #event-title { display: block; white-space: nowrap; text-overflow: ellipsis; -webkit-line-clamp: 1; }
  #participants { flex: 0 1 44%; min-width: 0; }
  .room #expiry { display: none; }
  .call-panel { padding-top: 5px; padding-bottom: 5px; }
  #call-route-note { display: none; }
  .composer-area { padding-top: 5px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } #call-join[data-incoming="true"] { animation: none; } }
