/* Echo Midnight Glass — finishing pass.
   Short, quiet feedback for voice states; no extra network messages or
   microphone processing. Keep readability across Echo/Night/Day themes. */

/* Start with what Echo actually does today: code-first rooms, voice + chat. */
#screenLobby .hero h1{
  font-size:clamp(40px,4.7vw,70px);
  line-height:1.075;
  letter-spacing:-2.6px;
}
#screenLobby .hero-description{max-width:435px}
#screenLobby .feature-row{display:flex;flex-wrap:wrap;gap:9px 19px}
#screenLobby .entry-create-info-icon{
  background:linear-gradient(140deg,rgba(123,232,176,.18),rgba(95,171,153,.08));
  box-shadow:inset 0 1px 0 rgba(205,255,231,.13);
}

/* Larger portraits are valuable now that Echo has its own illustration set.
   A small speaking-only visualizer stays inside each participant tile. */
body.in-room #screenCall .participant-card{min-height:178px}
body.in-room #screenCall .participant-card .avatar{
  width:74px;height:74px;font-size:28px;
  transition:transform .18s ease,filter .18s ease;
}
body.in-room #screenCall .participant-card .avatar-wrap{
  position:relative;isolation:isolate;min-width:74px;
  margin:5px auto 14px;
}
body.in-room #screenCall .participant-card .avatar-wrap::before,
body.in-room #screenCall .participant-card .avatar-wrap::after{
  content:"";position:absolute;inset:-8px;border:1px solid rgba(148,245,196,.38);
  border-radius:50%;opacity:0;pointer-events:none;z-index:0;
}
body.in-room #screenCall .participant-card .avatar-wrap .avatar{
  position:relative;z-index:2;
}
/* The fox's ear tips are drawn in transparent pixels beyond the shared rim.
   Do not circularly clip the image itself; its corners are already transparent.
   The ring is still part of the WebP, so the voice activity ring stays separate. */
:is(.avatar,.chat-avatar,.avatar-choice,.avatar-profile-preview) img[src="/avatars/fox.webp"]{
  border-radius:0;
}
body.in-room #screenCall .participant-card .activity-ring{
  inset:-5px;z-index:3;pointer-events:none;
}
body.in-room #screenCall .participant-card.speaking .activity-ring{
  border-color:rgba(154,239,196,.9);
  box-shadow:0 0 0 2px rgba(141,232,179,.08);
  opacity:var(--voice-strength,.82);
}
body.in-room #screenCall .participant-card.speaking .avatar{
  filter:drop-shadow(0 3px 9px rgba(119,233,184,.12));
}
body.in-room #screenCall .participant-card.speaking .avatar-wrap::before{
  animation:echo-soft-voice-wave 1.72s ease-out infinite;
}
body.in-room #screenCall .participant-card.speaking .avatar-wrap::after{
  animation:echo-soft-voice-wave 1.72s ease-out .86s infinite;
}
@keyframes echo-soft-voice-wave{
  0%{transform:scale(.98);opacity:.38}
  65%{opacity:.18}
  100%{transform:scale(1.19);opacity:0}
}
body.in-room #screenCall .voice-wave-meter{
  display:flex;align-items:center;justify-content:center;gap:3px;
  position:absolute;bottom:-11px;left:50%;transform:translateX(-50%);
  height:16px;padding:2px 6px;z-index:4;pointer-events:none;
  border-radius:9px;
  background:var(--eg-frost-heavy,#19252c);
  border:1px solid var(--eg-line,rgba(130,230,181,.16));
  opacity:0;transition:opacity .2s ease;
}
body.in-room #screenCall .voice-wave-meter i{
  display:block;width:3px;height:11px;flex:0 0 3px;
  border-radius:3px;background:var(--green,#9ceac1);
  transform:scaleY(.28);transform-origin:center;
}
body.in-room #screenCall .participant-card.speaking .voice-wave-meter{
  opacity:var(--voice-strength,1);
}
body.in-room #screenCall .participant-card.speaking .voice-wave-meter i{
  animation:echo-voice-bars 850ms ease-in-out infinite alternate;
}
body.in-room #screenCall .voice-wave-meter i:nth-child(1){animation-delay:-.08s}
body.in-room #screenCall .voice-wave-meter i:nth-child(2){animation-delay:-.43s}
body.in-room #screenCall .voice-wave-meter i:nth-child(3){animation-delay:-.67s}
body.in-room #screenCall .voice-wave-meter i:nth-child(4){animation-delay:-.31s}
body.in-room #screenCall .voice-wave-meter i:nth-child(5){animation-delay:-.57s}
@keyframes echo-voice-bars{
  from{transform:scaleY(.30)}to{transform:scaleY(1)}
}
body.in-room #screenCall .participant-grid.is-crowded .participant-card .avatar{
  width:60px;height:60px;font-size:24px;
}
body.in-room #screenCall .participant-grid.is-crowded .participant-card .avatar-wrap{
  min-width:60px;margin-block:0 12px;
}
body.in-room #screenCall .participant-grid.is-crowded .participant-card{
  min-height:153px;padding:10px;
}

/* Settings: compact desktop rail, ordinary select on narrow/mobile windows.
   The existing content-scrolling behavior remains unchanged. */
@media(min-width:840px) and (min-height:560px){
  .preferences-dialog[open]{
    width:min(795px,calc(100vw - 28px));
    height:min(760px,calc(100dvh - 28px));
    max-height:calc(100dvh - 28px);
    display:grid;grid-template-columns:192px minmax(0,1fr);
    grid-template-rows:auto minmax(0,1fr);
    background:var(--eg-frost-heavy,var(--panel));
    border-color:var(--eg-line,var(--border));
  }
  .preferences-dialog .preferences-header{
    grid-row:1;grid-column:1/-1;
    border-bottom:1px solid var(--eg-line,var(--border));
    background:linear-gradient(135deg,var(--eg-frost-soft,var(--panel)),var(--eg-frost-heavy,var(--panel)));
    padding:15px 19px;
  }
  .preferences-dialog .preferences-navigation{
    grid-row:2;grid-column:1;
    min-width:0;min-height:0;padding:15px 10px;
    overflow-x:hidden;overflow-y:auto;
    border-right:1px solid var(--eg-line,var(--border));
    border-bottom:0;
    background:var(--eg-frost-heavy,var(--panel));
  }
  .preferences-dialog .preferences-navigation select{display:none}
  .preferences-dialog .preferences-nav-list{display:grid;gap:5px}
  .preferences-dialog .preferences-content{
    grid-row:2;grid-column:2;min-width:0;min-height:0;
    padding:19px 22px 28px;
  }
}
.preferences-dialog .preferences-nav-list{display:none}
@media(min-width:840px) and (min-height:560px){
  .preferences-dialog .preferences-nav-list{display:grid}
}
.preferences-dialog .preferences-nav-list button{
  width:100%;min-height:40px;display:flex;align-items:center;gap:11px;
  padding:9px 11px;border:1px solid transparent;
  border-radius:10px;text-align:left;cursor:pointer;font:inherit;
  font-size:12.5px;font-weight:550;
  color:var(--muted,#a6b7b8);background:transparent;
  transition:background .16s,border-color .16s,color .16s;
}
.preferences-dialog .preferences-nav-list button svg{
  width:17px;height:17px;flex:none;
  stroke:currentColor;stroke-width:1.75;fill:none;
  stroke-linecap:round;stroke-linejoin:round;
}
.preferences-dialog .preferences-nav-list button:hover{
  color:var(--eg-text,var(--text));background:var(--eg-frost-soft,var(--panel-soft));
}
.preferences-dialog .preferences-nav-list button[aria-current="true"]{
  color:var(--green,#a0efc6);
  background:color-mix(in srgb,var(--green) 11%,var(--eg-frost-heavy));
  border-color:var(--eg-line,var(--border));
}
.preferences-dialog .preferences-nav-list button:focus-visible{
  outline:2px solid var(--green);outline-offset:2px;
}
.preferences-dialog .preferences-content > section{
  scroll-margin-top:12px;
}
.preferences-dialog .avatar-profile-preview{
  display:flex;align-items:center;gap:13px;
  padding:12px;margin-top:10px;min-height:82px;
  background:var(--eg-frost-soft,var(--panel-soft));
  border:1px solid var(--eg-line,var(--border));
  border-radius:14px;
}
.preferences-dialog .avatar-profile-preview .avatar{
  width:65px;height:65px;min-width:65px;display:grid;place-items:center;
  font-size:25px;overflow:hidden;
}
.preferences-dialog .avatar-profile-preview-copy{display:grid;min-width:0;gap:5px}
.preferences-dialog .avatar-profile-preview-copy strong{
  font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.preferences-dialog .avatar-profile-preview-copy small{
  font-size:11.5px;color:var(--muted);
}
.preferences-dialog .avatar-choices{
  grid-template-columns:repeat(auto-fill,minmax(46px,1fr));
  gap:10px;margin-top:13px;
}
.preferences-dialog .avatar-choice{
  width:46px;height:46px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08);
  transition:transform .15s,border-color .15s;
}
.preferences-dialog .avatar-choice:hover{transform:translateY(-2px)}
.preferences-dialog .avatar-choice[aria-pressed="true"]{
  border-color:var(--green);box-shadow:0 0 0 2px color-mix(in srgb,var(--green) 15%,transparent);
}
.preferences-dialog .preferences-content h3{letter-spacing:-.3px}
.preferences-dialog .preferences-header h2{letter-spacing:-.4px}
@media(max-width:520px){
  body.in-room #screenCall .participant-card .avatar{
    width:56px;height:56px;font-size:22px;
  }
  body.in-room #screenCall .participant-card .avatar-wrap{
    min-width:56px;margin:3px auto 11px;
  }
  body.in-room #screenCall .participant-card{min-height:146px}
  body.in-room #screenCall .participant-grid.is-crowded .participant-card .avatar{width:50px;height:50px}
  body.in-room #screenCall .participant-grid.is-crowded .participant-card .avatar-wrap{min-width:50px}
  .preferences-dialog .avatar-choices{grid-template-columns:repeat(auto-fill,minmax(42px,1fr))}
  .preferences-dialog .avatar-choice{width:42px;height:42px}
}
/* Accessibility and low-power defaults: no endless animations. */
:root[data-reduce-motion="true"] .participant-card.speaking .avatar-wrap::before,
:root[data-reduce-motion="true"] .participant-card.speaking .avatar-wrap::after,
:root[data-reduce-motion="true"] .participant-card.speaking .voice-wave-meter i{
  animation:none!important;
}
@media(prefers-reduced-motion:reduce){
  .participant-card.speaking .avatar-wrap::before,
  .participant-card.speaking .avatar-wrap::after,
  .participant-card.speaking .voice-wave-meter i{animation:none!important}
}
:root[data-reduce-transparency="true"] .entry-card,
:root[data-reduce-transparency="true"] .settings-panel,
:root[data-reduce-transparency="true"] .room-banner,
:root[data-reduce-transparency="true"] .control-dock,
:root[data-reduce-transparency="true"] .preferences-dialog,
:root[data-reduce-transparency="true"] body.in-room #chatPanel{
  background:var(--panel,#1c252e)!important;
  backdrop-filter:none!important;
}
:root[data-reduce-transparency="true"] body.in-room #chatPanel .chat-head,
:root[data-reduce-transparency="true"] body.in-room #chatPanel .chat-compose{
  backdrop-filter:none!important;
  background:var(--panel,#1c252e)!important;
}
:root[data-reduce-transparency="true"] .participant-card.speaking .avatar-wrap::before,
:root[data-reduce-transparency="true"] .participant-card.speaking .avatar-wrap::after{
  animation:none!important;
}

/* On narrow phones the original card switches to a two-column grid. That was
   designed for 48px placeholders; real Echo portraits need a vertical tile. */
@media(max-width:520px){
  body.in-room #screenCall .participant-grid .participant-card{
    display:flex;flex-direction:column;justify-content:space-between;
    min-height:156px;padding:10px 11px;
    grid-template-columns:none;grid-template-rows:none;
  }
  body.in-room #screenCall .participant-grid .participant-card .tile-top{
    width:100%;gap:5px;min-width:0;
  }
  body.in-room #screenCall .participant-grid .participant-card .avatar-wrap{
    margin:1px auto 11px;align-self:center;
  }
  body.in-room #screenCall .participant-grid .participant-card .tile-bottom{
    width:100%;min-width:0;gap:5px;
    display:flex;flex-direction:row;justify-content:space-between;
    align-items:center;
  }
  body.in-room #screenCall .participant-grid .participant-card .tile-name{
    min-width:0;max-width:calc(100% - 26px);
    flex:1 1 auto;gap:3px;
  }
  body.in-room #screenCall .participant-grid .participant-card .tile-name strong{
    display:block;max-width:100%;font-size:11.5px;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  body.in-room #screenCall .participant-grid .participant-card .tile-name .small-muted{
    font-size:10px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;
  }
  body.in-room #screenCall .participant-grid .participant-card .mic-icon{
    flex:0 0 20px;width:20px;
  }
  body.in-room #screenCall .participant-grid.is-crowded .participant-card{
    min-height:148px;
  }
}

/* Win10/11 daylight contrast. Original styles contain more specific button
   backgrounds, so declare the actual background-color with higher priority. */
:root[data-theme="day"] body .topbar .topbar-windows-download{
  color:#22513f!important;
  background-color:#e4f2eb!important;
  background-image:none!important;
  border-color:#accfbe!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.85);
}
:root[data-theme="day"] body .topbar .topbar-windows-download:hover{
  background-color:#d3eadd!important;
  border-color:#7cb99a!important;
}
:root[data-theme="day"] body.in-room #screenCall .dock-button:not(.dock-danger):not(.is-off){
  color:#244b3d!important;
  background-color:#f2faf6!important;
  background-image:none!important;
  border-color:#abcbbd!important;
}
:root[data-theme="day"] body.in-room #screenCall .dock-button.is-off{
  color:#8a3446!important;
  background-color:#f8e7e9!important;
  background-image:none!important;
  border-color:#d8b3ba!important;
}
:root[data-theme="day"] body.in-room #screenCall .dock-button.dock-danger{
  color:#fff6f7!important;
  background-color:#754553!important;
  background-image:none!important;
  border-color:#8e6270!important;
}
:root[data-theme="day"] body.in-room #screenCall .dock-button:not(:disabled):hover{
  filter:brightness(.98);
}
