#support-open, #support-dialog {
  --support-gold: #f0d3a3;
  --support-muted: #afbcd0;
  --support-line: #acbdd52b;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

#support-open {
  position: fixed;
  z-index: 30;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-height: 48px;
  border-radius: 100px;
  border: 1px solid #e8c79180;
  background: #101a28f0;
  color: #fff3dc;
  font-weight: 680;
  box-shadow: 0 12px 32px #0008, inset 0 0 18px #b4d1ff13;
  cursor: pointer;
}

.support-launch-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 13px;
  border: 1.5px solid var(--support-gold);
  border-radius: 5px;
  background: radial-gradient(circle, var(--support-gold) 1px, transparent 1.5px) 1px center / 5px 4px repeat-x;
}
.support-launch-icon::after {
  position: absolute;
  content: "";
  left: 3px;
  bottom: -4px;
  width: 4px;
  height: 4px;
  background: #101a28;
  border-left: 1.5px solid var(--support-gold);
  border-bottom: 1.5px solid var(--support-gold);
  transform: skewY(-36deg);
}

#support-dialog {
  position: fixed;
  inset: auto 24px 24px auto;
  margin: 0;
  width: min(425px, calc(100vw - 48px));
  height: min(635px, calc(100dvh - 48px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #ab9f896e;
  border-radius: 23px;
  overflow: hidden;
  background: #0e1726;
  color: #edf3fb;
  box-shadow: 0 30px 108px #000c, 0 0 0 5px #090d1666;
  color-scheme: dark;
}
#support-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  animation: support-enter 210ms ease-out;
}
#support-dialog::backdrop { background: #080c1875; backdrop-filter: blur(4px); }
#support-dialog [hidden] { display: none !important; }
#support-dialog button { cursor: pointer; font: inherit; }
#support-dialog button:disabled { cursor: wait; opacity: .55; }
#support-open:focus-visible, #support-dialog :focus-visible {
  outline: 2px solid #f4d49a;
  outline-offset: 3px;
}
#support-dialog .support-head {
  min-height: 149px;
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid #e5c48d50;
  background:
    linear-gradient(95deg, #101a30 2%, #152237e0 40%, #1a2d463e 90%),
    url("../art/sword-king/keyart.jpg") right 43% / cover, #122037;
}
#support-dialog .support-head::after {
  position: absolute;
  content: "";
  pointer-events: none;
  inset: 7px;
  border: 1px solid #e0cca225;
  border-radius: 17px 17px 8px 8px;
}
#support-dialog .support-brand {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--support-gold);
  font-weight: 720;
}
#support-dialog h2 {
  margin: 0;
  font: 780 34px/1.15 "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  letter-spacing: .05em;
}
#support-dialog .support-mode { margin: 10px 0 0; color: #e3e8f3; font-size: 12px; }
#support-close {
  width: 35px;
  height: 35px;
  line-height: 1;
  background: #08111caa;
  color: #f6ebd6;
  border: 1px solid #f5dfae5c;
  border-radius: 50%;
  font-size: 22px !important;
}
#support-dialog .support-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 19px 15px;
  scrollbar-width: thin;
  background: radial-gradient(ellipse at 85% -18%, #27466f55, transparent 64%), #101926;
}
#support-dialog .support-welcome-title { margin: 0 0 12px; color: #f1eadb; font-size: 17px; font-weight: 700; }
#support-dialog .support-prompts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
#support-dialog .support-prompts button {
  position: relative;
  text-align: left;
  min-height: 80px;
  min-width: 0;
  padding: 13px 17px 13px 13px;
  color: #eef2f7;
  border: 1px solid var(--support-line);
  border-radius: 11px;
  background: linear-gradient(145deg,#23334a,#17253a);
}
#support-dialog .support-prompts button:hover { border-color: #dda96b9c; background: #283754; }
#support-dialog .support-prompts b, #support-dialog .support-prompts small { display: block; }
#support-dialog .support-prompts small { color: #b6c2d4; font-size: 11px; margin-top: 5px; }
#support-dialog .support-prompts span {
  position: absolute;
  top: 9px;
  right: 9px;
  color: var(--support-gold);
  font-size: 11px;
}
#support-dialog .support-line { display: flex; margin-bottom: 13px; }
#support-dialog .support-user { justify-content: flex-end; }
#support-dialog .support-bubble {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  padding: 11px 14px;
  max-width: 94%;
  border-radius: 13px;
  border: 1px solid var(--support-line);
  background: #233047;
}
#support-dialog .support-user .support-bubble {
  color: #181e29;
  background: linear-gradient(130deg,#f4dab2,#dfb778);
  border-color: #f7dbaa;
  border-bottom-right-radius: 4px;
}
#support-dialog .support-assistant .support-bubble { border-bottom-left-radius: 4px; }
#support-dialog .support-bubble a { display: block; width: fit-content; color: #f6d6a4; margin-top: 6px; text-decoration: underline; }
#support-pending { color: var(--support-muted); margin: 2px 0; font-size: 12px; }

#support-form { padding: 13px 16px 10px; border-top: 1px solid var(--support-line); background: #0e1726; }
#support-form .support-compose { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: stretch; gap: 8px; }
#support-input {
  margin: 0;
  width: 100%;
  min-height: 48px;
  max-height: 104px;
  resize: vertical;
  font: inherit;
  border: 1px solid #9aafc94a;
  border-radius: 9px;
  background: #192538;
  color: #f0f4fa;
  padding: 12px;
}
#support-input::placeholder { color: #acb9cd; }
#support-send {
  background: #ebcb97;
  color: #22232a;
  border: 1px solid #fce1b6;
  border-radius: 9px;
  padding: 0 12px;
  min-width: 70px;
  font-weight: 700 !important;
}
#support-dialog .support-foot {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: var(--support-muted);
}
#support-reset { padding: 0; background: none; border: 0; color: var(--support-gold); font-size: 12px !important; }
#support-dialog .support-sr { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; }

@keyframes support-enter {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
}
@media (min-width: 601px) {
  #support-dialog:has(#support-welcome:not([hidden])) { height: min(535px, calc(100dvh - 48px)); }
}
@media (max-width: 600px) {
  #support-open { right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); }
  #support-dialog {
    inset: auto 0 0;
    width: 100%;
    height: min(720px, 90dvh);
    border-radius: 20px 20px 0 0;
  }
  #support-dialog:has(#support-welcome:not([hidden])) { height: min(550px, 88dvh); }
  #support-dialog .support-head { min-height: 125px; padding: 20px; }
  #support-dialog h2 { font-size: 30px; }
  #support-input { font-size: 16px; }
  #support-form { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  #support-dialog[open] { animation: none; }
}

#support-dialog .support-head-actions { display: flex; gap: 7px; align-items: flex-start; }
#support-feedback {
  min-height: 35px;
  padding: 0 9px;
  white-space: nowrap;
  border: 1px solid #f5dfae5c;
  border-radius: 100px;
  background: #08111caa;
  color: #f5dfae;
  font-size: 12px !important;
}
#support-feedback:hover { background: #243751; }
#support-dialog:has(#feedback-page:not([hidden])) { height: min(704px, calc(100dvh - 48px)); }
#feedback-page {
  grid-row: 2 / 4;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px 23px;
  background: radial-gradient(ellipse at 80% -12%, #27466f4a, transparent 60%), #101926;
}
#feedback-form { display: grid; gap: 13px; }
#feedback-form label { display: grid; min-width: 0; gap: 5px; font-weight: 620; }
#feedback-form :is(input:not([type=file]),select,textarea) {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--support-line);
  border-radius: 8px;
  background: #192538;
  color: #eef4f9;
  padding: 9px 11px;
  min-height: 42px;
  font: inherit;
  font-weight: 400;
}
#feedback-form :is(input,textarea)::placeholder { color: #a4b4cb; }
#feedback-form .feedback-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
#feedback-form .feedback-upload {
  padding: 11px 12px;
  border: 1px dashed #b0c2d771;
  border-radius: 10px;
  background: #182538;
}
#feedback-form .feedback-upload small, #feedback-form .feedback-hint { color: #b6c5d9; font-size: 11px; }
#feedback-files { max-width: 100%; font: inherit; font-size: 12px; }
#feedback-files::file-selector-button {
  margin-right: 7px;
  border: 1px solid #e8c79180;
  border-radius: 5px;
  padding: 5px 8px;
  color: #f8e1ba;
  background: #25394f;
}
#feedback-thumbs { display: flex; gap: 6px; }
#feedback-thumbs:empty { display: none; }
#feedback-thumbs img { width: 66px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--support-line); }
#feedback-result { margin: 0; padding: 9px 10px; background: #482b2d; border-radius: 7px; color: #ffd7c9; }
#feedback-result.feedback-success { background: #21423b; color: #d5f1e4; }
#feedback-send {
  min-height: 44px;
  border: 1px solid #fce1b6;
  border-radius: 9px;
  background: #ebcb97;
  color: #22232a;
  font-weight: 700 !important;
}
@media (max-width: 600px) {
  #support-dialog:has(#feedback-page:not([hidden])) { height: min(740px, 93dvh); }
  #feedback-form :is(input:not([type=file]),textarea,select) { font-size: 16px; }
}

#support-dialog .support-prompts .support-handoff { border-color: #e8c79170; }
@media (min-height: 690px) { #support-dialog { height:min(615px,calc(100dvh - 48px)); } }
