/* GAIHA Chat 0.5 — isolated, responsive Chatway-inspired workspace */
body.gaiha-chat-page .entry-title,body.gaiha-chat-page .page-title,body.gaiha-chat-page .post-title,body.gaiha-chat-page .article-title,body.gaiha-chat-page .banner-title,body.gaiha-chat-page .page-header,body.gaiha-chat-page .post-header,body.gaiha-chat-page .article-header,body.gaiha-chat-page h1.entry-title{display:none!important}
body.gaiha-chat-page .entry-content,body.gaiha-chat-page .post-content{margin-top:0!important}
body.gaiha-chat-page .gaiha-chat-root{width:min(1440px,calc(100vw - 26px));max-width:none;margin:6px auto 24px;height:clamp(590px,calc(100dvh - 140px),940px);min-height:590px;border:1px solid #e8edf4;border-radius:15px;box-shadow:0 12px 46px #152d5410;background:#fff;overflow:hidden}
.gaiha-chat-root{--gc-primary:#2e70dc;--gc-stroke:#e9edf4;--gc-text:#17263b;color:var(--gc-text);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif}
.gaiha-chat-root .gc-app{display:grid;grid-template-columns:64px 290px minmax(0,1fr) 245px;grid-template-rows:minmax(0,1fr);height:100%}
.gaiha-chat-root .gc-rail{grid-column:1;grid-row:1;background:#132744;display:flex;flex-direction:column;align-items:center;gap:13px;padding:20px 8px;min-height:0}
.gaiha-chat-root .gc-rail-logo{width:40px;height:40px;border-radius:12px;background:#337eea;color:#fff;display:grid;place-items:center;font-weight:800;font-size:22px;margin-bottom:24px}
.gaiha-chat-root .gc-rail-btn{position:relative;border:0;background:transparent;color:#acbcd1;border-radius:12px;width:44px;height:44px;display:grid;place-items:center;padding:0}
.gaiha-chat-root .gc-rail-btn.is-active,.gaiha-chat-root .gc-rail-btn:hover{color:#fff;background:#2e4a70}
.gaiha-chat-root .gc-rail-btn .gc-label{position:absolute;overflow:hidden;width:1px;height:1px;clip-path:inset(50%)}
.gaiha-chat-root .gc-rail-bottom{margin-top:auto}.gaiha-chat-root .gc-icon svg{height:20px;width:20px;display:block}.gaiha-chat-root .gc-avatar{border-radius:50%;background:#dfeafa;display:grid;place-items:center;color:#47729e;font-weight:650;width:39px;height:39px;flex:none;overflow:hidden}
.gaiha-chat-root .gc-avatar img{width:100%;height:100%;object-fit:cover}.gaiha-chat-root .gc-avatar.small{width:34px;height:34px;border:2px solid #6b7c97}.gaiha-chat-root .gc-room-avatar{background:#e7f0ff;color:#3974c6;font-size:20px}
.gaiha-chat-root .gc-side{grid-column:2;grid-row:1;background:#fff;display:flex;flex-direction:column;padding:0;border-right:1px solid var(--gc-stroke)}
.gaiha-chat-root .gc-icon-button{border:0;background:transparent;color:#718096;border-radius:9px;width:32px;height:32px;display:grid;place-items:center}.gaiha-chat-root .gc-icon-button:hover{background:#f0f5fa}
.gaiha-chat-root .gc-tab.active{border:0;background:#fff;color:#2868c5;box-shadow:0 2px 7px #203c5d12;font-weight:650}

.gaiha-chat-root .gc-conversations{padding:8px 10px;flex:1;overflow:auto;min-height:0}.gaiha-chat-root .gc-conversation{display:flex;align-items:center;gap:11px;width:100%;background:transparent;border:0;border-radius:11px;padding:13px 11px;color:inherit;text-align:left}.gaiha-chat-root .gc-conversation.selected{background:#eaf2fe}.gaiha-chat-root .gc-conversation:hover{background:#f0f5fd}.gaiha-chat-root .gc-person-info{min-width:0}.gaiha-chat-root .gc-person-info strong{font-size:13px;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.gaiha-chat-root .gc-person-info small{display:block;margin-top:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#8a98a9;font-size:11px}
.gaiha-chat-root .gc-center{grid-column:3;grid-row:1;min-width:0;display:flex;flex-direction:column;background:#fff}.gaiha-chat-root .gc-thread-head{height:76px;min-height:76px;border-bottom:1px solid var(--gc-stroke);padding:12px 24px;display:flex;align-items:center;gap:11px}.gaiha-chat-root .gc-thread-title{flex:1;min-width:0}.gaiha-chat-root .gc-thread-title strong{display:block;font-size:15px}.gaiha-chat-root .gc-thread-title small{display:block;color:#8b99aa;font-size:11px;margin-top:5px}.gaiha-chat-root .gc-back{display:none}
.gaiha-chat-root .gc-load-older{align-self:center;margin:10px auto 0;border:0;background:none;color:#7d95b3;font-size:11px;cursor:pointer}.gaiha-chat-root .gc-feed{min-height:0;flex:1;display:flex;flex-direction:column;gap:20px;padding:23px 25px;overflow-y:auto;overscroll-behavior:contain;background:#fff}.gaiha-chat-root .gc-line{display:flex;gap:10px;align-items:flex-start}.gaiha-chat-root .gc-line .gc-avatar{height:32px;width:32px}.gaiha-chat-root .gc-line.mine{justify-content:flex-end}.gaiha-chat-root .gc-message-detail{max-width:calc(100% - 45px);display:flex;flex-direction:column;gap:6px;align-items:flex-start;min-width:0}.gaiha-chat-root .mine .gc-message-detail{align-items:flex-end}.gaiha-chat-root .gc-message-meta{display:flex;align-items:center;gap:10px;font-size:11px;color:#465870}.gaiha-chat-root .gc-message-meta time{font-size:10px;color:#9ba7b6}.gaiha-chat-root .gc-bubble{background:#f3f5f8;border-radius:5px 14px 14px 14px;color:#21314a;padding:12px 15px;max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere}.gaiha-chat-root .mine .gc-bubble{background:#e5f0ff;border-radius:14px 5px 14px 14px}.gaiha-chat-root .gc-script{writing-mode:vertical-lr;text-orientation:mixed;height:auto;max-height:240px;min-height:55px;max-width:100%;overflow:auto;font-family:var(--gaiha-chat-mongol-font,'Noto Sans Mongolian',serif);font-size:var(--gc-mn-size,19px);line-height:1.85}.gaiha-chat-root .gc-bubble:not(.gc-script){font-size:var(--gc-zh-size,14px)}.gaiha-chat-root .gc-status{min-height:22px;font-size:11px;color:#a77f67;padding:0 20px}.gaiha-chat-root .gc-empty{margin:auto;color:#98a5b3;font-size:12px}
.gaiha-chat-root .gc-editor-panel{grid-column:4;grid-row:1;display:flex;flex-direction:column;min-width:0;min-height:0;gap:12px;padding:19px;background:#fbfcfe;border-left:1px solid var(--gc-stroke)}.gaiha-chat-root .gc-editor-head{display:flex;align-items:center;justify-content:space-between;color:#23324a;font-size:13px}.gaiha-chat-root .gc-hint{font-weight:400;color:#91a0b0;font-size:11px}.gaiha-chat-root .gc-edit{flex:1;min-height:0;width:100%;border:1px solid #dfe6f0;border-radius:12px;background:white;outline:none;padding:15px;overflow:auto;white-space:pre-wrap;user-select:text;-webkit-user-select:text}.gaiha-chat-root .gc-edit:focus{border-color:#78a8e9;box-shadow:0 0 0 3px #dcecff}.gaiha-chat-root .gc-edit:empty:before{content:attr(data-placeholder);color:#abb7c8;pointer-events:none}.gaiha-chat-root .gc-edit-mn{writing-mode:vertical-lr;text-orientation:mixed;font-family:var(--gaiha-chat-mongol-font,'Noto Sans Mongolian',serif);font-size:var(--gc-mn-size,19px);line-height:1.9;overflow-x:auto;overflow-y:hidden}.gaiha-chat-root .gc-edit-zh{writing-mode:horizontal-tb;font-size:var(--gc-zh-size,14px);line-height:1.8}.gaiha-chat-root .gc-editor-actions{display:flex;align-items:center;gap:10px}.gaiha-chat-root .gc-switch{flex:1;min-width:0;height:42px;background:white;border:1px solid #e5eaf1;border-radius:10px;display:flex;align-items:center;justify-content:center;gap:2px;font-size:12px;white-space:nowrap}.gaiha-chat-root .gc-mongol-label{font-family:var(--gaiha-chat-mongol-font,'Noto Sans Mongolian',serif)}.gaiha-chat-root .gc-send{height:42px;width:46px;display:grid;place-items:center;border:0;background:#2e70dc;color:#fff;border-radius:10px}.gaiha-chat-root .gc-send:disabled{opacity:.45}.gaiha-chat-root .gc-send .gc-icon svg{height:18px;width:18px}
.gaiha-chat-root button:focus-visible{outline:2px solid #2e70dc;outline-offset:2px}
@media(max-width:1180px){.gaiha-chat-root .gc-app{grid-template-columns:58px 235px minmax(0,1fr) 200px}.gaiha-chat-root .gc-editor-panel{padding:12px}.gaiha-chat-root .gc-feed{padding:18px}}
@media(max-width:850px){body.gaiha-chat-page .gaiha-chat-root{width:100%;margin:0;border:0;border-radius:0;height:calc(100dvh - 70px);min-height:390px;box-shadow:none}.gaiha-chat-root .gc-app{grid-template-columns:56px minmax(0,1fr);position:relative}.gaiha-chat-root .gc-rail{grid-column:1}.gaiha-chat-root .gc-side{grid-column:2}.gaiha-chat-root .gc-center{grid-column:2;display:none}.gaiha-chat-root .gc-editor-panel{display:none}.gaiha-chat-root .gc-app.gc-mobile-chat .gc-side{display:none}.gaiha-chat-root .gc-app.gc-mobile-chat .gc-center{display:flex}.gaiha-chat-root .gc-app.gc-mobile-chat .gc-editor-panel{display:flex;grid-column:2;grid-row:1;position:absolute;z-index:4;bottom:8px;right:9px;width:min(215px,53%);height:min(250px,39%);border:1px solid #e1e9f5;border-radius:14px;box-shadow:0 8px 24px #0a26401b}.gaiha-chat-root .gc-feed{padding-bottom:265px}.gaiha-chat-root .gc-back{border:0;background:none;width:28px;height:36px;display:grid;place-items:center}}
@media(max-width:600px){body.gaiha-chat-page .gaiha-chat-root{height:calc(100dvh - 58px);min-height:380px}.gaiha-chat-root .gc-app{display:block}.gaiha-chat-root .gc-rail{display:none}.gaiha-chat-root .gc-side,.gaiha-chat-root .gc-center{position:absolute;inset:0;height:100%;width:100%}.gaiha-chat-root .gc-conversations{padding:8px 13px}.gaiha-chat-root .gc-app.gc-mobile-chat .gc-editor-panel{width:min(235px,56vw);height:240px;right:9px;bottom:max(8px,env(safe-area-inset-bottom));padding:11px;gap:7px}.gaiha-chat-root .gc-thread-head{min-height:62px;height:62px;padding:8px 10px}.gaiha-chat-root .gc-feed{padding:16px 11px 255px;gap:15px}.gaiha-chat-root .gc-editor-head{font-size:11px}.gaiha-chat-root .gc-edit{padding:10px}.gaiha-chat-root .gc-editor-actions{gap:4px}.gaiha-chat-root .gc-switch{font-size:10px;height:37px}.gaiha-chat-root .gc-send{height:37px;width:35px}.gaiha-chat-root .gc-bubble{padding:9px 11px}}

/* v0.5.2 – user avatar identity, standards-based icons, selected-conversation focus */
.gaiha-chat-root .gc-profile{width:42px;height:42px;padding:0;border:0;background:transparent;border-radius:50%;display:grid;place-items:center;cursor:pointer;margin-bottom:20px}
.gaiha-chat-root .gc-profile .gc-avatar{width:38px;height:38px;border:2px solid #6d819d}
.gaiha-chat-root .gc-profile-menu{position:absolute;z-index:35;top:16px;left:60px;min-width:170px;padding:13px 15px;background:#fff;color:#26364e;border:1px solid #e5ebf4;border-radius:12px;box-shadow:0 10px 30px #13274420;font-size:13px}
.gaiha-chat-root .gc-profile-menu[hidden]{display:none}
.gaiha-chat-root .gc-profile-menu strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:10px}
.gaiha-chat-root .gc-profile-link{text-decoration:none;color:#336fc9}
.gaiha-chat-root .gc-rail{position:relative}
.gaiha-chat-root .gc-room-avatar{font-size:initial}.gaiha-chat-root .gc-room-avatar .gc-icon svg{width:20px;height:20px}
.gaiha-chat-root .gc-app.gc-no-editor{grid-template-columns:64px 290px minmax(0,1fr)}
.gaiha-chat-root .gc-app.gc-no-editor .gc-editor-panel{display:none}
.gaiha-chat-root .gc-welcome{background:#fff;flex:1}
@media(min-width:851px){.gaiha-chat-root .gc-app{grid-template-columns:60px 300px minmax(0,1fr) 248px}.gaiha-chat-root .gc-app.gc-no-editor{grid-template-columns:60px 300px minmax(0,1fr)} }
@media(max-width:850px){.gaiha-chat-root .gc-profile-menu{top:18px;left:52px}.gaiha-chat-root .gc-app.gc-no-editor{grid-template-columns:56px minmax(0,1fr)}}
@media(max-width:600px){.gaiha-chat-root .gc-profile-menu{display:none}}

/* v0.5.3: Chinese chat-message typography only; Mongolian vertical bubbles unchanged. */
.gaiha-chat-root .gc-bubble:not(.gc-script){font-family: "PingFang SC", "苹方-简", -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif; font-weight:600; text-shadow:0 1px 1px rgba(25,35,55,.14);}

/* v0.5.4: configurable flat rectangular chat bubbles */
.gaiha-chat-root .gc-feed{gap:var(--gc-bubble-gap,14px)}
.gaiha-chat-root .gc-bubble,.gaiha-chat-root .mine .gc-bubble{border-radius:var(--gc-bubble-radius,3px);border:var(--gc-bubble-border-width,1px) solid var(--gc-bubble-border,#e4e8ee);box-shadow:var(--gc-bubble-shadow,none);background-image:none}
.gaiha-chat-root .gc-bubble{background-color:var(--gc-bubble-other,#fff)}
.gaiha-chat-root .mine .gc-bubble{background-color:var(--gc-bubble-mine,#eaf1f8)}
.gaiha-chat-root .gc-bubble:not(.gc-script){font-family:"PingFang SC","苹方-简",-apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;font-weight:var(--gc-zh-weight,600);text-shadow:var(--gc-zh-shadow,0 1px 1px rgba(25,35,55,.14))}
.gaiha-chat-root .gc-bubble.gc-script{writing-mode:vertical-lr;text-orientation:mixed;width:max-content;max-width:100%;height:auto;min-height:55px;max-height:240px;overflow:auto}

/* v0.5.5: thin outlined bubbles; admin CSS variables still control these values. */
.gaiha-chat-root .gc-bubble,.gaiha-chat-root .mine .gc-bubble{background-image:none;border-style:solid;box-shadow:var(--gc-bubble-shadow,0 0 4px rgba(0,0,0,.08))}

/* v1.3.0 — use PingFang for horizontal UI text, not native Mongolian vertical text */
.gaiha-chat-root{font-family:"PingFang SC","苹方-简",-apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;}
.gaiha-chat-root .gc-script,.gaiha-chat-root .gc-edit-mn,.gaiha-chat-root .gc-mongol-label{font-family:var(--gaiha-chat-mongol-font,"Noto Sans Mongolian",serif);}

/* GGear 1.3.2: Safari native Mongolian text, no microscopic scrollable bubble */
.gaiha-chat-root .gc-bubble.gc-script,
.gaiha-chat-root .mine .gc-bubble.gc-script{
 writing-mode:vertical-lr;-webkit-writing-mode:vertical-lr;text-orientation:mixed;
 block-size:auto;inline-size:auto;width:auto;height:auto;
 min-height:0;max-height:none;max-width:100%;
 overflow:visible;white-space:pre-wrap;overflow-wrap:anywhere;
 font-size:var(--gc-mn-size,19px);line-height:1.7;
 padding:13px 12px;align-self:flex-start;
}
.gaiha-chat-root .gc-feed{overflow-x:hidden;overflow-y:auto;min-width:0}
.gaiha-chat-root .gc-message-detail{min-width:0;max-width:calc(100% - 50px)}
.gaiha-chat-root .gc-unread-indicator{background:#bc2e3a;color:white;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;min-width:17px;height:17px;padding:0 4px;font:600 10px/1 Arial,sans-serif;margin-left:5px}
.gaiha-chat-root .gc-unread-indicator[hidden]{display:none}
.gaiha-chat-root .gc-unread-dot{flex:0 0 8px;width:8px;height:8px;background:#c52f44;border-radius:50%;margin-left:auto}
@media(max-width:600px){.gaiha-chat-root .gc-bubble.gc-script{font-size:var(--gc-mn-size,19px);max-height:none}}

/* GGear 1.3.3: vertical Mongolian bubble — 500px physical height cap,
   column growth horizontally, no inner scrollbars, subtle glyph shadow. */
.gaiha-chat-root .gc-message-detail:has(.gc-bubble.gc-script){max-width:none;min-width:0;flex:0 1 auto}
.gaiha-chat-root .gc-bubble.gc-script,
.gaiha-chat-root .mine .gc-bubble.gc-script{
  writing-mode:vertical-lr;-webkit-writing-mode:vertical-lr;
  text-orientation:mixed;
  width:max-content;max-width:none;
  height:auto;max-height:500px;min-height:0;
  overflow:visible;
  white-space:pre-wrap;overflow-wrap:anywhere;
  font-size:var(--gc-mn-size,16px);line-height:1.65;
  text-shadow:0 1px 1px rgba(22,35,59,.18);
  padding:12px 11px;
}
/* Long messages can extend in the column direction; scroll the feed, not a tiny bubble. */
.gaiha-chat-root .gc-feed{overflow-x:auto;overflow-y:auto}
@media(max-width:600px){
  .gaiha-chat-root .gc-bubble.gc-script,
  .gaiha-chat-root .mine .gc-bubble.gc-script{
    max-height:500px;max-width:none;font-size:var(--gc-mn-size,16px)
  }
}

/* GGP 1.6.1: Square chat viewport; bubble radius remains configurable. */
.gbs-reader-chat-floating,.ggp-chat-float{border-radius:0!important;border:1px solid #dfe3e8!important;box-shadow:0 4px 12px rgba(0,0,0,.06),0 16px 40px rgba(0,0,0,.10)!important;}
.gbs-reader-chat-floating .gaiha-chat-root,.ggp-chat-float .gaiha-chat-root{border-radius:0!important;}


/* GGP 1.6.3 - borderless reader chat window, retain soft shadow and configurable bubble corners. */
.gbs-reader-chat-floating,
.gbs-reader-chat-panel,
.ggp-chat-float,
.ggp-chat-float.is-open {
  border-radius:0 !important;
  border:0 !important;
  box-shadow:0 5px 16px rgba(20,30,42,.10),0 18px 48px rgba(20,30,42,.15) !important;
  background:#fff !important;
  background-image:none !important;
  overflow:hidden !important;
}
.gbs-reader-chat-floating .gbs-reader-chat-header,
.gbs-reader-chat-panel .gbs-reader-chat-header,
.ggp-chat-float .ggp-chat-head,
.gbs-reader-chat-floating .gbs-reader-chat-content,
.gbs-reader-chat-panel .gbs-reader-chat-content,
.ggp-chat-float .ggp-chat-body,
.gbs-reader-chat-floating .gaiha-chat-root,
.gbs-reader-chat-panel .gaiha-chat-root,
.ggp-chat-float .gaiha-chat-root {
  border-radius:0 !important;
}
/* Only the outer window is squared. gc-bubble radius stays under admin control. */

/* GGP 1.6.3: external frame only, no visible outline. */
.gbs-reader-chat-floating,.gbs-reader-chat-panel,.ggp-chat-float,.ggp-chat-float.is-open{border:0!important;outline:0!important;border-radius:0!important;box-shadow:0 5px 16px rgba(20,30,42,.10),0 18px 48px rgba(20,30,42,.15)!important}

/* GGP 1.8.74: avatar-only contact/room list, disposable group-room controls. */
.gaiha-chat-root .gc-side{position:relative!important}
.gaiha-chat-root .gc-conversations.gc-avatar-only{display:flex;flex-direction:column;align-items:center;gap:10px;padding:12px 5px!important}
.gaiha-chat-root .gc-conversation{width:54px!important;min-width:54px!important;height:54px!important;padding:5px!important;display:grid!important;place-items:center!important;justify-content:center!important;border:1px solid transparent!important;border-radius:9px!important;flex:none!important}
.gaiha-chat-root .gc-conversation .gc-avatar{width:42px!important;height:42px!important}
.gaiha-chat-root .gc-conversation .gc-unread-dot{position:absolute;right:4px;top:3px}
.gaiha-chat-root .gc-room-toolbar{display:flex;justify-content:center;align-items:center;padding:11px 0 6px;border-bottom:1px solid #e8ecf1}
.gaiha-chat-root .gc-room-create,.gaiha-chat-root .gc-room-action{width:31px;height:31px;display:grid;place-items:center;border:1px solid #dce5ee!important;background:#fff!important;color:#304e72!important;border-radius:6px!important;padding:5px;flex:none;cursor:pointer}
.gaiha-chat-root .gc-room-create svg,.gaiha-chat-root .gc-room-action svg{width:18px;height:18px}
.gaiha-chat-root .gc-room-action:disabled{opacity:.4;cursor:default}
.gaiha-chat-root .gc-room-end{color:#b94345!important}
.gaiha-chat-root .gc-avatar-upload[hidden]{display:none!important}
.gaiha-chat-root .gc-create-room-form{position:absolute;z-index:50;top:49px;left:8px;min-width:240px;max-width:min(300px,calc(100vw - 95px));width:260px;box-sizing:border-box;display:flex;flex-direction:column;gap:9px;background:#fff;border:1px solid #dce5ee;padding:12px;box-shadow:0 9px 22px #17345622;writing-mode:horizontal-tb}
.gaiha-chat-root .gc-create-room-form input{display:block;min-width:0;width:100%;font-size:13px;background:white;color:#26364e}
.gaiha-chat-root .gc-room-name{height:34px;border:1px solid #cdd8e4;padding:0 8px}
.gaiha-chat-root .gc-room-file{font-size:11px!important}
.gaiha-chat-root .gc-create-actions{display:flex;gap:8px}
.gaiha-chat-root .gc-create-actions button{border:1px solid #dce5ee;border-radius:3px;background:#fff;color:#1c4168;padding:5px 12px}
.gaiha-chat-root .gc-create-submit{background:#ecf4ff!important}
.gaiha-chat-root .gc-create-error{font-size:12px;color:#b63535;overflow-wrap:anywhere}
@media(max-width:600px){.gaiha-chat-root .gc-create-room-form{left:6px;width:min(260px,calc(100vw - 70px))}}
