/* v2.2.3 — ChatGPT-style mobile conversation layout.
   Scoped to normal AI chat. Translator and two-person voice mode are untouched. */
body:has(#chatView.active){--header-height:64px;--nav-height:64px}
main:has(> #chatView.active){display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:0 12px 6px;}
#chatView.active{
  display:flex;flex-direction:column;flex:1 1 auto;min-height:0!important;
  height:100%!important;overflow:hidden;padding-top:8px;gap:0;
}
#chatView .section-head{
  display:flex;align-items:center;justify-content:space-between;
  flex:0 0 auto;gap:8px;margin:0 0 6px;padding:0;
}
#chatView .section-head h1{font-size:22px;line-height:1.25;margin:0;padding:0}
#chatView .section-head p{display:none}
#chatView #clearChatBtn{position:static;font-size:18px;font-weight:900;-webkit-text-stroke:.3px currentColor;color:#ffe3a0;border:2px solid #d8b66d;min-height:44px;line-height:1.25;padding:9px 14px;border-radius:13px;white-space:nowrap;max-width:72%}
/* The globe animates only while an actual request is pending. */
#chatView .section-head{display:grid;grid-template-columns:auto minmax(40px,1fr) auto}
#chatView #clearChatBtn{max-width:none;white-space:normal}
#chatView .chat-working{position:relative;justify-self:center;display:grid;place-items:center;width:100%;height:44px;min-width:40px;flex-shrink:0}
#chatView .chat-working-sphere{display:block;width:30px;height:30px;border-radius:50%;background:#0b3158 url('earth-texture-yoryi.jpg') 0 50%/auto 100%;box-shadow:inset -6px -3px 8px #020c20b3,inset 2px 1px 4px #ffffff44,0 0 8px #52baff55}
#chatView .chat-working-orbit{position:absolute;inset:0;overflow:hidden;pointer-events:none;opacity:0}
#chatView .chat-working-orbit i{position:absolute;display:block;width:15px;height:2px;border-radius:50%;background:linear-gradient(90deg,#fff4c9,#e8bc66 35%,transparent);box-shadow:2px 0 5px #eac679;left:100%;top:-3px;transform:rotate(-20deg);opacity:0}
#chatView .chat-working-orbit i:nth-child(2){animation-delay:-.6s!important}
#chatView .chat-working-orbit i:nth-child(3){animation-delay:-1.2s!important}
#chatView .chat-working[data-working="true"] .chat-working-sphere{animation:yoryi-globe-turn 3s linear infinite;box-shadow:inset -6px -3px 8px #020c20b3,inset 2px 1px 4px #ffffff44,0 0 12px #52baff88}
#chatView .chat-working[data-working="true"] .chat-working-orbit{opacity:1}
#chatView[aria-busy="true"] > .assistant-status{display:none}
@keyframes yoryi-globe-turn{to{background-position:200% 50%}}
#chatView .chat-working[data-working="true"] .chat-working-orbit i{animation:yoryi-shooting-star 1.8s linear infinite}
@keyframes yoryi-shooting-star{0%{left:100%;top:-3px;opacity:0}10%,85%{opacity:1}100%{left:-18px;top:43px;opacity:0}}
@media(prefers-reduced-motion:reduce){#chatView .chat-working[data-working="true"] *{animation:none!important}#chatView .chat-working[data-working="true"] .chat-working-orbit i{opacity:1;left:50%;top:7px}}
#chatView .assistant-bar{display:flex;align-items:center;gap:7px;flex:0 0 auto;min-height:38px;margin:0 0 2px;padding:0}
#chatView .assistant-bar select{
 flex:1 1 auto;min-width:0;width:0;min-height:38px;max-width:none;
 padding:7px 10px;font-size:14px;line-height:1.2;border-radius:12px;
 background:#0a2038;color:#f7f2e8
}
#chatView #openMemory{flex:0 0 38px;min-width:38px;width:38px;height:38px;min-height:38px;padding:4px;font-size:18px;line-height:1;border-radius:12px}
#chatView .assistant-status{
  flex:0 0 auto;min-height:0;max-height:2.6em;overflow-y:auto;
  margin:0 0 5px;font-size:12px;line-height:1.25;color:#d7ba7c;
  scrollbar-width:thin;
}
#chatView .messages{
  flex:1 1 0;min-height:0!important;max-height:none!important;
  overflow-y:auto;overscroll-behavior:contain;
  padding:4px 1px 9px;margin:0;scrollbar-width:thin;
  scrollbar-color:#c19d58 #071a30;
}
#chatView .message{margin:8px 0 12px;min-width:0}
#chatView .message.ai{margin:6px 0 15px}
#chatView .message.ai .bubble{
  width:auto;max-width:100%;padding:5px 3px;border:0;
  border-radius:0;background:transparent;color:#f7f2e8;
  font-size:20px;line-height:1.48;font-weight:450;white-space:normal;
}
#chatView .message.user .bubble{
  max-width:88%;padding:10px 13px;border:1px solid #335a7d;
  border-radius:18px;background:#19344f;color:#f7f2e8;
  font-size:19px;line-height:1.45;font-weight:450;white-space:pre-wrap;
}
#chatView .message .meta{font-size:12px;line-height:1.3;color:#a7b6c5;margin-top:6px}
#chatView .chat-source-links{font-size:15px;line-height:1.45}
#chatView .composer{
  display:grid;grid-template-columns:minmax(0,1fr) 42px 42px;
  grid-template-rows:auto;align-items:end;gap:4px;
  flex:0 0 auto;position:relative;bottom:auto!important;
  margin:0;padding:5px;min-width:0;
  border:1px solid #49617b;border-radius:23px;
  background:#0d233b;box-shadow:0 -3px 16px #020b1822;
}
#chatView .composer textarea{
  grid-column:1;grid-row:1;width:100%;min-width:0;
  height:42px;min-height:42px!important;max-height:132px!important;
  padding:9px 8px;margin:0;border:0;outline:none;
  background:transparent;color:#f8f1e5;
  border-radius:16px;resize:none;overflow-y:auto;
  font-size:18px;font-weight:450;line-height:24px;
  box-sizing:border-box;
}
#chatView .composer textarea::placeholder{color:#bdc8d4;opacity:1}
#chatView .composer:focus-within{border-color:#e3bc72}
#chatView .composer .chat-mic,#chatView .composer .send-btn{
  width:42px;height:42px;min-height:42px;padding:0;
  display:flex;align-items:center;justify-content:center;
  border-radius:50%;font-size:22px;line-height:1;
  flex:none;touch-action:manipulation;
}
#chatView .composer .chat-mic{grid-column:2;grid-row:1;background:#193b5a}
#chatView .composer .send-btn{grid-column:3;grid-row:1;background:linear-gradient(135deg,#ffe8a7,#f2c66d);color:#07182c;border:0}
#chatView .composer .chat-mic:focus-visible,#chatView .composer .send-btn:focus-visible{outline:3px solid #fff;outline-offset:2px}
#chatView .chat-voice-status{
  flex:0 0 auto;font-size:12px;line-height:1.3;
  margin:2px 3px 0;padding:0;color:#e6c980;
  max-height:2.6em;overflow-y:auto;
}
#chatView .chat-voice-status:empty{display:none}
@media(max-width:360px){
 #chatView .message.ai .bubble{font-size:19px}
 #chatView .message.user .bubble{font-size:18px}
 #chatView .composer textarea{font-size:17px}
}
@media(max-height:590px){
 #chatView .section-head{margin-bottom:3px}
 #chatView .assistant-bar{margin-bottom:0}
 #chatView .message.ai{margin-bottom:8px}
}
body.yoryi-keyboard-open main:has(> #chatView.active){padding-bottom:5px}

#chatView .chat-retry{align-self:flex-start;flex:0 0 auto;min-height:40px;margin:2px 0 6px;padding:8px 12px;font-size:15px;border-radius:12px}
#chatView .chat-retry[hidden]{display:none}

/* v2.2.12: photo attachment without shrinking the answer area */
#chatView .composer{grid-template-columns:minmax(0,1fr) 42px 42px 42px;}
#chatView .composer .chat-photo{grid-column:2;grid-row:1;width:42px;height:42px;min-height:42px;padding:0;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#193b5a;color:#fff;font-size:23px;line-height:1;touch-action:manipulation;}
#chatView .composer .chat-mic{grid-column:3;}
#chatView .composer .send-btn{grid-column:4;}
#chatView .composer .chat-photo:focus-visible,#chatView #chatPhotoRemove:focus-visible{outline:3px solid #fff;outline-offset:2px;}
#chatView .chat-photo-preview:not([hidden]){display:flex;align-items:center;justify-content:space-between;flex:0 0 auto;gap:8px;max-width:100%;padding:5px 8px;margin:2px 3px;border:1px solid #8a744b;border-radius:10px;background:#132b42;color:#ffe3a8;font-size:14px;}
#chatView .chat-photo-preview span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}
#chatView .chat-photo-preview button{min-height:34px;min-width:34px;flex:none;font-size:18px;padding:0;border-radius:8px;}
#chatView .chat-photo-preview[hidden]{display:none;}
@media(max-width:360px){#chatView .composer{grid-template-columns:minmax(0,1fr) 39px 39px 39px;gap:3px;}#chatView .composer .chat-photo,#chatView .composer .chat-mic,#chatView .composer .send-btn{width:39px;height:42px;min-height:42px;}}

/* v2.2.13: an extra compact video attachment button, same size as photo */
#chatView .composer{grid-template-columns:minmax(0,1fr) repeat(4,42px);}
#chatView .composer .chat-video{grid-column:3;grid-row:1;width:42px;height:42px;min-height:42px;padding:0;display:flex;align-items:center;justify-content:center;border-radius:50%;background:#193b5a;color:#fff;font-size:21px;line-height:1;touch-action:manipulation;}
#chatView .composer .chat-mic{grid-column:4;}
#chatView .composer .send-btn{grid-column:5;}
#chatView .composer .chat-video:focus-visible,#chatView #chatVideoRemove:focus-visible{outline:3px solid #fff;outline-offset:2px;}
#chatView #chatVideoPreview:not([hidden]){display:flex;}
@media(max-width:360px){#chatView .composer{grid-template-columns:minmax(0,1fr) repeat(4,38px);gap:3px;}#chatView .composer .chat-photo,#chatView .composer .chat-video,#chatView .composer .chat-mic,#chatView .composer .send-btn{width:38px;min-height:42px;height:42px;font-size:21px;}}
