/* Echo Midnight Glass — progressive visual layer, optimized for WebView2/Windows 10.
   Navigation and calling behavior are unchanged. Glass follows all existing themes. */
:root{
  --eg-frost:rgba(19,32,39,.84);
  --eg-frost-heavy:rgba(19,30,38,.985);
  --eg-frost-soft:rgba(30,45,52,.66);
  --eg-line:rgba(171,237,217,.18);
  --eg-toplight:rgba(224,255,243,.18);
  --eg-shadow:0 16px 48px rgba(2,13,18,.30),inset 0 1px 0 rgba(236,255,249,.07);
  --eg-text:var(--tone-eef4f2,#eef4f2);
}
:root[data-theme="night"]{
  --eg-frost:rgba(23,28,40,.88);
  --eg-frost-heavy:rgba(20,26,38,.985);
  --eg-frost-soft:rgba(43,51,65,.64);
  --eg-line:rgba(179,202,230,.17);
}
:root[data-theme="day"]{
  --eg-frost:rgba(249,253,250,.91);
  --eg-frost-heavy:rgba(251,254,252,.985);
  --eg-frost-soft:rgba(234,244,240,.87);
  --eg-line:rgba(49,108,88,.19);
  --eg-toplight:rgba(255,255,255,.94);
  --eg-shadow:0 13px 37px rgba(40,77,66,.12),inset 0 1px 0 rgba(255,255,255,.95);
  --eg-text:var(--text,#15292a);
}
/* Restrained reflected light only, no costly moving gradients or animations. */
:root:not([data-theme="day"]) body{
  background:radial-gradient(ellipse 64% 56% at 76% -12%,rgba(59,160,134,.13),transparent 78%),
             radial-gradient(ellipse 75% 70% at -18% 110%,rgba(49,120,111,.11),transparent 75%),
             var(--bg,#0c141b);
}
.topbar{height:77px;min-height:77px;border-bottom:1px solid var(--eg-line)}
.topbar .brand{font-size:27px;letter-spacing:-1.1px}
.topbar .brand-mark{width:45px;height:45px}
.topbar button,.topbar .topbar-windows-download{transition:background .17s,border-color .17s,box-shadow .17s}
.lobby-layout{grid-template-columns:minmax(0,1fr) minmax(330px,440px);gap:clamp(20px,3.5vw,55px);padding-block:37px 42px}
.hero{min-height:min(575px,75dvh)}
.hero h1{font-size:clamp(49px,5.2vw,75px);letter-spacing:-3.5px;line-height:1.05}
.hero-description{max-width:400px;line-height:1.65}
.entry-card,.settings-panel,.room-banner,.sound-card{
  border-color:var(--eg-line);
  box-shadow:var(--eg-shadow);
  background:linear-gradient(150deg,var(--eg-frost-soft),var(--eg-frost-heavy));
}
.entry-card{border-radius:22px;padding:clamp(22px,2.9vw,34px)}
.entry-card h2{margin-top:16px;letter-spacing:-.8px}
.entry-mode-tab,.entry-card input,.preferences-dialog input,.preferences-dialog select{
  transition:background .16s,border-color .16s,box-shadow .16s;
}
.call-layout{gap:clamp(16px,2vw,25px);padding-block:23px 32px;grid-template-columns:minmax(0,1fr) minmax(254px,305px)}
.call-heading h1{font-size:clamp(34px,3.45vw,48px);line-height:1.1;letter-spacing:-1.8px;margin:8px 0}
.connection-pill{padding:8px 12px}
.room-banner{margin-top:18px;padding:13px 17px;border-radius:17px}
.section-heading{margin-block:25px 14px}
.participant-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,175px),1fr));gap:11px}
.participant-card{
  min-height:169px;padding:12px;border-radius:17px;border-color:var(--eg-line);
  background:linear-gradient(155deg,var(--eg-frost-soft),var(--eg-frost-heavy));
  box-shadow:inset 0 1px 0 var(--eg-toplight);
  transition:border-color .16s,box-shadow .16s,transform .16s;
}
.participant-card:hover{border-color:color-mix(in srgb,var(--green) 43%,transparent)}
.participant-card.speaking{
  border-color:color-mix(in srgb,var(--green) 76%,transparent);
  box-shadow:0 0 0 1px rgba(143,241,191,.20),0 0 22px rgba(94,226,163,.12),inset 0 1px 0 var(--eg-toplight);
}
.participant-card .avatar{width:59px;height:59px;font-size:24px}
.participant-card .avatar-wrap{margin:4px auto 6px}
.participant-card .tile-top,.participant-card .tile-bottom{min-width:0}
.participant-card .tile-name strong{font-size:13px}
.participant-card .small-muted{font-size:11px}
.participant-card .peer-volume{margin-top:5px}
.control-dock{
  width:fit-content;max-width:100%;margin:24px auto 0;
  background:linear-gradient(150deg,var(--eg-frost-soft),var(--eg-frost));
  border:1px solid var(--eg-line);border-radius:999px;
  box-shadow:var(--eg-shadow);padding:9px 15px;gap:13px;
}
.dock-button{transition:transform .17s,background .17s,border-color .17s,box-shadow .17s}
.dock-button:hover:not(:disabled){transform:translateY(-1px)}
body.in-room .dock-buttons{gap:8px}
body.in-room #chatToggle{
  background:var(--eg-frost-soft);border-color:var(--eg-line);
  box-shadow:inset 0 1px 0 var(--eg-toplight);
}
body.in-room #chatToggle[aria-expanded="true"]{
  background:color-mix(in srgb,var(--green) 16%,var(--eg-frost));
  box-shadow:0 0 0 1px rgba(135,228,182,.12);
}
.settings-panel{min-height:unset;padding:22px 20px;border-radius:20px}
.settings-panel .sound-card{box-shadow:none}

/* Messenger-density chat. Keep floating-chat.js geometry, scrolling and resize. */
body.in-room #chatPanel{
  border-radius:19px;border:1px solid var(--eg-line);
  background:var(--eg-frost-heavy);
  box-shadow:0 22px 64px rgba(0,9,14,.37),inset 0 1px 0 var(--eg-toplight);
}
body.in-room #chatPanel .chat-head{
  padding:10px 13px;background:linear-gradient(160deg,var(--eg-frost-soft),var(--eg-frost));
  border-bottom:1px solid var(--eg-line);
}
body.in-room #chatPanel .chat-heading strong{font-size:14px;letter-spacing:-.2px}
body.in-room #chatPanel .chat-head-actions button{
  border-radius:10px;transition:background .16s,color .16s;
}
body.in-room #chatPanel .chat-messages{
  padding:10px 8px 12px;gap:0;scrollbar-gutter:stable;
}
body.in-room #chatPanel .chat-message{
  flex:0 0 auto;min-height:0;max-width:100%;align-self:stretch;min-width:0;
  padding:6px 9px;border:0;border-radius:9px;
  background:transparent;box-shadow:none;
  transition:background .14s;overflow-wrap:anywhere;
}
body.in-room #chatPanel .chat-message:hover{background:color-mix(in srgb,var(--eg-frost-soft) 70%,transparent)}
body.in-room #chatPanel .chat-own{border:0;background:transparent}
body.in-room #chatPanel .chat-message-head{display:flex;align-items:center;gap:7px;margin:0 0 3px;min-height:27px}
body.in-room #chatPanel .chat-author{display:flex;align-items:center;gap:7px;min-width:0}
body.in-room #chatPanel .chat-avatar{width:25px;height:25px;min-width:25px;min-height:25px;overflow:hidden}
body.in-room #chatPanel .chat-avatar img{width:100%;height:100%;object-fit:cover}
body.in-room #chatPanel .chat-message-head strong{font-size:12px;font-weight:700;letter-spacing:0}
body.in-room #chatPanel .chat-message-head time{font-size:10px;white-space:nowrap;opacity:.82;margin-left:auto}
body.in-room #chatPanel .chat-message-text{
  margin:0 0 0 32px;padding:0;background:none;border:0;
  font-size:12.5px;line-height:1.52;overflow-wrap:anywhere;
}
body.in-room #chatPanel .chat-message.chat-consecutive{
  padding-top:2px;padding-bottom:2px;
}
body.in-room #chatPanel .chat-message.chat-consecutive .chat-message-head{display:none}
body.in-room #chatPanel .chat-message.chat-consecutive .chat-message-text{margin-left:32px}
body.in-room #chatPanel .chat-message:not(.chat-consecutive){margin-top:6px}
body.in-room #chatPanel .chat-message:first-of-type{margin-top:0}
body.in-room #chatPanel .image-message .image-thumbnail{
  box-sizing:border-box;margin:6px 0 2px 32px;
  max-width:calc(100% - 32px);width:fit-content;border-radius:11px;
  border:1px solid var(--eg-line);overflow:hidden;background:var(--eg-frost-soft);
}
body.in-room #chatPanel .image-message .image-thumbnail img{
  display:block;max-height:210px;max-width:100%;object-fit:contain;
}
body.in-room #chatPanel .image-message .image-save,
body.in-room #chatPanel .image-message .image-status{
  margin-left:32px;font-size:11px;line-height:1.35;
}
body.in-room #chatPanel .chat-compose{
  display:flex;align-items:center;gap:7px;
  padding:10px 11px;background:linear-gradient(160deg,var(--eg-frost),var(--eg-frost-heavy));
  border-top:1px solid var(--eg-line);
}
body.in-room #chatPanel .chat-compose textarea{
  flex:1;min-width:0;box-sizing:border-box;
  height:40px;min-height:40px;max-height:94px;
  resize:none;padding:10px 11px;
  border-radius:11px;border:1px solid var(--eg-line);
  background:color-mix(in srgb,var(--eg-frost-heavy) 82%,transparent);
  color:var(--eg-text);line-height:19px;font-size:12.5px;
}
body.in-room #chatPanel .chat-compose textarea:focus-visible{
  outline:0;border-color:color-mix(in srgb,var(--green) 64%,transparent);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--green) 16%,transparent);
}
body.in-room #chatPanel .chat-compose button{
  display:grid;place-items:center;width:40px;height:40px;min-width:40px;
  border-radius:12px;border:1px solid var(--eg-line);
  color:var(--eg-text);background:linear-gradient(150deg,var(--eg-frost-soft),var(--eg-frost));
  box-shadow:inset 0 1px 0 var(--eg-toplight);
  transition:transform .15s,background .15s,box-shadow .15s;
}
body.in-room #chatPanel .chat-compose button svg{
  width:19px;height:19px;stroke:currentColor;stroke-width:1.8;fill:none;
  stroke-linecap:round;stroke-linejoin:round;
}
body.in-room #chatPanel .chat-compose button:hover:not(:disabled){
  transform:translateY(-1px);border-color:color-mix(in srgb,var(--green) 56%,transparent);
}
body.in-room #chatPanel .chat-compose #chatSend{
  background:linear-gradient(160deg,#adf4d2,#73d7b0);
  color:#10352d;border:1px solid #aef7d5;
  box-shadow:0 4px 16px rgba(92,228,166,.15),inset 0 1px 0 rgba(255,255,255,.55);
}
body.in-room #chatPanel .chat-compose #chatSend:hover:not(:disabled){
  background:linear-gradient(150deg,#bbf9de,#87e5be);box-shadow:0 5px 20px rgba(88,210,162,.25)
}
body.in-room #chatPanel .chat-compose #chatSend:active,
body.in-room #chatPanel .chat-compose #imageAttach:active{transform:scale(.96)}
body.in-room #chatPanel .chat-compose button:focus-visible{outline:2px solid var(--green);outline-offset:2px}
body.in-room #chatPanel .chat-compose button:disabled{opacity:.5;cursor:default}
body.in-room #chatPanel .chat-jump-latest{bottom:70px}

/* Reduced motion and transparency are functional alternatives, not afterthoughts. */
@media (prefers-reduced-motion:reduce){
  .participant-card,.dock-button,
  body.in-room #chatPanel .chat-message,
  body.in-room #chatPanel .chat-compose button{transition:none!important}
}
@media (prefers-reduced-transparency:reduce){
  body.in-room #chatPanel,.entry-card,.settings-panel,.room-banner,.sound-card,.control-dock{
    background:var(--panel,#19232c)!important;backdrop-filter:none!important
  }
}
@supports (backdrop-filter:blur(12px)){
  .control-dock,body.in-room #chatPanel .chat-head,
  body.in-room #chatPanel .chat-compose,.entry-card{backdrop-filter:blur(14px) saturate(120%)}
}
@media (max-width:1100px){
  .lobby-layout{grid-template-columns:minmax(0,1fr) minmax(300px,390px);gap:24px}
  .call-layout{grid-template-columns:minmax(0,1fr) minmax(240px,285px);gap:16px}
  .participant-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,155px),1fr))}
}
@media (max-width:780px){
  .topbar{height:65px;min-height:65px}
  .lobby-layout{padding-block:18px 35px}
  .hero{min-height:unset}
  .hero h1{font-size:clamp(40px,9.7vw,60px);letter-spacing:-2.5px}
  .call-layout{grid-template-columns:minmax(0,1fr);padding-block:16px 26px}
  .call-heading h1{font-size:34px}
  .participant-card{min-height:148px;padding:10px}
  .control-dock{margin:17px auto 0;padding:8px 10px}
  body.in-room #chatPanel .chat-messages{padding:9px 6px}
}
@media (max-width:520px){
  .topbar{height:62px;min-height:62px}
  .topbar .brand{font-size:25px}
  .hero h1{font-size:clamp(37px,10vw,53px)}
  .entry-card{padding:20px 17px}
  .room-banner{padding:12px}
  .participant-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .participant-card{min-height:139px}
  .participant-card .avatar{width:49px;height:49px}
  .control-dock{max-width:100%}
  body.in-room #chatPanel .chat-compose{padding:8px;gap:6px}
  body.in-room #chatPanel .chat-compose button{width:38px;height:38px;min-width:38px}
  body.in-room #chatPanel .chat-compose textarea{height:38px;min-height:38px;padding:9px}
  body.in-room #chatPanel .chat-message-text{font-size:12.5px}
}


/* Stronger specificity over the established in-room grid overrides. The
   old room CSS intentionally placed the dock and speaker card full width. */
body.in-room #screenCall .participant-grid{
  grid-template-columns:repeat(auto-fill,minmax(min(100%,175px),1fr));
  align-content:start;
}
body.in-room #screenCall .control-dock{
  position:relative;display:flex;flex-direction:column;align-items:center;
  justify-content:center;justify-self:center;align-self:center;
  width:max-content;max-width:100%;height:auto;
  margin:0 auto;padding:9px 13px;gap:5px;
  border:1px solid var(--eg-line);border-radius:27px;
  background:linear-gradient(150deg,var(--eg-frost-soft),var(--eg-frost-heavy));
  box-shadow:var(--eg-shadow);grid-template-columns:none;grid-template-rows:none;
}
body.in-room #screenCall .control-dock .dock-buttons{
  background:transparent;border:0;padding:0;margin:0;box-shadow:none;
}
body.in-room #screenCall .settings-panel{
  height:fit-content;max-height:calc(100dvh - 100px);align-self:start;
}
@media (max-width:780px){
 body.in-room #screenCall .settings-panel{max-height:none}
 body.in-room #screenCall .participant-grid{
   grid-template-columns:repeat(auto-fill,minmax(min(100%,150px),1fr));
 }
}
@media (max-width:520px){
 body.in-room #screenCall .participant-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 body.in-room #screenCall .control-dock{padding:8px 10px;border-radius:24px}
}

/* Lobby viewport-fit: keep the native quit and feedback buttons visible.
   The room already manages its own viewport; this only affects the lobby.
   At phone widths, preserve normal page scrolling rather than hiding form controls. */
@media (min-width:681px) {
  body:not(.in-room) {
    height:100dvh;
    min-height:0;
    overflow:hidden;
  }
  body:not(.in-room) .app-shell {
    height:100dvh;
    min-height:0;
    max-height:100dvh;
    overflow:hidden;
    display:flex;
    flex-direction:column;
  }
  body:not(.in-room) .topbar {
    flex:0 0 auto;
  }
  body:not(.in-room) #screenLobby.lobby-layout {
    flex:1 1 auto;
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(300px,440px);
    align-items:center;
    min-height:0;
    min-width:0;
    padding:clamp(8px,2.2dvh,24px) 0;
    gap:clamp(14px,3vw,44px);
    overflow-x:hidden;
    overflow-y:auto; /* Only a genuine small-window fallback. */
    overscroll-behavior:contain;
    scrollbar-gutter:stable;
  }
  body:not(.in-room) #screenLobby .hero {
    align-self:center;
    min-height:0;
    justify-content:center;
  }
  body:not(.in-room) #screenLobby .entry-card {
    align-self:center;
    box-sizing:border-box;
    width:100%;
    margin-inline:0;
  }
  body:not(.in-room) .footer {
    flex:0 0 auto;
    min-height:45px;
    height:45px;
    padding-block:3px;
    box-sizing:border-box;
  }
}
@media (min-width:681px) and (max-width:1100px) {
  body:not(.in-room) #screenLobby.lobby-layout{
    grid-template-columns:minmax(0,1fr) minmax(295px,390px);
  }
}
@media (min-width:681px) and (max-width:840px) {
  body:not(.in-room) #screenLobby.lobby-layout{
    grid-template-columns:minmax(0,1fr) minmax(290px,345px);
    gap:14px;
  }
  body:not(.in-room) #screenLobby .hero h1{
    font-size:clamp(34px,5.7vw,48px);
    line-height:1.08;
    letter-spacing:-1.8px;
  }
  body:not(.in-room) #screenLobby .hero-description{font-size:13px;line-height:1.5}
  body:not(.in-room) #screenLobby .feature-row{gap:9px;font-size:11px}
}
@media (min-width:681px) and (max-height:790px) {
  body:not(.in-room) .topbar{height:67px;min-height:67px}
  body:not(.in-room) #screenLobby.lobby-layout{
    padding-block:10px;
  }
  body:not(.in-room) #screenLobby .hero h1{
    font-size:clamp(36px,4.8vw,62px);
    margin-bottom:14px;
  }
  body:not(.in-room) #screenLobby .hero-description{line-height:1.5}
  body:not(.in-room) #screenLobby .feature-row{margin-top:16px}
  body:not(.in-room) #screenLobby .entry-card{padding:22px 24px}
  body:not(.in-room) #screenLobby .entry-card h2{margin-top:0;font-size:23px}
  body:not(.in-room) #screenLobby .entry-mode-tabs{margin:13px 0 9px}
  body:not(.in-room) #screenLobby .entry-mode-description{margin-bottom:12px}
  body:not(.in-room) #screenLobby .entry-create-info{min-height:74px;padding:10px 13px}
  body:not(.in-room) #screenLobby .inline-check{margin:12px 0 13px}
  body:not(.in-room) #screenLobby .field-label{margin-bottom:6px}
  body:not(.in-room) #screenLobby .entry-card input:not([type=checkbox]){min-height:44px}
  body:not(.in-room) #screenLobby .primary-button{min-height:45px}
  body:not(.in-room) #screenLobby .entry-mode-tab{min-height:40px}
}
@media (min-width:681px) and (max-height:640px) {
  body:not(.in-room) .topbar{height:58px;min-height:58px}
  body:not(.in-room) #screenLobby.lobby-layout{padding-block:6px}
  body:not(.in-room) #screenLobby .entry-card{padding:15px 18px}
  body:not(.in-room) #screenLobby .entry-card h2{font-size:20px}
  body:not(.in-room) #screenLobby .entry-mode-tabs{margin:8px 0 7px;padding:3px}
  body:not(.in-room) #screenLobby .entry-mode-tab{min-height:36px;padding:7px}
  body:not(.in-room) #screenLobby .entry-mode-description{margin-bottom:7px}
  body:not(.in-room) #screenLobby .entry-create-info{min-height:60px;padding:7px 10px}
  body:not(.in-room) #screenLobby .inline-check{margin:7px 0 8px}
  body:not(.in-room) #screenLobby .entry-card input:not([type=checkbox]){min-height:40px}
  body:not(.in-room) #screenLobby .primary-button{min-height:42px}
  body:not(.in-room) #screenLobby .hero h1{margin-bottom:10px}
  body:not(.in-room) #screenLobby .feature-row{margin-top:10px}
  body:not(.in-room) .footer{min-height:42px;height:42px}
}
@media (min-width:681px) and (max-height:520px) {
  body:not(.in-room) .topbar{height:52px;min-height:52px}
  body:not(.in-room) #screenLobby.lobby-layout{padding-block:4px}
  body:not(.in-room) #screenLobby .hero h1{font-size:clamp(32px,4.2vw,49px)}
  body:not(.in-room) #screenLobby .hero-description{font-size:12px}
  body:not(.in-room) #screenLobby .entry-card{padding:12px 16px}
  body:not(.in-room) #screenLobby .entry-create-info{min-height:51px}
  body:not(.in-room) #screenLobby .entry-mode-tab{min-height:34px}
  body:not(.in-room) #screenLobby .entry-mode-description{margin-bottom:5px}
}


/* 681–780 px is still a usable two-column desktop window. The header already
   contains the Windows download link, so do not create a third grid row. */
@media (min-width:681px) and (max-width:780px){
  body:not(.in-room) #screenLobby .windows-download-mobile{display:none!important}
  body:not(.in-room) #screenLobby .hero .windows-download-card{display:none!important}
}
@media (min-width:681px) and (max-height:520px) {
  body:not(.in-room) #screenLobby .entry-card{padding:9px 14px}
  body:not(.in-room) #screenLobby .entry-create-info{
    min-height:38px;
    padding:4px 8px;
    gap:8px;
  }
  body:not(.in-room) #screenLobby .entry-create-info-description{display:none}
  body:not(.in-room) #screenLobby .entry-create-info-icon{width:29px;height:29px}
  body:not(.in-room) #screenLobby .entry-mode-tabs{margin-top:5px;margin-bottom:5px}
  body:not(.in-room) #screenLobby .entry-mode-description{margin-bottom:4px}
  body:not(.in-room) #screenLobby .inline-check{margin-block:5px}
}


@media (min-width:681px) and (max-height:520px) {
  /* Preserve labels, both room tabs, the nickname and the primary action.
     Only redundant helper copy is suppressed in the smallest desktop window. */
  body:not(.in-room) #screenLobby .entry-mode-description{display:none}
  body:not(.in-room) #screenLobby .entry-card{padding:7px 14px}
  body:not(.in-room) #screenLobby .entry-create-info{min-height:34px}
}
