@font-face {
  font-family: "MDHZ-HanSerif";
  src: url("assets/original-theme/basic-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0020-007E;
}
@font-face {
  font-family: "MDHZ-HanSerif";
  src: url("assets/original-theme/common-cjk-punct.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+3000-303F;
}
@font-face {
  font-family: "MDHZ-HanSerif";
  src: url("assets/original-theme/font-level-1.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+4E00-62FF;
}
@font-face {
  font-family: "MDHZ-HanSerif";
  src: url("assets/original-theme/font-level-2.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+6300-7FFF;
}
@font-face {
  font-family: "MDHZ-HanSerif";
  src: url("assets/original-theme/font-remain.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+8000-9FA5;
}
@font-face {
  font-family: "Original chat icons";
  src: url("assets/original-theme/original-icons.woff2") format("woff2");
  font-display: block;
  unicode-range: U+E000-F8FF;
}
:root {
  color-scheme: light;
  --app-width: 550px;
  --ink: #3b291d;
  --accent: #80591d;
  --type: "MDHZ-HanSerif","Songti SC","Noto Serif CJK SC",SimSun,serif;
  font: 16px/1.5 var(--type);
  color: var(--ink);
  background: #ededed;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, label:focus-within {
  outline: 2px solid #896026;
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.chat {
  container-type: inline-size;
  width: min(100%, var(--app-width));
  height: 100vh;
  height: 100dvh;
  position: relative;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f5ebd8 url("assets/gilded/welcome.png") center top / 100% auto no-repeat;
  background-size: 100% max(min(215vw, calc(var(--app-width) * 2.15)), 100%);
}
.chat-header {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .8cqw;
  flex: none;
  padding: env(safe-area-inset-top) 2.3cqw 0;
  height: calc(13.75cqw + env(safe-area-inset-top));
}
.chat-header #sound { margin-inline-start: auto; margin-inline-end: 1.3cqw; }
.chat-header #new-chat { margin-inline-end: 1.2cqw; }
.chat-header button { pointer-events: auto; }
.icon-button, .round-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
  width: 8.6cqw;
  height: 100%;
  padding: 0;
}
.glyph { display: block; font: normal 5.4cqw/1 "Original chat icons"; }
.glyph-history::before { content: "\e906"; }
.glyph-new::before { content: "\e93a"; }
.glyph-history-new::before { content: "\e909"; }
.glyph-copy::before { content: "\e902"; font-size: 17px; }
.glyph-send::before { content: "\e8a8"; }
.chat-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.chat-scroll::-webkit-scrollbar { display: none; }
.welcome {
  padding: calc(17.36cqw + env(safe-area-inset-top)) 0 6.2cqw;
  text-align: center;
}
.welcome h1 {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.3cqw;
  min-height: 11.47cqw;
  font-size: 8.2cqw;
  line-height: 1.28;
  letter-spacing: .04em;
}
.welcome h1 span {
  border-radius: 99px;
  background: #9b3925;
  color: white;
  padding: .25cqw 1.4cqw;
  font-size: 2.9cqw;
  line-height: 1.15;
  letter-spacing: 0;
}
.greeting {
  width: 88cqw;
  padding-inline-end: 2.25cqw;
  margin: 52cqw auto 0;
  font-size: 5cqw;
  line-height: 1.55;
  font-weight: 700;
}
.swash { display: block; width: 54cqw; height: 6.1cqw; object-fit: contain; margin: .5cqw auto 0; }
.suggestions { margin: 6.3cqw 4.2cqw 0; }
.suggestions h2 { margin: 0 auto 3.4cqw; width: 66.9cqw; }
.suggestions h2 img { display: block; width: 100%; height: auto; }
.questions { display: grid; gap: 1.9cqw; }
.questions button {
  min-height: 12.1cqw;
  width: 100%;
  padding: 1.25cqw 5cqw 1.25cqw 18.4cqw;
  border: 0;
  border-radius: 2.3cqw;
  background: transparent center / 100% 100% no-repeat;
  text-align: start;
  font-size: 3.75cqw;
  line-height: 1.45;
}
.questions button:nth-child(1) { background-image: url("assets/gilded/question-1.png"); }
.questions button:nth-child(2) { background-image: url("assets/gilded/question-2.png"); }
.questions button:nth-child(3) { background-image: url("assets/gilded/question-3.png"); }
.questions button:active { transform: translateY(1px); }
.chat-footer { position: relative; flex: none; padding: 3.8cqw 2.9cqw env(safe-area-inset-bottom); }
.composer {
  display: flex;
  align-items: center;
  padding: 0 .8cqw 0 .3cqw;
  border: 1px solid #c6a168;
  border-radius: 10cqw;
  background: #fcf3e1;
  box-shadow: 0 2px 10px #8d71533a;
  color: #5b462a;
}
.composer .round-button { flex: none; width: max(44px,11.6cqw); height: max(44px,12.2cqw); }
#more .glyph { font-size: max(23px,6.2cqw); }
#voice .glyph { font-size: max(22px,6.7cqw); }
#voice[aria-pressed="true"] { color: #9b3925; }
textarea {
  flex: 1;
  display: block;
  min-width: 0;
  resize: none;
  align-self: center;
  border: none;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 4.06cqw;
  line-height: 1.4;
}
textarea::placeholder { color: #6e604b; opacity: 1; }
.composer:focus-within { border-color: #aa8345; }
.footer-note { margin: 0; padding: 2.5cqw 0 1.25cqw; text-align: center; color: #4c301b; font-size: 2.81cqw; line-height: 1.44; }
.operations { display: grid; grid-template-columns: repeat(4,1fr); padding: 4cqw 0 6cqw; }
.operations button, .operations label { position: relative; display: grid; justify-items: center; gap: 5px; border: 0; padding: 0; background: transparent; cursor: pointer; font-size: 3.5cqw; }
.operations img { width: 12cqw; }
.operations input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.chat-footer:has(.operations:not([hidden])) .footer-note { display: none; }
#feedback, #attachment { padding: 8px; background: #fcf3e1; margin: 0 4px 6px; border-radius: 8px; font-size: 13px; }
#attachment img { height: 36px; max-width: 52px; vertical-align: middle; margin-right: 8px; }
#attachment button { float: right; border: 0; background: transparent; }
.messages { display: grid; gap: 3cqw; padding: 0 2.9cqw 4cqw; }
.messages:empty { display: none; }
.message-time { justify-self: center; font-size: 3.44cqw; color: #796c61; line-height: 1.45; }
.user-message, .reply { width: fit-content; max-width: 88%; padding: 2.6cqw 3.6cqw; overflow-wrap: anywhere; font-size: clamp(14px,3.7cqw,17px); line-height: 1.55; }
.user-message { justify-self: end; border-radius: 4.5cqw 4.5cqw 1.4cqw 4.5cqw; background: linear-gradient(145deg,#d1ae58,#976a22); color: white; white-space: pre-wrap; }
.reply { border: 1px solid #dfc69c; background: #fff4df; border-radius: 4.5cqw 4.5cqw 4.5cqw 1.4cqw; }
.reply h2 { margin: 0 0 7px; font-size: 1.04em; }
.reply p, .reply ul { margin: 6px 0; }
.reply-tools { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.reply-tools .icon-button { width: 32px; height: 32px; }
.palette { display: grid; gap: 5px; padding: 0; list-style: none; }
.palette li { display: flex; align-items: baseline; gap: 9px; }
.palette strong { flex: none; }
dialog {
  color: var(--ink);
  margin: auto;
  border: 1px solid #b78966;
  background: #fff6e5;
  padding: 13px 16px 17px;
}
dialog::backdrop { background: #26181163; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { margin: 0; font-size: 19px; }
.history-panel {
  position: fixed;
  inset: 0 auto 0 max(0px, calc((100vw - var(--app-width)) / 2));
  width: min(84vw, 300px);
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) 0 18px;
  border: 0;
  background: white;
  color: #222;
}
.history-panel[open] { display: flex; flex-direction: column; }
.history-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 44px;
  margin-inline: 15px;
  border: 0;
  border-radius: 8px;
  background: #f3f3f3;
  font-weight: 650;
  font-size: 14px;
}
#history-list { display: grid; align-content: start; gap: 4px; min-height: 0; overflow: auto; }
#history-list p { margin: 18px 15px 5px; color: #666; font-size: 12px; }
.history-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 15px;
  text-align: start;
  border: 0;
  background: white;
  font-size: 14px;
}
.history-item:hover, .history-item[aria-current="true"] { background: #f3f3f3; }
.history-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item time { color: #666; font-size: 12px; }
.date-panel { width: min(88vw, 340px); border-radius: 15px; }
.close-dialog { width: 44px; height: 44px; font: 23px/1 var(--type); }
.date-panel label { display: block; font-size: 14px; }
.date-panel input, .date-submit {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 7px 10px;
  margin-top: 8px;
  border: 1px solid #a97a5b;
  border-radius: 8px;
  background: #fffdfa;
  color: var(--ink);
}
.date-submit { background: var(--accent); color: #fff; border-color: var(--accent); }

.history-new .glyph { font-size: 20px; }
@media (min-width: 680px) {
  :root { --app-width: clamp(320px, 46.5dvh, 550px); }
}
@media (prefers-reduced-motion: no-preference) {
  .welcome h1 { animation: appear .5s both; }
  .greeting, .suggestions { animation: appear .65s ease-out both; }
  .suggestions { animation-delay: .15s; }
  @keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
}
.reply p { white-space: pre-wrap; }
.turn-photo { display: block; max-width: min(100%, 220px); max-height: 180px; margin-top: 5px; border-radius: 8px; object-fit: contain; }
.reply h3 { font-size: 1em; margin: 12px 0 4px; }
.chart-details { width: 88%; }
.chart-details summary { display: flex; align-items: center; gap: .7em; cursor: pointer; list-style: none; }
.chart-details summary::-webkit-details-marker { display: none; }
.chart-details summary::before { content: "⚛"; }
.chart-details summary::after, .jump-latest::before {
  content: ""; width: .43em; height: .43em; border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg);
}
.chart-details summary::after { margin-left: auto; }
.chart-details[open] summary::after { transform: rotate(225deg); }
.chart-details ol { list-style: none; margin: 6cqw 0 0; padding: 0; }
.chart-details li { position: relative; padding-left: 6cqw; }
.chart-details li + li { margin-top: 6cqw; }
.chart-details li::before { content: "◦"; position: absolute; left: .25em; }
.chart-details li:last-child::before { content: "✓"; left: 0; }
.chart-details li:not(:last-child)::after { content: ""; position: absolute; left: .42em; top: 1.7em; height: 3.5cqw; border-left: 1px solid #dfd2bc; }
.jump-latest { position: absolute; z-index: 1; bottom: calc(100% + 1.7cqw); left: 50%; transform: translateX(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #eee5d8; border-radius: 50%; color: #625e58; background: white; box-shadow: 0 1px 5px #594a3320; }
.jump-latest::before { border-width: 0 2px 2px 0; margin-top: -3px; }
