@import url("./chinese-font.css");
body.chat-active main.main{padding-top:16px;padding-bottom:calc(var(--nav-h) + 18px + env(safe-area-inset-bottom))}
.chat-shell{height:calc(100dvh - 176px - env(safe-area-inset-bottom));min-height:410px;display:flex;flex-direction:column;background:linear-gradient(145deg,rgba(26,23,16,.97),rgba(10,10,8,.97));border:1px solid var(--line-strong);border-radius:20px;overflow:hidden;box-shadow:var(--shadow)}
.chat-heading{display:flex;align-items:center;gap:16px;padding:20px 24px;border-bottom:1px solid var(--line)}
.chat-heading>div:nth-child(2){flex:1;min-width:0}.chat-heading h1{font-size:clamp(19px,3vw,27px);color:var(--gold-light)}
.chat-heading small,.chat-empty>small,.chat-order>small{font-size:9px;letter-spacing:.16em;color:var(--gold)}.chat-heading p{font-size:11px;color:var(--muted);margin:5px 0 0;overflow-wrap:anywhere}
#royal-chat .chat-logo,#royal-chat .chat-empty-logo{display:block;aspect-ratio:1;object-fit:contain;object-position:center;border-radius:50%;background:transparent}
.chat-logo{width:56px;height:auto;flex-shrink:0}
/* User-supplied official support portrait; the brand-section dragon keeps its existing styling. */
#royal-chat .chat-support-avatar{object-fit:cover;border:1px solid var(--gold);background:#201e19}
.chat-connection{display:flex;align-items:center;gap:8px;padding:9px 24px;font-size:11px;color:#B2F5FC;background:rgba(212,175,55,.06)}.chat-connection #chat-connection-text{min-width:0;overflow-wrap:anywhere}.chat-connection .chat-dot{width:6px;height:6px;background:#00E5FF;border-radius:50%;flex-shrink:0;box-shadow:0 0 7px rgba(0,229,255,.45)}
.chat-connection.is-connected .chat-dot{animation:chat-status-pulse 2.8s ease-in-out infinite}
.chat-connection.is-hidden .chat-dot{animation-play-state:paused}
@keyframes chat-status-pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(.85)}}
@media(prefers-reduced-motion:reduce){.chat-connection.is-connected .chat-dot{animation:none}}
.chat-notice{flex-shrink:0;font-size:12px;line-height:1.6;color:#ded6c7;padding:10px 24px;border-bottom:1px solid var(--line-soft);overflow-wrap:anywhere}
.chat-notice h2{margin:0 0 3px;font-size:14px;line-height:1.4;font-weight:600;color:var(--gold-light)}
.chat-notice p{margin:0}
.chat-log{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:24px;display:flex;flex-direction:column;gap:16px;scrollbar-gutter:stable}
.chat-log>.chat-message{flex-shrink:0}
.chat-empty{margin:auto;text-align:center;max-width:420px;padding:20px 0}.chat-empty-logo{margin:0 auto 24px;width:100px;max-width:85%;height:auto}.chat-empty h2{font-size:22px;margin:12px 0;color:var(--gold-light)}.chat-empty p{color:#c4bcaf;font-size:13px;line-height:1.8}.chat-empty>span:last-child{font-size:10px;color:var(--muted)}
.chat-message{max-width:78%;padding:14px 18px;border-radius:16px;border:1px solid var(--line);background:#211e17;align-self:flex-start;overflow-wrap:anywhere}.chat-message.outgoing{align-self:flex-end;background:linear-gradient(130deg,#46391b,#302815);border-color:var(--line-strong);border-bottom-right-radius:4px}.chat-message.incoming{border-bottom-left-radius:4px}.chat-message>small{color:var(--gold-light);font-size:10px}.chat-message p{white-space:pre-wrap;margin:7px 0 12px;line-height:1.7}.chat-message footer{display:flex;gap:12px;justify-content:space-between;font-size:10px;color:#c2b8a3}.chat-message button:not([data-withdrawal-receipt]){margin-top:10px;color:var(--gold-light);background:transparent;border:0;text-decoration:underline;cursor:pointer}
.chat-feedback{margin:0;padding:0 24px;color:var(--gold-light);font-size:12px}.chat-feedback:not(:empty){padding-top:8px;padding-bottom:8px}
.chat-composer{padding:14px 24px;background:rgba(18,16,12,.98);border-top:1px solid var(--line);position:relative}.chat-input-row{display:flex;gap:10px;align-items:center}.chat-input-row textarea{resize:none;flex:1;width:0;min-width:0;border:1px solid var(--line);border-radius:12px;padding:12px;background:#0e0d0a;font-size:16px;max-height:100px}.chat-icon{display:grid;place-items:center;width:38px;height:44px;flex-shrink:0;background:transparent;border:0;color:var(--gold-light);cursor:pointer}.chat-icon svg{width:24px;height:24px}.chat-composer-note{display:flex;justify-content:space-between;gap:12px;font-size:10px;color:var(--muted);margin-top:8px}.chat-emojis{position:absolute;bottom:100%;left:20px;border:1px solid var(--line);border-radius:12px;background:#242017;padding:8px;box-shadow:var(--shadow)}.chat-emojis button{padding:8px;font-size:23px;background:transparent;border:0;cursor:pointer}
.chat-order{width:400px;padding:22px;border:1px solid var(--line-strong);border-radius:14px;background:linear-gradient(135deg,#302715,#16140f)}.chat-order h3{color:var(--gold-light);margin:10px 0}.chat-amount{font-family:var(--font);font-size:28px;font-weight:600;font-variant-numeric:tabular-nums;color:var(--gold-light)}.chat-order dl>div{display:flex;justify-content:space-between;gap:16px;padding:8px 0;border-bottom:1px solid var(--line)}.chat-order dt{color:#c2b8a3;font-size:11px}.chat-order dd{margin:0;font-size:11px;overflow-wrap:anywhere;text-align:right}.chat-order-status{color:var(--gold-light)}.chat-order p{font-size:12px;color:#d6cdbb}
.chat-dev{margin-top:14px;color:var(--muted);font-size:11px}.chat-dev summary{cursor:pointer;padding:8px 0}.chat-dev-controls{display:flex;flex-wrap:wrap;gap:8px}.chat-dev-controls button{border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--gold-light);padding:10px;cursor:pointer}.chat-loading{padding:20px;width:85%;color:var(--muted)}.chat-loading i{display:block;height:44px;background:linear-gradient(90deg,#262115,#18150f);border-radius:12px;margin:15px 0}.chat-loading i:nth-child(2){margin-left:30%}
#royal-chat :focus-visible{outline:2px solid var(--gold-light);outline-offset:3px}#royal-chat button:disabled{opacity:.5;cursor:wait}
@media(min-width:960px){body.chat-active main.main{padding-bottom:calc(var(--nav-h) + 40px + env(safe-area-inset-bottom))}.chat-shell{height:calc(100dvh - 130px);min-height:500px}.desknav button{padding-left:8px;padding-right:8px;font-size:12px}}
@media(max-width:599px){.chat-shell{border-radius:14px}.chat-heading{padding:14px 12px;gap:10px}.chat-logo{width:40px;height:auto}.chat-empty-logo{width:80px;margin-bottom:18px}.chat-heading small{font-size:7px}.chat-heading .btn{padding:8px 10px;font-size:11px}.chat-log{padding:16px 12px}.chat-notice,.chat-connection{padding:8px 12px}.chat-composer{padding:10px 12px}.chat-message{max-width:90%}.chat-composer-note{font-size:9px}.chat-input-row{gap:6px}.chat-input-row .btn{padding:12px}.chat-emojis{max-width:90%}.chat-empty h2{font-size:20px}}
@media(max-width:599px){body.chat-active .topbar-inner{gap:6px;padding-left:10px;padding-right:10px}body.chat-active .brand{min-width:0;flex-shrink:1}body.chat-active .brand img{max-width:100%;height:auto;max-height:32px}body.chat-active .who{gap:5px;flex-shrink:0}body.chat-active .hdr-auth{padding:7px 8px;font-size:10px}body.chat-active .lang-btn{padding:6px;gap:4px}body.chat-active .lang-btn .caret{display:none}body.chat-active .menu-btn{flex-shrink:0}body.chat-active .who-text .name{max-width:60px}}
.chat-input-row textarea{height:58px;min-height:58px}

/* Keep long translated labels within the existing six-column navigation. */
.nav button{min-width:0}
.nav button[data-goto="chat"] span{white-space:normal;line-height:1.2;overflow-wrap:anywhere}
:lang(zh) #royal-chat{font-family:"Inter","Noto Sans SC",sans-serif}
:lang(zh) #royal-chat h1,:lang(zh) #royal-chat h2,:lang(zh) #royal-chat h3{font-family:"Cinzel","Noto Sans SC",serif}

/* Image messages */
.chat-icon[hidden]{display:none}
.chat-images{display:grid;gap:6px;margin:8px 0 10px}
.chat-image{display:block;position:relative;width:min(280px,100%);max-height:340px;padding:0;margin:0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#0e0d0a;cursor:zoom-in;color:var(--muted);text-decoration:none!important}
.chat-message .chat-image{margin-top:0}
.chat-image img{display:block;width:100%;height:auto;max-height:340px;object-fit:cover}
.chat-image.loading,.chat-image.failed{min-height:150px;aspect-ratio:4/3;display:grid;place-items:center;font-size:11px;padding:12px;cursor:pointer}
.chat-image.loading{background:linear-gradient(90deg,#262115,#18150f)}
.chat-image.failed{cursor:pointer;color:var(--gold-light)}
.chat-message.has-image p{margin-top:0}
.chat-message button+button{margin-left:14px}
.chat-progress{display:block;width:100%;height:4px;margin:0 0 10px;accent-color:var(--gold);appearance:none;border:0;border-radius:4px;background:#0e0d0a;overflow:hidden}
.chat-progress::-webkit-progress-bar{background:#0e0d0a}.chat-progress::-webkit-progress-value{background:var(--gold)}.chat-progress::-moz-progress-bar{background:var(--gold)}
.chat-attachment{display:flex;align-items:center;gap:12px;margin-bottom:10px;padding:8px;border:1px solid var(--line-strong);border-radius:12px;background:#17150f}
.chat-attachment[hidden]{display:none}
.chat-attachment>div{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;font-size:12px}.chat-attachment strong{color:var(--gold-light);font-weight:600}.chat-attachment span{font-size:10px;color:var(--muted)}
.chat-attachment-thumb{width:56px;height:56px;flex-shrink:0;padding:0;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#0e0d0a;cursor:zoom-in}
.chat-attachment-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.chat-attachment-thumb img:not([src]){visibility:hidden}
.chat-lightbox{padding:0;border:0;background:transparent;max-width:100vw;max-height:100dvh;width:100vw;height:100dvh;margin:0;overflow:hidden}
.chat-lightbox[open]{display:grid;place-items:center}
.chat-lightbox::backdrop{background:rgba(0,0,0,.9)}
.chat-lightbox img{max-width:94vw;max-height:88dvh;object-fit:contain;border-radius:8px;box-shadow:var(--shadow)}
.chat-lightbox .chat-icon{position:fixed;top:calc(12px + env(safe-area-inset-top));right:12px;width:44px;height:44px;border-radius:50%;background:rgba(20,18,14,.85);border:1px solid var(--line-strong)}
@media(max-width:599px){.chat-input-row .chat-icon{width:32px}.chat-image{width:min(240px,100%)}}

/* The official 2:1 PNG fits in full; the separate support portrait remains circular. */
#royal-chat .chat-empty-logo{width:180px;height:auto;aspect-ratio:2;object-fit:contain;border-radius:0}
@media(max-width:599px){#royal-chat .chat-empty-logo{width:140px}}
.chat-order [data-withdrawal-receipt]{display:block;margin-left:auto}.chat-order footer{justify-content:flex-end}

/* Dedicated mobile conversation: only the history scrolls. Back returns to
   the portal, where the primary navigation and language controls reappear. */
@media(max-width:719px){
  body.chat-active{overflow:hidden;overscroll-behavior:none}
  body.chat-active .topbar,body.chat-active .bottom{display:none}
  html body.chat-active main.main{
    position:fixed;inset:auto 0 auto;top:var(--chat-viewport-top,0px);
    height:var(--chat-viewport-height,100dvh);width:100%;max-width:none;
    margin:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    overflow:hidden;
  }
  body.chat-active #view-chat,body.chat-active #royal-chat{height:100%;min-height:0}
  body.chat-active .chat-shell{height:100%;min-height:0;border:0;border-radius:0;box-shadow:none}
  body.chat-active .chat-heading,body.chat-active .chat-connection,body.chat-active .chat-composer,body.chat-active .chat-feedback{flex-shrink:0}
  body.chat-active .chat-heading{padding:8px 12px;gap:10px}
  body.chat-active .chat-logo{width:36px}
  body.chat-active .chat-heading small{font-size:7px;letter-spacing:.08em}
  body.chat-active .chat-heading h1{font-size:18px;line-height:1.2}
  body.chat-active .chat-heading p{margin-top:2px;font-size:10px;line-height:1.3}
  body.chat-active .chat-heading .btn{min-height:44px;padding:8px 12px;font-size:11px}
  body.chat-active .chat-connection{padding:4px 12px;font-size:10px;line-height:1.4}
  body.chat-active .chat-notice{padding:6px 12px;font-size:11px;line-height:1.35}
  body.chat-active .chat-notice h2{font-size:12px;margin-bottom:2px}
  body.chat-active .chat-log{padding:12px;min-height:0;overflow-x:hidden;touch-action:pan-y}
  body.chat-active .chat-composer{padding:8px 10px}
  body.chat-active .chat-input-row{gap:4px}
  body.chat-active .chat-input-row textarea{height:44px;min-height:44px;padding:10px 8px}
  body.chat-active .chat-input-row .chat-icon{width:36px;height:44px}
  body.chat-active .chat-input-row .btn{min-height:44px;padding:10px;font-size:12px;flex-shrink:0}
  body.chat-active .chat-composer-note{gap:4px 10px;flex-wrap:wrap;margin-top:5px;font-size:9px;line-height:1.4}
  body.chat-active #chat-count{flex-shrink:0}
  body.chat-active #chat-images-note{min-width:0;overflow-wrap:anywhere}
  body.chat-active .chat-empty{padding:8px 0}
  body.chat-active #royal-chat .chat-empty-logo{width:90px;margin-bottom:6px}
  body.chat-active .chat-empty h2{font-size:18px;margin:6px 0}
  body.chat-active .chat-empty p{font-size:12px;line-height:1.5;margin:6px 0}
  body.chat-active .chat-attachment{padding:4px;margin-bottom:6px;gap:8px}
  body.chat-active .chat-attachment-thumb{width:40px;height:40px}
  body.chat-active .chat-dev{display:none}
  body.chat-active .toast{bottom:calc(100dvh - var(--chat-viewport-height,100dvh) + 110px + env(safe-area-inset-bottom))}
}
@media(max-width:719px) and (max-height:450px){
  body.chat-active .chat-heading{padding-block:4px}
  body.chat-active .chat-heading small{display:none}
  body.chat-active .chat-notice{padding-block:3px}
  body.chat-active .chat-notice h2{display:none}
}
