/* A single, growing composer. File previews remain above the form. */
.chat-compose #chat-form {
  --tool:44px;
  --send:44px;
  --space:7px;
  position:relative;
  display:flex;
  flex-flow:row nowrap;
  align-items:flex-end;
  width:100%;
  min-width:0;
  gap:0;
  padding:0;
  margin:0;
  grid-template-areas:none;
  grid-template-columns:none;
}
.chat-compose #chat-form::before {
  content:"";
  position:absolute;
  inset:0 calc(var(--send) + var(--space)) 0 0;
  pointer-events:none;
  border:1px solid var(--line);
  border-radius:22px;
  background:var(--surface);
}
.chat-compose #chat-form:focus-within::before {border-color:var(--gold)}
#chat-form .chat-emojis,#chat-form > label.icon-button,#chat-form #kd-mic,
#chat-form .chat-emojis > summary.icon-button,#chat-form > button[type=submit] {
  box-sizing:border-box;
  width:var(--tool);
  min-width:0;
  height:44px;
  min-height:44px;
  padding:0;
  margin:0;
  flex:0 0 var(--tool);
  border:0;
  border-radius:22px;
  color:var(--copper-dark);
  touch-action:manipulation;
}
#chat-form > label.icon-button,#chat-form #kd-mic,#chat-form .chat-emojis > summary.icon-button {
  position:relative;
  display:grid;
  place-items:center;
  background:transparent;
  cursor:pointer;
}
#chat-form .chat-emojis > summary.icon-button {display:flex;justify-content:center;align-items:center}
#chat-form .chat-emojis > summary span {font-size:29px;transform:translateY(-1px)}
#chat-form > label.icon-button .icon,#chat-form #kd-mic svg {width:22px;height:22px;stroke-width:1.85}
#chat-form .chat-emojis[open] > summary.icon-button,
#chat-form > label.icon-button:active,#chat-form #kd-mic:active {background:var(--pale)}
#chat-form #chat-input {
  position:relative;
  flex:1 1 0%;
  min-width:0;
  width:0;
  min-height:44px;
  max-height:120px;
  height:44px;
  box-sizing:border-box;
  margin:0;
  padding:10px 3px;
  border:0;
  border-radius:0;
  box-shadow:none;
  background:transparent;
  color:var(--ink);
  font-size:17px;
  line-height:24px;
  resize:none;
  overflow-wrap:anywhere;
}
#chat-form #chat-input:focus {outline:none}
#chat-form #chat-input::placeholder {color:var(--muted);opacity:.85}
#chat-form > button.primary[type=submit] {
  flex:0 0 var(--send);
  width:var(--send);
  margin-inline-start:var(--space);
  color:var(--surface);
  background:var(--copper);
}
#chat-form > button.primary[type=submit] .icon {width:21px;height:21px;margin-left:2px}
#chat-form > button.primary[type=submit]:active {background:var(--copper-dark)}
#chat-form #kd-mic:focus-visible {outline:2px solid var(--copper);outline-offset:-3px}
@media(max-width:389px){
  .chat-compose #chat-form {--tool:39px;--space:5px}
}
@media(max-width:349px){
  .chat-compose #chat-form {--tool:36px;--space:4px}
  #chat-form #chat-input {font-size:16px}
}
#chat-form .chat-emojis > .chat-emoji-panel {
  top:auto;
  bottom:calc(100% + 8px);
  left:0;
  width:344px;
  max-width:100%;
  height:248px;
  max-height:48vh;
  max-height:clamp(88px,calc(var(--chat-viewport-height,100dvh) - 174px),248px);
  overflow-y:auto;
}
.chat-compose #chat-form.kd-listening {display:none!important}
#kd-bar {
  display:flex;align-items:center;gap:4px;
  padding:2px 3px;box-sizing:border-box;
  width:100%;min-height:50px;min-width:0;
  border:1px solid var(--line);border-radius:25px;
  background:var(--surface);color:var(--ink);
}
#kd-bar button {
  box-sizing:border-box;flex:0 0 44px;width:44px;height:44px;
  margin:0;padding:0;display:grid;place-items:center;
  background:var(--bg);border:0;border-radius:50%;
  color:var(--ink);touch-action:manipulation;
}
#kd-bar button:active {transform:scale(.95)}
#kd-bar button:disabled {opacity:.48}
#kd-bar button.kd-take {background:var(--copper);color:var(--surface);width:52px;flex-basis:52px;border-radius:24px}
#kd-bar button svg {width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
#kd-bar .kd-take svg {width:24px;height:24px}
#kd-bar .kd-center {min-width:0;flex:1 1 0;padding:0 5px;font-size:14px;line-height:1.3;overflow-wrap:anywhere}
#kd-bar .kd-signal {display:none;align-items:center;gap:10px}
#kd-bar[data-mode=live] .kd-signal {display:flex}
#kd-bar [role=timer] {font-variant-numeric:tabular-nums;font-size:13px;font-weight:550;color:var(--copper-dark)}
#kd-bar[data-mode=live] [role=status] {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#kd-bar .kd-wave {display:flex;align-items:center;gap:3px;flex:1 1 0;height:32px;min-width:0;overflow:hidden}
#kd-bar .kd-wave i {display:block;flex:none;width:2.5px;height:5px;border-radius:5px;background:var(--muted);opacity:.7;--peak:3.3}
#kd-bar .kd-wave i:nth-child(3n) {--peak:2.1;animation-delay:-.17s}
#kd-bar .kd-wave i:nth-child(4n) {--peak:4.8;animation-delay:-.38s}
#kd-bar .kd-wave i:nth-child(5n) {--peak:1.5;animation-delay:-.29s}
#kd-bar .kd-wave i:nth-child(7n) {--peak:5.3;animation-delay:-.47s}
#kd-bar .kd-wave.kd-speaking i {background:var(--copper);opacity:1;animation-name:kd-pulse;animation-iteration-count:infinite;animation-duration:.62s;animation-timing-function:ease-in-out}
@keyframes kd-pulse {0%,100%{transform:scaleY(1)}50%{transform:scaleY(var(--peak))}}
@media(prefers-reduced-motion:reduce){#kd-bar .kd-wave.kd-speaking i{animation:none;transform:scaleY(calc(var(--peak)*.6))}}
#kd-bar:not([data-mode=live]) .kd-stop,
#kd-bar:not([data-mode=live]):not([data-mode=review]) .kd-take {display:none}
#kd-bar .kd-result:not(:empty) {padding:6px 0;line-height:1.42;font-size:16px;max-height:110px;white-space:pre-wrap;overflow-y:auto;-webkit-user-select:text;user-select:text}
#kd-bar[data-mode=error] [role=status],#kd-bar[data-mode=long] [role=status]{color:var(--copper-dark)}
