.h5-only { display: none; }

@media (max-width: 780px) {
  .h5-active {
    --h5-ink: rgb(var(--gray-34));
    --h5-text: rgb(var(--gray-34));
    --h5-muted: rgb(var(--gray-110));
    --h5-line: rgb(var(--gray-222));
    --h5-radius: 16px;
    --h5-edge: max(14px, env(safe-area-inset-left), env(safe-area-inset-right));
    background: rgb(var(--gray-245));
    color: var(--h5-text);
    line-height: 1.5;
  }
  .h5-active [hidden] { display: none !important; }
  .h5-active .app {
    position: fixed;
    inset: var(--h5-top, 0px) 0 auto;
    height: 100vh;
    height: var(--h5-height, 100dvh);
    flex-direction: column;
    overflow: hidden;
    background: radial-gradient(ellipse 95% 290px at 74% 0%, rgb(var(--gray-236)) 2%, transparent 85%), linear-gradient(160deg, rgb(var(--gray-250)), rgb(var(--gray-255)) 54%, rgb(var(--gray-245)));
  }
  .h5-active:not(.h5-keyboard) .app { padding-top: env(safe-area-inset-top); }
  .h5-active :is(.side, .side-mask, .square-view, .chat-head, .welcome, #historyPop) { display: none !important; }
  .h5-active .main { display: none; }
  .h5-active[data-h5-page='chat'] .main,
  .h5-active[data-h5-page='draw'] .main { display: flex; min-height: 0; }
  .h5-active[data-h5-page='draw'] #drawBack { display: none; }
  .h5-active :is(.h5-nav, .h5-page, .h5-chat-intro, .h5-drawer, .h5-post-details) { min-width: 0; }
  .h5-active :where(.h5-nav, .h5-page, .h5-chat-intro, .h5-shade, .h5-post-details) button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: inherit;
    -webkit-appearance: none;
    appearance: none;
  }
  .h5-active :is(button, input, textarea, select):focus-visible { outline: 2px solid rgb(var(--gray-110)); outline-offset: 2px; }
  .h5-active button:disabled { cursor: default; }
  .h5-active :is(input:not([type='range']), select, textarea) { font-size: 16px; }
  .h5-icon, .h5-chevron { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; }
  .h5-icon svg, .h5-chevron svg, .h5-sticker svg, .h5-hero-art svg { display: block; width: 100%; height: 100%; }
  .h5-chevron { width: 15px; height: 15px; color: rgb(var(--gray-110)); }
  .h5-text { display: block; flex: 1; min-width: 0; }
  .h5-text strong, .h5-text small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .h5-text strong { font-size: 14px; line-height: 1.35; font-weight: 700; }
  .h5-text small { font-size: 11.5px; color: var(--h5-muted); margin-top: 3px; }

  .h5-active .h5-icon-button {
    flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--h5-line); border-radius: 50%;
    color: rgb(var(--gray-80)); background: rgba(var(--gray-255), 0.722);
  }
  .h5-page { display: block; flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior-y: contain; padding: 4px var(--h5-edge) 18px; }
  .h5-nav {
    flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); z-index: 6;
    padding: 3px var(--h5-edge) max(4px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--h5-line); background: rgba(var(--gray-255), 0.929);
    box-shadow: 0 -5px 20px rgba(var(--gray-56), 0.031);
  }
  .h5-active .h5-nav-item {
    display: grid; justify-items: center; align-content: center; gap: 1px;
    min-height: 53px; padding: 0 2px; border: 0; border-radius: 12px;
    background: transparent; color: rgb(var(--gray-110)); font-size: 11.5px;
  }
  .h5-nav-item .h5-icon { width: 23px; height: 23px; }
  .h5-active .h5-nav-item[aria-current] { color: rgb(var(--gray-80)); font-weight: 720; }
  .h5-nav-item[aria-current] .h5-icon { filter: drop-shadow(0 2px 3px rgba(var(--gray-168), 0.533)); }

  .h5-search {
    display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; min-height: 44px; margin: 0 0 11px;
    padding: 0 13px; border: 1px solid rgb(var(--gray-222)); border-radius: 999px; background: rgba(var(--gray-255), 0.678); color: var(--h5-muted);
  }
  .h5-search input { width: 100%; min-width: 0; min-height: 42px; border: 0; padding: 0; outline: 0 !important; font: inherit; color: var(--h5-text); background: transparent; }
  .h5-search:focus-within { outline: 2px solid rgb(var(--gray-168)); outline-offset: 1px; }
  .h5-section-head { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 40px; margin: 9px 0 3px; }
  .h5-section-head h2 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 16px; color: var(--h5-text); line-height: 1.3; }
  .h5-section-head h2::before { content: ''; width: 4px; height: 15px; border-radius: 99px; background: linear-gradient(rgb(var(--gray-168)), rgb(var(--gray-110))); flex: none; }
  .h5-active .h5-text-button { display: inline-flex; flex-direction: row-reverse; align-items: center; gap: 2px; min-height: 44px; border: 0; padding: 0 0 0 6px; background: none; color: var(--h5-muted); font-size: 12px; }
  .h5-text-button .h5-icon { width: 14px; height: 14px; }
  .h5-list { border: 1px solid var(--h5-line); border-radius: var(--h5-radius); background: rgba(var(--gray-255), 0.737); overflow: hidden; }
  .h5-active .h5-list-row { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 54px; padding: 7px 9px; border: 0; background: transparent; }
  .h5-list-row + .h5-list-row { border-top: 1px solid rgb(var(--gray-236)); }
  .h5-list-row .h5-row-extra { max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--h5-muted); font-size: 10px; }
  .h5-avatar, .h5-profile-avatar, .h5-recommend-art, .h5-post-cover, .h5-chat-art {
    display: grid; place-items: center; flex: none; min-width: 0; overflow: hidden;
    color: rgb(var(--gray-110)); background: radial-gradient(circle at 28% 20%, rgba(var(--gray-255), 0.533), transparent 52%), linear-gradient(140deg, rgb(var(--gray-236)), rgb(var(--gray-222)));
  }
  .h5-avatar { width: 40px; height: 40px; border-radius: 10px; font-size: 17px; font-weight: 700; }
  .h5-active :is(.h5-avatar, .h5-profile-avatar, .h5-recommend-art, .h5-post-cover, .h5-chat-art) img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .h5-empty { display: grid; grid-template-columns: 23px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 64px; padding: 10px; border: 1px solid var(--h5-line); border-radius: var(--h5-radius); background: rgba(var(--gray-255), 0.729); }
  .h5-empty > .h5-icon { color: rgb(var(--gray-168)); }
  .h5-empty .h5-text small { white-space: normal; }
  .h5-active .h5-chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 5px 10px; border: 1px solid rgb(var(--gray-222)); border-radius: 999px; background: rgb(var(--gray-245)); color: rgb(var(--gray-80)); font-size: 12px; white-space: nowrap; }
  .h5-active .h5-chip.selected { color: rgb(var(--gray-56)); background: rgb(var(--gray-222)); border-color: rgb(var(--gray-200)); font-weight: 700; }
  .h5-chip .h5-icon { width: 16px; height: 16px; }

  .h5-active .h5-tile {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
    min-width: 0; min-height: 92px; padding: 8px; border: 1px solid rgb(var(--gray-236)); border-radius: 15px;
    background: linear-gradient(145deg, rgb(var(--gray-222)), rgb(var(--gray-245)) 95%);
  }
  .h5-create-grid .h5-tile:nth-child(2), .h5-create-grid .h5-tile:nth-child(3) { background: linear-gradient(145deg, rgb(var(--gray-236)), rgb(var(--gray-245))); border-color: rgb(var(--gray-236)); }
  .h5-tile > .h5-sticker { align-self: center; }
  .h5-tile .h5-text strong { font-size: 13px; }
  .h5-tile .h5-text small { font-size: 10px; }
  .h5-tile .h5-text { width: 100%; }
  .h5-tile .h5-chevron { position: absolute; right: 4px; bottom: 7px; width: 12px; height: 12px; }
  .h5-tile:has(.h5-chevron) .h5-text small { padding-right: 7px; }
  .h5-sticker {
    display: grid; place-items: center; flex: none; width: 35px; height: 35px; padding: 6px; border-radius: 12px;
    color: rgb(var(--gray-110)); background: radial-gradient(circle at 29% 19%, rgb(var(--gray-255)) 3%, rgb(var(--gray-236)) 38%, rgb(var(--gray-200)) 100%);
    box-shadow: inset 0 1px 2px rgb(var(--gray-255)), 0 3px 6px rgba(var(--gray-110), 0.11);
  }
  .h5-sticker.pink { color: rgb(var(--gray-80)); background: radial-gradient(circle at 29% 19%, rgb(var(--gray-255)), rgb(var(--gray-236)) 40%, rgb(var(--gray-200))); }
  .h5-sticker.blue { color: rgb(var(--gray-110)); background: radial-gradient(circle at 29% 19%, rgb(var(--gray-255)), rgb(var(--gray-236)) 40%, rgb(var(--gray-200))); }
  .h5-create-grid .h5-sticker { width: 41px; height: 41px; padding: 8px; transform: rotate(-8deg); }
  .h5-recommend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .h5-active .h5-recommend-card { display: block; position: relative; min-width: 0; padding: 0; aspect-ratio: .92; overflow: hidden; border: 1px solid var(--h5-line); border-radius: 13px; background: rgb(var(--gray-236)); }
  .h5-recommend-art { position: absolute; inset: 0; }
  .h5-recommend-art img { object-position: center 34%; }
  .h5-recommend-card .h5-text { position: absolute; inset: auto 0 0; padding: 5px 6px; background: rgba(var(--gray-245), 0.929); border-radius: 10px 10px 0 0; }
  .h5-recommend-card .h5-text small { margin-top: 0; font-size: 10px; }

  .h5-hero {
    position: relative; isolation: isolate; overflow: hidden; min-height: 89px;
    border: 1px solid rgb(var(--gray-222)); border-radius: var(--h5-radius); padding: 13px 75px 13px 12px;
    background: radial-gradient(ellipse at 100% 0%, rgb(var(--gray-200)) 0%, transparent 65%), linear-gradient(125deg, rgb(var(--gray-222)), rgb(var(--gray-245)) 75%);
  }
  .h5-hero h1 { margin: 0; color: var(--h5-ink); font-size: 22px; line-height: 1.25; font-weight: 770; letter-spacing: .035em; }
  .h5-hero p { margin: 5px 0 0; font-size: 12px; color: var(--h5-muted); }
  .h5-hero-art { position: absolute; right: 13px; top: 50%; width: 56px; height: 56px; color: rgb(var(--gray-110)); transform: translateY(-50%) rotate(-12deg); filter: drop-shadow(0 6px 5px rgba(var(--gray-136), 0.541)); }
  .h5-tags:empty { display: none; }
  .h5-square-searchbar { margin-bottom: 6px; }
  .h5-square-searchbar .h5-search { gap: 6px; min-height: 36px; margin: 0; padding-inline: 10px; }
  .h5-square-searchbar .h5-search input { min-height: 34px; }
  .h5-square-searchbar .h5-search input::placeholder { font-size: 13px; }
  .h5-square-searchbar .h5-search .h5-icon { width: 16px; height: 16px; }
  .h5-square-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-bottom: 6px; }
  .h5-active :is(.h5-square-searchbar, .h5-square-tabs) .h5-chip {
    min-width: 0; min-height: 34px; padding: 3px 7px; gap: 3px; font-size: 12px;
  }
  .h5-active .h5-square-searchbar .h5-chip { min-height: 36px; }
  .h5-square-tabs .h5-icon { width: 13px; height: 13px; }
  .h5-square-results {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px;
  }
  .h5-square-results:empty { display: none; }
  .h5-active .h5-post-card {
    position: relative; isolation: isolate; min-width: 0; aspect-ratio: 2 / 3;
    padding: 0; overflow: hidden; border: 1px solid var(--h5-line); border-radius: 15px;
    background: #252525; color: #fff;
  }
  .h5-active .h5-post-card:focus-visible { outline-offset: -3px; }
  .h5-post-cover { position: absolute; inset: 0; font-size: 46px; font-weight: 720; }
  .h5-post-cover img { object-position: center 34%; }
  .h5-active .h5-square-results .h5-post-cover::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(transparent 21%, #0002 37%, #0009 61%, #000f 100%);
  }
  .h5-badge { position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 7px; background: #000a; color: #fff; font-size: 10px; }
  .h5-badge.h5-post-audience { left: auto; right: 8px; }
  .h5-post-body { position: absolute; inset: auto 0 0; display: grid; gap: 4px; padding: 9px 9px 10px; text-shadow: 0 1px 3px #0009; }
  .h5-post-body strong { font-size: clamp(14px, 4.2vw, 19px); line-height: 1.25; }
  .h5-post-body strong, .h5-post-body small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
  .h5-post-body small { color: #eee; font-size: 11px; line-height: 1.4; }
  .h5-post-author { overflow: hidden; color: #ddd; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .h5-post-body .h5-tags { margin: 0; }
  .h5-post-body .h5-tags > span { max-width: 74%; padding: 1px 6px; border: 1px solid #fff4; font-size: 10px; }
  .h5-post-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; color: #eee; font-size: 11px; font-variant-numeric: tabular-nums; }
  .h5-post-stats > span { display: inline-flex; align-items: center; gap: 3px; }
  .h5-post-stats .h5-icon { width: 13px; height: 13px; }
  .h5-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
  .h5-tags > span { max-width: 100%; padding: 1px 6px; border-radius: 99px; color: rgb(var(--gray-80)); background: rgb(var(--gray-236)); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .h5-square-more { margin-top: 10px; text-align: center; }
  .h5-square-more p { margin: 0; color: var(--h5-muted); font-size: 12px; }

  .h5-create-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
  .h5-create-grid .h5-tile { min-height: 104px; padding: 9px 12px; }
  .h5-create-grid .h5-tile .h5-text strong { font-size: 15px; }
  .h5-page > .h5-chip { margin-top: 10px; }
  .h5-assist-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin: 10px 0 14px; padding: 15px 16px; border: 1px solid var(--h5-line); border-radius: 18px;
    background: linear-gradient(130deg, rgb(var(--gray-245)), rgb(var(--gray-222))); color: var(--h5-ink);
  }
  .h5-assist-banner small, .h5-assist-result small { display: block; margin-bottom: 4px; color: var(--h5-muted); font-size: 12px; font-weight: 650; }
  .h5-assist-banner strong { display: block; font-size: 20px; line-height: 1.25; }
  .h5-assist-banner p { margin: 6px 0 0; color: var(--h5-muted); font-size: 13px; }
  .h5-assist-banner .h5-icon { width: 30px; height: 30px; }
  .h5-assist-form, .h5-assist-preview { margin: 0 0 14px; padding: 14px; border: 1px solid var(--h5-line); border-radius: 18px; background: rgb(var(--gray-255)); }
  .h5-assist-step { margin: 0 0 9px; font-size: 15px; line-height: 1.35; }
  .h5-assist-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 18px; }
  .h5-active .h5-assist-choice {
    display: grid; align-content: start; gap: 3px; min-width: 0; min-height: 77px; padding: 8px;
    border: 1px solid var(--h5-line); border-radius: 12px; background: rgb(var(--gray-250));
    color: var(--h5-ink); line-height: 1.25; text-align: left;
  }
  .h5-active .h5-assist-choice[aria-pressed='true'] { border-color: var(--h5-ink); background: var(--h5-ink); color: rgb(var(--gray-255)); }
  .h5-assist-choice .h5-icon { width: 17px; height: 17px; margin-bottom: 2px; }
  .h5-assist-choice strong { font-size: 13px; }
  .h5-assist-choice small { font-size: 11px; opacity: .78; }
  .h5-assist-hint { margin: 0 0 8px; color: var(--h5-muted); font-size: 13px; }
  .h5-assist-ideas, .h5-assist-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .h5-assist-ideas > span { margin-right: 1px; color: var(--h5-muted); font-size: 12px; }
  .h5-active .h5-assist-ideas .h5-chip { min-height: 36px; padding: 4px 8px; font-size: 12px; }
  .h5-assist-field { display: grid; gap: 5px; min-width: 0; color: var(--h5-ink); font-size: 13px; font-weight: 650; }
  .h5-assist-field :is(textarea, select) {
    width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--h5-line); border-radius: 10px;
    background: rgb(var(--gray-250)); color: var(--h5-text); font-weight: 400;
  }
  .h5-assist-field textarea { resize: vertical; }
  .h5-assist-field textarea::placeholder { color: var(--h5-muted); opacity: 1; }
  .h5-assist-field select { min-height: 42px; }
  .h5-assist-count { display: block; margin-top: 4px; color: var(--h5-muted); font-size: 11px; text-align: right; }
  .h5-assist-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; }
  .h5-assist-form button:disabled, .h5-assist-preview button:disabled { opacity: .56; }
  .h5-assist-status { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--h5-line); border-radius: 10px; color: var(--h5-muted); font-size: 13px; overflow-wrap: anywhere; }
  .h5-assist-status.is-error { border-color: currentColor; color: var(--h5-ink); }
  .h5-assist-preview p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
  .h5-assist-result h2 { margin: 0 0 5px; font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; scroll-margin-top: 12px; }
  .h5-assist-result p { color: var(--h5-muted); }
  .h5-assist-detail { margin-top: 8px; border: 1px solid var(--h5-line); border-radius: 11px; background: rgb(var(--gray-250)); }
  .h5-assist-detail summary { min-height: 44px; padding: 11px 10px; font-size: 14px; font-weight: 650; cursor: pointer; overflow-wrap: anywhere; }
  .h5-assist-detail p { padding: 0 10px 4px; }
  .h5-assist-entry-key { display: block; padding: 0 10px 5px; color: var(--h5-muted); font-size: 12px; overflow-wrap: anywhere; }
  .h5-assist-refine { margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--h5-line); }
  .h5-assist-refine h3 { margin: 0 0 4px; font-size: 15px; }
  .h5-assist-refine .h5-assist-hint { white-space: normal; }
  .h5-assist-actions { margin: 8px 0 0; }
  .h5-library-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; margin: 10px 0; padding: 3px; border: 1px solid var(--h5-line); border-radius: 13px; background: rgba(var(--gray-255), 0.722); }
  .h5-library-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .h5-active .h5-gallery-card { min-width: 0; overflow: hidden; padding: 0; border: 1px solid var(--h5-line); border-radius: 12px; background: rgb(var(--gray-255)); }
  .h5-gallery-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: rgb(var(--gray-236)); }
  .h5-gallery-card span { display: block; overflow: hidden; padding: 6px 8px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .h5-active .h5-library-tab { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 47px; min-width: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; color: rgb(var(--gray-80)); font-size: 11px; }
  .h5-active .h5-library-tab[aria-pressed='true'] { color: rgb(var(--gray-56)); background: rgb(var(--gray-222)); font-weight: 700; }
  .h5-library-controls { display: flex; align-items: flex-start; gap: 6px; }
  .h5-library-controls .h5-search { margin-bottom: 1px; }
  .h5-profile { display: flex; align-items: center; gap: 9px; margin: 9px 0 13px; padding: 10px 0; }
  .h5-profile-avatar { width: 60px; height: 60px; border: 3px solid rgb(var(--gray-236)); border-radius: 50%; box-shadow: 0 0 0 1px rgb(var(--gray-200)); font-size: 24px; font-weight: 730; }
  .h5-profile .h5-text strong { font-size: 19px; }
  .h5-settings .h5-list-row { min-height: 60px; }

  .h5-chat-intro { display: block; flex: none; padding: 4px var(--h5-edge) 6px; }
  .h5-active[data-h5-page='draw'] .h5-chat-intro { display: none; }
  .h5-chat-top { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; }
  .h5-chat-top h1 { flex: 1; min-width: 0; margin: 0 0 0 2px; font-size: 16px; font-weight: 730; }
  .h5-chat-spacer { flex: 1; }
  .h5-chat-top .h5-icon-button { background: rgba(var(--gray-255), 0.58); }
  .h5-chat-hero { display: grid; grid-template-columns: minmax(90px, .48fr) 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 10px; position: relative; overflow: hidden; min-height: 78px; padding-right: 10px; border: 1px solid rgb(var(--gray-222)); border-radius: var(--h5-radius); background: linear-gradient(105deg, rgb(var(--gray-236)), rgb(var(--gray-222))); }
  .h5-chat-art { grid-row: 1 / 3; align-self: stretch; min-height: 78px; max-height: 118px; width: 100%; position: relative; font-size: 32px; font-weight: 720; }
  .h5-chat-art img { object-position: 50% 32%; }
  .h5-chat-hero .h5-text { grid-row: 1 / 3; }
  .h5-chat-hero:has(.h5-scenario) .h5-text { grid-row: 1; align-self: end; }
  .h5-chat-hero .h5-text strong { font-size: 20px; color: var(--h5-ink); }
  .h5-chat-hero.tavern { background: linear-gradient(125deg, rgb(var(--gray-56)), rgb(var(--gray-80))); border-color: rgb(var(--gray-80)); }
  .h5-chat-hero.tavern :is(.h5-text strong, .h5-text small, .h5-scenario) { color: rgb(var(--gray-255)); }
  .h5-scenario { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; align-self: start; overflow: hidden; font-size: 11px; margin: 4px 0 6px; }
  .h5-chat-tools { display: flex; align-items: stretch; gap: 4px; margin-top: 5px; }
  .h5-chat-tools > * { min-width: 0; flex: 1; }
  .h5-active .h5-chat-tools .h5-chip { min-height: 36px; padding: 0 3px; gap: 3px; }
  .h5-chat-tools .h5-chip .h5-icon { width: 14px; height: 14px; }
  .h5-chat-tools .h5-list-row { padding: 5px 6px; border: 1px solid var(--h5-line); border-radius: 12px; background: rgb(var(--gray-245)); }
  .h5-chat-tools .h5-list-row:nth-child(1) { background: rgb(var(--gray-245)); }
  .h5-chat-tools .h5-list-row .h5-sticker { width: 25px; height: 25px; padding: 4px; border-radius: 8px; }
  .h5-chat-tools .h5-list-row .h5-text strong { font-size: 12px; }
  .h5-chat-tools .h5-list-row .h5-text small { font-size: 10px; }
  .h5-chat-tools .h5-chevron { display: none; }
  .h5-chat-start .h5-chip { margin: 9px 6px 0 0; }
  .h5-active .messages { padding: 10px var(--h5-edge) 5px; overscroll-behavior-y: contain; background: linear-gradient(140deg, rgb(var(--gray-250)), rgb(var(--gray-250)) 55%, rgb(var(--gray-245))); }
  .h5-active .messages .row { gap: 7px; margin-bottom: 10px; }
  .h5-active .messages .row.grouped { margin-top: -5px; }
  .h5-active .messages .row.me .avatar { display: none; }
  .h5-active .messages .row.ai .avatar { background: rgb(var(--gray-222)); color: rgb(var(--gray-80)); }
  .h5-active .messages .bubble { max-width: min(85%, 520px); padding: 8px 10px; border-radius: 14px; color: var(--h5-text); line-height: 1.55; overflow-wrap: anywhere; }
  .h5-active .messages .row.me .bubble { background: rgb(var(--gray-222)); border-top-right-radius: 5px; }
  .h5-active .messages .row.ai .bubble { background: rgb(var(--gray-255)); border: 1px solid var(--h5-line); border-top-left-radius: 5px; }
  .h5-active .messages .row.ai.story-opening .bubble { max-width: 660px; padding: 14px; border-radius: 16px; }
  .h5-active #messages.story-creation-chat .story-narration .bubble { font-size: 13.5px; }
  .h5-active #messages.story-creation-chat .row.me .bubble { font-size: 13.5px; }
  .h5-active #messages.story-creation-chat .story-narration { gap: 4px; margin-bottom: 18px; }
  .h5-active .h5-no-character .composer-wrap { display: none; }
  .h5-active .composer-wrap { background: rgb(var(--gray-255)); border-top: 1px solid var(--h5-line); padding: 5px var(--h5-edge); }
  .h5-active .composer { min-height: 50px; gap: 7px; border: 1px solid var(--h5-line); border-radius: 22px; background: rgb(var(--gray-250)); padding: 3px 4px 3px 13px; box-shadow: none; }
  .h5-active .composer:focus-within { border-color: rgb(var(--gray-136)); box-shadow: none; }
  .h5-active #input { min-width: 0; min-height: 44px; padding: 10px 0; line-height: 1.5; color: var(--h5-text); }
  .h5-active #input:focus-visible { outline: none; }
  .h5-active #sendBtn { width: 44px; height: 44px; border-radius: 50%; background: var(--h5-ink); color: rgb(var(--gray-255)); touch-action: manipulation; }
  .h5-active #sendBtn:disabled { background: rgb(var(--gray-168)); color: rgb(var(--gray-255)); opacity: .78; }
  .h5-active .empty .cta { min-height: 44px; color: rgb(var(--gray-80)); border-color: var(--h5-line); }
  .h5-active.h5-keyboard :is(.h5-nav, .h5-chat-hero, .h5-chat-tools) { display: none; }
  .h5-active.h5-keyboard[data-h5-page='chat'] .composer-wrap { padding-bottom: 8px; }

  .h5-shade {
    position: fixed; z-index: 35; inset: var(--h5-top, 0px) 0 auto; height: 100vh; height: var(--h5-height, 100dvh);
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(var(--gray-34), 0.459);
  }
  .h5-drawer {
    width: 100%; max-width: 620px; max-height: 89%; overflow: auto; overscroll-behavior-y: contain;
    padding: 14px var(--h5-edge) max(17px, env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0;
    background: radial-gradient(ellipse 80% 170px at 72% 0%, rgb(var(--gray-222)), transparent), rgb(var(--gray-250));
    box-shadow: 0 -10px 38px rgba(var(--gray-34), 0.196);
  }
  .h5-drawer::before { content: ''; display: block; width: 39px; height: 4px; margin: -5px auto 2px; border-radius: 99px; background: rgb(var(--gray-168)); }
  .h5-drawer-head { display: flex; align-items: center; gap: 7px; }
  .h5-drawer-head > .h5-icon { color: rgb(var(--gray-136)); width: 24px; height: 24px; }
  .h5-drawer-head h2 { flex: 1; margin: 0; font-size: 21px; color: var(--h5-ink); }
  .h5-drawer-lead { margin: 1px 0 10px; font-size: 13px; color: var(--h5-muted); }
  .h5-install-brand { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
  .h5-install-brand img { width: 48px; height: 48px; border-radius: 12px; }
  .h5-install-brand :is(strong, small) { display: block; }
  .h5-install-brand small { margin-top: 4px; color: var(--h5-muted); }
  .h5-install-steps { margin: 0 0 6px; padding-left: 23px; color: var(--h5-ink); font-size: 14px; line-height: 1.65; }
  .h5-install-steps li + li { margin-top: 6px; }
  .h5-install-action { width: 100%; min-height: 44px; justify-content: center; }
  .h5-mode-list { display: grid; gap: 5px; }
  .h5-mode-list .h5-list-row { border: 1px solid var(--h5-line); border-radius: 12px; background: rgba(var(--gray-255), 0.639); }
  .h5-mode-list .h5-list-row.selected { border-color: rgb(var(--gray-136)); background: rgb(var(--gray-236)); }
  .h5-story-personas .h5-text small { white-space: normal; }
  .h5-mode-check { display: grid; place-items: center; flex: none; width: 23px; height: 23px; padding: 4px; border-radius: 50%; background: rgb(var(--gray-110)); color: rgb(var(--gray-255)); }
  .h5-mode-check svg { width: 100%; }
  .h5-drawer > .h5-chip { margin-top: 8px; }
  .h5-history-row { display: flex; align-items: center; padding-right: 6px; }
  .h5-history-row + .h5-history-row { border-top: 1px solid var(--h5-line); }

  .h5-active .sheet {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%; max-height: min(93vh, 100%);
    max-height: calc(var(--h5-height, 100dvh) - 12px);
    padding: 14px var(--h5-edge) max(18px, env(safe-area-inset-bottom));
    border: 1px solid var(--h5-line); border-radius: 22px 22px 0 0;
    transform: translateY(110%); visibility: hidden; overscroll-behavior-y: contain;
    background: rgb(var(--gray-250));
  }
  .h5-active .sheet.show { transform: none; visibility: visible; }
  .h5-active.h5-keyboard .sheet { top: var(--h5-top, 0px); bottom: auto; max-height: var(--h5-height, 100dvh); }
  .h5-active .sheet :is(.ghost-btn, .mini-btn, .switch-btn, .save-btn, .test-btn, .pers-chip) { min-height: 44px; }
  .h5-active .sheet .save-btn { background: rgb(var(--gray-110)); border-color: rgb(var(--gray-110)); }
  .h5-active .sheet .ghost-btn { flex: none; padding: 0 11px; border: 1px solid var(--h5-line); border-radius: 22px; background: rgba(var(--gray-255), 0.749); color: rgb(var(--gray-80)); font: inherit; font-size: 13px; }
  .h5-active .h5-use-server { display: inline-block; align-self: flex-start; margin: 0 0 12px; color: rgb(var(--gray-80)); background: rgb(var(--gray-236)); border-color: var(--h5-line); }
  .h5-active .sheet-head { min-height: 42px; margin-bottom: 9px; }
  .h5-active .sheet-head :is(h3, .sheet-sub) { margin: 0; overflow-wrap: anywhere; }
  .h5-active .sheet-head .sheet-sub { margin-top: 3px; color: var(--h5-muted); font-size: 12px; }
  .h5-active .sheet-foot { position: static; margin: 10px 0 0; padding: 0; flex-wrap: wrap; }
  .h5-active .sheet-mask { background: rgba(var(--gray-34), 0.412); }
  .h5-active #authMask { z-index: 30; }
  .h5-active #authSheet { z-index: 31; }
  .h5-active[data-h5-page='post'] #postSheet {
    top: var(--h5-top, 0px); bottom: auto; height: var(--h5-height, 100dvh); max-height: none; border: 0; border-radius: 0;
    padding-top: max(10px, env(safe-area-inset-top));
    background: radial-gradient(ellipse at 75% 0%, rgb(var(--gray-236)), transparent 220px), rgb(var(--gray-250));
  }
  .h5-active[data-h5-page='post'] #postSheet .sheet-head { flex-direction: row-reverse; justify-content: flex-end; gap: 8px; }
  .h5-active[data-h5-page='post'] #postSheet .sheet-head > div { flex: 1; min-width: 0; }
  .h5-active[data-h5-page='post'] #poCover { height: clamp(155px, 48vw, 240px); max-height: none; aspect-ratio: auto; border: 1px solid var(--h5-line); border-radius: 16px; background: rgb(var(--gray-222)); }
  .h5-active[data-h5-page='post'] #poCover img { width: 100%; height: 100%; object-fit: cover; object-position: center 34%; }
  .h5-active[data-h5-page='post'] #postSheet[data-post-kind='character'] #poCover img { object-position: center 16%; }
  .h5-active[data-h5-page='post'] .h5-post-details { display: block; }
  .h5-post-details .h5-tags { margin: 8px 0; }
  .h5-detail-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 7px; text-align: center; background: rgb(var(--gray-236)); border-radius: 12px; }
  .h5-detail-author { display: flex; align-items: center; gap: 9px; margin-top: 8px; padding: 7px; border: 1px solid var(--h5-line); border-radius: 12px; background: rgba(var(--gray-255), 0.722); }
  .h5-detail-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; margin: 0 0 8px; overflow: hidden; overflow-wrap: anywhere; font-size: 13px; }
  .h5-active .h5-primary { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 46px; margin: 10px 0 0; border: 0; border-radius: 25px; background: linear-gradient(125deg, rgb(var(--gray-110)), rgb(var(--gray-110))); color: rgb(var(--gray-255)); font-weight: 730; }
  .h5-toast { display: block; position: fixed; z-index: 45; left: 50%; bottom: max(70px, calc(55px + env(safe-area-inset-bottom))); transform: translateX(-50%); max-width: calc(100vw - 28px); width: max-content; padding: 8px 12px; border-radius: 12px; color: rgb(var(--gray-255)); background: rgb(var(--gray-56)); box-shadow: 0 5px 15px rgba(var(--gray-34), 0.196); font-size: 13px; overflow-wrap: anywhere; }
  .h5-keyboard .h5-toast { top: calc(var(--h5-top, 0px) + 3px); bottom: auto; }
}

@media (max-width: 380px) {
  .h5-active { --h5-edge: max(10px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .h5-tile .h5-text strong { font-size: 12px; }
  .h5-list-row .h5-row-extra { max-width: 60px; }
}

@media (max-width: 780px) and (max-height: 510px) {
  .h5-chat-hero, .h5-chat-tools { display: none; }
  .h5-nav .h5-nav-item { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .h5-active :is(.sheet, .row) { animation-duration: .01ms; transition-duration: .01ms; }
}
